Skip to content

Commit

Permalink
Merge pull request #66 from AnduroProject/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
emailnjv authored Dec 11, 2024
2 parents 458f9a6 + a8de643 commit 1121ff4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app/src/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub static DEV: Lazy<ChainSpec> = Lazy::new(|| {
"2e80ab37dfb510a64526296fd1f295c42ef19c29".parse().unwrap(),
],
federation_bitcoin_pubkeys: vec![
BitcoinPublicKey::from_str("02767b3ebfdee7190772742cbeacf678e21f1aa043b66e8bfd6d07ac9e50b0049a").unwrap()
BitcoinPublicKey::from_str("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798").unwrap()
],
bits: 505794034,
chain_id: 212121,
Expand Down
20 changes: 13 additions & 7 deletions crates/federation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use bitcoincore_rpc::{Error as RpcError, RpcApi};
use ethers::prelude::*;
use futures::prelude::*;
use std::str::FromStr;
use tracing::{debug, instrument, warn};
use tracing::{debug, info, instrument, warn};

pub use bitcoin_signing::{
BitcoinSignatureCollector, BitcoinSigner, Federation, FeeRate,
Expand Down Expand Up @@ -247,15 +247,21 @@ impl Bridge {

for log in receipt.logs {
if let Ok(event) = parse_log::<RequestPegOut>(log) {
if let Some(address) = parse_bitcoin_address(event.bitcoin_address) {
let txout = TxOut {
script_pubkey: address.script_pubkey(),
value: wei_to_sats(event.value),
};
let event_amount_in_sats = wei_to_sats(event.value);
if event_amount_in_sats >= 1000000 {
if let Some(address) = parse_bitcoin_address(event.bitcoin_address) {
let txout = TxOut {
script_pubkey: address.script_pubkey(),
value: event_amount_in_sats,
};

if txout.value >= 100000000000000 {
pegouts.push(txout);
}
} else {
info!(
"Ignoring pegout with for {} sats from {}:{}",
event_amount_in_sats, event.evm_address, event.bitcoin_address
);
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion scripts/regtest_pegout.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
. $SCRIPT_DIR/utils/shared.sh

PRIVATE_KEY=${PRIVATE_KEY:-$1}
SATOSHIS=${SATOSHIS:-1000001}
if [ -z $PRIVATE_KEY ]; then
PRIVATE_KEY=$DEV_PRIVATE_KEY
else
Expand All @@ -12,4 +13,4 @@ fi

BTC_ADDRESS=${BTC_ADDRESS:-$2}

pegout $PRIVATE_KEY $BTC_ADDRESS
pegout $PRIVATE_KEY $BTC_ADDRESS $SATOSHIS
2 changes: 1 addition & 1 deletion scripts/utils/shared.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function pegout() {
cd $PWD/contracts

# 0.00100000 btc, or 100000 satoshi
export SATOSHIS=100000
export SATOSHIS="$3"
export PRIVATE_KEY="$1"
forge script script/PegOut.s.sol --rpc-url http://localhost:8545 --broadcast --silent
)
Expand Down

0 comments on commit 1121ff4

Please sign in to comment.