Skip to content

Commit

Permalink
initialize vanchor tree
Browse files Browse the repository at this point in the history
  • Loading branch information
salman01zp committed Feb 5, 2024
1 parent 1e3b9ba commit 737c3da
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
13 changes: 12 additions & 1 deletion evm-test-utils/src/local_evm_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@ impl LocalEvmChain {
handler: ethers::types::Address,
token: ethers::types::Address,
max_edges: u8,
minimal_withdrawal_amount: ethers::types::U256,
maximum_deposit_amount: ethers::types::U256,
) -> Result<VAnchorTreeContract<SignerEthersClient>> {
let client = self.client.clone();
let vanchor_encode_inputs =
Expand All @@ -392,7 +394,14 @@ impl LocalEvmChain {
.confirmations(0usize)
.send()
.await?;
Ok(VAnchorTreeContract::new(contract.address(), client))

let contract = VAnchorTreeContract::new(contract.address(), client);

contract
.initialize(minimal_withdrawal_amount, maximum_deposit_amount)
.call()
.await?;
Ok(contract)
}

fn spawn_anvil_node(
Expand Down Expand Up @@ -476,6 +485,8 @@ mod tests {
handler.address(),
token.address(),
2,
0.into(),
u64::MAX.into(),
)
.await?;
// hasher on the vanchor tree should be the same as the one we deployed
Expand Down
13 changes: 6 additions & 7 deletions evm-test-utils/src/v_bridge.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
use std::collections::HashMap;

use webb::evm::{
contract::protocol_solidity::{
fungible_token_wrapper::FungibleTokenWrapperContract, signature_bridge,
},
contract::protocol_solidity::signature_bridge,
ethers::{
contract::EthCall,
signers::{LocalWallet, Signer},
types::{Address, U256},
types::Address,
utils::keccak256,
},
};

use crate::errors::{self, Result};
use webb_proposals::{
evm::{RegisterFungibleTokenProposal, SetTreasuryHandlerProposal},
FunctionSignature, Nonce, ProposalHeader, ProposalTrait, ResourceId,
TargetSystem, TypedChainId,
evm::SetTreasuryHandlerProposal, FunctionSignature, Nonce, ProposalHeader,
ProposalTrait, ResourceId, TargetSystem, TypedChainId,
};

#[derive(Clone, Debug, typed_builder::TypedBuilder)]
Expand Down Expand Up @@ -162,6 +159,8 @@ impl VAnchorBridgeDeployment {
anchor_handler.address(),
fungible_token_wrapper.address(),
self.max_edges,
0.into(),
10000000000000000000000000u128.into(),
)
.await?;

Expand Down

0 comments on commit 737c3da

Please sign in to comment.