diff --git a/docs/deploy.md b/docs/deploy.md index f14a1b17..aa620e15 100644 --- a/docs/deploy.md +++ b/docs/deploy.md @@ -86,7 +86,7 @@ All commands of bridge deployer require a private key of you EVM wallet to run E ### Erc20 bridge -Deploy bridge canister and BFT bridge contract: +Deploy bridge canister and BTF bridge contract: ```shell cargo run -p bridge-deployer -- deploy --wasm .artifact/erc20-bridge.wasm.gz \ @@ -98,7 +98,7 @@ After the bridge was deployed, create a wrapped token (using addresses from the ```shell cargo run -p bridge-deployer -- wrap erc20 \ --base-evm-url https://testnet.bitfinity.network \ - --base-bft-address \ - --wrapped-bft-address \ + --base-btf-address \ + --wrapped-btf-address \ --token-address ``` diff --git a/solidity/docs.md b/solidity/docs.md index 20d93b46..de92d553 100644 --- a/solidity/docs.md +++ b/solidity/docs.md @@ -1,11 +1,11 @@ -# BFT Bridge Forge Scripts +# BTF Bridge Forge Scripts -This comprehensive guide provides detailed instructions for running various Forge scripts within the project. These scripts are essential for deploying, upgrading, and managing the BFT Bridge and related contracts. +This comprehensive guide provides detailed instructions for running various Forge scripts within the project. These scripts are essential for deploying, upgrading, and managing the BTF Bridge and related contracts. ## Table of Contents -1. [DeployBFT.s.sol](#deploybftssol) -2. [UpgradeBFT.s.sol](#upgradebftssol) +1. [DeployBTF.s.sol](#deploybtfssol) +2. [UpgradeBTF.s.sol](#upgradebtfssol) 3. [PauseUnpause.s.sol](#pauseunpausessol) 4. [DeployFeeCharge.s.sol](#deployfeechargessol) 5. [DeployWrappedToken.s.sol](#deploywrappedtokenssol) @@ -19,15 +19,15 @@ Before running any scripts, ensure you have the following: - Access to an Ethereum RPC endpoint - A funded account with the necessary permissions -## DeployBFT.s.sol +## DeployBTF.s.sol -This script is responsible for deploying the BFTBridge contract, a crucial component of the BFT Bridge system. +This script is responsible for deploying the BTFBridge contract, a crucial component of the BTF Bridge system. ### Usage -Execute the following command to deploy the BFTBridge: +Execute the following command to deploy the BTFBridge: -forge script script/DeployBFT.s.sol:DeployBFTBridge --rpc-url --broadcast --private-key --sender +forge script script/DeployBTF.s.sol:DeployBTFBridge --rpc-url --broadcast --private-key --sender ### Environment Variables @@ -41,9 +41,9 @@ To customize the deployment, set the following environment variables: - `OWNER`: (Optional) Address of the contract owner - `CONTROLLERS`: (Optional) Comma-separated list of controller addresses -## UpgradeBFT.s.sol +## UpgradeBTF.s.sol -This script facilitates the upgrade process for the BFTBridge contract. It consists of three separate contracts, each handling a specific step in the upgrade process. +This script facilitates the upgrade process for the BTFBridge contract. It consists of three separate contracts, each handling a specific step in the upgrade process. #### Usage @@ -51,15 +51,15 @@ Execute the following commands in sequence to perform the upgrade: 1. Deploy the new implementation: - forge script script/UpgradeBFT.s.sol:PrepareUpgrade --rpc-url --broadcast --private-key --sender + forge script script/UpgradeBTF.s.sol:PrepareUpgrade --rpc-url --broadcast --private-key --sender 2. Add the new implementation to the proxy's allowed implementations: - forge script script/UpgradeBFT.s.sol:AddNewImplementation --rpc-url --broadcast --private-key --sender + forge script script/UpgradeBTF.s.sol:AddNewImplementation --rpc-url --broadcast --private-key --sender 3. Upgrade the proxy to use the new implementation: - forge script script/UpgradeBFT.s.sol:UpgradeProxy --rpc-url --broadcast --private-key --sender + forge script script/UpgradeBTF.s.sol:UpgradeProxy --rpc-url --broadcast --private-key --sender ### Environment Variables @@ -70,7 +70,7 @@ Set the following environment variables for the upgrade process: ## PauseUnpause.s.sol -This script allows for the pausing and unpausing of the BFTBridge contract, providing an essential safety mechanism. +This script allows for the pausing and unpausing of the BTFBridge contract, providing an essential safety mechanism. ### Usage @@ -84,7 +84,7 @@ forge script script/PauseUnpause.s.sol:PauseUnpauseScript --rpc-url --private-key --broadcast @@ -22,7 +22,7 @@ contract PauseUnpauseScript is Script { uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); vm.startBroadcast(deployerPrivateKey); - BFTBridge bridge = BFTBridge(contractAddress); + BTFBridge bridge = BTFBridge(contractAddress); if (shouldPause) { bridge.pause(); diff --git a/solidity/script/UpgradeBFT.s.sol b/solidity/script/UpgradeBFT.s.sol index a0e9c3d3..66535231 100644 --- a/solidity/script/UpgradeBFT.s.sol +++ b/solidity/script/UpgradeBFT.s.sol @@ -8,7 +8,7 @@ import { Options } from "@openzeppelin/foundry-upgrades/Options.sol"; /** * @title PrepareUpgradeScript * @dev Step 1: Deploys the new implementation contract. - * Running this script will deploy the updated contract (BFTBridgeV2). + * Running this script will deploy the updated contract (BTFBridgeV2). */ contract PrepareUpgrade is Script { address proxyAddress; @@ -27,8 +27,8 @@ contract PrepareUpgrade is Script { // Start broadcasting to the network vm.startBroadcast(); - // Deploy the new implementation contract (BFTBridgeV2) - string memory contractName = "BftBridge.sol:BFTBridgeV2"; + // Deploy the new implementation contract (BTFBridgeV2) + string memory contractName = "BTFBridge.sol:BTFBridgeV2"; Options memory opts; newImplementationAddress = Upgrades.prepareUpgrade(contractName, opts); @@ -74,7 +74,7 @@ contract AddNewImplementation is Script { bytes32 bytecodeHash = keccak256(deployedBytecode); // Interface to interact with the proxy contract (assuming it's an Ownable UUPS proxy) - IBFTBridge proxyContract = IBFTBridge(proxyAddress); + IBTFBridge proxyContract = IBTFBridge(proxyAddress); // Add the new implementation's bytecode hash to allowed implementations proxyContract.addAllowedImplementation(bytecodeHash); @@ -110,7 +110,7 @@ contract UpgradeProxy is Script { vm.startBroadcast(); // Interface to interact with the proxy contract - IBFTBridge proxyContract = IBFTBridge(proxyAddress); + IBTFBridge proxyContract = IBTFBridge(proxyAddress); // Prepare the initialization data bytes memory initData = abi.encodeWithSignature("__BridgeV2_init()"); @@ -126,10 +126,10 @@ contract UpgradeProxy is Script { } /** - * @dev Interface to interact with the BFTBridge proxy contract. + * @dev Interface to interact with the BTFBridge proxy contract. * Include the functions needed for the upgrade process. */ -interface IBFTBridge { +interface IBTFBridge { function addAllowedImplementation( bytes32 bytecodeHash ) external; diff --git a/solidity/src/BftBridge.sol b/solidity/src/BTFBridge.sol similarity index 99% rename from solidity/src/BftBridge.sol rename to solidity/src/BTFBridge.sol index 0d71598d..2c118a27 100644 --- a/solidity/src/BftBridge.sol +++ b/solidity/src/BTFBridge.sol @@ -12,7 +12,7 @@ import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol"; -contract BFTBridge is TokenManager, UUPSUpgradeable, OwnableUpgradeable, PausableUpgradeable { +contract BTFBridge is TokenManager, UUPSUpgradeable, OwnableUpgradeable, PausableUpgradeable { using RingBuffer for RingBuffer.RingBufferUint32; using SafeERC20 for IERC20; @@ -112,7 +112,7 @@ contract BFTBridge is TokenManager, UUPSUpgradeable, OwnableUpgradeable, Pausabl _disableInitializers(); } - /// Initializes the BftBridge contract. + /// Initializes the BTFBridge contract. /// /// @param minterAddress The address of the minter canister. /// @param feeChargeAddress The address of the fee charge contract. @@ -339,7 +339,7 @@ contract BFTBridge is TokenManager, UUPSUpgradeable, OwnableUpgradeable, Pausabl bytes memory recipientID, bytes32 memo ) public whenNotPaused returns (uint32) { - require(fromERC20 != address(this), "From address must not be BFT bridge address"); + require(fromERC20 != address(this), "From address must not be BTF bridge address"); require(fromERC20 != address(0), "Invalid from address; must not be zero address"); // Check if the token is registered on the bridge or the side is base require( diff --git a/solidity/src/abstract/TokenManager.sol b/solidity/src/abstract/TokenManager.sol index 3af2fcb4..35802ccb 100644 --- a/solidity/src/abstract/TokenManager.sol +++ b/solidity/src/abstract/TokenManager.sol @@ -82,13 +82,13 @@ abstract contract TokenManager is Initializable { ) internal view returns (TokenMetadata memory meta) { try IERC20Metadata(token).name() returns (string memory _name) { meta.name = StringUtils.truncateUTF8(_name); - } catch {} + } catch { } try IERC20Metadata(token).symbol() returns (string memory _symbol) { meta.symbol = bytes16(StringUtils.truncateUTF8(_symbol)); - } catch {} + } catch { } try IERC20Metadata(token).decimals() returns (uint8 _decimals) { meta.decimals = _decimals; - } catch {} + } catch { } } /// Returns wrapped token for the given base token diff --git a/solidity/src/test_contracts/NewBftBridge.sol b/solidity/src/test_contracts/NewBTFBridge.sol similarity index 90% rename from solidity/src/test_contracts/NewBftBridge.sol rename to solidity/src/test_contracts/NewBTFBridge.sol index b984a220..b06247d6 100644 --- a/solidity/src/test_contracts/NewBftBridge.sol +++ b/solidity/src/test_contracts/NewBTFBridge.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.7; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "src/WrappedToken.sol"; -import "src/BftBridge.sol"; +import "src/BTFBridge.sol"; import "src/interfaces/IFeeCharge.sol"; import { RingBuffer } from "src/libraries/RingBuffer.sol"; import "src/abstract/TokenManager.sol"; @@ -14,8 +14,8 @@ import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol"; /// Make sure you add the reference contracts to the `import` statement above. -/// @custom:oz-upgrades-from src/BftBridge.sol:BFTBridge -contract BFTBridgeV2 is BFTBridge { +/// @custom:oz-upgrades-from src/BTFBridge.sol:BTFBridge +contract BTFBridgeV2 is BTFBridge { // Hello World function helloWorld( string memory name diff --git a/solidity/test/contract_tests/BftBridge.t.sol b/solidity/test/contract_tests/BTFBridge.t.sol similarity index 97% rename from solidity/test/contract_tests/BftBridge.t.sol rename to solidity/test/contract_tests/BTFBridge.t.sol index 4b3c01a2..46d266d8 100644 --- a/solidity/test/contract_tests/BftBridge.t.sol +++ b/solidity/test/contract_tests/BTFBridge.t.sol @@ -4,13 +4,13 @@ pragma solidity ^0.8.7; import "forge-std/Test.sol"; import "forge-std/console.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; -import "src/BftBridge.sol"; +import "src/BTFBridge.sol"; import "src/test_contracts/UUPSProxy.sol"; import "src/WrappedToken.sol"; import "src/WrappedTokenDeployer.sol"; import "src/libraries/StringUtils.sol"; -contract BftBridgeTest is Test { +contract BTFBridgeTest is Test { using StringUtils for string; struct MintOrder { @@ -42,8 +42,8 @@ contract BftBridgeTest is Test { WrappedTokenDeployer _wrappedTokenDeployer; - BFTBridge _wrappedBridge; - BFTBridge _baseBridge; + BTFBridge _wrappedBridge; + BTFBridge _baseBridge; address newImplementation = address(8); @@ -61,7 +61,7 @@ contract BftBridgeTest is Test { // Encode the initialization call bytes memory initializeData = abi.encodeWithSelector( - BFTBridge.initialize.selector, + BTFBridge.initialize.selector, _owner, address(0), address(_wrappedTokenDeployer), @@ -70,28 +70,28 @@ contract BftBridgeTest is Test { initialControllers ); - BFTBridge wrappedImpl = new BFTBridge(); + BTFBridge wrappedImpl = new BTFBridge(); UUPSProxy wrappedProxyContract = new UUPSProxy(address(wrappedImpl), initializeData); wrappedProxy = address(wrappedProxyContract); - // Cast the proxy to BFTBridge - _wrappedBridge = BFTBridge(address(wrappedProxy)); + // Cast the proxy to BTFBridge + _wrappedBridge = BTFBridge(address(wrappedProxy)); // Encode the initialization call bytes memory baseInitializeData = abi.encodeWithSelector( - BFTBridge.initialize.selector, _owner, address(0), _wrappedTokenDeployer, false, _owner, initialControllers + BTFBridge.initialize.selector, _owner, address(0), _wrappedTokenDeployer, false, _owner, initialControllers ); - BFTBridge baseImpl = new BFTBridge(); + BTFBridge baseImpl = new BTFBridge(); UUPSProxy baseProxyContract = new UUPSProxy(address(baseImpl), baseInitializeData); baseProxy = address(baseProxyContract); - // Cast the proxy to BFTBridge - _baseBridge = BFTBridge(address(baseProxy)); + // Cast the proxy to BTFBridge + _baseBridge = BTFBridge(address(baseProxy)); vm.stopPrank(); } @@ -538,7 +538,7 @@ contract BftBridgeTest is Test { function testAddAllowedImplementation() public { vm.startPrank(_owner, _owner); - BFTBridge _newImpl = new BFTBridge(); + BTFBridge _newImpl = new BTFBridge(); newImplementation = address(_newImpl); @@ -559,7 +559,7 @@ contract BftBridgeTest is Test { function testAddAllowedImplementationByAController() public { vm.startPrank(_owner); - BFTBridge _newImpl = new BFTBridge(); + BTFBridge _newImpl = new BTFBridge(); newImplementation = address(_newImpl); @@ -579,7 +579,7 @@ contract BftBridgeTest is Test { function testUpgradeBridgeWithAllowedImplementation() public { vm.startPrank(_owner); - BFTBridge _newImpl = new BFTBridge(); + BTFBridge _newImpl = new BTFBridge(); newImplementation = address(_newImpl); @@ -587,7 +587,7 @@ contract BftBridgeTest is Test { assertTrue(_wrappedBridge.allowedImplementations(newImplementation.codehash)); // Wrap in ABI for easier testing - BFTBridge proxy = BFTBridge(wrappedProxy); + BTFBridge proxy = BTFBridge(wrappedProxy); // pass empty calldata to initialize bytes memory data = new bytes(0); @@ -599,11 +599,11 @@ contract BftBridgeTest is Test { function testUpgradeBridgeWithNotAllowedImplementation() public { vm.startPrank(_owner); - BFTBridge _newImpl = new BFTBridge(); + BTFBridge _newImpl = new BTFBridge(); newImplementation = address(_newImpl); // Wrap in ABI for easier testing - BFTBridge proxy = BFTBridge(wrappedProxy); + BTFBridge proxy = BTFBridge(wrappedProxy); // pass empty calldata to initialize bytes memory data = new bytes(0); vm.expectRevert(); diff --git a/src/brc20-bridge/src/canister.rs b/src/brc20-bridge/src/canister.rs index f80db21a..bc0ad8ca 100644 --- a/src/brc20-bridge/src/canister.rs +++ b/src/brc20-bridge/src/canister.rs @@ -2,7 +2,7 @@ use std::cell::RefCell; use std::collections::HashSet; use std::rc::Rc; -use bridge_canister::runtime::service::fetch_logs::FetchBftBridgeEventsService; +use bridge_canister::runtime::service::fetch_logs::FetchBtfBridgeEventsService; use bridge_canister::runtime::service::mint_tx::SendMintTxService; use bridge_canister::runtime::service::sign_orders::SignMintOrdersService; use bridge_canister::runtime::service::update_evm_params::RefreshEvmParamsService; @@ -29,8 +29,8 @@ use ic_storage::IcStorage; use crate::canister::inspect::inspect_is_owner; use crate::interface::GetAddressError; use crate::ops::{ - Brc20BftEventsHandler, Brc20BridgeOpImpl, Brc20MintOrderHandler, Brc20MintTxHandler, - FETCH_BFT_EVENTS_SERVICE_ID, REFRESH_PARAMS_SERVICE_ID, SEND_MINT_TX_SERVICE_ID, + Brc20BridgeOpImpl, Brc20BtfEventsHandler, Brc20MintOrderHandler, Brc20MintTxHandler, + FETCH_BTF_EVENTS_SERVICE_ID, REFRESH_PARAMS_SERVICE_ID, SEND_MINT_TX_SERVICE_ID, SIGN_MINT_ORDER_SERVICE_ID, }; use crate::state::Brc20State; @@ -191,9 +191,9 @@ fn init_runtime() -> SharedRuntime { let mint_tx_handler = Brc20MintTxHandler::new(state.clone()); let mint_tx_service = Rc::new(SendMintTxService::new(mint_tx_handler)); - let bft_events_handler = Brc20BftEventsHandler::new(get_brc20_state()); - let fetch_bft_events_service = Rc::new(FetchBftBridgeEventsService::new( - bft_events_handler, + let btf_events_handler = Brc20BtfEventsHandler::new(get_brc20_state()); + let fetch_btf_events_service = Rc::new(FetchBtfBridgeEventsService::new( + btf_events_handler, runtime.clone(), config, )); @@ -206,8 +206,8 @@ fn init_runtime() -> SharedRuntime { ); services.borrow_mut().add_service( ServiceOrder::BeforeOperations, - FETCH_BFT_EVENTS_SERVICE_ID, - fetch_bft_events_service, + FETCH_BTF_EVENTS_SERVICE_ID, + fetch_btf_events_service, ); services.borrow_mut().add_service( ServiceOrder::ConcurrentWithOperations, diff --git a/src/brc20-bridge/src/core/deposit.rs b/src/brc20-bridge/src/core/deposit.rs index 098560f8..65490b3f 100644 --- a/src/brc20-bridge/src/core/deposit.rs +++ b/src/brc20-bridge/src/core/deposit.rs @@ -52,7 +52,7 @@ pub enum DepositRequestStatus { requested_amounts: HashMap, actual_amounts: HashMap, }, - /// Mint orders are signed by the canister but are not sent to the BftBridge. The user may attempt + /// Mint orders are signed by the canister but are not sent to the BTFBridge. The user may attempt /// to send them by themselves or wait for the canister to retry the operation. MintOrdersCreated { orders: Vec, diff --git a/src/brc20-bridge/src/interface.rs b/src/brc20-bridge/src/interface.rs index 5f1916f1..a24dae54 100644 --- a/src/brc20-bridge/src/interface.rs +++ b/src/brc20-bridge/src/interface.rs @@ -26,9 +26,9 @@ pub enum Erc20MintStatus { }, /// The transaction is processed, ckBTC tokens are minted and mint order is created. But there /// was a problem sending the mint order to the EVM. The given signed mint order can be sent - /// manually to the BftBridge ot mint wrapped tokens. + /// manually to the Btfbridge ot mint wrapped tokens. Signed(Box), - /// Mint order for wrapped tokens is successfully sent to the BftBridge. + /// Mint order for wrapped tokens is successfully sent to the Btfbridge. Minted { /// Amount of tokens minted. amount: u128, diff --git a/src/brc20-bridge/src/ops.rs b/src/brc20-bridge/src/ops.rs index 695d9d14..77b78a2f 100644 --- a/src/brc20-bridge/src/ops.rs +++ b/src/brc20-bridge/src/ops.rs @@ -9,7 +9,7 @@ use bridge_canister::bridge::{Operation, OperationProgress}; use bridge_canister::runtime::service::ServiceId; use bridge_canister::runtime::RuntimeState; use bridge_did::brc20_info::Brc20Tick; -use bridge_did::error::{BftResult, Error}; +use bridge_did::error::{BTFResult, Error}; use bridge_did::event_data::{MinterNotificationType, NotifyMinterEventData}; use bridge_did::op_id::OperationId; use bridge_did::operations::{ @@ -23,13 +23,13 @@ use serde::Serialize; use withdraw::Brc20BridgeWithdrawOpImpl; pub use self::deposit::Brc20BridgeDepositOpImpl; -pub use self::events_handler::Brc20BftEventsHandler; +pub use self::events_handler::Brc20BtfEventsHandler; pub use self::mint_order_handler::Brc20MintOrderHandler; pub use self::mint_tx_handler::Brc20MintTxHandler; use crate::canister::get_brc20_state; pub const REFRESH_PARAMS_SERVICE_ID: ServiceId = 0; -pub const FETCH_BFT_EVENTS_SERVICE_ID: ServiceId = 1; +pub const FETCH_BTF_EVENTS_SERVICE_ID: ServiceId = 1; pub const SIGN_MINT_ORDER_SERVICE_ID: ServiceId = 2; pub const SEND_MINT_TX_SERVICE_ID: ServiceId = 3; @@ -48,7 +48,7 @@ impl Operation for Brc20BridgeOpImpl { self, id: OperationId, ctx: RuntimeState, - ) -> BftResult> { + ) -> BTFResult> { let next_step = match self.0 { Brc20BridgeOp::Deposit(Brc20BridgeDepositOp::AwaitInputs(deposit)) => { log::debug!("Brc20BridgeDepositOp::AwaitInputs {deposit:?}"); diff --git a/src/brc20-bridge/src/ops/deposit.rs b/src/brc20-bridge/src/ops/deposit.rs index 78bf21d6..5b7f5919 100644 --- a/src/brc20-bridge/src/ops/deposit.rs +++ b/src/brc20-bridge/src/ops/deposit.rs @@ -1,5 +1,5 @@ use bridge_canister::runtime::RuntimeState; -use bridge_did::error::{BftResult, Error}; +use bridge_did::error::{BTFResult, Error}; use bridge_did::operations::{Brc20BridgeDepositOp, DepositRequest}; use ic_exports::ic_cdk::api::management_canister::bitcoin::Utxo; @@ -13,7 +13,7 @@ impl Brc20BridgeDepositOpImpl { pub async fn await_inputs( state: RuntimeState, request: DepositRequest, - ) -> BftResult { + ) -> BTFResult { let deposit = Brc20Deposit::get(state.clone()) .map_err(|err| Error::FailedToProgress(format!("cannot deposit: {err:?}")))?; let utxos = deposit @@ -42,7 +42,7 @@ impl Brc20BridgeDepositOpImpl { deposit_request: DepositRequest, utxos: Vec, nonce: u32, - ) -> BftResult { + ) -> BTFResult { let DepositRequest { amount, brc20_tick, diff --git a/src/brc20-bridge/src/ops/events_handler.rs b/src/brc20-bridge/src/ops/events_handler.rs index 136c3df9..4e0af2d9 100644 --- a/src/brc20-bridge/src/ops/events_handler.rs +++ b/src/brc20-bridge/src/ops/events_handler.rs @@ -2,7 +2,7 @@ use std::cell::RefCell; use std::rc::Rc; use bridge_canister::bridge::OperationAction; -use bridge_canister::runtime::service::fetch_logs::BftBridgeEventHandler; +use bridge_canister::runtime::service::fetch_logs::BtfBridgeEventHandler; use bridge_did::event_data::{BurntEventData, MintedEventData, NotifyMinterEventData}; use bridge_did::operations::{ Brc20BridgeDepositOp, Brc20BridgeOp, Brc20BridgeWithdrawOp, DepositRequest, @@ -12,18 +12,18 @@ use crate::core::withdrawal; use crate::ops::{Brc20BridgeOpImpl, Brc20MinterNotification}; use crate::state::Brc20State; -/// Decsribes event processing logic. -pub struct Brc20BftEventsHandler { +/// Describes event processing logic. +pub struct Brc20BtfEventsHandler { brc20_state: Rc>, } -impl Brc20BftEventsHandler { +impl Brc20BtfEventsHandler { pub fn new(brc20_state: Rc>) -> Self { Self { brc20_state } } } -impl BftBridgeEventHandler for Brc20BftEventsHandler { +impl BtfBridgeEventHandler for Brc20BtfEventsHandler { fn on_wrapped_token_minted( &self, event: MintedEventData, diff --git a/src/brc20-bridge/src/ops/mint_order_handler.rs b/src/brc20-bridge/src/ops/mint_order_handler.rs index d2e8fb31..85ef8571 100644 --- a/src/brc20-bridge/src/ops/mint_order_handler.rs +++ b/src/brc20-bridge/src/ops/mint_order_handler.rs @@ -3,7 +3,7 @@ use bridge_canister::memory::StableMemory; use bridge_canister::runtime::scheduler::{BridgeTask, SharedScheduler}; use bridge_canister::runtime::service::sign_orders::MintOrderHandler; use bridge_canister::runtime::RuntimeState; -use bridge_did::error::BftResult; +use bridge_did::error::BTFResult; use bridge_did::op_id::OperationId; use bridge_did::operations::{Brc20BridgeDepositOp, Brc20BridgeOp}; use bridge_did::order::{MintOrder, SignedOrders}; @@ -30,7 +30,7 @@ impl Brc20MintOrderHandler { } impl MintOrderHandler for Brc20MintOrderHandler { - fn get_signer(&self) -> BftResult { + fn get_signer(&self) -> BTFResult { self.state.get_signer() } diff --git a/src/brc20-bridge/src/ops/mint_tx_handler.rs b/src/brc20-bridge/src/ops/mint_tx_handler.rs index a0c6a308..a7c58ad9 100644 --- a/src/brc20-bridge/src/ops/mint_tx_handler.rs +++ b/src/brc20-bridge/src/ops/mint_tx_handler.rs @@ -2,7 +2,7 @@ use bridge_canister::bridge::OperationContext as _; use bridge_canister::runtime::service::mint_tx::MintTxHandler; use bridge_canister::runtime::state::SharedConfig; use bridge_canister::runtime::RuntimeState; -use bridge_did::error::BftResult; +use bridge_did::error::BTFResult; use bridge_did::op_id::OperationId; use bridge_did::operations::{Brc20BridgeDepositOp, Brc20BridgeOp}; use bridge_did::order::SignedOrders; @@ -24,7 +24,7 @@ impl Brc20MintTxHandler { } impl MintTxHandler for Brc20MintTxHandler { - fn get_signer(&self) -> BftResult { + fn get_signer(&self) -> BTFResult { self.state.get_signer() } diff --git a/src/brc20-bridge/src/ops/withdraw.rs b/src/brc20-bridge/src/ops/withdraw.rs index e42678da..87f444a8 100644 --- a/src/brc20-bridge/src/ops/withdraw.rs +++ b/src/brc20-bridge/src/ops/withdraw.rs @@ -1,4 +1,4 @@ -use bridge_did::error::{BftResult, Error}; +use bridge_did::error::{BTFResult, Error}; use bridge_did::operations::{ Brc20BridgeWithdrawOp, Brc20WithdrawalPayload, DidTransaction, RevealUtxo, }; @@ -14,7 +14,7 @@ impl Brc20BridgeWithdrawOpImpl { /// Create BRC20 transfer inscription transactions pub async fn create_inscription_txs( payload: Brc20WithdrawalPayload, - ) -> BftResult { + ) -> BTFResult { let withdraw = Withdrawal::get() .map_err(|err| Error::FailedToProgress(format!("cannot get withdraw: {err:?}")))?; @@ -48,7 +48,7 @@ impl Brc20BridgeWithdrawOpImpl { commit_tx: DidTransaction, reveal_tx: DidTransaction, reveal_utxo: RevealUtxo, - ) -> BftResult { + ) -> BTFResult { let withdraw = Withdrawal::get() .map_err(|err| Error::FailedToProgress(format!("cannot get withdraw: {err:?}")))?; @@ -72,7 +72,7 @@ impl Brc20BridgeWithdrawOpImpl { payload: Brc20WithdrawalPayload, reveal_tx: DidTransaction, reveal_utxo: RevealUtxo, - ) -> BftResult { + ) -> BTFResult { let withdraw = Withdrawal::get() .map_err(|err| Error::FailedToProgress(format!("cannot get withdraw: {err:?}")))?; @@ -94,7 +94,7 @@ impl Brc20BridgeWithdrawOpImpl { pub async fn await_inscription_transactions( payload: Brc20WithdrawalPayload, reveal_utxo: RevealUtxo, - ) -> BftResult { + ) -> BTFResult { let withdraw = Withdrawal::get() .map_err(|err| Error::FailedToProgress(format!("cannot get withdraw: {err:?}")))?; @@ -122,7 +122,7 @@ impl Brc20BridgeWithdrawOpImpl { pub async fn create_transfer_transaction( payload: Brc20WithdrawalPayload, reveal_utxo: Utxo, - ) -> BftResult { + ) -> BTFResult { let withdraw = Withdrawal::get() .map_err(|err| Error::FailedToProgress(format!("cannot get withdraw: {err:?}")))?; @@ -144,7 +144,7 @@ impl Brc20BridgeWithdrawOpImpl { pub async fn send_transfer_transaction( from_address: H160, tx: DidTransaction, - ) -> BftResult { + ) -> BTFResult { let withdraw = Withdrawal::get() .map_err(|err| Error::FailedToProgress(format!("cannot get withdraw: {err:?}")))?; diff --git a/src/bridge-canister/src/bridge.rs b/src/bridge-canister/src/bridge.rs index 24e71f53..09b33ec9 100644 --- a/src/bridge-canister/src/bridge.rs +++ b/src/bridge-canister/src/bridge.rs @@ -1,10 +1,10 @@ #![allow(async_fn_in_trait)] -use bridge_did::error::{BftResult, Error}; +use bridge_did::error::{BTFResult, Error}; use bridge_did::evm_link::EvmLink; use bridge_did::op_id::OperationId; use bridge_did::operation_log::Memo; -use bridge_utils::bft_events::BridgeEvent; +use bridge_utils::btf_events::BridgeEvent; use bridge_utils::evm_bridge::EvmParams; use bridge_utils::evm_link::EvmLinkClient; use candid::CandidType; @@ -26,7 +26,7 @@ pub trait Operation: self, id: OperationId, ctx: RuntimeState, - ) -> BftResult>; + ) -> BTFResult>; /// Check if the operation is complete. fn is_complete(&self) -> bool; @@ -45,16 +45,16 @@ pub trait OperationContext { /// Get link to the EVM with wrapped tokens. fn get_evm_link(&self) -> EvmLink; - /// Get address of the BftBridge contract. - fn get_bridge_contract_address(&self) -> BftResult; + /// Get address of the Btfbridge contract. + fn get_bridge_contract_address(&self) -> BTFResult; /// Get EVM parameters. - fn get_evm_params(&self) -> BftResult; + fn get_evm_params(&self) -> BTFResult; /// Get signer for transactions, orders, etc... - fn get_signer(&self) -> BftResult; + fn get_signer(&self) -> BTFResult; - async fn collect_evm_events(&self, max_logs_number: u64) -> BftResult { + async fn collect_evm_events(&self, max_logs_number: u64) -> BTFResult { log::trace!("collecting evm events"); let link = self.get_evm_link(); diff --git a/src/bridge-canister/src/canister.rs b/src/bridge-canister/src/canister.rs index 47cd38a9..7bd39832 100644 --- a/src/bridge-canister/src/canister.rs +++ b/src/bridge-canister/src/canister.rs @@ -2,7 +2,7 @@ use std::cell::RefCell; use std::rc::Rc; use std::time::Duration; -use bridge_did::error::{BftResult, Error}; +use bridge_did::error::{BTFResult, Error}; use bridge_did::evm_link::EvmLink; use bridge_did::init::BridgeInitData; use candid::Principal; @@ -59,24 +59,24 @@ pub trait BridgeCanister: Canister + LogCanister { /// Returns bridge contract address for EVM. /// If contract isn't initialized yet - returns None. #[query(trait = true)] - fn get_bft_bridge_contract(&mut self) -> Option { - self.config().borrow().get_bft_bridge_contract() + fn get_btf_bridge_contract(&mut self) -> Option { + self.config().borrow().get_btf_bridge_contract() } - /// Set BFT bridge contract address. + /// Set BTF bridge contract address. #[update(trait = true)] - fn set_bft_bridge_contract(&mut self, address: H160) { + fn set_btf_bridge_contract(&mut self, address: H160) { let config = self.config(); - inspect::inspect_set_bft_bridge_contract(self.config()); - config.borrow_mut().set_bft_bridge_contract(address.clone()); + inspect::inspect_set_btf_bridge_contract(self.config()); + config.borrow_mut().set_btf_bridge_contract(address.clone()); - info!("Bridge canister BFT bridge contract address changed to {address}"); + info!("Bridge canister BTF bridge contract address changed to {address}"); } /// Returns evm_address of the bridge canister. #[allow(async_fn_in_trait)] #[update(trait = true)] - async fn get_bridge_canister_evm_address(&mut self) -> BftResult { + async fn get_bridge_canister_evm_address(&mut self) -> BTFResult { let signer = self.config().borrow().get_signer()?; signer.get_address().await.map_err(|e| { Error::Initialization(format!("failed to get bridge canister address: {e}")) @@ -298,26 +298,26 @@ mod tests { } #[tokio::test] - async fn set_bft_bridge_works() { + async fn set_btf_bridge_works() { let mut canister = init_canister().await; inject::get_context().update_id(owner()); let address = H160::from_slice(&[42; 20]); - let _ = canister_call!(canister.set_bft_bridge_contract(address.clone()), ()).await; + let _ = canister_call!(canister.set_btf_bridge_contract(address.clone()), ()).await; // check if state updated - let stored_bft = canister_call!(canister.get_bft_bridge_contract(), Option) + let stored_btf = canister_call!(canister.get_btf_bridge_contract(), Option) .await .unwrap(); - assert_eq!(stored_bft, Some(address)); + assert_eq!(stored_btf, Some(address)); } #[tokio::test] #[should_panic(expected = "Running this method is only allowed for the owner of the canister")] - async fn set_bft_bridge_rejected_for_non_owner() { + async fn set_btf_bridge_rejected_for_non_owner() { let mut canister = init_canister().await; let address = H160::from_slice(&[42; 20]); - let _ = canister_call!(canister.set_bft_bridge_contract(address), ()).await; + let _ = canister_call!(canister.set_btf_bridge_contract(address), ()).await; } } diff --git a/src/bridge-canister/src/inspect.rs b/src/bridge-canister/src/inspect.rs index f119b4ec..4c4bf5e9 100644 --- a/src/bridge-canister/src/inspect.rs +++ b/src/bridge-canister/src/inspect.rs @@ -17,7 +17,7 @@ pub fn bridge_inspect() { "set_logger_filter" => inspect_set_logger_filter(config), "ic_logs" => inspect_ic_logs(config), "set_owner" => inspect_set_owner(config), - "set_bft_bridge_contract" => inspect_set_bft_bridge_contract(config), + "set_btf_bridge_contract" => inspect_set_btf_bridge_contract(config), _ => {} } } @@ -57,8 +57,8 @@ pub fn inspect_set_evm_principal(config: SharedConfig) { inspect_caller_is_owner(owner, caller) } -/// Inspect check for `set_bft_bridge_contract` API method. -pub fn inspect_set_bft_bridge_contract(config: SharedConfig) { +/// Inspect check for `set_btf_bridge_contract` API method. +pub fn inspect_set_btf_bridge_contract(config: SharedConfig) { let caller = ic::caller(); let owner = config.borrow().get_owner(); inspect_caller_is_owner(owner, caller) diff --git a/src/bridge-canister/src/lib.rs b/src/bridge-canister/src/lib.rs index c3b3e1cd..0fca5ccc 100644 --- a/src/bridge-canister/src/lib.rs +++ b/src/bridge-canister/src/lib.rs @@ -1,4 +1,4 @@ -//! Implementation of the common functions for BFT bridge canisters. The main entry point is +//! Implementation of the common functions for BTF bridge canisters. The main entry point is //! [`BridgeCanister`] trait that should be implemented by a canister to include common APIs and //! functions. //! diff --git a/src/bridge-canister/src/operation_store.rs b/src/bridge-canister/src/operation_store.rs index 568bffc8..d625bb16 100644 --- a/src/bridge-canister/src/operation_store.rs +++ b/src/bridge-canister/src/operation_store.rs @@ -338,7 +338,7 @@ where #[cfg(test)] mod tests { - use bridge_did::error::BftResult; + use bridge_did::error::BTFResult; use ic_exports::ic_kit::MockContext; use ic_stable_structures::VectorMemory; use serde::Serialize; @@ -377,7 +377,7 @@ mod tests { self, _id: OperationId, _ctx: RuntimeState, - ) -> BftResult> { + ) -> BTFResult> { todo!() } diff --git a/src/bridge-canister/src/runtime.rs b/src/bridge-canister/src/runtime.rs index f7b71bb9..95f7d85f 100644 --- a/src/bridge-canister/src/runtime.rs +++ b/src/bridge-canister/src/runtime.rs @@ -5,7 +5,7 @@ pub mod state; use std::cell::RefCell; use std::rc::Rc; -use bridge_did::error::BftResult; +use bridge_did::error::BTFResult; use bridge_did::evm_link::EvmLink; use bridge_did::op_id::OperationId; use bridge_utils::evm_bridge::EvmParams; @@ -157,15 +157,15 @@ impl OperationContext for RuntimeState { self.borrow().config.get_evm_link() } - fn get_bridge_contract_address(&self) -> BftResult { + fn get_bridge_contract_address(&self) -> BTFResult { self.borrow().config.get_bridge_contract_address() } - fn get_evm_params(&self) -> BftResult { + fn get_evm_params(&self) -> BTFResult { self.borrow().config.get_evm_params() } - fn get_signer(&self) -> BftResult { + fn get_signer(&self) -> BTFResult { self.borrow().config.borrow().get_signer() } } diff --git a/src/bridge-canister/src/runtime/scheduler.rs b/src/bridge-canister/src/runtime/scheduler.rs index 533e16e3..6967b6fb 100644 --- a/src/bridge-canister/src/runtime/scheduler.rs +++ b/src/bridge-canister/src/runtime/scheduler.rs @@ -2,7 +2,7 @@ use std::future::Future; use std::pin::Pin; use std::rc::Rc; -use bridge_did::error::{BftResult, Error}; +use bridge_did::error::{BTFResult, Error}; use bridge_did::op_id::OperationId; use candid::CandidType; use ic_stable_structures::stable_structures::Memory; @@ -110,7 +110,7 @@ impl BridgeTask { self, ctx: RuntimeState, task_scheduler: DynScheduler, - ) -> BftResult<()> { + ) -> BTFResult<()> { let Some(operation) = ctx.borrow().operations.get(self.op_id) else { log::warn!("Operation #{} not found.", { self.op_id }); return Err(Error::OperationNotFound(self.op_id)); @@ -235,7 +235,7 @@ mod tests { self, _id: OperationId, _ctx: RuntimeState, - ) -> BftResult> { + ) -> BTFResult> { if self.successful { Ok(OperationProgress::Progress(Self { successful_runs: self.successful_runs + 1, diff --git a/src/bridge-canister/src/runtime/service.rs b/src/bridge-canister/src/runtime/service.rs index 109b2a58..0f44d94f 100644 --- a/src/bridge-canister/src/runtime/service.rs +++ b/src/bridge-canister/src/runtime/service.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; use std::rc::Rc; -use bridge_did::error::{BftResult, Error}; +use bridge_did::error::{BTFResult, Error}; use bridge_did::op_id::OperationId; pub mod fetch_logs; @@ -13,9 +13,9 @@ pub mod update_evm_params; // The async-trait macro is necessary to make the trait object safe. #[async_trait::async_trait(?Send)] pub trait BridgeService { - async fn run(&self) -> BftResult<()>; + async fn run(&self) -> BTFResult<()>; - fn push_operation(&self, id: OperationId) -> BftResult<()>; + fn push_operation(&self, id: OperationId) -> BTFResult<()>; } pub type ServiceId = u64; @@ -45,7 +45,7 @@ impl Services { } /// Asks a start service with the given id to process operation with the given OperationId. - pub fn push_operation(&self, service_id: ServiceId, op_id: OperationId) -> BftResult<()> { + pub fn push_operation(&self, service_id: ServiceId, op_id: OperationId) -> BTFResult<()> { let Some(service) = self .before .get(&service_id) diff --git a/src/bridge-canister/src/runtime/service/fetch_logs.rs b/src/bridge-canister/src/runtime/service/fetch_logs.rs index 45f13d18..f9ccbfd9 100644 --- a/src/bridge-canister/src/runtime/service/fetch_logs.rs +++ b/src/bridge-canister/src/runtime/service/fetch_logs.rs @@ -1,33 +1,33 @@ -use bridge_did::error::{BftResult, Error}; +use bridge_did::error::{BTFResult, Error}; use bridge_did::event_data::{BurntEventData, MintedEventData, NotifyMinterEventData}; use bridge_did::op_id::OperationId; use bridge_did::operation_log::Memo; -use bridge_utils::bft_events::BridgeEvent; +use bridge_utils::btf_events::BridgeEvent; use super::BridgeService; use crate::bridge::{Operation, OperationAction, OperationContext}; use crate::runtime::state::SharedConfig; use crate::runtime::{RuntimeState, SharedRuntime}; -pub trait BftBridgeEventHandler { +pub trait BtfBridgeEventHandler { /// Action to perform when a WrappedToken is minted. fn on_wrapped_token_minted(&self, event: MintedEventData) -> Option>; /// Action to perform when a WrappedToken is burnt. fn on_wrapped_token_burnt(&self, event: BurntEventData) -> Option>; - /// Action to perform on notification from BftBridge contract. + /// Action to perform on notification from Btfbridge contract. fn on_minter_notification(&self, event: NotifyMinterEventData) -> Option>; } /// Service to fetch logs from evm and process it using event handler H. -pub struct FetchBftBridgeEventsService { +pub struct FetchBtfBridgeEventsService { handler: H, runtime: SharedRuntime, evm_config: SharedConfig, } -impl> FetchBftBridgeEventsService { +impl> FetchBtfBridgeEventsService { const MAX_LOG_REQUEST_COUNT: u64 = 1000; /// Creates new instance of the service, which will fetch events using the `evm_config` @@ -44,7 +44,7 @@ impl> FetchBftBridgeEventsService BftResult<()> { + async fn collect_evm_logs(&self) -> BTFResult<()> { let collected = self .evm_config .collect_evm_events(Self::MAX_LOG_REQUEST_COUNT) @@ -146,14 +146,14 @@ impl> FetchBftBridgeEventsService> BridgeService - for FetchBftBridgeEventsService +impl> BridgeService + for FetchBtfBridgeEventsService { - async fn run(&self) -> BftResult<()> { + async fn run(&self) -> BTFResult<()> { self.collect_evm_logs().await } - fn push_operation(&self, _: OperationId) -> BftResult<()> { + fn push_operation(&self, _: OperationId) -> BTFResult<()> { Err(Error::FailedToProgress( "Log fetch service doesn't requre operations".into(), )) diff --git a/src/bridge-canister/src/runtime/service/mint_tx.rs b/src/bridge-canister/src/runtime/service/mint_tx.rs index 7f767d47..d482da25 100644 --- a/src/bridge-canister/src/runtime/service/mint_tx.rs +++ b/src/bridge-canister/src/runtime/service/mint_tx.rs @@ -1,10 +1,10 @@ use std::cell::RefCell; use std::collections::{HashMap, HashSet}; -use bridge_did::error::{BftResult, Error}; +use bridge_did::error::{BTFResult, Error}; use bridge_did::op_id::OperationId; use bridge_did::order::{SignedOrders, SignedOrdersData}; -use bridge_utils::bft_events::{self}; +use bridge_utils::btf_events::{self}; use bridge_utils::evm_link::EvmLinkClient; use did::H256; use eth_signer::sign_strategy::TransactionSigner; @@ -20,7 +20,7 @@ pub struct MintOrderBatchInfo { } pub trait MintTxHandler { - fn get_signer(&self) -> BftResult; + fn get_signer(&self) -> BTFResult; fn get_evm_config(&self) -> SharedConfig; fn get_signed_orders(&self, id: OperationId) -> Option; fn mint_tx_sent(&self, id: OperationId, tx_hash: H256); @@ -44,7 +44,7 @@ impl SendMintTxService { #[async_trait::async_trait(?Send)] impl BridgeService for SendMintTxService { - async fn run(&self) -> BftResult<()> { + async fn run(&self) -> BTFResult<()> { log::trace!("Running SendMintTxService"); let Some((digest, batch_info)) = self @@ -66,9 +66,9 @@ impl BridgeService for SendMintTxService { let bridge_contract = config .borrow() - .get_bft_bridge_contract() + .get_btf_bridge_contract() .ok_or(Error::Initialization( - "Singing service failed to get BftBridge address".into(), + "Singing service failed to get Btfbridge address".into(), ))?; let evm_params = config.borrow().get_evm_params()?; @@ -78,7 +78,7 @@ impl BridgeService for SendMintTxService { "Sending batchMint transaction with {} mint orders.", batch_info.orders_batch.orders_number() ); - let mut tx = bft_events::batch_mint_transaction( + let mut tx = btf_events::batch_mint_transaction( tx_params, &batch_info.orders_batch.orders_data, &batch_info.orders_batch.signature, @@ -127,7 +127,7 @@ impl BridgeService for SendMintTxService { Ok(()) } - fn push_operation(&self, op_id: OperationId) -> BftResult<()> { + fn push_operation(&self, op_id: OperationId) -> BTFResult<()> { let Some(order) = self.handler.get_signed_orders(op_id) else { log::warn!("Signed order not found for operation {op_id}."); return Err(bridge_did::error::Error::FailedToProgress(format!( diff --git a/src/bridge-canister/src/runtime/service/sign_orders.rs b/src/bridge-canister/src/runtime/service/sign_orders.rs index 63ed85a1..6e971be6 100644 --- a/src/bridge-canister/src/runtime/service/sign_orders.rs +++ b/src/bridge-canister/src/runtime/service/sign_orders.rs @@ -1,7 +1,7 @@ use std::cell::RefCell; use std::collections::HashMap; -use bridge_did::error::{BftResult, Error}; +use bridge_did::error::{BTFResult, Error}; use bridge_did::op_id::OperationId; use bridge_did::order::{MintOrder, SignedOrders, SignedOrdersData}; use did::keccak; @@ -11,7 +11,7 @@ use super::BridgeService; pub trait MintOrderHandler { /// Get signer to sign mint orders batch. - fn get_signer(&self) -> BftResult; + fn get_signer(&self) -> BTFResult; /// Get mint order by the OperationId. fn get_order(&self, id: OperationId) -> Option; @@ -40,7 +40,7 @@ impl SignMintOrdersService { #[async_trait::async_trait(?Send)] impl BridgeService for SignMintOrdersService { - fn push_operation(&self, id: OperationId) -> BftResult<()> { + fn push_operation(&self, id: OperationId) -> BTFResult<()> { let order = self .order_handler .get_order(id) @@ -50,7 +50,7 @@ impl BridgeService for SignMintOrdersService { Ok(()) } - async fn run(&self) -> BftResult<()> { + async fn run(&self) -> BTFResult<()> { log::trace!("Running SignMintOrdersService"); let orders_number = self.orders.borrow().len().min(MAX_MINT_ORDERS_IN_BATCH); diff --git a/src/bridge-canister/src/runtime/service/timer.rs b/src/bridge-canister/src/runtime/service/timer.rs index 5212a091..511bc577 100644 --- a/src/bridge-canister/src/runtime/service/timer.rs +++ b/src/bridge-canister/src/runtime/service/timer.rs @@ -1,7 +1,7 @@ use std::cell::Cell; use std::time::Duration; -use bridge_did::error::BftResult; +use bridge_did::error::BTFResult; use bridge_did::op_id::OperationId; use ic_exports::ic_kit::ic; @@ -33,7 +33,7 @@ impl ServiceTimer { #[async_trait::async_trait(?Send)] impl BridgeService for ServiceTimer { - async fn run(&self) -> BftResult<()> { + async fn run(&self) -> BTFResult<()> { let now = ic::time(); if !self.time_to_run(now) { return Ok(()); @@ -44,7 +44,7 @@ impl BridgeService for ServiceTimer { self.inner.run().await } - fn push_operation(&self, id: OperationId) -> BftResult<()> { + fn push_operation(&self, id: OperationId) -> BTFResult<()> { self.inner.push_operation(id) } } diff --git a/src/bridge-canister/src/runtime/service/update_evm_params.rs b/src/bridge-canister/src/runtime/service/update_evm_params.rs index d21f0299..b4e5e0c7 100644 --- a/src/bridge-canister/src/runtime/service/update_evm_params.rs +++ b/src/bridge-canister/src/runtime/service/update_evm_params.rs @@ -1,4 +1,4 @@ -use bridge_did::error::BftResult; +use bridge_did::error::BTFResult; use bridge_did::op_id::OperationId; use super::BridgeService; @@ -18,11 +18,11 @@ impl RefreshEvmParamsService { #[async_trait::async_trait(?Send)] impl BridgeService for RefreshEvmParamsService { - async fn run(&self) -> BftResult<()> { + async fn run(&self) -> BTFResult<()> { ConfigStorage::refresh_evm_params(self.config.clone()).await } - fn push_operation(&self, _: OperationId) -> BftResult<()> { + fn push_operation(&self, _: OperationId) -> BTFResult<()> { let msg = "Operations should not be pushed to the RefreshEvmParamsService service"; log::warn!("{msg}"); Err(bridge_did::error::Error::FailedToProgress(msg.into())) diff --git a/src/bridge-canister/src/runtime/state.rs b/src/bridge-canister/src/runtime/state.rs index 505d9152..becc6651 100644 --- a/src/bridge-canister/src/runtime/state.rs +++ b/src/bridge-canister/src/runtime/state.rs @@ -4,7 +4,7 @@ use std::cell::RefCell; use std::rc::Rc; use std::time::Duration; -use bridge_did::error::{BftResult, Error}; +use bridge_did::error::{BTFResult, Error}; use bridge_did::evm_link::EvmLink; use bridge_did::op_id::OperationId; use bridge_utils::evm_bridge::EvmParams; @@ -87,7 +87,7 @@ impl State { &self, service: ServiceId, operation_id: OperationId, - ) -> BftResult<()> { + ) -> BTFResult<()> { self.services .borrow_mut() .push_operation(service, operation_id) @@ -99,24 +99,24 @@ impl OperationContext for SharedConfig { self.borrow().get_evm_link() } - fn get_bridge_contract_address(&self) -> BftResult { - self.borrow().get_bft_bridge_contract().ok_or_else(|| { - Error::Initialization("bft bridge contract expected to be initialized".to_string()) + fn get_bridge_contract_address(&self) -> BTFResult { + self.borrow().get_btf_bridge_contract().ok_or_else(|| { + Error::Initialization("btf bridge contract expected to be initialized".to_string()) }) } - fn get_evm_params(&self) -> BftResult { + fn get_evm_params(&self) -> BTFResult { self.borrow().get_evm_params() } - fn get_signer(&self) -> BftResult { + fn get_signer(&self) -> BTFResult { self.borrow().get_signer() } } #[cfg(test)] mod tests { - use bridge_did::error::BftResult; + use bridge_did::error::BTFResult; use bridge_did::op_id::OperationId; use candid::CandidType; use ic_exports::ic_kit::MockContext; @@ -136,7 +136,7 @@ mod tests { self, _: OperationId, _: RuntimeState, - ) -> BftResult> { + ) -> BTFResult> { unimplemented!() } diff --git a/src/bridge-canister/src/runtime/state/config.rs b/src/bridge-canister/src/runtime/state/config.rs index 967aa576..d01084b5 100644 --- a/src/bridge-canister/src/runtime/state/config.rs +++ b/src/bridge-canister/src/runtime/state/config.rs @@ -2,7 +2,7 @@ use std::borrow::Cow; use std::cell::RefCell; use std::rc::Rc; -use bridge_did::error::{BftResult, Error}; +use bridge_did::error::{BTFResult, Error}; use bridge_did::evm_link::EvmLink; use bridge_did::init::BridgeInitData; use bridge_utils::evm_bridge::EvmParams; @@ -49,7 +49,7 @@ impl ConfigStorage { owner: init_data.owner, evm_link: init_data.evm_link.clone(), evm_params: None, - bft_bridge_contract_address: None, + btf_bridge_contract_address: None, signing_strategy: init_data.signing_strategy.clone(), }; @@ -57,7 +57,7 @@ impl ConfigStorage { } /// Query EVM params using the EvmLink in the config data. - pub async fn init_evm_params(config: Rc>) -> BftResult<()> { + pub async fn init_evm_params(config: Rc>) -> BTFResult<()> { log::trace!("initializing evm params"); let link = config.borrow().get_evm_link(); @@ -102,7 +102,7 @@ impl ConfigStorage { } /// Updates evm params in the given config, using the EvmLink from there. - pub async fn refresh_evm_params(config: Rc>) -> BftResult<()> { + pub async fn refresh_evm_params(config: Rc>) -> BTFResult<()> { log::trace!("updating evm params"); let link = config.borrow().get_evm_link(); @@ -156,7 +156,7 @@ impl ConfigStorage { } /// Checks if the caller is owner. - pub fn check_owner(&self, caller: Principal) -> BftResult<()> { + pub fn check_owner(&self, caller: Principal) -> BTFResult<()> { if caller != self.get_owner() { return Err(Error::AccessDenied); } @@ -165,7 +165,7 @@ impl ConfigStorage { } /// Returns parameters of EVM canister with which the bridge canister works. - pub fn get_evm_params(&self) -> BftResult { + pub fn get_evm_params(&self) -> BTFResult { self.0.get().evm_params.clone().ok_or_else(|| { Error::Initialization("failed to get uninitialized get evm params".into()) }) @@ -191,17 +191,17 @@ impl ConfigStorage { } /// Returns bridge contract address for EVM. - pub fn get_bft_bridge_contract(&self) -> Option { - self.0.get().bft_bridge_contract_address.clone() + pub fn get_btf_bridge_contract(&self) -> Option { + self.0.get().btf_bridge_contract_address.clone() } /// Set bridge contract address for EVM. - pub fn set_bft_bridge_contract(&mut self, address: H160) { - self.update(|config| config.bft_bridge_contract_address = Some(address)); + pub fn set_btf_bridge_contract(&mut self, address: H160) { + self.update(|config| config.btf_bridge_contract_address = Some(address)); } /// Creates a signer according to `Self::signing_strategy`. - pub fn get_signer(&self) -> BftResult { + pub fn get_signer(&self) -> BTFResult { let config = self.0.get(); let chain_id = self.get_evm_params()?.chain_id; config @@ -234,7 +234,7 @@ pub struct Config { pub owner: Principal, pub evm_link: EvmLink, pub evm_params: Option, - pub bft_bridge_contract_address: Option, + pub btf_bridge_contract_address: Option, pub signing_strategy: SigningStrategy, } @@ -244,7 +244,7 @@ impl Default for Config { owner: Principal::management_canister(), evm_link: EvmLink::Ic(Principal::anonymous()), evm_params: None, - bft_bridge_contract_address: None, + btf_bridge_contract_address: None, signing_strategy: SigningStrategy::ManagementCanister { key_id: eth_signer::ic_sign::SigningKeyId::Test, }, diff --git a/src/bridge-client/src/bridge_client.rs b/src/bridge-client/src/bridge_client.rs index 6aacfbd6..7bafe285 100644 --- a/src/bridge-client/src/bridge_client.rs +++ b/src/bridge-client/src/bridge_client.rs @@ -1,4 +1,4 @@ -use bridge_did::error::BftResult; +use bridge_did::error::BTFResult; use bridge_did::id256::Id256; use bridge_did::order::SignedMintOrder; use candid::Principal; @@ -80,7 +80,7 @@ pub trait BridgeCanisterClient { } /// Returns principal of EVM canister with which the bridge canister works. - async fn get_bridge_canister_evm_address(&self) -> CanisterClientResult> { + async fn get_bridge_canister_evm_address(&self) -> CanisterClientResult> { self.client() .update("get_bridge_canister_evm_address", ()) .await @@ -91,16 +91,16 @@ pub trait BridgeCanisterClient { self.client().query("get_evm_principal", ()).await } - /// Sets bft bridge contract address. - async fn set_bft_bridge_contract(&self, address: &H160) -> CanisterClientResult<()> { + /// Sets btf bridge contract address. + async fn set_btf_bridge_contract(&self, address: &H160) -> CanisterClientResult<()> { self.client() - .update("set_bft_bridge_contract", (address,)) + .update("set_btf_bridge_contract", (address,)) .await } - /// Returns the address of the BFT bridge contract in EVM canister. - async fn get_bft_bridge_contract(&self) -> CanisterClientResult>> { - self.client().update("get_bft_bridge_contract", ()).await + /// Returns the address of the BTF bridge contract in EVM canister. + async fn get_btf_bridge_contract(&self) -> CanisterClientResult>> { + self.client().update("get_btf_bridge_contract", ()).await } /// Returns `(nonce, mint_order)` pairs for the given sender id. @@ -120,7 +120,7 @@ pub trait BridgeCanisterClient { } /// Adds the given principal to the whitelist. - async fn add_to_whitelist(&self, principal: Principal) -> CanisterClientResult> { + async fn add_to_whitelist(&self, principal: Principal) -> CanisterClientResult> { self.client().update("add_to_whitelist", (principal,)).await } @@ -128,7 +128,7 @@ pub trait BridgeCanisterClient { async fn remove_from_whitelist( &self, principal: Principal, - ) -> CanisterClientResult> { + ) -> CanisterClientResult> { self.client() .update("remove_from_whitelist", (principal,)) .await diff --git a/src/bridge-client/src/erc20_bridge_client.rs b/src/bridge-client/src/erc20_bridge_client.rs index f30adb4e..70ad25bb 100644 --- a/src/bridge-client/src/erc20_bridge_client.rs +++ b/src/bridge-client/src/erc20_bridge_client.rs @@ -1,4 +1,4 @@ -use bridge_did::error::BftResult; +use bridge_did::error::BTFResult; use bridge_did::op_id::OperationId; use bridge_did::operation_log::{Memo, OperationLog}; use bridge_did::operations::Erc20BridgeOp; @@ -65,15 +65,15 @@ impl Erc20BridgeClient { .await } - pub async fn set_base_bft_bridge_contract(&self, address: &H160) -> CanisterClientResult<()> { + pub async fn set_base_btf_bridge_contract(&self, address: &H160) -> CanisterClientResult<()> { self.client - .update("set_base_bft_bridge_contract", (address,)) + .update("set_base_btf_bridge_contract", (address,)) .await } pub async fn get_bridge_canister_base_evm_address( &self, - ) -> CanisterClientResult> { + ) -> CanisterClientResult> { self.client .update("get_bridge_canister_base_evm_address", ()) .await diff --git a/src/bridge-deployer/README.md b/src/bridge-deployer/README.md index 90489c91..49b78204 100644 --- a/src/bridge-deployer/README.md +++ b/src/bridge-deployer/README.md @@ -95,7 +95,7 @@ To upgrade a bridge, you will need to provide the canister id of the bridge to b To reinstall a bridge, you will need to provide the canister id of the bridge to be reinstalled. The command is similar to the deployment command, with the addition of the `--canister-id` argument. ```bash -bridge-deployer reinstall [BRIDGE_TYPE] --canister-id --wasm --bft-bridge
+bridge-deployer reinstall [BRIDGE_TYPE] --canister-id --wasm --btf-bridge
``` Note: You need to provide the canister arguments for the bridge type you are reinstalling. @@ -124,7 +124,7 @@ Note: The examples above are for illustrative purposes only. Please replace the ### Extra Information -For the upgrade process, only the canister will be upgraded. The BFT contract will remain the same, hence the BFT contract should be deployed separately in case it requires an upgrade. +For the upgrade process, only the canister will be upgraded. The BTF contract will remain the same, hence the BTF contract should be deployed separately in case it requires an upgrade. ### Troubleshooting diff --git a/src/bridge-deployer/src/bridge_deployer.rs b/src/bridge-deployer/src/bridge_deployer.rs index 746dfcfe..4b311a95 100644 --- a/src/bridge-deployer/src/bridge_deployer.rs +++ b/src/bridge-deployer/src/bridge_deployer.rs @@ -77,11 +77,11 @@ impl BridgeDeployer { Ok(canister_id) } - pub async fn configure_minter(&self, bft_address: H160) -> anyhow::Result<()> { + pub async fn configure_minter(&self, btf_address: H160) -> anyhow::Result<()> { info!("Configuring bridge canister"); self.client - .set_bft_bridge_contract(&bft_address.into()) + .set_btf_bridge_contract(&btf_address.into()) .await?; info!("Bridge canister is configured"); diff --git a/src/bridge-deployer/src/commands/deploy.rs b/src/bridge-deployer/src/commands/deploy.rs index 10d84645..ea4f94ea 100644 --- a/src/bridge-deployer/src/commands/deploy.rs +++ b/src/bridge-deployer/src/commands/deploy.rs @@ -12,10 +12,10 @@ use ic_canister_client::agent::identity::GenericIdentity; use ic_utils::interfaces::management_canister::builders::InstallMode; use tracing::info; -use super::{BFTArgs, Bridge}; +use super::{BTFArgs, Bridge}; use crate::bridge_deployer::BridgeDeployer; use crate::canister_ids::{CanisterIds, CanisterIdsPath}; -use crate::commands::BftDeployedContracts; +use crate::commands::BtfDeployedContracts; use crate::config::BtcBridgeConnection; use crate::contracts::{EvmNetwork, SolidityContractDeployer}; use crate::evm::ic_host; @@ -33,7 +33,7 @@ const BTC_ERC20_DECIMALS: u8 = 10; /// The deploy command. /// /// This command is used to deploy a bridge canister to the IC network. -/// It will also deploy the BFT bridge if the `deploy_bft` flag is set to true. +/// It will also deploy the BTF bridge if the `deploy_btf` flag is set to true. #[derive(Debug, Parser)] pub struct DeployCommands { /// The type of Bridge to deploy @@ -62,9 +62,9 @@ pub struct DeployCommands { #[arg(long, value_name = "WALLET_CANISTER", env)] wallet_canister: Option, - /// These are extra arguments for the BFT bridge. - #[command(flatten, next_help_heading = "BFT Bridge deployment")] - bft_args: BFTArgs, + /// These are extra arguments for the BTF bridge. + #[command(flatten, next_help_heading = "BTF Bridge deployment")] + btf_args: BTFArgs, } impl DeployCommands { @@ -104,24 +104,24 @@ impl DeployCommands { canister_ids.set((&self.bridge_type).into(), canister_id); canister_ids.write()?; - info!("Deploying BFT bridge"); - let BftDeployedContracts { - bft_bridge, + info!("Deploying BTF bridge"); + let BtfDeployedContracts { + btf_bridge, wrapped_token_deployer, fee_charge, minter_address, } = self - .bft_args - .deploy_bft(network.into(), canister_id, pk, &agent, true, evm) + .btf_args + .deploy_btf(network.into(), canister_id, pk, &agent, true, evm) .await?; - info!("BFT bridge deployed successfully with {bft_bridge}; wrapped_token_deployer: {wrapped_token_deployer:x}"); + info!("BTF bridge deployed successfully with {btf_bridge}; wrapped_token_deployer: {wrapped_token_deployer:x}"); // If the bridge type is BTC, we also deploy the Token contract for wrapped BTC if let Bridge::Btc { connection, .. } = &self.bridge_type { info!("Deploying wrapped BTC contract"); let wrapped_btc_addr = - self.deploy_wrapped_btc(network, pk, &bft_bridge, *connection, evm)?; + self.deploy_wrapped_btc(network, pk, &btf_bridge, *connection, evm)?; info!("Wrapped BTC contract deployed successfully with {wrapped_btc_addr:x}"); println!("Wrapped BTC contract deployed with address {wrapped_btc_addr:x}"); @@ -132,12 +132,12 @@ impl DeployCommands { } // configure minter - deployer.configure_minter(bft_bridge).await?; + deployer.configure_minter(btf_bridge).await?; let base_side_ids = self .bridge_type .finalize( - &self.bft_args, + &self.btf_args, network, deployer.bridge_principal(), pk, @@ -155,22 +155,22 @@ impl DeployCommands { ); println!("Bridge canister principal: {}", canister_id); println!("---------------------------"); - println!("Wrapped side BFT bridge: 0x{}", hex::encode(bft_bridge)); + println!("Wrapped side BTF bridge: 0x{}", hex::encode(btf_bridge)); println!("Wrapped side FeeCharge: 0x{}", hex::encode(fee_charge)); println!( "Wrapped side bridge address: 0x{}", hex::encode(minter_address) ); - if let Some(BftDeployedContracts { - bft_bridge, + if let Some(BtfDeployedContracts { + btf_bridge, fee_charge, minter_address, .. }) = base_side_ids { println!(); - println!("Base side BFT bridge: 0x{}", hex::encode(bft_bridge)); + println!("Base side BTF bridge: 0x{}", hex::encode(btf_bridge)); println!("Base side FeeCharge: 0x{}", hex::encode(fee_charge)); println!( "Base side bridge address: 0x{}", @@ -186,7 +186,7 @@ impl DeployCommands { &self, network: EvmNetwork, pk: H256, - bft_bridge: &H160, + btf_bridge: &H160, btc_connection: BtcBridgeConnection, evm: Principal, ) -> anyhow::Result { @@ -194,7 +194,7 @@ impl DeployCommands { let base_token_id = Id256::from(btc_connection.ledger_principal()); contract_deployer.deploy_wrapped_token( - bft_bridge, + btf_bridge, String::from_utf8_lossy(&BTC_ERC20_NAME).as_ref(), String::from_utf8_lossy(&BTC_ERC20_SYMBOL).as_ref(), BTC_ERC20_DECIMALS, diff --git a/src/bridge-deployer/src/commands/mod.rs b/src/bridge-deployer/src/commands/mod.rs index 9e3da31b..91e650a0 100644 --- a/src/bridge-deployer/src/commands/mod.rs +++ b/src/bridge-deployer/src/commands/mod.rs @@ -2,7 +2,7 @@ use std::time::Duration; use anyhow::Context; use bridge_client::Erc20BridgeClient; -use bridge_did::error::BftResult; +use bridge_did::error::BTFResult; use bridge_did::evm_link::EvmLink; use bridge_did::init::erc20::{BaseEvmSettings, QueryDelays}; use bridge_did::init::BtcBridgeConfig; @@ -185,16 +185,16 @@ impl Bridge { Ok(arg) } - /// Run necessary deployment steps after canister and wrapped side BFT were deployed. + /// Run necessary deployment steps after canister and wrapped side BTF were deployed. pub async fn finalize( &self, - bft_args: &BFTArgs, + btf_args: &BTFArgs, wrapped_network: EvmNetwork, bridge_principal: Principal, pk: H256, agent: &Agent, evm: Principal, - ) -> anyhow::Result> { + ) -> anyhow::Result> { match self { Self::Erc20 { erc, .. } => { let network = if let Some(url) = &erc.base_evm_url { @@ -206,23 +206,23 @@ impl Bridge { wrapped_network.into() }; - let bft_address = bft_args - .deploy_bft(network, bridge_principal, pk, agent, false, evm) + let btf_address = btf_args + .deploy_btf(network, bridge_principal, pk, agent, false, evm) .await?; - info!("Base BFT bridge deployed with address {bft_address:?}"); + info!("Base BTF bridge deployed with address {btf_address:?}"); let client = Erc20BridgeClient::new(IcAgentClient::with_agent( bridge_principal, agent.clone(), )); client - .set_base_bft_bridge_contract(&bft_address.bft_bridge.into()) + .set_base_btf_bridge_contract(&btf_address.btf_bridge.into()) .await?; - info!("Bridge canister configured with base BFT bridge contract address"); + info!("Bridge canister configured with base BTF bridge contract address"); - Ok(Some(bft_address)) + Ok(Some(btf_address)) } _ => Ok(None), } @@ -246,7 +246,7 @@ impl Commands { /// /// This function handles the deployment, reinstallation, and upgrade of the bridge canister. /// It takes in various parameters such as the identity file path, the IC host, the Ethereum network, - /// the private key, whether to deploy the BFT contract, and the BFT contract arguments. + /// the private key, whether to deploy the BTF contract, and the BTF contract arguments. /// The function returns a result indicating whether the operation was successful or not. pub async fn run( @@ -278,7 +278,7 @@ impl Commands { } #[derive(Debug, Args)] -pub struct BFTArgs { +pub struct BTFArgs { /// The address of the owner of the contract. #[arg(long, value_name = "OWNER")] owner: Option, @@ -289,16 +289,16 @@ pub struct BFTArgs { } #[derive(Debug, PartialEq, Eq, Clone)] -pub struct BftDeployedContracts { - pub bft_bridge: H160, +pub struct BtfDeployedContracts { + pub btf_bridge: H160, pub wrapped_token_deployer: H160, pub fee_charge: H160, pub minter_address: H160, } -impl BFTArgs { - /// Deploy the BFT contract - pub async fn deploy_bft( +impl BTFArgs { + /// Deploy the BTF contract + pub async fn deploy_btf( &self, network: NetworkConfig, canister_id: Principal, @@ -306,13 +306,13 @@ impl BFTArgs { agent: &Agent, is_wrapped_side: bool, evm: Principal, - ) -> anyhow::Result { - info!("Deploying BFT contract"); + ) -> anyhow::Result { + info!("Deploying BTF contract"); let contract_deployer = SolidityContractDeployer::new(network, pk, evm); let nonce_increment = match is_wrapped_side { - true => 3, // 1) TokenDeployer, 2) BFTBridge, 3) FeePayer + true => 3, // 1) TokenDeployer, 2) BTFBridge, 3) FeePayer false => 2, // we don't deploy token deployer for base EVM, so FeePayer is No 2. }; let expected_nonce = contract_deployer.get_nonce().await? + nonce_increment; @@ -336,13 +336,13 @@ impl BFTArgs { "get_bridge_canister_base_evm_address" }; let minter_address = canister_client - .update::<_, BftResult>(evm_address_method, ()) + .update::<_, BTFResult>(evm_address_method, ()) .await? .context("failed to get the bridge canister address")?; info!("Minter address: {:x}", minter_address); - let bft_address = contract_deployer.deploy_bft( + let btf_address = contract_deployer.deploy_btf( &minter_address.clone().into(), &expected_fee_charge_address, &wrapped_token_deployer, @@ -351,12 +351,12 @@ impl BFTArgs { &self.controllers, )?; - contract_deployer.deploy_fee_charge(&[bft_address], Some(expected_fee_charge_address))?; + contract_deployer.deploy_fee_charge(&[btf_address], Some(expected_fee_charge_address))?; - info!("BFT bridge deployed successfully. Contract address: {bft_address:x}"); + info!("BTF bridge deployed successfully. Contract address: {btf_address:x}"); - Ok(BftDeployedContracts { - bft_bridge: bft_address, + Ok(BtfDeployedContracts { + btf_bridge: btf_address, wrapped_token_deployer, fee_charge: expected_fee_charge_address, minter_address: minter_address.into(), diff --git a/src/bridge-deployer/src/commands/reinstall.rs b/src/bridge-deployer/src/commands/reinstall.rs index bcc60799..b0dbe948 100644 --- a/src/bridge-deployer/src/commands/reinstall.rs +++ b/src/bridge-deployer/src/commands/reinstall.rs @@ -37,9 +37,9 @@ pub struct ReinstallCommands { #[arg(long, value_name = "WASM_PATH")] wasm: PathBuf, - /// Existing BFT bridge contract address to work with the deployed bridge. - #[arg(long = "bft-bridge", value_name = "ADDRESS")] - bft_bridge: H160, + /// Existing BTF bridge contract address to work with the deployed bridge. + #[arg(long = "btf-bridge", value_name = "ADDRESS")] + btf_bridge: H160, } impl ReinstallCommands { @@ -87,7 +87,7 @@ impl ReinstallCommands { info!("Canister installed successfully"); - deployer.configure_minter(self.bft_bridge).await?; + deployer.configure_minter(self.btf_bridge).await?; info!("Canister reinstalled successfully with ID: {}", canister_id); diff --git a/src/bridge-deployer/src/commands/wrap_token_type.rs b/src/bridge-deployer/src/commands/wrap_token_type.rs index 13361131..374ab6d6 100644 --- a/src/bridge-deployer/src/commands/wrap_token_type.rs +++ b/src/bridge-deployer/src/commands/wrap_token_type.rs @@ -46,12 +46,12 @@ impl WrapTokenType { } } - fn wrapped_bft_address(&self) -> &H160 { + fn wrapped_btf_address(&self) -> &H160 { match self { WrapTokenType::Erc20(WrapErc20Args { - wrapped_bft_address, + wrapped_btf_address, .. - }) => wrapped_bft_address, + }) => wrapped_btf_address, } } @@ -76,7 +76,7 @@ impl WrapTokenType { decimals, id, } = base_token_params; - deployer.deploy_wrapped_token(self.wrapped_bft_address(), name, symbol, *decimals, *id) + deployer.deploy_wrapped_token(self.wrapped_btf_address(), name, symbol, *decimals, *id) } async fn get_erc20_params( @@ -171,10 +171,10 @@ pub struct WrapErc20Args { base_evm_url: String, #[arg(long)] - base_bft_address: H160, + base_btf_address: H160, #[arg(long)] - wrapped_bft_address: H160, + wrapped_btf_address: H160, #[arg(long)] token_address: H160, @@ -186,7 +186,7 @@ mod tests { use crate::contracts::TESTNET_URL; #[tokio::test] - #[ignore = "requires connection to BF testnet and some BFT in the wallet; if in doubt, run manually"] + #[ignore = "requires connection to BF testnet and some BTF in the wallet; if in doubt, run manually"] async fn getting_erc20_token_parameters() { let wallet_pk = "0xf886b8c9418002fb34bbeaa0a1002e13eebd9fdc0fc41d70a7393747cd95af71"; let token_address = "0xCe72ce5Aa299e1E630CBf5262Dd630260b42BF1a"; diff --git a/src/bridge-deployer/src/contracts.rs b/src/bridge-deployer/src/contracts.rs index 3ea6238f..317400ed 100644 --- a/src/bridge-deployer/src/contracts.rs +++ b/src/bridge-deployer/src/contracts.rs @@ -210,8 +210,8 @@ impl SolidityContractDeployer<'_> { H160::from_str(address).context(format!("Invalid {} address", prefix)) } - /// Deploys the BFT contract. - pub fn deploy_bft( + /// Deploys the BTF contract. + pub fn deploy_btf( &self, minter_address: &H160, fee_charge_address: &H160, @@ -220,7 +220,7 @@ impl SolidityContractDeployer<'_> { owner: Option, controllers: &Option>, ) -> Result { - info!("Deploying BFT contract"); + info!("Deploying BTF contract"); let env_vars = vec![ ("MINTER_ADDRESS", minter_address.encode_hex_with_prefix()), @@ -258,7 +258,7 @@ impl SolidityContractDeployer<'_> { env_vars }; - let output = self.execute_forge_script("DeployBFT.s.sol", env_vars)?; + let output = self.execute_forge_script("DeployBTF.s.sol", env_vars)?; Self::extract_address_from_output(&output, "Proxy address:") } @@ -296,7 +296,7 @@ impl SolidityContractDeployer<'_> { /// Deploys the WrappedToken contract. pub fn deploy_wrapped_token( &self, - bft_bridge: &H160, + btf_bridge: &H160, name: &str, symbol: &str, decimals: u8, @@ -305,7 +305,7 @@ impl SolidityContractDeployer<'_> { info!("Deploying Wrapped ERC20 contract"); let env_vars = vec![ - ("BFT_BRIDGE", bft_bridge.encode_hex_with_prefix()), + ("BTF_BRIDGE", btf_bridge.encode_hex_with_prefix()), ("NAME", name.to_string()), ("SYMBOL", symbol.to_string()), ("DECIMALS", decimals.to_string()), diff --git a/src/bridge-did/src/erc721_mint_order.rs b/src/bridge-did/src/erc721_mint_order.rs index 2e2a5f19..6d81a438 100644 --- a/src/bridge-did/src/erc721_mint_order.rs +++ b/src/bridge-did/src/erc721_mint_order.rs @@ -10,7 +10,7 @@ use ic_stable_structures::{Bound, MultimapStructure as _, StableMultimap, Storab use serde::de::Visitor; use serde::Deserialize; -use crate::error::{BftResult, Error}; +use crate::error::{BTFResult, Error}; use crate::id256::Id256; #[derive(Debug, CandidType, Clone, PartialEq, Eq, PartialOrd, Ord)] @@ -47,7 +47,7 @@ impl<'de> Deserialize<'de> for ERC721SignedMintOrder { } } -/// Data which should be signed and provided to the `BftBridge.mint()` call +/// Data which should be signed and provided to the `Btfbridge.mint()` call /// to perform mint. #[derive(Debug, Clone, PartialEq, Eq)] pub struct ERC721MintOrder { @@ -115,7 +115,7 @@ impl ERC721MintOrder { pub async fn encode_and_sign( &self, signer: &impl TransactionSigner, - ) -> BftResult { + ) -> BTFResult { let data = self.token_uri.as_bytes(); let mut buf = vec![0; Self::SIGNED_ENCODED_DATA_SIZE + data.len()]; let data_size = data.len(); diff --git a/src/bridge-did/src/error.rs b/src/bridge-did/src/error.rs index 683e4b6a..83dca0a4 100644 --- a/src/bridge-did/src/error.rs +++ b/src/bridge-did/src/error.rs @@ -5,7 +5,7 @@ use thiserror::Error; use crate::op_id::OperationId; -pub type BftResult = Result; +pub type BTFResult = Result; #[derive(Debug, Error, Clone, Serialize, Deserialize, CandidType, PartialEq, Eq)] pub enum Error { diff --git a/src/bridge-did/src/events.rs b/src/bridge-did/src/events.rs index c2a067a9..b46df864 100644 --- a/src/bridge-did/src/events.rs +++ b/src/bridge-did/src/events.rs @@ -3,19 +3,19 @@ use std::fmt::{Display, Formatter}; use alloy_sol_types::sol; use candid::{CandidType, Decode}; use serde::{Deserialize, Serialize}; -use BFTBridge::{BurnTokenEvent, MintTokenEvent, NotifyMinterEvent}; +use BTFBridge::{BurnTokenEvent, MintTokenEvent, NotifyMinterEvent}; -use crate::error::{BftResult, Error}; +use crate::error::{BTFResult, Error}; use crate::op_id::OperationId; use crate::operation_log::Memo; sol! { #[derive(Debug, Serialize, Deserialize)] - BFTBridge, - "../../solidity/out/BftBridge.sol/BFTBridge.json" + BTFBridge, + "../../solidity/out/BTFBridge.sol/BTFBridge.json" } -/// Emitted when token is burnt by BFTBridge. +/// Emitted when token is burnt by BTFBridge. #[derive(Debug, Default, Clone, CandidType, Serialize, Deserialize)] pub struct BurntEventData { pub sender: did::H160, @@ -64,7 +64,7 @@ impl From for BurntEventData { } } -/// Event emitted when token is minted by BFTBridge. +/// Event emitted when token is minted by BTFBridge. #[derive(Debug, Default, Clone, CandidType, Serialize, Deserialize, PartialEq, Eq)] pub struct MintedEventData { pub amount: did::U256, @@ -148,7 +148,7 @@ impl NotifyMinterEventData { } /// Tries to decode the notification into rescheduling operation id. - pub fn try_decode_reschedule_operation_id(&self) -> BftResult { + pub fn try_decode_reschedule_operation_id(&self) -> BTFResult { if self.notification_type != MinterNotificationType::RescheduleOperation { return Err(Error::Serialization(format!( "expected MinterNotificationType::RescheduleOperation, got {:?}", diff --git a/src/bridge-did/src/id256.rs b/src/bridge-did/src/id256.rs index bc0bd257..5bb6349c 100644 --- a/src/bridge-did/src/id256.rs +++ b/src/bridge-did/src/id256.rs @@ -5,7 +5,7 @@ use did::H160; use ic_stable_structures::{Bound, Storable}; use serde::Deserialize; -use crate::error::{BftResult, Error}; +use crate::error::{BTFResult, Error}; /// 32-bytes entity identifier. /// Uniquely identifies: @@ -61,7 +61,7 @@ impl Id256 { Self(buf) } - pub fn to_evm_address(&self) -> BftResult<(u32, H160)> { + pub fn to_evm_address(&self) -> BTFResult<(u32, H160)> { if self.0[0] != Self::EVM_ADDRESS_MARK { return Err(Error::Serialization( "wrong evm address mark in Id256".into(), @@ -78,7 +78,7 @@ impl Id256 { } /// Convert ID256 into BRC20 tick. - pub fn to_brc20_tick(&self) -> BftResult<[u8; 4]> { + pub fn to_brc20_tick(&self) -> BTFResult<[u8; 4]> { if self.0[0] != Self::BRC20_TICK_MARK { return Err(Error::Serialization( "wrong brc20 tick mark in Id256".into(), @@ -145,7 +145,7 @@ impl Id256 { /// Converts Id256 into `(block_id, tx_index)` transaction index if the ID represents the rune id, /// or returns an error otherwise. - pub fn to_btc_tx_index(&self) -> BftResult<(u64, u32)> { + pub fn to_btc_tx_index(&self) -> BTFResult<(u64, u32)> { if self.0[0] != Self::BTC_TX_MARK { return Err(Error::Serialization("wrong rune id mark in Id256".into())); } @@ -166,7 +166,7 @@ impl Id256 { impl TryFrom<&[u8]> for Id256 { type Error = Error; - fn try_from(value: &[u8]) -> BftResult { + fn try_from(value: &[u8]) -> BTFResult { let inner: [u8; Self::BYTE_SIZE as _] = value.try_into().map_err(|_| { Error::Serialization("data of Id256 should contain exactly 32 bytes".into()) })?; @@ -220,7 +220,7 @@ impl From<(u32, H160)> for Id256 { impl TryFrom for Principal { type Error = Error; - fn try_from(id: Id256) -> BftResult { + fn try_from(id: Id256) -> BTFResult { if id.0[0] != Id256::PRINCIPAL_MARK { return Err(Error::Serialization("wrong principal mark in Id256".into())); } @@ -239,7 +239,7 @@ impl TryFrom for Principal { impl TryFrom for H160 { type Error = Error; - fn try_from(id: Id256) -> BftResult { + fn try_from(id: Id256) -> BTFResult { if id.0[0] != Id256::EVM_ADDRESS_MARK { return Err(Error::Serialization("wrong address mark in Id256".into())); } diff --git a/src/bridge-did/src/lib.rs b/src/bridge-did/src/lib.rs index 73688a4a..a6798216 100644 --- a/src/bridge-did/src/lib.rs +++ b/src/bridge-did/src/lib.rs @@ -19,7 +19,7 @@ pub mod runes; /// Re-export the event data /// pub mod event_data { - pub use crate::events::BFTBridge::{BurnTokenEvent, MintTokenEvent, NotifyMinterEvent}; + pub use crate::events::BTFBridge::{BurnTokenEvent, MintTokenEvent, NotifyMinterEvent}; pub use crate::events::{ BurntEventData, MintedEventData, MinterNotificationType, NotifyMinterEventData, }; diff --git a/src/bridge-did/src/order.rs b/src/bridge-did/src/order.rs index 45286ae0..0dba1bba 100644 --- a/src/bridge-did/src/order.rs +++ b/src/bridge-did/src/order.rs @@ -10,10 +10,10 @@ use ic_stable_structures::{Bound, Storable}; use serde::de::Visitor; use serde::{Deserialize, Serialize}; -use crate::error::{BftResult, Error}; +use crate::error::{BTFResult, Error}; use crate::id256::Id256; -/// Data which should be signed and provided to the `BftBridge.mint()` call +/// Data which should be signed and provided to the `Btfbridge.mint()` call /// to perform mint. #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, CandidType)] pub struct MintOrder { @@ -136,7 +136,7 @@ impl MintOrder { pub async fn encode_and_sign( &self, signer: &impl TransactionSigner, - ) -> BftResult { + ) -> BTFResult { let mut buf = [0; Self::SIGNED_ENCODED_DATA_SIZE]; let encoded_data = self.encode(); diff --git a/src/bridge-tool/src/flow/mod.rs b/src/bridge-tool/src/flow/mod.rs index ff66d69b..68180f73 100644 --- a/src/bridge-tool/src/flow/mod.rs +++ b/src/bridge-tool/src/flow/mod.rs @@ -6,7 +6,7 @@ use anyhow::anyhow; use bridge_client::Erc20BridgeClient; use bridge_did::id256::Id256; use bridge_did::operations::Erc20OpStage; -use bridge_utils::{BFTBridge, FeeCharge, WrappedToken}; +use bridge_utils::{BTFBridge, FeeCharge, WrappedToken}; use candid::Principal; use clap::{Args, Parser, Subcommand}; use did::block::ExeResult; @@ -64,9 +64,9 @@ pub struct DepositErc20Args { #[arg(long)] base_evm: String, - /// Base side BFT bridge contract address + /// Base side BTF bridge contract address #[arg(long)] - base_bft: H160, + base_btf: H160, /// Base token address #[arg(long)] @@ -76,9 +76,9 @@ pub struct DepositErc20Args { #[clap(long)] wrapped_evm: String, - /// Wrapped side BFT bridge contract address + /// Wrapped side BTF bridge contract address #[arg(long)] - wrapped_bft: H160, + wrapped_btf: H160, /// Wrapped token address #[arg(long)] @@ -92,7 +92,7 @@ pub struct DepositErc20Args { #[arg(long)] bridge_canister: Principal, - /// Amount of tokens to be tranferred + /// Amount of tokens to be transferred #[arg(long)] amount: u128, @@ -107,9 +107,9 @@ pub struct WithdrawErc20Args { #[arg(long)] base_evm: String, - /// Base side BFT bridge contract address + /// Base side BTF bridge contract address #[arg(long)] - base_bft: H160, + base_btf: H160, /// Base token address #[arg(long)] @@ -119,9 +119,9 @@ pub struct WithdrawErc20Args { #[clap(long)] wrapped_evm: String, - /// Wrapped side BFT bridge contract address + /// Wrapped side BTF bridge contract address #[arg(long)] - wrapped_bft: H160, + wrapped_btf: H160, /// Wrapped token address #[arg(long)] @@ -135,7 +135,7 @@ pub struct WithdrawErc20Args { #[arg(long)] bridge_canister: Principal, - /// Amount of tokens to be tranferred + /// Amount of tokens to be transferred #[arg(long)] amount: u128, @@ -150,19 +150,16 @@ struct Erc20BridgeFlow<'a> { wallet: Wallet<'a, SigningKey>, base_client: RpcClient, wrapped_client: RpcClient, - - base_bft: H160, + base_btf: H160, base_token: H160, - - wrapped_bft: H160, + wrapped_btf: H160, wrapped_token: H160, - ic_host: String, bridge_canister: Principal, } impl<'a> Erc20BridgeFlow<'a> { - fn new_desposit(pk: H256, args: &DepositErc20Args) -> Self { + fn new_deposit(pk: H256, args: &DepositErc20Args) -> Self { let reqwest_client = reqwest::ClientBuilder::new() .danger_accept_invalid_certs(true) .build() @@ -181,9 +178,9 @@ impl<'a> Erc20BridgeFlow<'a> { wallet, base_client, wrapped_client, - base_bft: args.base_bft, + base_btf: args.base_btf, base_token: args.base_token, - wrapped_bft: args.wrapped_bft, + wrapped_btf: args.wrapped_btf, wrapped_token: args.wrapped_token, ic_host: args.ic_host.clone(), bridge_canister: args.bridge_canister, @@ -209,9 +206,9 @@ impl<'a> Erc20BridgeFlow<'a> { wallet, base_client, wrapped_client, - base_bft: args.base_bft, + base_btf: args.base_btf, base_token: args.base_token, - wrapped_bft: args.wrapped_bft, + wrapped_btf: args.wrapped_btf, wrapped_token: args.wrapped_token, ic_host: args.ic_host.clone(), bridge_canister: args.bridge_canister, @@ -232,7 +229,7 @@ impl DepositToken { pub async fn run(&self) -> anyhow::Result<()> { match &self.token_type { DepositTokenType::Erc20(erc20args) => { - let flow = Erc20BridgeFlow::new_desposit(self.private_key, erc20args); + let flow = Erc20BridgeFlow::new_deposit(self.private_key, erc20args); flow.deposit(erc20args.amount, erc20args.recipient).await } } @@ -292,19 +289,19 @@ impl<'a> Erc20BridgeFlow<'a> { self.approve_erc20(amount, side).await?; self.approve_fee(side.other(), FEE_APPROVE_AMOUNT).await?; - self.burn_bft(side, amount, &recipient, memo).await?; + self.burn_btf(side, amount, &recipient, memo).await?; self.track_operation(memo, side.other()).await } async fn get_fee_charge_address(&self, side: EvmSide) -> anyhow::Result { - let input = BFTBridge::feeChargeContractCall {}.abi_encode(); + let input = BTFBridge::feeChargeContractCall {}.abi_encode(); - let (client, bft, _) = self.get_side(side); + let (client, btf, _) = self.get_side(side); let result = client .eth_call( TransactionRequest { from: Some(self.wallet.address()), - to: Some((*bft).into()), + to: Some((*btf).into()), gas: None, gas_price: None, value: None, @@ -320,8 +317,8 @@ impl<'a> Erc20BridgeFlow<'a> { .unwrap_or_else(|_| panic!("Invalid response for fee charge address: {result}")); info!( - "Fee charge address for BFT {} is {}", - bft.encode_hex_with_prefix(), + "Fee charge address for BTF {} is {}", + btf.encode_hex_with_prefix(), address.encode_hex_with_prefix() ); @@ -465,15 +462,15 @@ impl<'a> Erc20BridgeFlow<'a> { fn get_side(&self, evm_side: EvmSide) -> (&RpcClient, &H160, &H160) { match evm_side { - EvmSide::Base => (&self.base_client, &self.base_bft, &self.base_token), - EvmSide::Wrapped => (&self.wrapped_client, &self.wrapped_bft, &self.wrapped_token), + EvmSide::Base => (&self.base_client, &self.base_btf, &self.base_token), + EvmSide::Wrapped => (&self.wrapped_client, &self.wrapped_btf, &self.wrapped_token), } } async fn approve_erc20(&self, amount: u128, evm_side: EvmSide) -> anyhow::Result<()> { info!("Approving transfer of {amount} ERC20 tokens"); - let (client, bft_bridge, token) = self.get_side(evm_side); + let (client, btf_bridge, token) = self.get_side(evm_side); let input = WrappedToken::balanceOfCall { account: self.wallet.address().0.into(), } @@ -508,7 +505,7 @@ impl<'a> Erc20BridgeFlow<'a> { let amount: U256 = amount.into(); let input = WrappedToken::approveCall { - spender: bft_bridge.0.into(), + spender: btf_bridge.0.into(), value: amount.clone().into(), } .abi_encode(); @@ -572,16 +569,16 @@ impl<'a> Erc20BridgeFlow<'a> { )) } - async fn burn_bft( + async fn burn_btf( &self, evm_side: EvmSide, amount: u128, recipient: &H160, memo: [u8; 32], ) -> anyhow::Result { - info!("Requesting BFT burn with amount {amount} "); + info!("Requesting BTF burn with amount {amount} "); - let (client, bft, from_token) = self.get_side(evm_side); + let (client, btf, from_token) = self.get_side(evm_side); let (_, _, to_token) = self.get_side(evm_side.other()); let to_chain_id = self.chain_id(evm_side.other()).await?; @@ -591,7 +588,7 @@ impl<'a> Erc20BridgeFlow<'a> { let recipient = recipient_id.0; let amount: U256 = amount.into(); - let input = BFTBridge::burnCall { + let input = BTFBridge::burnCall { amount: amount.into(), fromERC20: from_token.0.into(), toTokenID: alloy_sol_types::private::FixedBytes::from_slice(&to_token_id.0), @@ -606,7 +603,7 @@ impl<'a> Erc20BridgeFlow<'a> { let chain_id = client.get_chain_id().await?; let burn_tx = TransactionBuilder { from: &self.wallet.address().into(), - to: Some((*bft).into()), + to: Some((*btf).into()), nonce: nonce.into(), value: 0u64.into(), gas: 5_000_000u64.into(), @@ -624,7 +621,7 @@ impl<'a> Erc20BridgeFlow<'a> { .expect("Failed to send raw transaction"); info!( - "BFT burn transaction sent: 0x{}", + "BTF burn transaction sent: 0x{}", hash.encode_hex_with_prefix() ); diff --git a/src/bridge-tool/src/main.rs b/src/bridge-tool/src/main.rs index 54859bac..7cd76d9c 100644 --- a/src/bridge-tool/src/main.rs +++ b/src/bridge-tool/src/main.rs @@ -4,7 +4,7 @@ use std::time::Duration; use alloy_sol_types::{SolCall, SolConstructor}; use bridge_did::id256::Id256; use bridge_did::reason::Icrc2Burn; -use bridge_utils::{BFTBridge, FeeCharge, UUPSProxy, WrappedToken, WrappedTokenDeployer}; +use bridge_utils::{BTFBridge, FeeCharge, UUPSProxy, WrappedToken, WrappedTokenDeployer}; use candid::{CandidType, Encode, IDLArgs, Principal, TypeEnv}; use clap::Parser; use did::constant::EIP1559_INITIAL_BASE_FEE; @@ -29,12 +29,12 @@ mod flow; // identity. const IDENTITY_PATH: &str = "src/bridge-tool/identity.pem"; -/// Some operations with BFT bridge. +/// Some operations with BTF bridge. #[derive(Parser, Debug)] #[clap(version = "0.1")] enum CliCommand { - /// Create bft bridge contract. - DeployBftBridge(DeployBftArgs), + /// Create btf bridge contract. + DeployBtfbridge(DeployBtfArgs), /// Create WrappedTokenDeployer contract. DeployWrappedTokenDeployer(DeployWrappedTokenDeployerArgs), /// Create wrapper token contract. @@ -45,7 +45,7 @@ enum CliCommand { BurnWrapped(BurnWrappedArgs), /// Return ETH wallet address. WalletAddress(WalletAddressArgs), - /// Create bft bridge contract. + /// Create btf bridge contract. DeployFeeCharge(DeployFeeChargeArgs), /// Returns expected contract address for the given parameters. ExpectedContractAddress(ExpectedContractAddress), @@ -80,9 +80,9 @@ struct DepositIcrcArgs { #[arg(long)] evm: Principal, - /// EVM address of the BFT bridge + /// EVM address of the BTF bridge #[arg(long)] - bft_bridge: String, + btf_bridge: String, /// Amount to deposit #[arg(long)] @@ -110,7 +110,7 @@ struct DepositIcrcArgs { } #[derive(Debug, Parser)] -struct DeployBftArgs { +struct DeployBtfArgs { /// ETH address of the bridge #[arg(long)] minter_address: String, @@ -184,7 +184,7 @@ struct DeployFeeChargeArgs { #[arg(long)] nonce: u64, - /// Addresses of BftBridges, which should be able to charge fee. + /// Addresses of Btfbridges, which should be able to charge fee. #[arg(long)] bridges: Vec, } @@ -202,9 +202,9 @@ struct ExpectedContractAddress { #[derive(Debug, Parser)] struct CreateTokenArgs { - /// ETH address of the BFT bridge contract. + /// ETH address of the BTF bridge contract. #[arg(long)] - bft_bridge_address: String, + btf_bridge_address: String, /// Name of the token to be created. #[arg(long)] @@ -257,9 +257,9 @@ struct BurnWrappedArgs { #[arg(long)] evm_canister: Principal, - /// ETH address of the BFT bridge contract. + /// ETH address of the BTF bridge contract. #[arg(long)] - bft_bridge: String, + btf_bridge: String, /// ETH address of the wrapper token contract. #[arg(long)] @@ -308,7 +308,7 @@ async fn main() { tracing::subscriber::set_global_default(registry).expect("failed to set global default"); match CliCommand::parse() { - CliCommand::DeployBftBridge(args) => deploy_bft_bridge(args).await, + CliCommand::DeployBtfbridge(args) => deploy_btf_bridge(args).await, CliCommand::DeployWrappedTokenDeployer(args) => deploy_wrapped_token_deployer(args).await, CliCommand::CreateToken(args) => create_token(args).await, CliCommand::CreateWallet(args) => create_wallet(args).await, @@ -343,9 +343,9 @@ async fn get_nonce(args: GetNonceArgs) { } async fn deposit_icrc(args: DepositIcrcArgs) { - let bft_bridge = H160::from_slice( - &hex::decode(args.bft_bridge.trim_start_matches("0x")) - .expect("failed to parse bft bridge address"), + let btf_bridge = H160::from_slice( + &hex::decode(args.btf_bridge.trim_start_matches("0x")) + .expect("failed to parse btf bridge address"), ); let host = args.ic_host.as_deref().unwrap_or("http://127.0.0.1:4943"); @@ -371,7 +371,7 @@ async fn deposit_icrc(args: DepositIcrcArgs) { }; let memo = alloy_sol_types::private::FixedBytes::ZERO; - let input = BFTBridge::notifyMinterCall { + let input = BTFBridge::notifyMinterCall { notificationType: 0, userData: Encode!(&data).unwrap().into(), memo, @@ -385,7 +385,7 @@ async fn deposit_icrc(args: DepositIcrcArgs) { .nonce; let notify_minter_tx = TransactionBuilder { from: &wallet.address().into(), - to: Some(bft_bridge.into()), + to: Some(btf_bridge.into()), nonce, value: 0u64.into(), gas: 5_000_000u64.into(), @@ -496,7 +496,7 @@ fn _print_signed_tx(tx: Transaction) { println!("{args}"); } -async fn deploy_bft_bridge(args: DeployBftArgs) { +async fn deploy_btf_bridge(args: DeployBtfArgs) { let minter = H160::from_slice( &hex::decode(args.minter_address.trim_start_matches("0x")) .expect("failed to parse minter address"), @@ -567,14 +567,14 @@ async fn deploy_bft_bridge(args: DeployBftArgs) { .into() } - let mut bft_contract_input = BFTBridge::BYTECODE.to_vec(); - let constructor = BFTBridge::constructorCall {}.abi_encode(); - bft_contract_input.extend_from_slice(&constructor); + let mut btf_contract_input = BTFBridge::BYTECODE.to_vec(); + let constructor = BTFBridge::constructorCall {}.abi_encode(); + btf_contract_input.extend_from_slice(&constructor); - let bft_contract_address = - deploy_contract(&client, &wallet, bft_contract_input, chain_id).await; + let btf_contract_address = + deploy_contract(&client, &wallet, btf_contract_input, chain_id).await; - let init_data = BFTBridge::initializeCall { + let init_data = BTFBridge::initializeCall { minterAddress: minter.0.into(), feeChargeAddress: fee_charge.0.into(), wrappedTokenDeployer: wrapped_token_deployer.0.into(), @@ -587,18 +587,18 @@ async fn deploy_bft_bridge(args: DeployBftArgs) { let mut proxy_input = UUPSProxy::BYTECODE.to_vec(); let constructor = UUPSProxy::constructorCall { - _implementation: bft_contract_address.0.into(), + _implementation: btf_contract_address.0.into(), _data: init_data.into(), } .abi_encode(); proxy_input.extend_from_slice(&constructor); - let bft_proxy_address = deploy_contract(&client, &wallet, proxy_input, chain_id).await; + let btf_proxy_address = deploy_contract(&client, &wallet, proxy_input, chain_id).await; - eprintln!("Created BFT Bridge contract"); - println!("Implementation address: {bft_contract_address:#x}"); - println!("Proxy address: {bft_proxy_address:#x}"); - println!("{bft_proxy_address:#x}"); + eprintln!("Created BTF Bridge contract"); + println!("Implementation address: {btf_contract_address:#x}"); + println!("Proxy address: {btf_proxy_address:#x}"); + println!("{btf_proxy_address:#x}"); } async fn deploy_wrapped_token_deployer(args: DeployWrappedTokenDeployerArgs) { @@ -641,7 +641,7 @@ async fn deploy_wrapped_token_deployer(args: DeployWrappedTokenDeployerArgs) { .send_raw_transaction(create_contract_tx) .await .expect("Failed to send raw transaction") - .expect("Failed to execute crate BFT contract transaction"); + .expect("Failed to execute crate BTF contract transaction"); let receipt = wait_for_tx_success(&client, hash).await; let wrapped_token_deployer_contract_address = receipt .contract_address @@ -703,7 +703,7 @@ async fn deploy_fee_charge(args: DeployFeeChargeArgs) { .send_raw_transaction(create_contract_tx) .await .expect("Failed to send raw transaction") - .expect("Failed to execute crate BFT contract transaction"); + .expect("Failed to execute crate BTF contract transaction"); let receipt = wait_for_tx_success(&client, hash).await; let fee_charge_contract_address = receipt .contract_address @@ -725,9 +725,9 @@ fn expected_contract_address(args: ExpectedContractAddress) { } async fn create_token(args: CreateTokenArgs) { - let bft_bridge = H160::from_slice( - &hex::decode(args.bft_bridge_address.trim_start_matches("0x")) - .expect("failed to parse bft bridge address"), + let btf_bridge = H160::from_slice( + &hex::decode(args.btf_bridge_address.trim_start_matches("0x")) + .expect("failed to parse btf bridge address"), ); let token_id = decode_token_id(&args.token_id) @@ -745,7 +745,7 @@ async fn create_token(args: CreateTokenArgs) { let wallet = get_wallet(&args.wallet, &client).await; let chain_id = client.eth_chain_id().await.expect("failed to get chain id"); - let input = BFTBridge::deployERC20Call { + let input = BTFBridge::deployERC20Call { name: args.token_name.clone(), symbol: args.token_name, decimals: args.token_decimals, @@ -760,7 +760,7 @@ async fn create_token(args: CreateTokenArgs) { .nonce; let create_token_tx = TransactionBuilder { from: &wallet.address().into(), - to: Some(bft_bridge.into()), + to: Some(btf_bridge.into()), nonce, value: 0u64.into(), gas: 5_000_000u64.into(), @@ -779,7 +779,7 @@ async fn create_token(args: CreateTokenArgs) { .expect("Failed to execute crate token transaction"); let receipt = wait_for_tx_success(&client, hash).await; - let token_address = BFTBridge::deployERC20Call::abi_decode_returns( + let token_address = BTFBridge::deployERC20Call::abi_decode_returns( &receipt .output .expect("Receipt for token creation does not contain output"), @@ -853,14 +853,14 @@ async fn burn_wrapped(args: BurnWrappedArgs) { let wallet = get_wallet(&wallet_addr, &client).await; let chain_id = client.eth_chain_id().await.expect("failed to get chain id"); - let bft_bridge = H160::from_slice( - &hex::decode(args.bft_bridge.trim_start_matches("0x")) - .expect("failed to parse bft bridge address"), + let btf_bridge = H160::from_slice( + &hex::decode(args.btf_bridge.trim_start_matches("0x")) + .expect("failed to parse btf bridge address"), ); let token = H160::from_slice( &hex::decode(args.token_address.trim_start_matches("0x")) - .expect("failed to parse bft bridge address"), + .expect("failed to parse btf bridge address"), ); let input = WrappedToken::balanceOfCall { @@ -887,7 +887,7 @@ async fn burn_wrapped(args: BurnWrappedArgs) { let amount: U256 = args.amount.into(); let input = WrappedToken::approveCall { - spender: bft_bridge.0.into(), + spender: btf_bridge.0.into(), value: amount.clone().into(), } .abi_encode(); @@ -919,7 +919,7 @@ async fn burn_wrapped(args: BurnWrappedArgs) { let memo = alloy_sol_types::private::FixedBytes::ZERO; - let input = BFTBridge::burnCall { + let input = BTFBridge::burnCall { amount: amount.into(), fromERC20: token.0.into(), toTokenID: alloy_sol_types::private::FixedBytes::from_slice(args.to_token_id.as_bytes()), @@ -935,7 +935,7 @@ async fn burn_wrapped(args: BurnWrappedArgs) { .nonce; let burn_tx = TransactionBuilder { from: &wallet.address().into(), - to: Some(bft_bridge.into()), + to: Some(btf_bridge.into()), nonce, value: 0u64.into(), gas: 5_000_000u64.into(), diff --git a/src/bridge-utils/src/bft_events.rs b/src/bridge-utils/src/btf_events.rs similarity index 98% rename from src/bridge-utils/src/bft_events.rs rename to src/bridge-utils/src/btf_events.rs index 120bf77d..7a5c979a 100644 --- a/src/bridge-utils/src/bft_events.rs +++ b/src/bridge-utils/src/btf_events.rs @@ -1,16 +1,16 @@ use alloy_sol_types::private::{Bytes, LogData}; use alloy_sol_types::{SolCall, SolEvent}; use anyhow::anyhow; -use bridge_did::error::{BftResult, Error}; +use bridge_did::error::{BTFResult, Error}; use bridge_did::event_data::*; use candid::CandidType; use ethereum_json_rpc_client::{Client, EthGetLogsParams, EthJsonRpcClient}; use ethers_core::types::{BlockNumber as EthBlockNumber, Log, Transaction, H160, U256}; use serde::{Deserialize, Serialize}; -use crate::BFTBridge; +use crate::BTFBridge; -/// Emitted when token is burnt or minted by BFTBridge. +/// Emitted when token is burnt or minted by BTFBridge. #[derive(Debug, Clone, CandidType, Serialize, Deserialize)] pub enum BridgeEvent { Burnt(BurntEventData), @@ -24,7 +24,7 @@ impl BridgeEvent { from_block: u64, to_block: u64, bridge_contract: H160, - ) -> BftResult> { + ) -> BTFResult> { let logs_result = Self::collect_logs(evm_client, from_block, to_block, bridge_contract).await; @@ -163,14 +163,14 @@ pub struct TxParams { } /// Sends transaction with given params to call `batchMint` function -/// in BftBridge contract. +/// in Btfbridge contract. pub fn batch_mint_transaction( params: TxParams, mint_orders_data: &[u8], signature: &[u8], orders_to_process: &[u32], ) -> Transaction { - let data = BFTBridge::batchMintCall { + let data = BTFBridge::batchMintCall { encodedOrders: mint_orders_data.to_vec().into(), signature: signature.to_vec().into(), ordersToProcess: orders_to_process.into(), diff --git a/src/bridge-utils/src/evm_bridge.rs b/src/bridge-utils/src/evm_bridge.rs index c88d63aa..7b78a715 100644 --- a/src/bridge-utils/src/evm_bridge.rs +++ b/src/bridge-utils/src/evm_bridge.rs @@ -6,7 +6,7 @@ use ethers_core::types::{BlockNumber, U256 as EthU256}; use jsonrpc_core::Id; use serde::{Deserialize, Serialize}; -use crate::bft_events::TxParams; +use crate::btf_events::TxParams; use crate::query::{batch_query, Query, QueryType, CHAINID_ID, LATEST_BLOCK_ID, NONCE_ID}; /// Information about EVM on a bridge side. diff --git a/src/bridge-utils/src/lib.rs b/src/bridge-utils/src/lib.rs index 22fef88f..e2bdb68d 100644 --- a/src/bridge-utils/src/lib.rs +++ b/src/bridge-utils/src/lib.rs @@ -1,5 +1,5 @@ use alloy_sol_types::sol; -pub mod bft_events; +pub mod btf_events; pub mod common; pub mod evm_bridge; pub mod evm_link; @@ -7,8 +7,8 @@ pub mod query; sol! { #[derive(Debug)] - BFTBridge, - "../../solidity/out/BftBridge.sol/BFTBridge.json" + BTFBridge, + "../../solidity/out/BTFBridge.sol/BTFBridge.json" } sol! { diff --git a/src/btc-bridge/src/canister.rs b/src/btc-bridge/src/canister.rs index a1060e09..6cfa3fa7 100644 --- a/src/btc-bridge/src/canister.rs +++ b/src/btc-bridge/src/canister.rs @@ -3,7 +3,7 @@ mod inspect; use std::cell::RefCell; use std::rc::Rc; -use bridge_canister::runtime::service::fetch_logs::FetchBftBridgeEventsService; +use bridge_canister::runtime::service::fetch_logs::FetchBtfBridgeEventsService; use bridge_canister::runtime::service::mint_tx::SendMintTxService; use bridge_canister::runtime::service::sign_orders::SignMintOrdersService; use bridge_canister::runtime::service::update_evm_params::RefreshEvmParamsService; @@ -12,7 +12,7 @@ use bridge_canister::runtime::state::config::ConfigStorage; use bridge_canister::runtime::state::SharedConfig; use bridge_canister::runtime::{BridgeRuntime, RuntimeState}; use bridge_canister::BridgeCanister; -use bridge_did::error::BftResult; +use bridge_did::error::BTFResult; use bridge_did::init::btc::WrappedTokenConfig; use bridge_did::init::BtcBridgeConfig; use bridge_did::op_id::OperationId; @@ -35,7 +35,7 @@ use ic_storage::IcStorage; use crate::ops::{ BtcBridgeOpImpl, BtcEventsHandler, BtcMintOrderHandler, BtcMintTxHandler, - FETCH_BFT_EVENTS_SERVICE_ID, REFRESH_PARAMS_SERVICE_ID, SEND_MINT_TX_SERVICE_ID, + FETCH_BTF_EVENTS_SERVICE_ID, REFRESH_PARAMS_SERVICE_ID, SEND_MINT_TX_SERVICE_ID, SIGN_MINT_ORDER_SERVICE_ID, }; use crate::state::State; @@ -131,7 +131,7 @@ impl BtcBridge { } #[update] - pub fn admin_configure_wrapped_token(&self, config: WrappedTokenConfig) -> BftResult<()> { + pub fn admin_configure_wrapped_token(&self, config: WrappedTokenConfig) -> BTFResult<()> { Self::inspect_caller_is_owner()?; get_state().borrow_mut().configure_wrapped_token(config); @@ -172,7 +172,7 @@ impl BtcBridge { generate_idl!() } - pub fn inspect_caller_is_owner() -> BftResult<()> { + pub fn inspect_caller_is_owner() -> BTFResult<()> { let owner = ConfigStorage::get().borrow().get_owner(); if ic_cdk::caller() == owner { @@ -212,8 +212,8 @@ fn init_runtime() -> SharedRuntime { let refresh_params_service = RefreshEvmParamsService::new(config.clone()); - let fetch_bft_events_service = - FetchBftBridgeEventsService::new(BtcEventsHandler, runtime.clone(), config); + let fetch_btf_events_service = + FetchBtfBridgeEventsService::new(BtcEventsHandler, runtime.clone(), config); let sign_orders_handler = BtcMintOrderHandler::new(state.clone(), scheduler); let sign_mint_orders_service = SignMintOrdersService::new(sign_orders_handler); @@ -229,8 +229,8 @@ fn init_runtime() -> SharedRuntime { ); services.borrow_mut().add_service( ServiceOrder::BeforeOperations, - FETCH_BFT_EVENTS_SERVICE_ID, - Rc::new(fetch_bft_events_service), + FETCH_BTF_EVENTS_SERVICE_ID, + Rc::new(fetch_btf_events_service), ); services.borrow_mut().add_service( ServiceOrder::ConcurrentWithOperations, diff --git a/src/btc-bridge/src/canister/inspect.rs b/src/btc-bridge/src/canister/inspect.rs index 6f61f291..91c932c2 100644 --- a/src/btc-bridge/src/canister/inspect.rs +++ b/src/btc-bridge/src/canister/inspect.rs @@ -1,6 +1,6 @@ #[cfg(target_family = "wasm")] use bridge_canister::bridge_inspect; -use bridge_did::error::BftResult; +use bridge_did::error::BTFResult; #[cfg(target_family = "wasm")] use ic_exports::ic_cdk; #[cfg(target_family = "wasm")] @@ -24,7 +24,7 @@ async fn inspect_message() { } #[allow(dead_code)] -async fn inspect_method(method: &str) -> BftResult<()> { +async fn inspect_method(method: &str) -> BTFResult<()> { match method { method if method.starts_with("admin_") => BtcBridge::inspect_caller_is_owner(), _ => Ok(()), diff --git a/src/btc-bridge/src/interface.rs b/src/btc-bridge/src/interface.rs index 4832eabe..5e7822cc 100644 --- a/src/btc-bridge/src/interface.rs +++ b/src/btc-bridge/src/interface.rs @@ -24,9 +24,9 @@ pub enum Erc20MintStatus { }, /// The transaction is processed, ckBTC tokens are minted and mint order is created. But there /// was a problem sending the mint order to the EVM. The given signed mint order can be sent - /// manually to the BftBridge ot mint wrapped tokens. + /// manually to the Btfbridge ot mint wrapped tokens. Signed(Box), - /// Mint order for wrapped tokens is successfully sent to the BftBridge. + /// Mint order for wrapped tokens is successfully sent to the Btfbridge. Minted { /// Amount of tokens minted. amount: u64, diff --git a/src/btc-bridge/src/ops.rs b/src/btc-bridge/src/ops.rs index 3429e625..e6c831c5 100644 --- a/src/btc-bridge/src/ops.rs +++ b/src/btc-bridge/src/ops.rs @@ -7,7 +7,7 @@ use std::cell::RefCell; use bridge_canister::bridge::{Operation, OperationContext, OperationProgress}; use bridge_canister::runtime::service::ServiceId; use bridge_canister::runtime::RuntimeState; -use bridge_did::error::{BftResult, Error}; +use bridge_did::error::{BTFResult, Error}; use bridge_did::event_data::*; use bridge_did::id256::Id256; use bridge_did::op_id::OperationId; @@ -36,7 +36,7 @@ use crate::interface::{BtcBridgeError, BtcWithdrawError}; use crate::state::State; pub const REFRESH_PARAMS_SERVICE_ID: ServiceId = 0; -pub const FETCH_BFT_EVENTS_SERVICE_ID: ServiceId = 1; +pub const FETCH_BTF_EVENTS_SERVICE_ID: ServiceId = 1; pub const SIGN_MINT_ORDER_SERVICE_ID: ServiceId = 2; pub const SEND_MINT_TX_SERVICE_ID: ServiceId = 3; @@ -48,7 +48,7 @@ impl Operation for BtcBridgeOpImpl { self, id: OperationId, ctx: RuntimeState, - ) -> BftResult> { + ) -> BTFResult> { let next_step = match self.0 { BtcBridgeOp::UpdateCkBtcBalance { eth_address } => { log::debug!("UpdateCkBtcBalance: Eth address {eth_address}"); @@ -186,7 +186,7 @@ impl Operation for BtcBridgeOpImpl { } impl BtcBridgeOpImpl { - async fn update_ckbtc_balance(ckbtc_minter: Principal, eth_address: &H160) -> BftResult<()> { + async fn update_ckbtc_balance(ckbtc_minter: Principal, eth_address: &H160) -> BTFResult<()> { let self_id = ic::id(); let subaccount = eth_address_to_subaccount(eth_address); @@ -246,7 +246,7 @@ impl BtcBridgeOpImpl { } /// Collect ckBTC balance for the given Ethereum address. - async fn collect_ckbtc_balance(ckbtc_ledger: Principal, eth_address: &H160) -> BftResult { + async fn collect_ckbtc_balance(ckbtc_ledger: Principal, eth_address: &H160) -> BTFResult { let icrc_account = IcrcAccount { owner: ic::id(), subaccount: Some(eth_address_to_subaccount(eth_address).0), @@ -279,7 +279,7 @@ impl BtcBridgeOpImpl { eth_address: &H160, amount: u64, ckbtc_fee: u64, - ) -> BftResult { + ) -> BTFResult { let amount_minus_fee = amount .checked_sub(ckbtc_fee) .ok_or(BtcBridgeError::ValueTooSmall)?; @@ -314,7 +314,7 @@ impl BtcBridgeOpImpl { eth_address: &H160, nonce: u32, amount: u64, - ) -> BftResult { + ) -> BTFResult { let state = get_state(); log::debug!( @@ -329,7 +329,7 @@ impl BtcBridgeOpImpl { } /// Withdraw BTC from the bridge to the recipient address. - async fn withdraw_btc(event: &BurntEventData) -> BftResult<()> { + async fn withdraw_btc(event: &BurntEventData) -> BTFResult<()> { let state = get_state(); let Ok(address) = String::from_utf8(event.recipient_id.clone()) else { @@ -360,7 +360,7 @@ impl BtcBridgeOpImpl { eth_address: H160, amount: u64, nonce: u32, - ) -> BftResult { + ) -> BTFResult { log::trace!("preparing mint order"); let state_ref = state.borrow(); @@ -392,7 +392,7 @@ impl BtcBridgeOpImpl { } /// Get the withdrawal account for the ckbtc minter. - async fn get_ckbtc_withdrawal_account(ckbtc_minter: Principal) -> BftResult { + async fn get_ckbtc_withdrawal_account(ckbtc_minter: Principal) -> BTFResult { log::trace!("Requesting ckbtc withdrawal account"); let account = @@ -416,7 +416,7 @@ impl BtcBridgeOpImpl { to: IcrcAccount, amount: u64, fee: u64, - ) -> BftResult<()> { + ) -> BTFResult<()> { log::trace!("Transferring {amount} ckbtc to {to:?} with fee {fee}"); CkBtcLedgerClient::from(ckbtc_ledger) @@ -445,7 +445,7 @@ impl BtcBridgeOpImpl { ckbtc_minter: Principal, address: String, amount: u64, - ) -> BftResult { + ) -> BTFResult { log::trace!("Requesting withdrawal of {amount} btc to {address}"); let result = CkBtcMinterClient::from(ckbtc_minter) diff --git a/src/btc-bridge/src/ops/events_handler.rs b/src/btc-bridge/src/ops/events_handler.rs index 34a3a5c0..161b79b8 100644 --- a/src/btc-bridge/src/ops/events_handler.rs +++ b/src/btc-bridge/src/ops/events_handler.rs @@ -1,5 +1,5 @@ use bridge_canister::bridge::OperationAction; -use bridge_canister::runtime::service::fetch_logs::BftBridgeEventHandler; +use bridge_canister::runtime::service::fetch_logs::BtfBridgeEventHandler; use bridge_did::event_data::{BurntEventData, MintedEventData, NotifyMinterEventData}; use bridge_did::operations::BtcBridgeOp; use bridge_did::reason::BtcDeposit; @@ -9,7 +9,7 @@ use super::BtcBridgeOpImpl; pub struct BtcEventsHandler; -impl BftBridgeEventHandler for BtcEventsHandler { +impl BtfBridgeEventHandler for BtcEventsHandler { fn on_wrapped_token_minted( &self, event: MintedEventData, @@ -39,7 +39,7 @@ impl BftBridgeEventHandler for BtcEventsHandler { let mut btc_deposit = match Decode!(&event.user_data, BtcDeposit) { Ok(icrc_burn) => icrc_burn, Err(e) => { - log::warn!("failed to decode BftBridge notification into BtcDeposit: {e}"); + log::warn!("failed to decode Btfbridge notification into BtcDeposit: {e}"); return None; } }; diff --git a/src/btc-bridge/src/ops/mint_order_handler.rs b/src/btc-bridge/src/ops/mint_order_handler.rs index 91e1a6d5..9655a65d 100644 --- a/src/btc-bridge/src/ops/mint_order_handler.rs +++ b/src/btc-bridge/src/ops/mint_order_handler.rs @@ -3,7 +3,7 @@ use bridge_canister::memory::StableMemory; use bridge_canister::runtime::scheduler::{BridgeTask, SharedScheduler}; use bridge_canister::runtime::service::sign_orders::MintOrderHandler; use bridge_canister::runtime::RuntimeState; -use bridge_did::error::BftResult; +use bridge_did::error::BTFResult; use bridge_did::op_id::OperationId; use bridge_did::operations::BtcBridgeOp; use bridge_did::order::{MintOrder, SignedOrders}; @@ -30,7 +30,7 @@ impl BtcMintOrderHandler { } impl MintOrderHandler for BtcMintOrderHandler { - fn get_signer(&self) -> BftResult { + fn get_signer(&self) -> BTFResult { self.state.get_signer() } diff --git a/src/btc-bridge/src/ops/mint_tx_handler.rs b/src/btc-bridge/src/ops/mint_tx_handler.rs index 93378c2e..625e6109 100644 --- a/src/btc-bridge/src/ops/mint_tx_handler.rs +++ b/src/btc-bridge/src/ops/mint_tx_handler.rs @@ -2,7 +2,7 @@ use bridge_canister::bridge::OperationContext as _; use bridge_canister::runtime::service::mint_tx::MintTxHandler; use bridge_canister::runtime::state::SharedConfig; use bridge_canister::runtime::RuntimeState; -use bridge_did::error::BftResult; +use bridge_did::error::BTFResult; use bridge_did::op_id::OperationId; use bridge_did::operations::BtcBridgeOp; use bridge_did::order::SignedOrders; @@ -24,7 +24,7 @@ impl BtcMintTxHandler { } impl MintTxHandler for BtcMintTxHandler { - fn get_signer(&self) -> BftResult { + fn get_signer(&self) -> BTFResult { self.state.get_signer() } diff --git a/src/erc20-bridge/src/canister.rs b/src/erc20-bridge/src/canister.rs index 20bc651d..1f255c03 100644 --- a/src/erc20-bridge/src/canister.rs +++ b/src/erc20-bridge/src/canister.rs @@ -2,7 +2,7 @@ use std::cell::RefCell; use std::rc::Rc; use bridge_canister::memory::{memory_by_id, StableMemory}; -use bridge_canister::runtime::service::fetch_logs::FetchBftBridgeEventsService; +use bridge_canister::runtime::service::fetch_logs::FetchBtfBridgeEventsService; use bridge_canister::runtime::service::mint_tx::SendMintTxService; use bridge_canister::runtime::service::sign_orders::SignMintOrdersService; use bridge_canister::runtime::service::timer::ServiceTimer; @@ -13,7 +13,7 @@ use bridge_canister::runtime::state::SharedConfig; use bridge_canister::runtime::{BridgeRuntime, RuntimeState}; use bridge_canister::BridgeCanister; use bridge_did::bridge_side::BridgeSide; -use bridge_did::error::{BftResult, Error}; +use bridge_did::error::{BTFResult, Error}; use bridge_did::init::erc20::BaseEvmSettings; use bridge_did::init::BridgeInitData; use bridge_did::op_id::OperationId; @@ -75,14 +75,14 @@ impl Erc20Bridge { } #[update] - fn set_base_bft_bridge_contract(&mut self, address: H160) { + fn set_base_btf_bridge_contract(&mut self, address: H160) { let config = get_runtime_state().borrow().config.clone(); - bridge_canister::inspect::inspect_set_bft_bridge_contract(config); + bridge_canister::inspect::inspect_set_btf_bridge_contract(config); get_base_evm_config() .borrow_mut() - .set_bft_bridge_contract(address.clone()); + .set_btf_bridge_contract(address.clone()); - log::info!("Bridge canister base EVM BFT bridge contract address changed to {address}"); + log::info!("Bridge canister base EVM BTF bridge contract address changed to {address}"); } /// Retrieves all operations for the given ETH wallet address whose @@ -140,7 +140,7 @@ impl Erc20Bridge { } #[update] - pub async fn get_bridge_canister_base_evm_address(&self) -> BftResult { + pub async fn get_bridge_canister_base_evm_address(&self) -> BTFResult { let signer = get_base_evm_config().borrow().get_signer()?; signer.get_address().await.map_err(|e| { Error::Initialization(format!("failed to get bridge canister address: {e}")) @@ -198,7 +198,7 @@ fn init_runtime() -> SharedRuntime { wrapped_config.clone(), ); let base_events_service = - FetchBftBridgeEventsService::new(base_event_handler, runtime.clone(), base_config.clone()); + FetchBtfBridgeEventsService::new(base_event_handler, runtime.clone(), base_config.clone()); let base_events_service_with_delay = ServiceTimer::new(base_events_service, base_state.query_delays().logs_query); let wrapped_event_handler = Erc20EventsHandler::new( @@ -207,7 +207,7 @@ fn init_runtime() -> SharedRuntime { wrapped_config.clone(), base_config.clone(), ); - let wrapped_events_service = FetchBftBridgeEventsService::new( + let wrapped_events_service = FetchBtfBridgeEventsService::new( wrapped_event_handler, runtime.clone(), wrapped_config.clone(), diff --git a/src/erc20-bridge/src/canister/inspect.rs b/src/erc20-bridge/src/canister/inspect.rs index 00554eee..4e5bd7ed 100644 --- a/src/erc20-bridge/src/canister/inspect.rs +++ b/src/erc20-bridge/src/canister/inspect.rs @@ -1,5 +1,5 @@ use bridge_canister::bridge_inspect; -use bridge_did::error::BftResult; +use bridge_did::error::BTFResult; use ic_exports::ic_cdk; use ic_exports::ic_cdk::{api, inspect_message}; use ic_exports::ic_kit::ic; @@ -18,10 +18,10 @@ async fn inspect_message() { } } -async fn inspect_method(method: &str) -> BftResult<()> { +async fn inspect_method(method: &str) -> BTFResult<()> { let config = canister::get_runtime_state().borrow().config.clone(); match method { - "set_base_bft_bridge_contract" => config.borrow().check_owner(ic::caller()), + "set_base_btf_bridge_contract" => config.borrow().check_owner(ic::caller()), _ => Ok(()), } } diff --git a/src/erc20-bridge/src/ops.rs b/src/erc20-bridge/src/ops.rs index 22952411..3fa19f8f 100644 --- a/src/erc20-bridge/src/ops.rs +++ b/src/erc20-bridge/src/ops.rs @@ -7,7 +7,7 @@ use bridge_canister::runtime::service::{BridgeService, ServiceId}; use bridge_canister::runtime::state::SharedConfig; use bridge_canister::runtime::RuntimeState; use bridge_did::bridge_side::BridgeSide; -use bridge_did::error::{BftResult, Error}; +use bridge_did::error::{BTFResult, Error}; use bridge_did::id256::Id256; use bridge_did::op_id::OperationId; use bridge_did::operations::{Erc20BridgeOp, Erc20OpStage}; @@ -38,7 +38,7 @@ impl Operation for Erc20BridgeOpImpl { self, _id: OperationId, _ctx: RuntimeState, - ) -> BftResult> { + ) -> BTFResult> { let stage = Erc20OpStageImpl(self.0.stage); let next_stage = match self.0.side { BridgeSide::Base => stage.progress().await?, @@ -132,7 +132,7 @@ impl Erc20OpStageImpl { } } - async fn progress(self) -> BftResult> { + async fn progress(self) -> BTFResult> { match self.0 { Erc20OpStage::SignMintOrder(_) => { Ok(OperationProgress::AddToService(SIGN_MINT_ORDER_SERVICE_ID)) @@ -164,14 +164,14 @@ impl Erc20ServiceSelector { #[async_trait::async_trait(?Send)] impl BridgeService for Erc20ServiceSelector { - async fn run(&self) -> BftResult<()> { + async fn run(&self) -> BTFResult<()> { let (base_result, wrapped_result) = futures::join!(self.base.run(), self.wrapped.run()); base_result?; wrapped_result?; Ok(()) } - fn push_operation(&self, id: OperationId) -> BftResult<()> { + fn push_operation(&self, id: OperationId) -> BTFResult<()> { let Some(op) = get_runtime_state().borrow().operations.get(id) else { log::warn!("Attempt to add unexisting operataion to mint order sign service"); return Err(Error::OperationNotFound(id)); @@ -206,7 +206,7 @@ impl Erc20OrderHandler { } impl MintOrderHandler for Erc20OrderHandler { - fn get_signer(&self) -> BftResult { + fn get_signer(&self) -> BTFResult { self.config.borrow().get_signer() } @@ -258,7 +258,7 @@ impl MintOrderHandler for Erc20OrderHandler { } impl MintTxHandler for Erc20OrderHandler { - fn get_signer(&self) -> BftResult { + fn get_signer(&self) -> BTFResult { self.config.borrow().get_signer() } diff --git a/src/erc20-bridge/src/ops/events_handler.rs b/src/erc20-bridge/src/ops/events_handler.rs index d50668f6..84d707ba 100644 --- a/src/erc20-bridge/src/ops/events_handler.rs +++ b/src/erc20-bridge/src/ops/events_handler.rs @@ -1,5 +1,5 @@ use bridge_canister::bridge::OperationAction; -use bridge_canister::runtime::service::fetch_logs::BftBridgeEventHandler; +use bridge_canister::runtime::service::fetch_logs::BtfBridgeEventHandler; use bridge_canister::runtime::state::SharedConfig; use bridge_did::bridge_side::BridgeSide; use bridge_did::event_data::{BurntEventData, MintedEventData, NotifyMinterEventData}; @@ -43,7 +43,7 @@ impl Erc20EventsHandler { } } -impl BftBridgeEventHandler for Erc20EventsHandler { +impl BtfBridgeEventHandler for Erc20EventsHandler { fn on_wrapped_token_minted( &self, event: MintedEventData, diff --git a/src/erc20-bridge/src/state.rs b/src/erc20-bridge/src/state.rs index 70924fb1..ca80b0b2 100644 --- a/src/erc20-bridge/src/state.rs +++ b/src/erc20-bridge/src/state.rs @@ -6,7 +6,7 @@ use bridge_canister::bridge::OperationContext; use bridge_canister::memory::{memory_by_id, StableMemory}; use bridge_canister::runtime::state::config::ConfigStorage; use bridge_canister::runtime::state::SharedConfig; -use bridge_did::error::{BftResult, Error}; +use bridge_did::error::{BTFResult, Error}; use bridge_did::evm_link::EvmLink; use bridge_did::init::erc20::{BaseEvmSettings, QueryDelays}; use bridge_utils::evm_bridge::EvmParams; @@ -43,7 +43,7 @@ impl BaseEvmState { config.evm_link = settings.evm_link; config.signing_strategy = settings.signing_strategy; config.evm_params = None; - config.bft_bridge_contract_address = None; + config.btf_bridge_contract_address = None; }) } } @@ -63,20 +63,20 @@ impl OperationContext for SharedBaseEvmState { self.0.borrow().config.borrow().get_evm_link() } - fn get_bridge_contract_address(&self) -> BftResult { + fn get_bridge_contract_address(&self) -> BTFResult { self.0 .borrow() .config .borrow() - .get_bft_bridge_contract() - .ok_or_else(|| Error::Initialization("base bft bridge contract not initialized".into())) + .get_btf_bridge_contract() + .ok_or_else(|| Error::Initialization("base btf bridge contract not initialized".into())) } - fn get_evm_params(&self) -> BftResult { + fn get_evm_params(&self) -> BTFResult { self.0.borrow().config.borrow().get_evm_params() } - fn get_signer(&self) -> BftResult { + fn get_signer(&self) -> BTFResult { self.0.borrow().config.borrow().get_signer() } } diff --git a/src/icrc2-bridge/src/canister.rs b/src/icrc2-bridge/src/canister.rs index f985eee0..3ed31e3b 100644 --- a/src/icrc2-bridge/src/canister.rs +++ b/src/icrc2-bridge/src/canister.rs @@ -1,7 +1,7 @@ use std::cell::RefCell; use std::rc::Rc; -use bridge_canister::runtime::service::fetch_logs::FetchBftBridgeEventsService; +use bridge_canister::runtime::service::fetch_logs::FetchBtfBridgeEventsService; use bridge_canister::runtime::service::mint_tx::SendMintTxService; use bridge_canister::runtime::service::sign_orders::SignMintOrdersService; use bridge_canister::runtime::service::update_evm_params::RefreshEvmParamsService; @@ -10,7 +10,7 @@ use bridge_canister::runtime::state::config::ConfigStorage; use bridge_canister::runtime::state::SharedConfig; use bridge_canister::runtime::{BridgeRuntime, RuntimeState}; use bridge_canister::BridgeCanister; -use bridge_did::error::{BftResult, Error}; +use bridge_did::error::{BTFResult, Error}; use bridge_did::init::BridgeInitData; use bridge_did::op_id::OperationId; use bridge_did::operation_log::{Memo, OperationLog}; @@ -29,7 +29,7 @@ use ic_storage::IcStorage; use crate::ops::events_handler::IcrcEventsHandler; use crate::ops::{ - IcrcBridgeOpImpl, IcrcMintOrderHandler, IcrcMintTxHandler, FETCH_BFT_EVENTS_SERVICE_ID, + IcrcBridgeOpImpl, IcrcMintOrderHandler, IcrcMintTxHandler, FETCH_BTF_EVENTS_SERVICE_ID, REFRESH_PARAMS_SERVICE_ID, SEND_MINT_TX_SERVICE_ID, SIGN_MINT_ORDER_SERVICE_ID, }; use crate::state::IcrcState; @@ -130,7 +130,7 @@ impl Icrc2BridgeCanister { /// Adds the provided principal to the whitelist. #[update] - pub fn add_to_whitelist(&mut self, icrc2_principal: Principal) -> BftResult<()> { + pub fn add_to_whitelist(&mut self, icrc2_principal: Principal) -> BTFResult<()> { let state = get_icrc_state(); Self::access_control_inspect_message_check(ic::caller(), icrc2_principal)?; @@ -144,7 +144,7 @@ impl Icrc2BridgeCanister { /// Remove a icrc2 principal token from the access list #[update] - pub fn remove_from_whitelist(&mut self, icrc2_principal: Principal) -> BftResult<()> { + pub fn remove_from_whitelist(&mut self, icrc2_principal: Principal) -> BTFResult<()> { let state = get_icrc_state(); Self::access_control_inspect_message_check(ic::caller(), icrc2_principal)?; @@ -165,7 +165,7 @@ impl Icrc2BridgeCanister { fn access_control_inspect_message_check( owner: Principal, icrc2_principal: Principal, - ) -> BftResult<()> { + ) -> BTFResult<()> { inspect_check_is_owner(owner)?; check_anonymous_principal(icrc2_principal)?; @@ -198,7 +198,7 @@ impl Metrics for Icrc2BridgeCanister { } /// inspect function to check whether provided principal is owner -fn inspect_check_is_owner(principal: Principal) -> BftResult<()> { +fn inspect_check_is_owner(principal: Principal) -> BTFResult<()> { let owner = ConfigStorage::get().borrow().get_owner(); if owner != principal { @@ -209,7 +209,7 @@ fn inspect_check_is_owner(principal: Principal) -> BftResult<()> { } /// inspect function to check whether the provided principal is anonymous -fn check_anonymous_principal(principal: Principal) -> BftResult<()> { +fn check_anonymous_principal(principal: Principal) -> BTFResult<()> { if principal == Principal::anonymous() { return Err(Error::AnonymousPrincipal); } @@ -226,8 +226,8 @@ fn init_runtime() -> SharedRuntime { let refresh_params_service = RefreshEvmParamsService::new(config.clone()); - let fetch_bft_events_service = - FetchBftBridgeEventsService::new(IcrcEventsHandler, runtime.clone(), config); + let fetch_btf_events_service = + FetchBtfBridgeEventsService::new(IcrcEventsHandler, runtime.clone(), config); let sign_orders_handler = IcrcMintOrderHandler::new(state.clone(), scheduler); let sign_mint_orders_service = SignMintOrdersService::new(sign_orders_handler); @@ -243,8 +243,8 @@ fn init_runtime() -> SharedRuntime { ); services.borrow_mut().add_service( ServiceOrder::BeforeOperations, - FETCH_BFT_EVENTS_SERVICE_ID, - Rc::new(fetch_bft_events_service), + FETCH_BTF_EVENTS_SERVICE_ID, + Rc::new(fetch_btf_events_service), ); services.borrow_mut().add_service( ServiceOrder::ConcurrentWithOperations, diff --git a/src/icrc2-bridge/src/canister/inspect.rs b/src/icrc2-bridge/src/canister/inspect.rs index 5126e0cb..bf4724b0 100644 --- a/src/icrc2-bridge/src/canister/inspect.rs +++ b/src/icrc2-bridge/src/canister/inspect.rs @@ -1,5 +1,5 @@ use bridge_canister::bridge_inspect; -use bridge_did::error::BftResult; +use bridge_did::error::BTFResult; use candid::Principal; use ic_exports::ic_cdk; use ic_exports::ic_cdk::{api, inspect_message}; @@ -19,7 +19,7 @@ async fn inspect_message() { } } -async fn inspect_method(method: &str) -> BftResult<()> { +async fn inspect_method(method: &str) -> BTFResult<()> { match method { "add_to_whitelist" | "remove_from_whitelist" => { let (principal,) = api::call::arg_data::<(Principal,)>(Default::default()); diff --git a/src/icrc2-bridge/src/ops.rs b/src/icrc2-bridge/src/ops.rs index 8b5ba698..d4c1bfa4 100644 --- a/src/icrc2-bridge/src/ops.rs +++ b/src/icrc2-bridge/src/ops.rs @@ -6,7 +6,7 @@ use bridge_canister::runtime::service::sign_orders::MintOrderHandler; use bridge_canister::runtime::service::ServiceId; use bridge_canister::runtime::state::SharedConfig; use bridge_canister::runtime::RuntimeState; -use bridge_did::error::{BftResult, Error}; +use bridge_did::error::{BTFResult, Error}; use bridge_did::event_data::BurntEventData; use bridge_did::id256::Id256; use bridge_did::op_id::OperationId; @@ -32,7 +32,7 @@ use crate::tokens::icrc2::{self, Success}; pub mod events_handler; pub const REFRESH_PARAMS_SERVICE_ID: ServiceId = 0; -pub const FETCH_BFT_EVENTS_SERVICE_ID: ServiceId = 1; +pub const FETCH_BTF_EVENTS_SERVICE_ID: ServiceId = 1; pub const SIGN_MINT_ORDER_SERVICE_ID: ServiceId = 2; pub const SEND_MINT_TX_SERVICE_ID: ServiceId = 3; @@ -44,7 +44,7 @@ impl Operation for IcrcBridgeOpImpl { self, id: OperationId, ctx: RuntimeState, - ) -> BftResult> { + ) -> BTFResult> { let next_step = match self.0 { IcrcBridgeOp::BurnIcrc2Tokens(burn_info) => { Self::burn_icrc_tokens(ctx, burn_info, id.nonce()).await @@ -118,7 +118,7 @@ impl IcrcBridgeOpImpl { ctx: impl OperationContext, burn_info: Icrc2Burn, nonce: u32, - ) -> BftResult { + ) -> BTFResult { log::trace!("burning icrc tokens due to: {burn_info:?}"); let evm_params = ctx.get_evm_params()?; @@ -199,7 +199,7 @@ impl IcrcBridgeOpImpl { ctx: impl OperationContext, event: BurntEventData, nonce: u32, - ) -> BftResult { + ) -> BTFResult { log::trace!("Minting Icrc2 tokens"); let evm_params = ctx.get_evm_params()?; @@ -314,7 +314,7 @@ impl IcrcMintOrderHandler { } impl MintOrderHandler for IcrcMintOrderHandler { - fn get_signer(&self) -> BftResult { + fn get_signer(&self) -> BTFResult { self.state.get_signer() } @@ -380,7 +380,7 @@ impl IcrcMintTxHandler { } impl MintTxHandler for IcrcMintTxHandler { - fn get_signer(&self) -> BftResult { + fn get_signer(&self) -> BTFResult { self.state.get_signer() } diff --git a/src/icrc2-bridge/src/ops/events_handler.rs b/src/icrc2-bridge/src/ops/events_handler.rs index abddb8f2..17f75863 100644 --- a/src/icrc2-bridge/src/ops/events_handler.rs +++ b/src/icrc2-bridge/src/ops/events_handler.rs @@ -1,5 +1,5 @@ use bridge_canister::bridge::OperationAction; -use bridge_canister::runtime::service::fetch_logs::BftBridgeEventHandler; +use bridge_canister::runtime::service::fetch_logs::BtfBridgeEventHandler; use bridge_did::event_data::{BurntEventData, MintedEventData, NotifyMinterEventData}; use bridge_did::operations::IcrcBridgeOp; use bridge_did::reason::Icrc2Burn; @@ -9,7 +9,7 @@ use super::IcrcBridgeOpImpl; pub struct IcrcEventsHandler; -impl BftBridgeEventHandler for IcrcEventsHandler { +impl BtfBridgeEventHandler for IcrcEventsHandler { fn on_wrapped_token_minted( &self, event: MintedEventData, @@ -40,7 +40,7 @@ impl BftBridgeEventHandler for IcrcEventsHandler { let mut icrc_burn = match Decode!(&event.user_data, Icrc2Burn) { Ok(icrc_burn) => icrc_burn, Err(e) => { - log::warn!("failed to decode BftBridge notification into Icrc2Burn: {e}"); + log::warn!("failed to decode Btfbridge notification into Icrc2Burn: {e}"); return None; } }; diff --git a/src/icrc2-bridge/src/state/access_list.rs b/src/icrc2-bridge/src/state/access_list.rs index 764f9d39..7eba865b 100644 --- a/src/icrc2-bridge/src/state/access_list.rs +++ b/src/icrc2-bridge/src/state/access_list.rs @@ -1,4 +1,4 @@ -use bridge_did::error::{BftResult, Error}; +use bridge_did::error::{BTFResult, Error}; use candid::Principal; use ic_stable_structures::stable_structures::Memory; use ic_stable_structures::{BTreeMapStructure, StableBTreeMap}; @@ -13,7 +13,7 @@ impl AccessList { access_list: StableBTreeMap::new(m), } } - pub fn add(&mut self, principal: Principal) -> BftResult<()> { + pub fn add(&mut self, principal: Principal) -> BTFResult<()> { if principal == Principal::anonymous() { return Err(Error::AnonymousPrincipal); } @@ -23,7 +23,7 @@ impl AccessList { Ok(()) } - pub fn batch_add(&mut self, principals: &[Principal]) -> BftResult<()> { + pub fn batch_add(&mut self, principals: &[Principal]) -> BTFResult<()> { for principal in principals { self.add(*principal)?; } diff --git a/src/integration-tests/tests/bridge_deployer/deploy/brc20_bridge.trycmd b/src/integration-tests/tests/bridge_deployer/deploy/brc20_bridge.trycmd index 300357d2..3e1b98c2 100644 --- a/src/integration-tests/tests/bridge_deployer/deploy/brc20_bridge.trycmd +++ b/src/integration-tests/tests/bridge_deployer/deploy/brc20_bridge.trycmd @@ -2,7 +2,7 @@ $ bridge-deployer -v --evm-network localhost --evm $EVM_PRINCIPAL --private-key $PRIVATE_KEY --identity $IDENTITY_PATH deploy --wasm $BRC20_BRIDGE_WASM_PATH --wallet-canister $WALLET_CANISTER brc20 --min-confirmations 6 --indexer-urls "https://indexer1.com,https://indexer2.com,https://indexer3.com" --deposit-fee 1000000 --mempool-timeout 3600 --signing-key-id dfx --bitcoin-network regtest --indexer-consensus-threshold 3 --enable-console --log-filter trace Starting Bitfinity Deployer v[..] Canister brc20-bridge deployed with ID: [..] -Wrapped side BFT bridge: [..] +Wrapped side BTF bridge: [..] Wrapped side FeeCharge: [..] Wrapped side bridge address: [..] diff --git a/src/integration-tests/tests/bridge_deployer/deploy/btc_bridge.trycmd b/src/integration-tests/tests/bridge_deployer/deploy/btc_bridge.trycmd index 3bc6ec0a..47076fb8 100644 --- a/src/integration-tests/tests/bridge_deployer/deploy/btc_bridge.trycmd +++ b/src/integration-tests/tests/bridge_deployer/deploy/btc_bridge.trycmd @@ -2,7 +2,7 @@ $ bridge-deployer -v --evm-network localhost --evm $EVM_PRINCIPAL --private-key $PRIVATE_KEY --identity $IDENTITY_PATH deploy --wasm $BTC_BRIDGE_WASM_PATH --wallet-canister $WALLET_CANISTER btc --signing-key-id dfx --enable-console --log-filter trace --ledger $CKBTC_LEDGER --minter $CKBTC_MINTER --network regtest --fee 1000 Starting Bitfinity Deployer v[..] Canister btc-bridge deployed with ID: [..] -Wrapped side BFT bridge: [..] +Wrapped side BTF bridge: [..] Wrapped side FeeCharge: [..] Wrapped side bridge address: [..] diff --git a/src/integration-tests/tests/bridge_deployer/deploy/erc20_bridge.trycmd b/src/integration-tests/tests/bridge_deployer/deploy/erc20_bridge.trycmd index 402f4161..a382ad1f 100644 --- a/src/integration-tests/tests/bridge_deployer/deploy/erc20_bridge.trycmd +++ b/src/integration-tests/tests/bridge_deployer/deploy/erc20_bridge.trycmd @@ -2,10 +2,10 @@ $ bridge-deployer -v --evm-network localhost --evm $EVM_PRINCIPAL --private-key $PRIVATE_KEY --identity $IDENTITY_PATH deploy --wasm $ERC20_BRIDGE_WASM_PATH --wallet-canister $WALLET_CANISTER erc20 --base-evm-principal $EVM_PRINCIPAL --signing-key-id dfx --enable-console --log-filter trace Starting Bitfinity Deployer v[..] Canister erc20-bridge deployed with ID: [..] -Wrapped side BFT bridge: [..] +Wrapped side BTF bridge: [..] Wrapped side FeeCharge: [..] Wrapped side bridge address: [..] -Base side BFT bridge: [..] +Base side BTF bridge: [..] Base side FeeCharge: [..] Base side bridge address: [..] diff --git a/src/integration-tests/tests/bridge_deployer/deploy/icrc2_bridge.trycmd b/src/integration-tests/tests/bridge_deployer/deploy/icrc2_bridge.trycmd index 030a92f3..939009be 100644 --- a/src/integration-tests/tests/bridge_deployer/deploy/icrc2_bridge.trycmd +++ b/src/integration-tests/tests/bridge_deployer/deploy/icrc2_bridge.trycmd @@ -2,7 +2,7 @@ $ bridge-deployer -v --evm-network localhost --evm $EVM_PRINCIPAL --private-key $PRIVATE_KEY --identity $IDENTITY_PATH deploy --wasm $ICRC2_BRIDGE_WASM_PATH --wallet-canister $WALLET_CANISTER icrc --signing-key-id dfx --enable-console --log-filter trace Starting Bitfinity Deployer v[..] Canister icrc2-bridge deployed with ID: [..] -Wrapped side BFT bridge: [..] +Wrapped side BTF bridge: [..] Wrapped side FeeCharge: [..] Wrapped side bridge address: [..] diff --git a/src/integration-tests/tests/bridge_deployer/deploy/rune_bridge.trycmd b/src/integration-tests/tests/bridge_deployer/deploy/rune_bridge.trycmd index b0afd7de..4f1b621d 100644 --- a/src/integration-tests/tests/bridge_deployer/deploy/rune_bridge.trycmd +++ b/src/integration-tests/tests/bridge_deployer/deploy/rune_bridge.trycmd @@ -2,7 +2,7 @@ $ bridge-deployer -v --evm-network localhost --evm $EVM_PRINCIPAL --private-key $PRIVATE_KEY --identity $IDENTITY_PATH deploy --wasm $RUNE_BRIDGE_WASM_PATH --wallet-canister $WALLET_CANISTER rune --min-confirmations 6 --indexer-urls "https://indexer1.com,https://indexer2.com,https://indexer3.com" --deposit-fee 1000000 --mempool-timeout 3600 --signing-key-id dfx --bitcoin-network regtest --indexer-consensus-threshold 3 --enable-console --log-filter trace Starting Bitfinity Deployer v[..] Canister rune-bridge deployed with ID: [..] -Wrapped side BFT bridge: [..] +Wrapped side BTF bridge: [..] Wrapped side FeeCharge: [..] Wrapped side bridge address: [..] diff --git a/src/integration-tests/tests/bridge_deployer/reinstall/brc20_bridge.trycmd b/src/integration-tests/tests/bridge_deployer/reinstall/brc20_bridge.trycmd index e19a91bb..5e881f2e 100644 --- a/src/integration-tests/tests/bridge_deployer/reinstall/brc20_bridge.trycmd +++ b/src/integration-tests/tests/bridge_deployer/reinstall/brc20_bridge.trycmd @@ -1,5 +1,5 @@ ``` -$ bridge-deployer -v --evm-network localhost --evm $EVM_PRINCIPAL --private-key $PRIVATE_KEY --identity $IDENTITY_PATH reinstall --bft-bridge $BFT_BRIDGE --canister-id $BRC20_BRIDGE_ID --wasm $BRC20_BRIDGE_WASM_PATH brc20 --min-confirmations 6 --indexer-urls "https://indexer1.com,https://indexer2.com,https://indexer3.com" --deposit-fee 1000000 --mempool-timeout 3600 --signing-key-id dfx --bitcoin-network regtest --indexer-consensus-threshold 3 --enable-console --log-filter trace +$ bridge-deployer -v --evm-network localhost --evm $EVM_PRINCIPAL --private-key $PRIVATE_KEY --identity $IDENTITY_PATH reinstall --btf-bridge $BTF_BRIDGE --canister-id $BRC20_BRIDGE_ID --wasm $BRC20_BRIDGE_WASM_PATH brc20 --min-confirmations 6 --indexer-urls "https://indexer1.com,https://indexer2.com,https://indexer3.com" --deposit-fee 1000000 --mempool-timeout 3600 --signing-key-id dfx --bitcoin-network regtest --indexer-consensus-threshold 3 --enable-console --log-filter trace Starting Bitfinity Deployer v[..] Canister brc20-bridge reinstalled with ID [..] diff --git a/src/integration-tests/tests/bridge_deployer/reinstall/btc_bridge.trycmd b/src/integration-tests/tests/bridge_deployer/reinstall/btc_bridge.trycmd index 465383c0..c641730d 100644 --- a/src/integration-tests/tests/bridge_deployer/reinstall/btc_bridge.trycmd +++ b/src/integration-tests/tests/bridge_deployer/reinstall/btc_bridge.trycmd @@ -1,5 +1,5 @@ ``` -$ bridge-deployer -v --evm-network localhost --evm $EVM_PRINCIPAL --private-key $PRIVATE_KEY --identity $IDENTITY_PATH reinstall --bft-bridge $BFT_BRIDGE --canister-id $BTC_BRIDGE_ID --wasm $BTC_BRIDGE_WASM_PATH btc --signing-key-id dfx --enable-console --log-filter trace --ledger $CKBTC_LEDGER --minter $CKBTC_MINTER --network regtest --fee 1000 +$ bridge-deployer -v --evm-network localhost --evm $EVM_PRINCIPAL --private-key $PRIVATE_KEY --identity $IDENTITY_PATH reinstall --btf-bridge $BTF_BRIDGE --canister-id $BTC_BRIDGE_ID --wasm $BTC_BRIDGE_WASM_PATH btc --signing-key-id dfx --enable-console --log-filter trace --ledger $CKBTC_LEDGER --minter $CKBTC_MINTER --network regtest --fee 1000 Starting Bitfinity Deployer v[..] Canister btc-bridge reinstalled with ID [..] diff --git a/src/integration-tests/tests/bridge_deployer/reinstall/erc20_bridge.trycmd b/src/integration-tests/tests/bridge_deployer/reinstall/erc20_bridge.trycmd index b3868091..ae540d5e 100644 --- a/src/integration-tests/tests/bridge_deployer/reinstall/erc20_bridge.trycmd +++ b/src/integration-tests/tests/bridge_deployer/reinstall/erc20_bridge.trycmd @@ -1,5 +1,5 @@ ``` -$ bridge-deployer -v --evm-network localhost --evm $EVM_PRINCIPAL --private-key $PRIVATE_KEY --identity $IDENTITY_PATH reinstall --wasm $ERC20_BRIDGE_WASM_PATH --bft-bridge $BFT_BRIDGE --canister-id $ERC20_BRIDGE_ID erc20 --base-evm-principal $EVM_PRINCIPAL --signing-key-id dfx --enable-console --log-filter trace +$ bridge-deployer -v --evm-network localhost --evm $EVM_PRINCIPAL --private-key $PRIVATE_KEY --identity $IDENTITY_PATH reinstall --wasm $ERC20_BRIDGE_WASM_PATH --btf-bridge $BTF_BRIDGE --canister-id $ERC20_BRIDGE_ID erc20 --base-evm-principal $EVM_PRINCIPAL --signing-key-id dfx --enable-console --log-filter trace Starting Bitfinity Deployer v[..] Canister erc20-bridge reinstalled with ID [..] diff --git a/src/integration-tests/tests/bridge_deployer/reinstall/icrc2_bridge.trycmd b/src/integration-tests/tests/bridge_deployer/reinstall/icrc2_bridge.trycmd index 1c2df667..c30458a9 100644 --- a/src/integration-tests/tests/bridge_deployer/reinstall/icrc2_bridge.trycmd +++ b/src/integration-tests/tests/bridge_deployer/reinstall/icrc2_bridge.trycmd @@ -1,5 +1,5 @@ ``` -$ bridge-deployer -v --evm-network localhost --evm $EVM_PRINCIPAL --private-key $PRIVATE_KEY --identity $IDENTITY_PATH reinstall --wasm $ICRC2_BRIDGE_WASM_PATH --bft-bridge $BFT_BRIDGE --canister-id $ICRC2_BRIDGE_ID icrc --signing-key-id dfx --enable-console --log-filter trace +$ bridge-deployer -v --evm-network localhost --evm $EVM_PRINCIPAL --private-key $PRIVATE_KEY --identity $IDENTITY_PATH reinstall --wasm $ICRC2_BRIDGE_WASM_PATH --btf-bridge $BTF_BRIDGE --canister-id $ICRC2_BRIDGE_ID icrc --signing-key-id dfx --enable-console --log-filter trace Starting Bitfinity Deployer v[..] Canister icrc2-bridge reinstalled with ID [..] diff --git a/src/integration-tests/tests/bridge_deployer/reinstall/rune_bridge.trycmd b/src/integration-tests/tests/bridge_deployer/reinstall/rune_bridge.trycmd index 9aa96f43..126184f3 100644 --- a/src/integration-tests/tests/bridge_deployer/reinstall/rune_bridge.trycmd +++ b/src/integration-tests/tests/bridge_deployer/reinstall/rune_bridge.trycmd @@ -1,5 +1,5 @@ ``` -$ bridge-deployer -v --evm-network localhost --evm $EVM_PRINCIPAL --private-key $PRIVATE_KEY --identity $IDENTITY_PATH reinstall --wasm $RUNE_BRIDGE_WASM_PATH --bft-bridge $BFT_BRIDGE --canister-id $RUNE_BRIDGE_ID rune --min-confirmations 6 --indexer-urls "https://indexer1.com,https://indexer2.com,https://indexer3.com" --deposit-fee 1000000 --mempool-timeout 3600 --signing-key-id dfx --bitcoin-network regtest --indexer-consensus-threshold 3 --enable-console --log-filter trace +$ bridge-deployer -v --evm-network localhost --evm $EVM_PRINCIPAL --private-key $PRIVATE_KEY --identity $IDENTITY_PATH reinstall --wasm $RUNE_BRIDGE_WASM_PATH --btf-bridge $BTF_BRIDGE --canister-id $RUNE_BRIDGE_ID rune --min-confirmations 6 --indexer-urls "https://indexer1.com,https://indexer2.com,https://indexer3.com" --deposit-fee 1000000 --mempool-timeout 3600 --signing-key-id dfx --bitcoin-network regtest --indexer-consensus-threshold 3 --enable-console --log-filter trace Starting Bitfinity Deployer v[..] Canister rune-bridge reinstalled with ID [..] diff --git a/src/integration-tests/tests/context/mod.rs b/src/integration-tests/tests/context/mod.rs index 3c9531ee..7bd62ff8 100644 --- a/src/integration-tests/tests/context/mod.rs +++ b/src/integration-tests/tests/context/mod.rs @@ -5,7 +5,7 @@ use std::collections::{HashMap, HashSet}; use std::path::PathBuf; use std::time::Duration; -use bridge_did::error::BftResult as McResult; +use bridge_did::error::BTFResult as McResult; use bridge_did::id256::Id256; use bridge_did::init::brc20::{Brc20BridgeConfig, SchnorrKeyIds}; use bridge_did::init::btc::BitcoinConnection; @@ -14,7 +14,7 @@ use bridge_did::operation_log::Memo; use bridge_did::order::SignedOrders; use bridge_did::reason::{ApproveAfterMint, Icrc2Burn}; use bridge_utils::evm_link::address_to_icrc_subaccount; -use bridge_utils::{BFTBridge, FeeCharge, UUPSProxy, WrappedToken, WrappedTokenDeployer}; +use bridge_utils::{BTFBridge, FeeCharge, UUPSProxy, WrappedToken, WrappedTokenDeployer}; use candid::utils::ArgumentEncoder; use candid::{Encode, Nat, Principal}; use did::constant::EIP1559_INITIAL_BASE_FEE; @@ -275,15 +275,15 @@ pub trait TestContext { } } - /// Crates BFTBridge contract in EVMc and registered it in minter canister - async fn initialize_bft_bridge( + /// Crates BTFBridge contract in EVMc and registered it in minter canister + async fn initialize_btf_bridge( &self, minter_canister_address: H160, fee_charge_address: Option, wrapped_token_deployer: H160, ) -> Result { let client = self.evm_client(self.admin_name()); - self.initialize_bft_bridge_on_evm( + self.initialize_btf_bridge_on_evm( &client, minter_canister_address, fee_charge_address, @@ -293,8 +293,8 @@ pub trait TestContext { .await } - /// Crates BFTBridge contract in EVMc and registered it in minter canister - async fn initialize_bft_bridge_on_evm( + /// Crates BTFBridge contract in EVMc and registered it in minter canister + async fn initialize_btf_bridge_on_evm( &self, evm_client: &EvmCanisterClient, minter_canister_address: H160, @@ -309,7 +309,7 @@ pub trait TestContext { let wallet = self.new_wallet_on_evm(evm_client, u64::MAX.into()).await?; let bridge_address = self - .initialize_bft_bridge_with_minter_on_evm( + .initialize_btf_bridge_with_minter_on_evm( evm_client, &wallet, minter_canister_address, @@ -322,8 +322,8 @@ pub trait TestContext { Ok(bridge_address) } - /// Creates BFTBridge contract in EVMC and registered it in minter canister - async fn initialize_bft_bridge_with_minter( + /// Creates BTFBridge contract in EVMC and registered it in minter canister + async fn initialize_btf_bridge_with_minter( &self, wallet: &Wallet<'_, SigningKey>, minter_canister_address: H160, @@ -332,7 +332,7 @@ pub trait TestContext { is_wrapped: bool, ) -> Result { let evm_client = self.evm_client(self.admin_name()); - self.initialize_bft_bridge_with_minter_on_evm( + self.initialize_btf_bridge_with_minter_on_evm( &evm_client, wallet, minter_canister_address, @@ -343,8 +343,8 @@ pub trait TestContext { .await } - /// Creates BFTBridge contract in EVMC and registered it in minter canister - async fn initialize_bft_bridge_with_minter_on_evm( + /// Creates BTFBridge contract in EVMC and registered it in minter canister + async fn initialize_btf_bridge_with_minter_on_evm( &self, evm_client: &EvmCanisterClient, wallet: &Wallet<'_, SigningKey>, @@ -353,18 +353,18 @@ pub trait TestContext { wrapped_token_deployer: H160, is_wrapped: bool, ) -> Result { - let mut bridge_input = BFTBridge::BYTECODE.to_vec(); - let constructor = BFTBridge::constructorCall {}.abi_encode(); + let mut bridge_input = BTFBridge::BYTECODE.to_vec(); + let constructor = BTFBridge::constructorCall {}.abi_encode(); bridge_input.extend_from_slice(&constructor); - println!("bridge bytecode size: {}", BFTBridge::BYTECODE.len()); + println!("bridge bytecode size: {}", BTFBridge::BYTECODE.len()); let bridge_address = self .create_contract_on_evm(evm_client, wallet, bridge_input.clone()) .await .unwrap(); - let init_data = BFTBridge::initializeCall { + let init_data = BTFBridge::initializeCall { minterAddress: minter_canister_address.into(), feeChargeAddress: fee_charge_address.unwrap_or_default().into(), wrappedTokenDeployer: wrapped_token_deployer.into(), @@ -485,9 +485,9 @@ pub trait TestContext { assert!(decoded_output._0); } - println!("Burning src tokens using BftBridge"); + println!("Burning src tokens using Btfbridge"); - let input = BFTBridge::burnCall { + let input = BTFBridge::burnCall { amount: amount.into(), fromERC20: from_token.clone().into(), toTokenID: alloy_sol_types::private::FixedBytes::from_slice(to_token_id), @@ -502,7 +502,7 @@ pub trait TestContext { if receipt.status != Some(U64::one()) { let decoded_output = - BFTBridge::burnCall::abi_decode_returns(&receipt.output.clone().unwrap(), false) + BTFBridge::burnCall::abi_decode_returns(&receipt.output.clone().unwrap(), false) .unwrap(); return Err(TestError::Generic(format!( "Burn transaction failed: {decoded_output:?} -- {receipt:?}, -- {}", @@ -511,7 +511,7 @@ pub trait TestContext { } let decoded_output = - BFTBridge::burnCall::abi_decode_returns(&dbg!(receipt.output.clone()).unwrap(), true) + BTFBridge::burnCall::abi_decode_returns(&dbg!(receipt.output.clone()).unwrap(), true) .unwrap(); let operation_id = decoded_output._0; @@ -569,7 +569,7 @@ pub trait TestContext { .await } - /// Current native token balance on user's deposit inside the BftBridge. + /// Current native token balance on user's deposit inside the Btfbridge. async fn native_token_deposit_balance( &self, evm_client: &EvmCanisterClient, @@ -604,7 +604,7 @@ pub trait TestContext { balance } - /// Deposit native tokens to BftBridge to pay mint fee. + /// Deposit native tokens to Btfbridge to pay mint fee. async fn native_token_deposit( &self, evm_client: &EvmCanisterClient, @@ -743,14 +743,14 @@ pub trait TestContext { Ok(hash) } - /// Creates wrapped token in EVMc by calling `BFTBridge:::deploy_wrapped_token()`. + /// Creates wrapped token in EVMc by calling `BTFBridge:::deploy_wrapped_token()`. async fn create_wrapped_token( &self, wallet: &Wallet<'_, SigningKey>, - bft_bridge: &H160, + btf_bridge: &H160, base_token_id: Id256, ) -> Result { - let input = BFTBridge::deployERC20Call { + let input = BTFBridge::deployERC20Call { name: "Wrapper".into(), symbol: "WPT".into(), decimals: 18, @@ -758,11 +758,11 @@ pub trait TestContext { } .abi_encode(); - let (_hash, receipt) = self.call_contract(wallet, bft_bridge, input, 0).await?; + let (_hash, receipt) = self.call_contract(wallet, btf_bridge, input, 0).await?; let output = receipt.output.as_ref().unwrap(); - let address = BFTBridge::deployERC20Call::abi_decode_returns(output, true) + let address = BTFBridge::deployERC20Call::abi_decode_returns(output, true) .unwrap() ._0; @@ -840,7 +840,7 @@ pub trait TestContext { let encoded_reason = Encode!(&reason).unwrap(); - let input = BFTBridge::notifyMinterCall { + let input = BTFBridge::notifyMinterCall { notificationType: MinterNotificationType::DepositRequest as u32, userData: encoded_reason.into(), memo: alloy_sol_types::private::FixedBytes::ZERO, @@ -862,7 +862,7 @@ pub trait TestContext { bridge: &H160, ) -> Result<()> { let encoded_op_id = Encode!(&operation_id).unwrap(); - let input = BFTBridge::notifyMinterCall { + let input = BTFBridge::notifyMinterCall { notificationType: MinterNotificationType::RescheduleOperation as u32, userData: encoded_op_id.into(), memo: alloy_sol_types::private::FixedBytes::ZERO, @@ -910,7 +910,7 @@ pub trait TestContext { order: SignedOrders, ) -> Result { let all_orders = order.all_orders().clone(); - let input = BFTBridge::batchMintCall { + let input = BTFBridge::batchMintCall { encodedOrders: all_orders.orders_data.into(), signature: all_orders.signature.into(), ordersToProcess: vec![order.idx() as u32], diff --git a/src/integration-tests/tests/context/stress.rs b/src/integration-tests/tests/context/stress.rs index 0a39354e..231e33cd 100644 --- a/src/integration-tests/tests/context/stress.rs +++ b/src/integration-tests/tests/context/stress.rs @@ -9,7 +9,7 @@ use std::time::Duration; use alloy_sol_types::SolCall; use bridge_did::id256::Id256; use bridge_did::operation_log::Memo; -use bridge_utils::BFTBridge; +use bridge_utils::BTFBridge; use did::{H160, U256}; use eth_signer::{Signer, Wallet}; use ethers_core::k256::ecdsa::SigningKey; @@ -59,7 +59,7 @@ pub trait BaseTokens { Ok(user) } - async fn set_bft_bridge_contract_address(&self, bft_bridge: &H160) -> Result<()>; + async fn set_btf_bridge_contract_address(&self, btf_bridge: &H160) -> Result<()>; async fn is_operation_complete(&self, address: H160, memo: Memo) -> Result; } @@ -95,7 +95,7 @@ pub struct StressTestState { base_tokens: B, users: Vec>, wrapped_tokens: Vec, - bft_bridge: H160, + btf_bridge: H160, config: StressTestConfig, memo_counter: AtomicU64, } @@ -113,7 +113,7 @@ impl StressTestState { let expected_fee_charge_address = ethers_core::utils::get_contract_address(admin_wallet.address(), 3); - println!("Initializing BftBridge contract"); + println!("Initializing Btfbridge contract"); let bridge_canister_address = base_tokens.bridge_canister_evm_address().await?; base_tokens @@ -128,9 +128,9 @@ impl StressTestState { .advance_by_times(Duration::from_secs(1), 2) .await; - let bft_bridge = base_tokens + let btf_bridge = base_tokens .ctx() - .initialize_bft_bridge_with_minter( + .initialize_btf_bridge_with_minter( &admin_wallet, bridge_canister_address, Some(expected_fee_charge_address.into()), @@ -142,13 +142,13 @@ impl StressTestState { println!("Initializing fee charge contract"); let fee_charge_address = base_tokens .ctx() - .initialize_fee_charge_contract(&admin_wallet, &[bft_bridge.clone()]) + .initialize_fee_charge_contract(&admin_wallet, &[btf_bridge.clone()]) .await .unwrap(); assert_eq!(expected_fee_charge_address, fee_charge_address.0); base_tokens - .set_bft_bridge_contract_address(&bft_bridge) + .set_btf_bridge_contract_address(&btf_bridge) .await?; println!("Creating wrapped tokens"); @@ -157,7 +157,7 @@ impl StressTestState { let token_id256 = base_tokens.token_id256(base_id.clone()); let wrapped_address = base_tokens .ctx() - .create_wrapped_token(&admin_wallet, &bft_bridge, token_id256) + .create_wrapped_token(&admin_wallet, &btf_bridge, token_id256) .await?; wrapped_tokens.push(wrapped_address); } @@ -179,7 +179,6 @@ impl StressTestState { // Deposit native token to charge fee. let evm_client = base_tokens.ctx().evm_client(base_tokens.ctx().admin_name()); - let user_id256 = base_tokens.user_id256(user_id.clone()); base_tokens .ctx() .native_token_deposit( @@ -202,7 +201,7 @@ impl StressTestState { base_tokens, wrapped_tokens, users, - bft_bridge, + btf_bridge, config, memo_counter: Default::default(), }; @@ -372,7 +371,7 @@ impl StressTestState { let user = &self.users[user_idx]; let memo = self.next_memo(); let burn_info = BurnInfo { - bridge: self.bft_bridge.clone(), + bridge: self.btf_bridge.clone(), base_token_idx: token_idx, wrapped_token: self.wrapped_tokens[token_idx].clone(), from: user.base_id.clone(), @@ -392,7 +391,7 @@ impl StressTestState { .user_id256(self.users[user_idx].base_id.clone()); let memo = self.next_memo(); - let input = BFTBridge::burnCall { + let input = BTFBridge::burnCall { amount: amount.into(), fromERC20: self.wrapped_tokens[token_idx].clone().into(), toTokenID: alloy_sol_types::private::FixedBytes::from_slice(&base_token_id.0), @@ -406,7 +405,7 @@ impl StressTestState { .ctx() .call_contract_without_waiting( &self.users[user_idx].wallet, - &self.bft_bridge, + &self.btf_bridge, input, 0, Some(nonce), diff --git a/src/integration-tests/tests/context/stress/erc20.rs b/src/integration-tests/tests/context/stress/erc20.rs index 509614df..6ea1f88b 100644 --- a/src/integration-tests/tests/context/stress/erc20.rs +++ b/src/integration-tests/tests/context/stress/erc20.rs @@ -7,7 +7,7 @@ use bridge_client::BridgeCanisterClient; use bridge_did::id256::Id256; use bridge_did::operation_log::Memo; use bridge_did::operations::Erc20OpStage; -use bridge_utils::BFTBridge; +use bridge_utils::BTFBridge; use did::{TransactionReceipt, H160, H256, U256, U64}; use eth_signer::{Signer, Wallet}; use ic_exports::ic_cdk::println; @@ -22,7 +22,7 @@ pub struct Erc20BaseTokens { ctx: Ctx, tokens: Vec, contracts_deployer: OwnedWallet, - bft_bridge: H160, + btf_bridge: H160, nonces: RwLock>, } @@ -65,7 +65,7 @@ impl Erc20BaseTokens { // wait to allow bridge canister to query evm params from external EVM. ctx.advance_by_times(Duration::from_millis(500), 10).await; - let bft_bridge = Self::init_bft_bridge_contract(&ctx).await; + let btf_bridge = Self::init_btf_bridge_contract(&ctx).await; // Mint tokens for bridge canister let bridge_client = ctx.erc20_bridge_client(ctx.admin_name()); @@ -92,13 +92,13 @@ impl Erc20BaseTokens { ctx, tokens, contracts_deployer, - bft_bridge, + btf_bridge, nonces: Default::default(), }) } - async fn init_bft_bridge_contract(ctx: &Ctx) -> H160 { - println!("Initializing BFTBridge contract on base EVM"); + async fn init_btf_bridge_contract(ctx: &Ctx) -> H160 { + println!("Initializing BTFBridge contract on base EVM"); let erc20_bridge_client = ctx.erc20_bridge_client(ctx.admin_name()); let bridge_canister_address = erc20_bridge_client @@ -110,7 +110,7 @@ impl Erc20BaseTokens { let base_evm_client = ctx.external_evm_client(ctx.admin_name()); let addr = ctx - .initialize_bft_bridge_on_evm( + .initialize_btf_bridge_on_evm( &base_evm_client, bridge_canister_address, None, @@ -121,11 +121,11 @@ impl Erc20BaseTokens { .unwrap(); erc20_bridge_client - .set_base_bft_bridge_contract(&addr) + .set_base_btf_bridge_contract(&addr) .await .unwrap(); - println!("BFTBridge contract initialized on base EVM"); + println!("BTFBridge contract initialized on base EVM"); addr } @@ -282,7 +282,7 @@ impl BaseTokens for Erc20BaseTokens { println!("approving tokens for bridge"); let input = TestWTM::approveCall { - spender: self.bft_bridge.clone().into(), + spender: self.btf_bridge.clone().into(), value: info.amount.clone().into(), } .abi_encode(); @@ -302,7 +302,7 @@ impl BaseTokens for Erc20BaseTokens { self.wait_tx_success(&tx_hash).await?; println!("burning tokens for bridge"); - let input = BFTBridge::burnCall { + let input = BTFBridge::burnCall { amount: info.amount.clone().into(), fromERC20: token_address.clone().into(), toTokenID: alloy_sol_types::private::FixedBytes::from_slice(&to_token_id.0), @@ -317,7 +317,7 @@ impl BaseTokens for Erc20BaseTokens { .call_contract_without_waiting_on_evm( &evm_client, &user_wallet, - &self.bft_bridge, + &self.btf_bridge, input, 0, Some(nonce), @@ -329,10 +329,10 @@ impl BaseTokens for Erc20BaseTokens { Ok(info.amount.clone()) } - async fn set_bft_bridge_contract_address(&self, bft_bridge: &H160) -> Result<()> { + async fn set_btf_bridge_contract_address(&self, btf_bridge: &H160) -> Result<()> { self.ctx .erc20_bridge_client(self.ctx.admin_name()) - .set_bft_bridge_contract(bft_bridge) + .set_btf_bridge_contract(btf_bridge) .await?; Ok(()) diff --git a/src/integration-tests/tests/context/stress/icrc.rs b/src/integration-tests/tests/context/stress/icrc.rs index 46abbad3..ae52f375 100644 --- a/src/integration-tests/tests/context/stress/icrc.rs +++ b/src/integration-tests/tests/context/stress/icrc.rs @@ -6,7 +6,7 @@ use bridge_did::id256::Id256; use bridge_did::operation_log::Memo; use bridge_did::operations::IcrcBridgeOp; use bridge_did::reason::Icrc2Burn; -use bridge_utils::{evm_link, BFTBridge}; +use bridge_utils::{evm_link, BTFBridge}; use candid::{Encode, Nat, Principal}; use did::error::{EvmError, TransactionPoolError}; use did::{H160, U256}; @@ -181,7 +181,7 @@ impl BaseTokens for IcrcBaseTokens { let encoded_reason = Encode!(&reason).unwrap(); - let input = BFTBridge::notifyMinterCall { + let input = BTFBridge::notifyMinterCall { notificationType: Default::default(), userData: encoded_reason.into(), memo: info.memo.into(), @@ -218,10 +218,10 @@ impl BaseTokens for IcrcBaseTokens { Ok(info.amount.clone()) } - async fn set_bft_bridge_contract_address(&self, bft_bridge: &H160) -> Result<()> { + async fn set_btf_bridge_contract_address(&self, btf_bridge: &H160) -> Result<()> { self.ctx .icrc_bridge_client(self.ctx.admin_name()) - .set_bft_bridge_contract(bft_bridge) + .set_btf_bridge_contract(btf_bridge) .await?; Ok(()) diff --git a/src/integration-tests/tests/dfx_tests/brc20_bridge/ctx.rs b/src/integration-tests/tests/dfx_tests/brc20_bridge/ctx.rs index e40329c8..9ee25619 100644 --- a/src/integration-tests/tests/dfx_tests/brc20_bridge/ctx.rs +++ b/src/integration-tests/tests/dfx_tests/brc20_bridge/ctx.rs @@ -16,7 +16,7 @@ use bridge_did::event_data::MinterNotificationType; use bridge_did::id256::Id256; use bridge_did::op_id::OperationId; use bridge_did::operations::{Brc20BridgeDepositOp, Brc20BridgeOp}; -use bridge_utils::BFTBridge; +use bridge_utils::BTFBridge; use candid::{Encode, Principal}; use did::constant::EIP1559_INITIAL_BASE_FEE; use did::{BlockNumber, TransactionReceipt, H160, H256}; @@ -105,7 +105,7 @@ pub fn generate_wallet_name() -> String { pub struct Brc20Context { inner: DfxTestContext, pub eth_wallet: Wallet<'static, SigningKey>, - bft_bridge_contract: H160, + btf_bridge_contract: H160, exit: Exit, miner: Option>, brc20: Brc20Wallet, @@ -245,8 +245,8 @@ impl Brc20Context { .await .unwrap(); - let bft_bridge = context - .initialize_bft_bridge_with_minter( + let btf_bridge = context + .initialize_btf_bridge_with_minter( &wallet, btc_bridge_eth_address.unwrap(), None, @@ -260,7 +260,7 @@ impl Brc20Context { for brc20_token in &brc20_wallet.brc20_tokens { let token = context - .create_wrapped_token(&wallet, &bft_bridge, (*brc20_token).into()) + .create_wrapped_token(&wallet, &btf_bridge, (*brc20_token).into()) .await .unwrap(); @@ -269,7 +269,7 @@ impl Brc20Context { let _: () = context .brc20_bridge_client(ADMIN) - .set_bft_bridge_contract(&bft_bridge) + .set_btf_bridge_contract(&btf_bridge) .await .unwrap(); @@ -281,7 +281,7 @@ impl Brc20Context { ); Self { - bft_bridge_contract: bft_bridge, + btf_bridge_contract: btf_bridge, eth_wallet: wallet, exit, miner: Some(miner), @@ -403,7 +403,7 @@ impl Brc20Context { brc20_tick: tick, }; - let input = BFTBridge::notifyMinterCall { + let input = BTFBridge::notifyMinterCall { notificationType: MinterNotificationType::DepositRequest as u32, userData: Encode!(&data).unwrap().into(), memo: alloy_sol_types::private::FixedBytes::ZERO, @@ -412,7 +412,7 @@ impl Brc20Context { let transaction = TransactionBuilder { from: &self.eth_wallet.address().into(), - to: Some(self.bft_bridge_contract.clone()), + to: Some(self.btf_bridge_contract.clone()), nonce, value: Default::default(), gas: 5_000_000u64.into(), @@ -484,7 +484,7 @@ impl Brc20Context { token_address, Id256::from(*tick).0.as_slice(), withdrawal_address.as_bytes().to_vec(), - &self.bft_bridge_contract, + &self.btf_bridge_contract, amount.amount(), true, None, diff --git a/src/integration-tests/tests/dfx_tests/bridge_deployer.rs b/src/integration-tests/tests/dfx_tests/bridge_deployer.rs index 29e3c046..54217752 100644 --- a/src/integration-tests/tests/dfx_tests/bridge_deployer.rs +++ b/src/integration-tests/tests/dfx_tests/bridge_deployer.rs @@ -228,10 +228,10 @@ async fn test_should_reinstall_bridge() { let ckbtc_ledger = ctx.canisters.icrc1_ledger().to_text(); let ckbtc_minter = ctx.canisters.ck_btc_minter().to_text(); - // deploy the bft bridge - let bft_bridge = deploy_bft_bridge(&ctx) + // deploy the btf bridge + let btf_bridge = deploy_btf_bridge(&ctx) .await - .expect("failed to deploy bft bridge"); + .expect("failed to deploy btf bridge"); // get the output dir for evaluated trycmd files let trycmd_output_dir = TempDir::new().expect("failed to create temp file"); @@ -255,7 +255,7 @@ async fn test_should_reinstall_bridge() { ("ERC20_BRIDGE_ID", erc20_bridge_id.to_string()), ("ICRC2_BRIDGE_ID", icrc2_bridge_id.to_string()), ("RUNE_BRIDGE_ID", rune_bridge_id.to_string()), - ("BFT_BRIDGE", hex::encode(bft_bridge)), + ("BTF_BRIDGE", hex::encode(btf_bridge)), ], Path::new("./tests/bridge_deployer/reinstall"), trycmd_output_dir.path(), @@ -310,8 +310,8 @@ fn restore_manifest_dir() { std::env::set_current_dir(&manifest_dir).expect("failed to change cwd"); } -/// Deploy the BFT bridge -async fn deploy_bft_bridge(ctx: &DfxTestContext) -> anyhow::Result { +/// Deploy the BTF bridge +async fn deploy_btf_bridge(ctx: &DfxTestContext) -> anyhow::Result { let private_key_bytes = hex::decode(HARDHAT_ETH_PRIVATE_KEY)?; let wallet = Wallet::from_bytes(&private_key_bytes)?; @@ -324,8 +324,8 @@ async fn deploy_bft_bridge(ctx: &DfxTestContext) -> anyhow::Result { .initialize_wrapped_token_deployer_contract(&wallet) .await?; - let bft_bridge = ctx - .initialize_bft_bridge_with_minter( + let btf_bridge = ctx + .initialize_btf_bridge_with_minter( &wallet, btc_bridge_eth_address.unwrap(), None, @@ -334,5 +334,5 @@ async fn deploy_bft_bridge(ctx: &DfxTestContext) -> anyhow::Result { ) .await?; - Ok(bft_bridge.0) + Ok(btf_bridge.0) } diff --git a/src/integration-tests/tests/dfx_tests/runes.rs b/src/integration-tests/tests/dfx_tests/runes.rs index e53a577a..0f6522c2 100644 --- a/src/integration-tests/tests/dfx_tests/runes.rs +++ b/src/integration-tests/tests/dfx_tests/runes.rs @@ -14,7 +14,7 @@ use bridge_did::id256::Id256; use bridge_did::op_id::OperationId; use bridge_did::operations::{RuneBridgeDepositOp, RuneBridgeOp}; use bridge_did::runes::RuneName; -use bridge_utils::BFTBridge; +use bridge_utils::BTFBridge; use candid::{Encode, Principal}; use did::constant::EIP1559_INITIAL_BASE_FEE; use did::{BlockNumber, TransactionReceipt, H160, H256}; @@ -58,7 +58,7 @@ struct RuneWallet { struct RunesContext { inner: DfxTestContext, eth_wallet: Wallet<'static, SigningKey>, - bft_bridge_contract: H160, + btf_bridge_contract: H160, exit: Exit, miner: Option>, runes: RuneWallet, @@ -186,8 +186,8 @@ impl RunesContext { .initialize_wrapped_token_deployer_contract(&wallet) .await .unwrap(); - let bft_bridge = context - .initialize_bft_bridge_with_minter( + let btf_bridge = context + .initialize_btf_bridge_with_minter( &wallet, btc_bridge_eth_address.unwrap(), None, @@ -201,7 +201,7 @@ impl RunesContext { for rune_id in rune_wallet.runes.keys() { let token = context - .create_wrapped_token(&wallet, &bft_bridge, (*rune_id).into()) + .create_wrapped_token(&wallet, &btf_bridge, (*rune_id).into()) .await .unwrap(); @@ -210,7 +210,7 @@ impl RunesContext { let _: () = context .rune_bridge_client(ADMIN) - .set_bft_bridge_contract(&bft_bridge) + .set_btf_bridge_contract(&btf_bridge) .await .unwrap(); @@ -224,7 +224,7 @@ impl RunesContext { ); Self { - bft_bridge_contract: bft_bridge, + btf_bridge_contract: btf_bridge, eth_wallet: wallet, exit, miner: Some(miner), @@ -441,7 +441,7 @@ impl RunesContext { amounts, }; - let input = BFTBridge::notifyMinterCall { + let input = BTFBridge::notifyMinterCall { notificationType: MinterNotificationType::DepositRequest as u32, userData: Encode!(&data).unwrap().into(), memo: alloy_sol_types::private::FixedBytes::ZERO, @@ -450,7 +450,7 @@ impl RunesContext { let transaction = TransactionBuilder { from: &self.eth_wallet.address().into(), - to: Some(self.bft_bridge_contract.clone()), + to: Some(self.btf_bridge_contract.clone()), nonce, value: Default::default(), gas: 5_000_000u64.into(), @@ -532,7 +532,7 @@ impl RunesContext { token_address, rune_info.id256.0.as_slice(), withdrawal_address.as_bytes().to_vec(), - &self.bft_bridge_contract, + &self.btf_bridge_contract, amount, true, None, diff --git a/src/integration-tests/tests/pocket_ic_integration_test/erc20_bridge.rs b/src/integration-tests/tests/pocket_ic_integration_test/erc20_bridge.rs index b08f588e..23c4d703 100644 --- a/src/integration-tests/tests/pocket_ic_integration_test/erc20_bridge.rs +++ b/src/integration-tests/tests/pocket_ic_integration_test/erc20_bridge.rs @@ -6,7 +6,7 @@ use bridge_client::{BridgeCanisterClient, Erc20BridgeClient}; use bridge_did::bridge_side::BridgeSide; use bridge_did::id256::Id256; use bridge_did::operations::Erc20OpStage; -use bridge_utils::{BFTBridge, UUPSProxy}; +use bridge_utils::{BTFBridge, UUPSProxy}; use did::{H160, U256}; use erc20_bridge::ops::{Erc20BridgeOpImpl, Erc20OpStageImpl}; use eth_signer::{Signer, Wallet}; @@ -25,8 +25,8 @@ pub struct ContextWithBridges { pub bob_wallet: Wallet<'static, SigningKey>, pub bob_address: H160, pub erc20_bridge_address: H160, - pub base_bft_bridge: H160, - pub wrapped_bft_bridge: H160, + pub base_btf_bridge: H160, + pub wrapped_btf_bridge: H160, pub base_token_address: H160, pub wrapped_token_address: H160, pub fee_charge_address: H160, @@ -102,8 +102,8 @@ impl ContextWithBridges { .await .unwrap(); - // Deploy the BFTBridge contract on the external EVM. - let base_bft_bridge = create_bft_bridge( + // Deploy the BTFBridge contract on the external EVM. + let base_btf_bridge = create_btf_bridge( &ctx, &bob_wallet, BridgeSide::Base, @@ -113,11 +113,11 @@ impl ContextWithBridges { ) .await; erc20_bridge_client - .set_base_bft_bridge_contract(&base_bft_bridge) + .set_base_btf_bridge_contract(&base_btf_bridge) .await .unwrap(); - let wrapped_bft_bridge = create_bft_bridge( + let wrapped_btf_bridge = create_btf_bridge( &ctx, &bob_wallet, BridgeSide::Wrapped, @@ -127,7 +127,7 @@ impl ContextWithBridges { ) .await; erc20_bridge_client - .set_bft_bridge_contract(&wrapped_bft_bridge) + .set_btf_bridge_contract(&wrapped_btf_bridge) .await .unwrap(); @@ -136,13 +136,13 @@ impl ContextWithBridges { .initialize_fee_charge_contract_on_evm( &base_evm_client, &fee_charge_deployer, - &[base_bft_bridge.clone()], + &[base_btf_bridge.clone()], ) .await .unwrap(); assert_eq!(expected_fee_charge_address, fee_charge_address.0); let fee_charge_address = ctx - .initialize_fee_charge_contract(&fee_charge_deployer, &[wrapped_bft_bridge.clone()]) + .initialize_fee_charge_contract(&fee_charge_deployer, &[wrapped_btf_bridge.clone()]) .await .unwrap(); assert_eq!(expected_fee_charge_address, fee_charge_address.0); @@ -158,7 +158,7 @@ impl ContextWithBridges { let wrapped_token_address = ctx .create_wrapped_token( &ctx.new_wallet(u128::MAX).await.unwrap(), - &wrapped_bft_bridge, + &wrapped_btf_bridge, token_id, ) .await @@ -169,8 +169,8 @@ impl ContextWithBridges { bob_wallet, bob_address, erc20_bridge_address, - base_bft_bridge, - wrapped_bft_bridge, + base_btf_bridge, + wrapped_btf_bridge, base_token_address, wrapped_token_address, fee_charge_address, @@ -182,12 +182,12 @@ impl ContextWithBridges { } } -// Create a second EVM canister (base_evm) instance and create BFTBridge contract on it, // It will play role of external evm +// Create a second EVM canister (base_evm) instance and create BTFBridge contract on it, // It will play role of external evm // Create erc20-bridge instance, initialized with EvmInfos for both EVM canisters. // Deploy ERC-20 token on external_evm, // Deploy Wrapped token on first EVM for the ERC-20 from previous step, // Approve ERC-20 transfer on behalf of some user in external_evm, -// Call BFTBridge::burn() on behalf of the user in external_evm. +// Call BTFBridge::burn() on behalf of the user in external_evm. // Wait some time for the erc20-bridge see and process it. // Make sure the tokens minted. // Make sure SignedMintOrder removed from erc20-bridge after some time. @@ -204,15 +204,13 @@ async fn test_external_bridging() { let amount = 1000_u128; - // spender should deposit native tokens to bft bridge, to pay fee. + // spender should deposit native tokens to btf bridge, to pay fee. let wrapped_evm_client = ctx.context.evm_client(ADMIN); - let bob_id = Id256::from_evm_address(&ctx.bob_address, CHAIN_ID as _); ctx.context .native_token_deposit( &wrapped_evm_client, ctx.fee_charge_address.clone(), &ctx.bob_wallet, - &[bob_id], 10_u64.pow(15).into(), ) .await @@ -242,7 +240,7 @@ async fn test_external_bridging() { &ctx.base_token_address, &to_token_id.to_bytes(), alice_id, - &ctx.base_bft_bridge, + &ctx.base_btf_bridge, amount, Some(memo), ) @@ -321,16 +319,14 @@ async fn native_token_deposit_increase_and_decrease() { .unwrap() .unwrap(); - // spender should deposit native tokens to bft bridge, to pay fee. + // spender should deposit native tokens to btf bridge, to pay fee. let native_balance_after_deposit = 10_u64.pow(15); - let bob_id = Id256::from_evm_address(&ctx.bob_address, CHAIN_ID as _); let init_native_balance = ctx .context .native_token_deposit( &wrapped_evm_client, ctx.fee_charge_address.clone(), &ctx.bob_wallet, - &[bob_id], native_balance_after_deposit.into(), ) .await @@ -379,7 +375,7 @@ async fn native_token_deposit_increase_and_decrease() { &ctx.base_token_address, &to_token_id.to_bytes(), alice_id, - &ctx.base_bft_bridge, + &ctx.base_btf_bridge, amount, None, ) @@ -449,7 +445,7 @@ async fn mint_should_fail_if_not_enough_tokens_on_fee_deposit() { let alice_id = Id256::from_evm_address(&alice_address, CHAIN_ID as _); let amount = 1000_u128; - // spender should deposit native tokens to bft bridge, to pay fee. + // spender should deposit native tokens to btf bridge, to pay fee. let base_evm_client = EvmCanisterClient::new( ctx.context .client(ctx.context.canisters().external_evm(), ADMIN), @@ -471,7 +467,7 @@ async fn mint_should_fail_if_not_enough_tokens_on_fee_deposit() { &ctx.base_token_address, &to_token_id.to_bytes(), alice_id, - &ctx.base_bft_bridge, + &ctx.base_btf_bridge, amount, None, ) @@ -519,7 +515,7 @@ async fn mint_should_fail_if_not_enough_tokens_on_fee_deposit() { ctx.context .batch_mint_erc_20_with_order( &ctx.bob_wallet, - &ctx.wrapped_bft_bridge, + &ctx.wrapped_btf_bridge, signed_order.clone(), ) .await @@ -565,16 +561,14 @@ async fn native_token_deposit_should_increase_fee_charge_contract_balance() { .unwrap() .unwrap(); - // Deposit native tokens to bft bridge. + // Deposit native tokens to btf bridge. let native_token_deposit = 10_000_000_u64; let wrapped_evm_client = ctx.context.evm_client(ADMIN); - let bob_id = Id256::from_evm_address(&ctx.bob_address, CHAIN_ID as _); ctx.context .native_token_deposit( &wrapped_evm_client, ctx.fee_charge_address.clone(), &ctx.bob_wallet, - &[bob_id], native_token_deposit.into(), ) .await @@ -617,7 +611,7 @@ async fn erc20_bridge_stress_test() { erc20::stress_test_erc20_bridge_with_ctx(context, 1, config).await; } -async fn create_bft_bridge( +async fn create_btf_bridge( ctx: &PocketIcTestContext, wallet: &Wallet<'static, SigningKey>, side: BridgeSide, @@ -630,9 +624,9 @@ async fn create_bft_bridge( BridgeSide::Wrapped => true, }; - let mut bft_input = BFTBridge::BYTECODE.to_vec(); - let constructor = BFTBridge::constructorCall {}.abi_encode(); - bft_input.extend_from_slice(&constructor); + let mut btf_input = BTFBridge::BYTECODE.to_vec(); + let constructor = BTFBridge::constructorCall {}.abi_encode(); + btf_input.extend_from_slice(&constructor); let evm = match side { BridgeSide::Base => ctx.canisters().external_evm(), @@ -642,11 +636,11 @@ async fn create_bft_bridge( let evm_client = EvmCanisterClient::new(ctx.client(evm, ADMIN)); let bridge_address = ctx - .create_contract_on_evm(&evm_client, wallet, bft_input.clone()) + .create_contract_on_evm(&evm_client, wallet, btf_input.clone()) .await .unwrap(); - let init_data = BFTBridge::initializeCall { + let init_data = BTFBridge::initializeCall { minterAddress: minter_address.into(), feeChargeAddress: fee_charge.into(), wrappedTokenDeployer: wrapped_token_deployer.into(), diff --git a/src/integration-tests/tests/pocket_ic_integration_test/icrc2_bridge.rs b/src/integration-tests/tests/pocket_ic_integration_test/icrc2_bridge.rs index cae33ddb..b2129452 100644 --- a/src/integration-tests/tests/pocket_ic_integration_test/icrc2_bridge.rs +++ b/src/integration-tests/tests/pocket_ic_integration_test/icrc2_bridge.rs @@ -27,7 +27,7 @@ use crate::pocket_ic_integration_test::{ADMIN, ALICE}; #[tokio::test] async fn test_icrc2_tokens_roundtrip() { - let (ctx, john_wallet, bft_bridge, fee_charge) = init_bridge().await; + let (ctx, john_wallet, btf_bridge, fee_charge) = init_bridge().await; let bridge_client = ctx.icrc_bridge_client(ADMIN); bridge_client @@ -38,14 +38,13 @@ async fn test_icrc2_tokens_roundtrip() { let base_token_id = Id256::from(&ctx.canisters().token_1()); let wrapped_token = ctx - .create_wrapped_token(&john_wallet, &bft_bridge, base_token_id) + .create_wrapped_token(&john_wallet, &btf_bridge, base_token_id) .await .unwrap(); let amount = 300_000u64; let evm_client = ctx.evm_client(ADMIN); - let john_principal_id = Id256::from(&john()); let native_token_amount = 10_u64.pow(17); ctx.native_token_deposit( &evm_client, @@ -62,7 +61,7 @@ async fn test_icrc2_tokens_roundtrip() { ctx.burn_icrc2( JOHN, &john_wallet, - &bft_bridge, + &btf_bridge, &wrapped_token, amount as _, Some(john_address), @@ -97,7 +96,7 @@ async fn test_icrc2_tokens_roundtrip() { &wrapped_token, base_token_id.0.as_slice(), (&john()).into(), - &bft_bridge, + &btf_bridge, wrapped_balance, ) .await @@ -122,7 +121,7 @@ async fn test_icrc2_tokens_roundtrip() { #[tokio::test] async fn test_icrc2_token_canister_stopped() { - let (ctx, john_wallet, bft_bridge, fee_charge) = init_bridge().await; + let (ctx, john_wallet, btf_bridge, fee_charge) = init_bridge().await; let minter_client = ctx.icrc_bridge_client(ADMIN); minter_client @@ -132,14 +131,13 @@ async fn test_icrc2_token_canister_stopped() { .unwrap(); let base_token_id = Id256::from(&ctx.canisters().token_1()); let wrapped_token = ctx - .create_wrapped_token(&john_wallet, &bft_bridge, base_token_id) + .create_wrapped_token(&john_wallet, &btf_bridge, base_token_id) .await .unwrap(); let amount = 3_000_000u64; let evm_client = ctx.evm_client(ADMIN); - let john_principal_id = Id256::from(&john()); let native_token_amount = 10_u64.pow(17); ctx.native_token_deposit( &evm_client, @@ -155,7 +153,7 @@ async fn test_icrc2_token_canister_stopped() { ctx.burn_icrc2( JOHN, &john_wallet, - &bft_bridge, + &btf_bridge, &wrapped_token, amount as _, Some(john_address.clone()), @@ -196,7 +194,7 @@ async fn test_icrc2_token_canister_stopped() { &wrapped_token, base_token_id.0.as_slice(), john_principal_id256, - &bft_bridge, + &btf_bridge, wrapped_balance, ) .await @@ -228,7 +226,7 @@ async fn test_icrc2_token_canister_stopped() { assert!(tx_hash.is_none()); let receipt = ctx - .batch_mint_erc_20_with_order(&john_wallet, &bft_bridge, order) + .batch_mint_erc_20_with_order(&john_wallet, &btf_bridge, order) .await .unwrap(); @@ -321,11 +319,11 @@ async fn test_canister_build_data() { #[tokio::test] async fn test_icrc2_tokens_approve_after_mint() { - let (ctx, john_wallet, bft_bridge, fee_charge) = init_bridge().await; + let (ctx, john_wallet, btf_bridge, fee_charge) = init_bridge().await; let base_token_id = Id256::from(&ctx.canisters().token_1()); let wrapped_token = ctx - .create_wrapped_token(&john_wallet, &bft_bridge, base_token_id) + .create_wrapped_token(&john_wallet, &btf_bridge, base_token_id) .await .unwrap(); @@ -337,7 +335,6 @@ async fn test_icrc2_tokens_approve_after_mint() { let spender_wallet = ctx.new_wallet(0).await.unwrap(); let evm_client = ctx.evm_client(ADMIN); - let john_principal_id = Id256::from(&john()); let native_token_amount = 10_u64.pow(17); ctx.native_token_deposit( &evm_client, @@ -358,7 +355,7 @@ async fn test_icrc2_tokens_approve_after_mint() { ctx.burn_icrc2( JOHN, &john_wallet, - &bft_bridge, + &btf_bridge, &wrapped_token, amount as _, Some(john_address.clone()), @@ -422,7 +419,7 @@ async fn test_icrc2_tokens_approve_after_mint() { async fn icrc2_token_bridge( ctx: &PocketIcTestContext, john_wallet: Wallet<'static, SigningKey>, - bft_bridge: &H160, + btf_bridge: &H160, fee_charge: &H160, wrapped_token: &H160, ) { @@ -452,7 +449,7 @@ async fn icrc2_token_bridge( ctx.burn_icrc2( JOHN, &john_wallet, - bft_bridge, + btf_bridge, wrapped_token, amount as _, Some(john_address.clone()), @@ -482,7 +479,7 @@ async fn icrc2_token_bridge( #[tokio::test] async fn test_minter_canister_address_balances_gets_replenished_after_roundtrip() { - let (ctx, john_wallet, bft_bridge, fee_charge) = init_bridge().await; + let (ctx, john_wallet, btf_bridge, fee_charge) = init_bridge().await; let evm_client = ctx.evm_client(ADMIN); let minter_address = ctx @@ -490,7 +487,6 @@ async fn test_minter_canister_address_balances_gets_replenished_after_roundtrip( .await .unwrap(); - let john_principal_id = Id256::from(&john()); let native_token_amount = 10_u64.pow(17); ctx.native_token_deposit( &evm_client, @@ -504,7 +500,7 @@ async fn test_minter_canister_address_balances_gets_replenished_after_roundtrip( let base_token_id = Id256::from(&ctx.canisters().token_1()); let wrapped_token = ctx - .create_wrapped_token(&john_wallet, &bft_bridge, base_token_id) + .create_wrapped_token(&john_wallet, &btf_bridge, base_token_id) .await .unwrap(); @@ -519,7 +515,7 @@ async fn test_minter_canister_address_balances_gets_replenished_after_roundtrip( icrc2_token_bridge( &ctx, john_wallet.clone(), - &bft_bridge, + &btf_bridge, &fee_charge, &wrapped_token, ) @@ -537,7 +533,7 @@ async fn test_minter_canister_address_balances_gets_replenished_after_roundtrip( #[tokio::test] async fn rescheduling_deposit_operation() { - let (ctx, john_wallet, bft_bridge, fee_charge) = init_bridge().await; + let (ctx, john_wallet, btf_bridge, fee_charge) = init_bridge().await; let bridge_client = ctx.icrc_bridge_client(ADMIN); bridge_client @@ -548,14 +544,13 @@ async fn rescheduling_deposit_operation() { let base_token_id = Id256::from(&ctx.canisters().token_1()); let wrapped_token = ctx - .create_wrapped_token(&john_wallet, &bft_bridge, base_token_id) + .create_wrapped_token(&john_wallet, &btf_bridge, base_token_id) .await .unwrap(); let amount = 300_000u64; let evm_client = ctx.evm_client(ADMIN); - let john_principal_id = Id256::from(&john()); let native_token_amount = 10_u64.pow(17); ctx.native_token_deposit( &evm_client, @@ -574,7 +569,7 @@ async fn rescheduling_deposit_operation() { ctx.burn_icrc2( JOHN, &john_wallet, - &bft_bridge, + &btf_bridge, &wrapped_token, amount as _, Some(john_address), @@ -663,7 +658,7 @@ async fn rescheduling_deposit_operation() { assert!(matches!(*state, IcrcBridgeOp::BurnIcrc2Tokens { .. })); - ctx.reschedule_operation(*operation_id, &john_wallet, &bft_bridge) + ctx.reschedule_operation(*operation_id, &john_wallet, &btf_bridge) .await .unwrap(); @@ -695,7 +690,7 @@ async fn test_icrc2_tokens_roundtrip_with_reschedule_spam() { async fn spam_reschedule_requests( ctx: PocketIcTestContext, wallet: Wallet<'_, SigningKey>, - bft_bridge: H160, + btf_bridge: H160, spam_stopper: CancellationToken, semaphore: Arc, ) { @@ -707,21 +702,21 @@ async fn test_icrc2_tokens_roundtrip_with_reschedule_spam() { .unwrap(); for (id, _) in &operations { let _ = semaphore.acquire().await; - ctx.reschedule_operation(*id, &wallet, &bft_bridge) + ctx.reschedule_operation(*id, &wallet, &btf_bridge) .await .unwrap(); } } } - let (ctx, john_wallet, bft_bridge, fee_charge) = init_bridge().await; + let (ctx, john_wallet, btf_bridge, fee_charge) = init_bridge().await; let spam_stopper = CancellationToken::new(); let semaphore = Arc::new(Semaphore::new(1)); tokio::task::spawn(spam_reschedule_requests( ctx.clone(), john_wallet.clone(), - bft_bridge.clone(), + btf_bridge.clone(), spam_stopper.clone(), semaphore.clone(), )); @@ -736,14 +731,13 @@ async fn test_icrc2_tokens_roundtrip_with_reschedule_spam() { let base_token_id = Id256::from(&ctx.canisters().token_1()); let wrapped_token = ctx - .create_wrapped_token(&john_wallet, &bft_bridge, base_token_id) + .create_wrapped_token(&john_wallet, &btf_bridge, base_token_id) .await .unwrap(); let amount = 300_000u64; let evm_client = ctx.evm_client(ADMIN); - let john_principal_id = Id256::from(&john()); let native_token_amount = 10_u64.pow(17); ctx.native_token_deposit( &evm_client, @@ -762,7 +756,7 @@ async fn test_icrc2_tokens_roundtrip_with_reschedule_spam() { ctx.burn_icrc2( JOHN, &john_wallet, - &bft_bridge, + &btf_bridge, &wrapped_token, amount as _, Some(john_address), @@ -800,7 +794,7 @@ async fn test_icrc2_tokens_roundtrip_with_reschedule_spam() { &wrapped_token, base_token_id.0.as_slice(), (&john()).into(), - &bft_bridge, + &btf_bridge, wrapped_balance, ) .await @@ -869,8 +863,8 @@ pub async fn init_bridge() -> (PocketIcTestContext, Wallet<'static, SigningKey>, .await .unwrap() .unwrap(); - let bft_bridge = ctx - .initialize_bft_bridge( + let btf_bridge = ctx + .initialize_btf_bridge( minter_canister_address, Some(expected_fee_charge_address.into()), wrapped_token_deployer, @@ -879,15 +873,15 @@ pub async fn init_bridge() -> (PocketIcTestContext, Wallet<'static, SigningKey>, .unwrap(); icrc_bridge_client - .set_bft_bridge_contract(&bft_bridge) + .set_btf_bridge_contract(&btf_bridge) .await .unwrap(); let fee_charge_address = ctx - .initialize_fee_charge_contract(&fee_charge_deployer, &[bft_bridge.clone()]) + .initialize_fee_charge_contract(&fee_charge_deployer, &[btf_bridge.clone()]) .await .unwrap(); assert_eq!(expected_fee_charge_address, fee_charge_address.0); - (ctx, john_wallet, bft_bridge, fee_charge_address) + (ctx, john_wallet, btf_bridge, fee_charge_address) } diff --git a/src/integration-tests/tests/state_machine_tests/btc.rs b/src/integration-tests/tests/state_machine_tests/btc.rs index b947a498..87566663 100644 --- a/src/integration-tests/tests/state_machine_tests/btc.rs +++ b/src/integration-tests/tests/state_machine_tests/btc.rs @@ -10,14 +10,14 @@ use alloy_sol_types::SolCall; use bitcoin::hashes::Hash; use bitcoin::secp256k1::Secp256k1; use bitcoin::{Address as BtcAddress, Network as BtcNetwork, PublicKey}; -use bridge_did::error::BftResult; +use bridge_did::error::BTFResult; use bridge_did::evm_link::EvmLink; use bridge_did::id256::Id256; use bridge_did::init::btc::{BitcoinConnection, WrappedTokenConfig}; use bridge_did::init::{BridgeInitData, BtcBridgeConfig}; use bridge_did::order::SignedMintOrder; use bridge_did::reason::{ApproveAfterMint, BtcDeposit}; -use bridge_utils::BFTBridge; +use bridge_utils::BTFBridge; use btc_bridge::canister::eth_address_to_subaccount; use candid::{Decode, Encode, Nat, Principal}; use did::{H160, U256}; @@ -209,7 +209,7 @@ struct CkBtcSetup { pub tip_height: AtomicU32, pub token_id: Id256, pub wrapped_token: H160, - pub bft_bridge: H160, + pub btf_bridge: H160, } impl CkBtcSetup {} @@ -365,9 +365,9 @@ impl CkBtcSetup { tokio::time::sleep(Duration::from_secs(2)).await; } - let btc_bridge_eth_address: BftResult = (&context) + let btc_bridge_eth_address: BTFResult = (&context) .client(btc_bridge, "admin") - .update::<_, BftResult>("get_bridge_canister_evm_address", ()) + .update::<_, BTFResult>("get_bridge_canister_evm_address", ()) .await .unwrap(); @@ -388,8 +388,8 @@ impl CkBtcSetup { .await .unwrap(); - let bft_bridge = (&context) - .initialize_bft_bridge_with_minter( + let btf_bridge = (&context) + .initialize_btf_bridge_with_minter( &wallet, btc_bridge_eth_address, None, @@ -399,18 +399,18 @@ impl CkBtcSetup { .await .unwrap(); - println!("bft_bridge {bft_bridge}",); + println!("btf_bridge {btf_bridge}",); - // set bft bridge + // set btf bridge (&context) .client(btc_bridge, "admin") - .update::<_, ()>("set_bft_bridge_contract", (bft_bridge.clone(),)) + .update::<_, ()>("set_btf_bridge_contract", (btf_bridge.clone(),)) .await .unwrap(); let token_id = Id256::from(&Principal::from(ledger_id)); let token = (&context) - .create_wrapped_token(&wallet, &bft_bridge, token_id) + .create_wrapped_token(&wallet, &btf_bridge, token_id) .await .unwrap(); @@ -421,16 +421,16 @@ impl CkBtcSetup { let mut token_symbol = [0; 16]; token_symbol[0..3].copy_from_slice(b"WPT"); - let bft_config = WrappedTokenConfig { + let btf_config = WrappedTokenConfig { token_address: token.clone(), token_name, token_symbol, decimals: 0, }; - let res: BftResult<()> = (&context) + let res: BTFResult<()> = (&context) .client(btc_bridge, "admin") - .update("admin_configure_wrapped_token", (bft_config,)) + .update("admin_configure_wrapped_token", (btf_config,)) .await .unwrap(); @@ -452,7 +452,7 @@ impl CkBtcSetup { minter_id, kyt_id, wrapped_token: token, - bft_bridge, + btf_bridge, token_id, tip_height: AtomicU32::default(), } @@ -1038,7 +1038,7 @@ impl CkBtcSetup { pub async fn btc_to_erc20( &self, wallet: &Wallet<'_, SigningKey>, - bft_bridge: &H160, + btf_bridge: &H160, eth_address: &H160, ) -> Result<(), TestError> { let user_data = BtcDeposit { @@ -1051,7 +1051,7 @@ impl CkBtcSetup { }; let encoded_reason = Encode!(&user_data).unwrap(); - let input = BFTBridge::notifyMinterCall { + let input = BTFBridge::notifyMinterCall { notificationType: Default::default(), userData: encoded_reason.into(), memo: alloy_sol_types::private::FixedBytes::ZERO, @@ -1062,7 +1062,7 @@ impl CkBtcSetup { (&self.context).advance_time(Duration::from_secs(2)).await; let receipt = (&self.context) - .call_contract(wallet, bft_bridge, input, 0) + .call_contract(wallet, btf_bridge, input, 0) .await .map(|(_, receipt)| receipt)?; @@ -1147,7 +1147,7 @@ impl CkBtcSetup { } assert!(self - .btc_to_erc20(wallet, &self.bft_bridge, &caller_eth_address) + .btc_to_erc20(wallet, &self.btf_bridge, &caller_eth_address) .await .is_ok()); @@ -1205,7 +1205,7 @@ impl CkBtcSetup { from_token, &self.token_id.to_bytes(), recipient, - &self.bft_bridge, + &self.btf_bridge, amount as u128, true, None, @@ -1442,7 +1442,7 @@ async fn test_should_mint_erc20_with_several_concurrent_btc_transactions() { // deposit assert!(ckbtc - .btc_to_erc20(&wallet, &ckbtc.bft_bridge, &caller_eth_address) + .btc_to_erc20(&wallet, &ckbtc.btf_bridge, &caller_eth_address) .await .is_ok()); @@ -1523,7 +1523,7 @@ async fn test_should_mint_erc20_with_several_tx_from_different_wallets() { // deposit let caller_eth_address = wallet.address().0.into(); assert!(ckbtc - .btc_to_erc20(wallet, &ckbtc.bft_bridge, &caller_eth_address) + .btc_to_erc20(wallet, &ckbtc.btf_bridge, &caller_eth_address) .await .is_ok()); } diff --git a/src/rune-bridge/src/canister.rs b/src/rune-bridge/src/canister.rs index 6d78c747..0cdf1d1d 100644 --- a/src/rune-bridge/src/canister.rs +++ b/src/rune-bridge/src/canister.rs @@ -1,7 +1,7 @@ use std::cell::RefCell; use std::rc::Rc; -use bridge_canister::runtime::service::fetch_logs::FetchBftBridgeEventsService; +use bridge_canister::runtime::service::fetch_logs::FetchBtfBridgeEventsService; use bridge_canister::runtime::service::mint_tx::SendMintTxService; use bridge_canister::runtime::service::sign_orders::SignMintOrdersService; use bridge_canister::runtime::service::update_evm_params::RefreshEvmParamsService; @@ -28,7 +28,7 @@ use crate::canister::inspect::{inspect_configure_ecdsa, inspect_configure_indexe use crate::interface::GetAddressError; use crate::ops::events_handler::RuneEventsHandler; use crate::ops::{ - RuneBridgeOpImpl, RuneMintOrderHandler, RuneMintTxHandler, FETCH_BFT_EVENTS_SERVICE_ID, + RuneBridgeOpImpl, RuneMintOrderHandler, RuneMintTxHandler, FETCH_BTF_EVENTS_SERVICE_ID, REFRESH_PARAMS_SERVICE_ID, SEND_MINT_TX_SERVICE_ID, SIGN_MINT_ORDER_SERVICE_ID, }; use crate::state::RuneState; @@ -205,8 +205,8 @@ fn init_runtime() -> SharedRuntime { let refresh_params_service = RefreshEvmParamsService::new(config.clone()); let events_handler = RuneEventsHandler::new(get_rune_state()); - let fetch_bft_events_service = - FetchBftBridgeEventsService::new(events_handler, runtime.clone(), config); + let fetch_btf_events_service = + FetchBtfBridgeEventsService::new(events_handler, runtime.clone(), config); let sign_orders_handler = RuneMintOrderHandler::new(state.clone(), scheduler); let sign_mint_orders_service = Rc::new(SignMintOrdersService::new(sign_orders_handler)); @@ -222,8 +222,8 @@ fn init_runtime() -> SharedRuntime { ); services.borrow_mut().add_service( ServiceOrder::BeforeOperations, - FETCH_BFT_EVENTS_SERVICE_ID, - Rc::new(fetch_bft_events_service), + FETCH_BTF_EVENTS_SERVICE_ID, + Rc::new(fetch_btf_events_service), ); services.borrow_mut().add_service( ServiceOrder::ConcurrentWithOperations, diff --git a/src/rune-bridge/src/core/deposit.rs b/src/rune-bridge/src/core/deposit.rs index 55531d81..9af61388 100644 --- a/src/rune-bridge/src/core/deposit.rs +++ b/src/rune-bridge/src/core/deposit.rs @@ -57,7 +57,7 @@ pub enum DepositRequestStatus { requested_amounts: HashMap, actual_amounts: HashMap, }, - /// Mint orders are signed by the canister but are not sent to the BftBridge. The user may attempt + /// Mint orders are signed by the canister but are not sent to the Btfbridge. The user may attempt /// to send them by themselves or wait for the canister to retry the operation. MintOrdersCreated { orders: Vec, diff --git a/src/rune-bridge/src/interface.rs b/src/rune-bridge/src/interface.rs index 20f68a4e..65e58a2e 100644 --- a/src/rune-bridge/src/interface.rs +++ b/src/rune-bridge/src/interface.rs @@ -28,9 +28,9 @@ pub enum Erc20MintStatus { }, /// The transaction is processed, ckBTC tokens are minted and mint order is created. But there /// was a problem sending the mint order to the EVM. The given signed mint order can be sent - /// manually to the BftBridge ot mint wrapped tokens. + /// manually to the Btfbridge ot mint wrapped tokens. Signed(Box), - /// Mint order for wrapped tokens is successfully sent to the BftBridge. + /// Mint order for wrapped tokens is successfully sent to the Btfbridge. Minted { /// Amount of tokens minted. amount: u128, diff --git a/src/rune-bridge/src/ops.rs b/src/rune-bridge/src/ops.rs index 404ffd55..d0f0a372 100644 --- a/src/rune-bridge/src/ops.rs +++ b/src/rune-bridge/src/ops.rs @@ -6,7 +6,7 @@ use std::collections::HashMap; use bridge_canister::bridge::{Operation, OperationProgress}; use bridge_canister::runtime::service::ServiceId; use bridge_canister::runtime::RuntimeState; -use bridge_did::error::{BftResult, Error}; +use bridge_did::error::{BTFResult, Error}; use bridge_did::op_id::OperationId; use bridge_did::operations::{RuneBridgeDepositOp, RuneBridgeOp, RuneBridgeWithdrawOp}; use bridge_did::runes::{DidTransaction, RuneName, RuneToWrap, RuneWithdrawalPayload}; @@ -25,7 +25,7 @@ use crate::core::utxo_handler::UtxoHandler; use crate::core::withdrawal::Withdrawal; pub const REFRESH_PARAMS_SERVICE_ID: ServiceId = 0; -pub const FETCH_BFT_EVENTS_SERVICE_ID: ServiceId = 1; +pub const FETCH_BTF_EVENTS_SERVICE_ID: ServiceId = 1; pub const SIGN_MINT_ORDER_SERVICE_ID: ServiceId = 2; pub const SEND_MINT_TX_SERVICE_ID: ServiceId = 3; @@ -39,7 +39,7 @@ impl Operation for RuneBridgeOpImpl { self, id: OperationId, ctx: RuntimeState, - ) -> BftResult> { + ) -> BTFResult> { let next_step = match self.0 { RuneBridgeOp::Deposit(RuneBridgeDepositOp::AwaitInputs { dst_address, @@ -235,7 +235,7 @@ impl RuneBridgeOpImpl { async fn schedule_operation_split( ctx: RuntimeState, operation_ids: Vec, - ) -> BftResult { + ) -> BTFResult { let state = ctx.borrow(); let mut operations = operation_ids @@ -263,7 +263,7 @@ impl RuneBridgeOpImpl { dst_address: H160, dst_tokens: HashMap, requested_amounts: Option>, - ) -> BftResult { + ) -> BTFResult { let inputs = input_provider .get_inputs(&dst_address) .await @@ -337,7 +337,7 @@ impl RuneBridgeOpImpl { dst_address: H160, utxo: Utxo, runes_to_wrap: Vec, - ) -> BftResult { + ) -> BTFResult { utxo_handler .check_confirmations(&dst_address, &utxo) .await @@ -360,7 +360,7 @@ impl RuneBridgeOpImpl { Ok(Self::split_or_update(ctx, dst_address, operations)) } - async fn create_withdrawal_transaction(payload: RuneWithdrawalPayload) -> BftResult { + async fn create_withdrawal_transaction(payload: RuneWithdrawalPayload) -> BTFResult { let withdraw = Withdrawal::get() .map_err(|err| Error::FailedToProgress(format!("cannot get withdraw: {err:?}")))?; let from_address = payload.sender.clone(); @@ -379,7 +379,7 @@ impl RuneBridgeOpImpl { ))) } - async fn send_transaction(from_address: H160, transaction: DidTransaction) -> BftResult { + async fn send_transaction(from_address: H160, transaction: DidTransaction) -> BTFResult { let withdraw = Withdrawal::get() .map_err(|err| Error::FailedToProgress(format!("cannot get withdraw: {err:?}")))?; withdraw diff --git a/src/rune-bridge/src/ops/events_handler.rs b/src/rune-bridge/src/ops/events_handler.rs index ecfe8b6a..7f9ad73f 100644 --- a/src/rune-bridge/src/ops/events_handler.rs +++ b/src/rune-bridge/src/ops/events_handler.rs @@ -2,7 +2,7 @@ use std::cell::RefCell; use std::rc::Rc; use bridge_canister::bridge::OperationAction; -use bridge_canister::runtime::service::fetch_logs::BftBridgeEventHandler; +use bridge_canister::runtime::service::fetch_logs::BtfBridgeEventHandler; use bridge_did::event_data::{ BurntEventData, MintedEventData, MinterNotificationType, NotifyMinterEventData, }; @@ -48,7 +48,7 @@ impl RuneEventsHandler { } } -impl BftBridgeEventHandler for RuneEventsHandler { +impl BtfBridgeEventHandler for RuneEventsHandler { fn on_wrapped_token_minted( &self, event: MintedEventData, diff --git a/src/rune-bridge/src/ops/mint_order_handler.rs b/src/rune-bridge/src/ops/mint_order_handler.rs index 098335e2..dba709f9 100644 --- a/src/rune-bridge/src/ops/mint_order_handler.rs +++ b/src/rune-bridge/src/ops/mint_order_handler.rs @@ -3,7 +3,7 @@ use bridge_canister::memory::StableMemory; use bridge_canister::runtime::scheduler::{BridgeTask, SharedScheduler}; use bridge_canister::runtime::service::sign_orders::MintOrderHandler; use bridge_canister::runtime::RuntimeState; -use bridge_did::error::BftResult; +use bridge_did::error::BTFResult; use bridge_did::op_id::OperationId; use bridge_did::operations::{RuneBridgeDepositOp, RuneBridgeOp}; use bridge_did::order::{MintOrder, SignedOrders}; @@ -30,7 +30,7 @@ impl RuneMintOrderHandler { } impl MintOrderHandler for RuneMintOrderHandler { - fn get_signer(&self) -> BftResult { + fn get_signer(&self) -> BTFResult { self.state.get_signer() } diff --git a/src/rune-bridge/src/ops/mint_tx_handler.rs b/src/rune-bridge/src/ops/mint_tx_handler.rs index cf43b5a5..4aeeb4a8 100644 --- a/src/rune-bridge/src/ops/mint_tx_handler.rs +++ b/src/rune-bridge/src/ops/mint_tx_handler.rs @@ -2,7 +2,7 @@ use bridge_canister::bridge::OperationContext as _; use bridge_canister::runtime::service::mint_tx::MintTxHandler; use bridge_canister::runtime::state::SharedConfig; use bridge_canister::runtime::RuntimeState; -use bridge_did::error::BftResult; +use bridge_did::error::BTFResult; use bridge_did::op_id::OperationId; use bridge_did::operations::{RuneBridgeDepositOp, RuneBridgeOp}; use bridge_did::order::SignedOrders; @@ -24,7 +24,7 @@ impl RuneMintTxHandler { } impl MintTxHandler for RuneMintTxHandler { - fn get_signer(&self) -> BftResult { + fn get_signer(&self) -> BTFResult { self.state.get_signer() } diff --git a/src/rune-bridge/src/ops/tests/deposit_request.rs b/src/rune-bridge/src/ops/tests/deposit_request.rs index bf01dfb2..e22839d3 100644 --- a/src/rune-bridge/src/ops/tests/deposit_request.rs +++ b/src/rune-bridge/src/ops/tests/deposit_request.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; use bridge_canister::bridge::OperationAction; -use bridge_canister::runtime::service::fetch_logs::BftBridgeEventHandler; +use bridge_canister::runtime::service::fetch_logs::BtfBridgeEventHandler; use bridge_did::event_data::*; use bridge_did::runes::RuneName; use candid::Encode; diff --git a/src/rune-bridge/src/ops/tests/mod.rs b/src/rune-bridge/src/ops/tests/mod.rs index 62957626..78fa3b93 100644 --- a/src/rune-bridge/src/ops/tests/mod.rs +++ b/src/rune-bridge/src/ops/tests/mod.rs @@ -62,7 +62,7 @@ fn dst_tokens() -> HashMap { pub mod minter_notification { use bridge_canister::bridge::OperationAction; - use bridge_canister::runtime::service::fetch_logs::BftBridgeEventHandler; + use bridge_canister::runtime::service::fetch_logs::BtfBridgeEventHandler; use bridge_did::event_data::*; use bridge_did::operations::{RuneBridgeDepositOp, RuneBridgeOp}; use candid::Encode;