From 4cc97ec985e540410d563eb8397ec8e1cdaf220c Mon Sep 17 00:00:00 2001 From: primata Date: Tue, 12 Nov 2024 18:23:56 +0100 Subject: [PATCH 1/6] rename atomic bridge to native bridge --- .github/scripts/update_move_toml.sh | 2 +- protocol-units/README.md | 2 +- protocol-units/bridge/cli/src/clap.rs | 2 +- .../bridge/cli/tests/integration_tests.rs | 4 +- ....sol => INativeBridgeCounterpartyMOVE.sol} | 6 +- ...OVE.sol => INativeBridgeInitiatorMOVE.sol} | 7 +- ...E.sol => NativeBridgeCounterpartyMOVE.sol} | 24 +- ...MOVE.sol => NativeBridgeInitiatorMOVE.sol} | 25 +- .../test/AtomicBridgeCounterpartyMOVE.t.sol | 268 ------------------ .../test/NativeBridgeCounterpartyMOVE.t.sol | 210 ++++++++++++++ ....t.sol => NativeBridgeInitiatorMOVE.t.sol} | 85 +++--- .../bridge/integration-tests/README.md | 2 +- .../bridge/integration-tests/src/utils.rs | 4 +- .../tests/bridge_e2e_test.rs | 6 +- .../tests/bridge_e2e_test_framework.rs | 6 +- .../scripts/enable_bridge_feature.move | 2 +- .../set_counterparty_time_lock_duration.move | 4 +- .../set_initiator_time_lock_duration.move | 4 +- .../scripts/store_mint_burn_caps.move | 6 +- .../scripts/update_bridge_operator.move | 4 +- ...json => NativeBridgeCounterpartyMOVE.json} | 2 +- ...VE.json => NativeBridgeInitiatorMOVE.json} | 2 +- .../service/src/chains/ethereum/client.rs | 20 +- .../src/chains/ethereum/event_monitoring.rs | 8 +- .../service/src/chains/ethereum/types.rs | 12 +- .../service/src/chains/movement/client.rs | 16 +- .../src/chains/movement/client_framework.rs | 26 +- .../src/chains/movement/event_monitoring.rs | 6 +- protocol-units/bridge/setup/src/deploy.rs | 12 +- 29 files changed, 355 insertions(+), 422 deletions(-) rename protocol-units/bridge/contracts/src/{IAtomicBridgeCounterpartyMOVE.sol => INativeBridgeCounterpartyMOVE.sol} (92%) rename protocol-units/bridge/contracts/src/{IAtomicBridgeInitiatorMOVE.sol => INativeBridgeInitiatorMOVE.sol} (92%) rename protocol-units/bridge/contracts/src/{AtomicBridgeCounterpartyMOVE.sol => NativeBridgeCounterpartyMOVE.sol} (78%) rename protocol-units/bridge/contracts/src/{AtomicBridgeInitiatorMOVE.sol => NativeBridgeInitiatorMOVE.sol} (88%) delete mode 100644 protocol-units/bridge/contracts/test/AtomicBridgeCounterpartyMOVE.t.sol create mode 100644 protocol-units/bridge/contracts/test/NativeBridgeCounterpartyMOVE.t.sol rename protocol-units/bridge/contracts/test/{AtomicBridgeInitiatorMOVE.t.sol => NativeBridgeInitiatorMOVE.t.sol} (66%) rename protocol-units/bridge/service/abis/{AtomicBridgeCounterpartyMOVE.json => NativeBridgeCounterpartyMOVE.json} (95%) rename protocol-units/bridge/service/abis/{AtomicBridgeInitiatorMOVE.json => NativeBridgeInitiatorMOVE.json} (98%) diff --git a/.github/scripts/update_move_toml.sh b/.github/scripts/update_move_toml.sh index b0b11205f..1db675f9e 100644 --- a/.github/scripts/update_move_toml.sh +++ b/.github/scripts/update_move_toml.sh @@ -37,7 +37,7 @@ echo "Derived resource address: $RESOURCE_ADDRESS" # Update the Move.toml file with the addresses sed -i "s/^resource_addr = \".*\"/resource_addr = \"$RESOURCE_ADDRESS\"/" "$MOVE_TOML_PATH" -sed -i "s/^atomic_bridge = \".*\"/atomic_bridge = \"$RESOURCE_ADDRESS\"/" "$MOVE_TOML_PATH" +sed -i "s/^native_bridge = \".*\"/native_bridge = \"$RESOURCE_ADDRESS\"/" "$MOVE_TOML_PATH" sed -i "s/^moveth = \".*\"/moveth = \"$RESOURCE_ADDRESS\"/" "$MOVE_TOML_PATH" sed -i "s/^master_minter = \".*\"/master_minter = \"$RESOURCE_ADDRESS\"/" "$MOVE_TOML_PATH" sed -i "s/^minter = \".*\"/minter = \"$RESOURCE_ADDRESS\"/" "$MOVE_TOML_PATH" diff --git a/protocol-units/README.md b/protocol-units/README.md index a5d62b5fe..188e487e0 100644 --- a/protocol-units/README.md +++ b/protocol-units/README.md @@ -3,7 +3,7 @@ We identify the following protocol unit categories: - [Data Availability](./da/m1/README.md): Protocol units concerned with enabling the secure submission and ordered retrieval of transaction data to and from a network. Light node clients and servers are members of this category. - [Mempool](./mempool/README.md): Protocol units concerned with the acceptance and ordering of transactions in a network prior to consensus. Mempool modules are members of this category. - [Sequencing](./sequencing/README.md): Protocol units concerned with consensus on the order of transactions in a network. Sequencer node implementations are members of this category. -- [Bridge](./bridge): Protocol units concerned with cross-blockchain bridging using atomic swaps. The atomic bridge consists of several packages and utilities to bridge from Ethereum to Movement, which can be extended to support any blockchains. +- [Bridge](./bridge): Protocol units concerned with cross-blockchain bridging using atomic swaps. The native bridge consists of several packages and utilities to bridge from Ethereum to Movement, which can be extended to support any blockchains. - [Cryptography](./cryptography): Protocol units concerned with cryptographic operations. Cryptography and data structure-related utilities are members of this category. - [Execution](./execution): Protocol units concerned with execution. Block executors and related unities are members of this category. - [Movement REST service](./movement-rest): Protocol units to support Movement's REST API. `movement-rest` provides additional Movement REST API endpoints. diff --git a/protocol-units/bridge/cli/src/clap.rs b/protocol-units/bridge/cli/src/clap.rs index a01b1b5fb..7b94c15b7 100644 --- a/protocol-units/bridge/cli/src/clap.rs +++ b/protocol-units/bridge/cli/src/clap.rs @@ -3,7 +3,7 @@ use clap::{Parser, Subcommand}; #[derive(Parser)] #[command(name = "Movementlabs Bridge CLI")] -#[command(about = "Command line interface to perform an atomic bridge transfers", long_about = None)] +#[command(about = "Command line interface to perform an native bridge transfers", long_about = None)] pub struct CliOptions { #[command(subcommand)] pub command: Commands, diff --git a/protocol-units/bridge/cli/tests/integration_tests.rs b/protocol-units/bridge/cli/tests/integration_tests.rs index ca18105a3..33e31a418 100644 --- a/protocol-units/bridge/cli/tests/integration_tests.rs +++ b/protocol-units/bridge/cli/tests/integration_tests.rs @@ -7,7 +7,7 @@ use bridge_cli::{ clap::eth_to_movement::{self, EthSharedArgs}, eth_to_moveth, }; -use ethereum_bridge::types::{AtomicBridgeInitiator, EthAddress}; +use ethereum_bridge::types::{NativeBridgeInitiator, EthAddress}; use movement_bridge::utils::MovementAddress; use std::str::FromStr; use url::Url; @@ -22,7 +22,7 @@ async fn test_swap() -> eyre::Result<()> { // Deploy contracts let wallet = anvil.keys()[0].clone(); - let initiator_contract = AtomicBridgeInitiator::deploy(provider).await?; + let initiator_contract = NativeBridgeInitiator::deploy(provider).await?; // Set up EthSharedArgs let eth_shared_args: EthSharedArgs = EthSharedArgs { diff --git a/protocol-units/bridge/contracts/src/IAtomicBridgeCounterpartyMOVE.sol b/protocol-units/bridge/contracts/src/INativeBridgeCounterpartyMOVE.sol similarity index 92% rename from protocol-units/bridge/contracts/src/IAtomicBridgeCounterpartyMOVE.sol rename to protocol-units/bridge/contracts/src/INativeBridgeCounterpartyMOVE.sol index daaf7c938..0ba2c80c2 100644 --- a/protocol-units/bridge/contracts/src/IAtomicBridgeCounterpartyMOVE.sol +++ b/protocol-units/bridge/contracts/src/INativeBridgeCounterpartyMOVE.sol @@ -1,7 +1,7 @@ pragma solidity ^0.8.22; -interface IAtomicBridgeCounterpartyMOVE { - // Event emitted when a new atomic bridge transfer is locked +interface INativeBridgeCounterpartyMOVE { + // Event emitted when a new native bridge transfer is locked event BridgeTransferLocked( bytes32 indexed bridgeTransferId, address indexed recipient, uint256 amount, bytes32 hashLock, uint256 timeLock ); @@ -26,7 +26,7 @@ interface IAtomicBridgeCounterpartyMOVE { error Unauthorized(); /** - * @dev Locks the assets for a new atomic bridge transfer + * @dev Locks the assets for a new native bridge transfer * @param initiator The address of the initiator of the BridgeTransfer * @param bridgeTransferId A unique id representing this BridgeTransfer * @param hashLock The hash of the secret (HASH) that will unlock the funds diff --git a/protocol-units/bridge/contracts/src/IAtomicBridgeInitiatorMOVE.sol b/protocol-units/bridge/contracts/src/INativeBridgeInitiatorMOVE.sol similarity index 92% rename from protocol-units/bridge/contracts/src/IAtomicBridgeInitiatorMOVE.sol rename to protocol-units/bridge/contracts/src/INativeBridgeInitiatorMOVE.sol index 45ffc2c61..a54ee3fb7 100644 --- a/protocol-units/bridge/contracts/src/IAtomicBridgeInitiatorMOVE.sol +++ b/protocol-units/bridge/contracts/src/INativeBridgeInitiatorMOVE.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.22; -interface IAtomicBridgeInitiatorMOVE { - // Event emitted when a new atomic bridge transfer is created +interface INativeBridgeInitiatorMOVE { + // Event emitted when a new native bridge transfer is created event BridgeTransferInitiated( bytes32 indexed _bridgeTransferId, address indexed _originator, @@ -28,9 +28,8 @@ interface IAtomicBridgeInitiatorMOVE { error ZeroAddress(); error Unauthorized(); - /** - * @dev Creates a new atomic bridge transfer using native ETH + * @dev Creates a new native bridge transfer using native ETH * @param _wethAmount The amount of WETH to send * @param _recipient The address on the other chain to which to transfer the funds * @param _hashLock The hash of the secret (HASH) that will unlock the funds diff --git a/protocol-units/bridge/contracts/src/AtomicBridgeCounterpartyMOVE.sol b/protocol-units/bridge/contracts/src/NativeBridgeCounterpartyMOVE.sol similarity index 78% rename from protocol-units/bridge/contracts/src/AtomicBridgeCounterpartyMOVE.sol rename to protocol-units/bridge/contracts/src/NativeBridgeCounterpartyMOVE.sol index fa2ca4f73..0cf840cef 100644 --- a/protocol-units/bridge/contracts/src/AtomicBridgeCounterpartyMOVE.sol +++ b/protocol-units/bridge/contracts/src/NativeBridgeCounterpartyMOVE.sol @@ -2,10 +2,10 @@ pragma solidity ^0.8.22; import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; -import {IAtomicBridgeCounterpartyMOVE} from "./IAtomicBridgeCounterpartyMOVE.sol"; -import {AtomicBridgeInitiatorMOVE} from "./AtomicBridgeInitiatorMOVE.sol"; +import {INativeBridgeCounterpartyMOVE} from "./INativeBridgeCounterpartyMOVE.sol"; +import {NativeBridgeInitiatorMOVE} from "./NativeBridgeInitiatorMOVE.sol"; -contract AtomicBridgeCounterpartyMOVE is IAtomicBridgeCounterpartyMOVE, OwnableUpgradeable { +contract NativeBridgeCounterpartyMOVE is INativeBridgeCounterpartyMOVE, OwnableUpgradeable { enum MessageState { PENDING, COMPLETED, @@ -21,24 +21,24 @@ contract AtomicBridgeCounterpartyMOVE is IAtomicBridgeCounterpartyMOVE, OwnableU MessageState state; } - AtomicBridgeInitiatorMOVE public atomicBridgeInitiatorMOVE; + NativeBridgeInitiatorMOVE public nativeBridgeInitiatorMOVE; mapping(bytes32 => BridgeTransferDetails) public bridgeTransfers; // Configurable time lock duration uint256 public counterpartyTimeLockDuration; - function initialize(address _atomicBridgeInitiator, address owner, uint256 _timeLockDuration) public initializer { - if (_atomicBridgeInitiator == address(0)) revert ZeroAddress(); - atomicBridgeInitiatorMOVE = AtomicBridgeInitiatorMOVE(_atomicBridgeInitiator); + function initialize(address _nativeBridgeInitiator, address owner, uint256 _timeLockDuration) public initializer { + if (_nativeBridgeInitiator == address(0)) revert ZeroAddress(); + nativeBridgeInitiatorMOVE = NativeBridgeInitiatorMOVE(_nativeBridgeInitiator); __Ownable_init(owner); // Set the configurable time lock duration counterpartyTimeLockDuration = _timeLockDuration; } - function setAtomicBridgeInitiator(address _atomicBridgeInitiator) external onlyOwner { - if (_atomicBridgeInitiator == address(0)) revert ZeroAddress(); - atomicBridgeInitiatorMOVE = AtomicBridgeInitiatorMOVE(_atomicBridgeInitiator); + function setNativeBridgeInitiator(address _nativeBridgeInitiator) external onlyOwner { + if (_nativeBridgeInitiator == address(0)) revert ZeroAddress(); + nativeBridgeInitiatorMOVE = NativeBridgeInitiatorMOVE(_nativeBridgeInitiator); } function setTimeLockDuration(uint256 _timeLockDuration) external onlyOwner { @@ -53,7 +53,7 @@ contract AtomicBridgeCounterpartyMOVE is IAtomicBridgeCounterpartyMOVE, OwnableU uint256 amount ) external onlyOwner returns (bool) { if (amount == 0) revert ZeroAmount(); - if (atomicBridgeInitiatorMOVE.poolBalance() < amount) revert InsufficientMOVEBalance(); + if (nativeBridgeInitiatorMOVE.poolBalance() < amount) revert InsufficientMOVEBalance(); // The time lock is now based on the configurable duration uint256 timeLock = block.timestamp + counterpartyTimeLockDuration; @@ -80,7 +80,7 @@ contract AtomicBridgeCounterpartyMOVE is IAtomicBridgeCounterpartyMOVE, OwnableU details.state = MessageState.COMPLETED; - atomicBridgeInitiatorMOVE.withdrawMOVE(details.recipient, details.amount); + nativeBridgeInitiatorMOVE.withdrawMOVE(details.recipient, details.amount); emit BridgeTransferCompleted(bridgeTransferId, preImage); } diff --git a/protocol-units/bridge/contracts/src/AtomicBridgeInitiatorMOVE.sol b/protocol-units/bridge/contracts/src/NativeBridgeInitiatorMOVE.sol similarity index 88% rename from protocol-units/bridge/contracts/src/AtomicBridgeInitiatorMOVE.sol rename to protocol-units/bridge/contracts/src/NativeBridgeInitiatorMOVE.sol index e9e1226f7..9c6c4f93d 100644 --- a/protocol-units/bridge/contracts/src/AtomicBridgeInitiatorMOVE.sol +++ b/protocol-units/bridge/contracts/src/NativeBridgeInitiatorMOVE.sol @@ -1,12 +1,12 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.22; -import {IAtomicBridgeInitiatorMOVE} from "./IAtomicBridgeInitiatorMOVE.sol"; +import {INativeBridgeInitiatorMOVE} from "./INativeBridgeInitiatorMOVE.sol"; import {MockMOVEToken} from "./MockMOVEToken.sol"; import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import {ERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; -contract AtomicBridgeInitiatorMOVE is IAtomicBridgeInitiatorMOVE, OwnableUpgradeable { +contract NativeBridgeInitiatorMOVE is INativeBridgeInitiatorMOVE, OwnableUpgradeable { enum MessageState { INITIALIZED, COMPLETED, @@ -36,12 +36,10 @@ contract AtomicBridgeInitiatorMOVE is IAtomicBridgeInitiatorMOVE, OwnableUpgrade uint256 public initiatorTimeLockDuration; // Initialize the contract with MOVE token address, owner, custom time lock duration, and initial pool balance - function initialize( - address _moveToken, - address owner, - uint256 _timeLockDuration, - uint256 _initialPoolBalance - ) public initializer { + function initialize(address _moveToken, address owner, uint256 _timeLockDuration, uint256 _initialPoolBalance) + public + initializer + { if (_moveToken == address(0)) { revert ZeroAddress(); } @@ -80,7 +78,9 @@ contract AtomicBridgeInitiatorMOVE is IAtomicBridgeInitiatorMOVE, OwnableUpgrade poolBalance += moveAmount; // Generate a unique nonce to prevent replay attacks, and generate a transfer ID - bridgeTransferId = keccak256(abi.encodePacked(originator, recipient, hashLock, initiatorTimeLockDuration, block.timestamp, nonce++)); + bridgeTransferId = keccak256( + abi.encodePacked(originator, recipient, hashLock, initiatorTimeLockDuration, block.timestamp, nonce++) + ); bridgeTransfers[bridgeTransferId] = BridgeTransfer({ amount: moveAmount, @@ -91,7 +91,9 @@ contract AtomicBridgeInitiatorMOVE is IAtomicBridgeInitiatorMOVE, OwnableUpgrade state: MessageState.INITIALIZED }); - emit BridgeTransferInitiated(bridgeTransferId, originator, recipient, moveAmount, hashLock, initiatorTimeLockDuration); + emit BridgeTransferInitiated( + bridgeTransferId, originator, recipient, moveAmount, hashLock, initiatorTimeLockDuration + ); return bridgeTransferId; } @@ -110,7 +112,7 @@ contract AtomicBridgeInitiatorMOVE is IAtomicBridgeInitiatorMOVE, OwnableUpgrade if (bridgeTransfer.state != MessageState.INITIALIZED) revert BridgeTransferStateNotInitialized(); if (block.timestamp < bridgeTransfer.timeLock) revert TimeLockNotExpired(); bridgeTransfer.state = MessageState.REFUNDED; - + // Decrease pool balance and transfer MOVE tokens back to the originator poolBalance -= bridgeTransfer.amount; if (!moveToken.transfer(bridgeTransfer.originator, bridgeTransfer.amount)) revert MOVETransferFailed(); @@ -125,4 +127,3 @@ contract AtomicBridgeInitiatorMOVE is IAtomicBridgeInitiatorMOVE, OwnableUpgrade if (!moveToken.transfer(recipient, amount)) revert MOVETransferFailed(); } } - diff --git a/protocol-units/bridge/contracts/test/AtomicBridgeCounterpartyMOVE.t.sol b/protocol-units/bridge/contracts/test/AtomicBridgeCounterpartyMOVE.t.sol deleted file mode 100644 index 2a7aae30e..000000000 --- a/protocol-units/bridge/contracts/test/AtomicBridgeCounterpartyMOVE.t.sol +++ /dev/null @@ -1,268 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.22; -pragma abicoder v2; - -import {Test, console} from "forge-std/Test.sol"; -import {AtomicBridgeCounterpartyMOVE} from "../src/AtomicBridgeCounterpartyMOVE.sol"; -import {AtomicBridgeInitiatorMOVE} from "../src/AtomicBridgeInitiatorMOVE.sol"; -import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; -import {TransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; -import {MockMOVEToken} from "../src/MockMOVEToken.sol"; - -contract AtomicBridgeCounterpartyMOVETest is Test { - AtomicBridgeCounterpartyMOVE public atomicBridgeCounterpartyMOVEImplementation; - AtomicBridgeCounterpartyMOVE public atomicBridgeCounterpartyMOVE; - AtomicBridgeInitiatorMOVE public atomicBridgeInitiatorMOVEImplementation; - AtomicBridgeInitiatorMOVE public atomicBridgeInitiatorMOVE; - MockMOVEToken public moveToken; - ProxyAdmin public proxyAdmin; - TransparentUpgradeableProxy public proxy; - - address public deployer = address(0x1); - address public originator = address(1); - address public recipient = address(0x2); - address public otherUser = address(0x3); - bytes32 public hashLock = keccak256(abi.encodePacked("secret")); - uint256 public amount = 100 * 10 ** 8; // 100 MOVEToken (assuming 8 decimals) - uint256 public timeLock = 100; - bytes32 public initiator = keccak256(abi.encodePacked(deployer)); - bytes32 public bridgeTransferId = - keccak256( - abi.encodePacked( - block.timestamp, - initiator, - recipient, - amount, - hashLock, - timeLock - ) - ); - - uint256 public constant COUNTERPARTY_TIME_LOCK_DURATION = 24 * 60 * 60; // 24 hours - - function setUp() public { - // Deploy the MOVEToken contract and mint some tokens to the deployer - moveToken = new MockMOVEToken(); - moveToken.initialize(address(this)); // Contract will hold initial MOVE tokens - - // Time lock durations - uint256 initiatorTimeLockDuration = 48 * 60 * 60; // 48 hours for the initiator - uint256 counterpartyTimeLockDuration = 24 * 60 * 60; // 24 hours for the counterparty - - originator = vm.addr(uint256(keccak256(abi.encodePacked(block.timestamp, block.prevrandao)))); - - // Deploy the AtomicBridgeInitiator contract with a 48-hour time lock - atomicBridgeInitiatorMOVEImplementation = new AtomicBridgeInitiatorMOVE(); - proxyAdmin = new ProxyAdmin(deployer); - proxy = new TransparentUpgradeableProxy( - address(atomicBridgeInitiatorMOVEImplementation), - address(proxyAdmin), - abi.encodeWithSignature( - "initialize(address,address,uint256,uint256)", - address(moveToken), - deployer, - initiatorTimeLockDuration, - 0 ether // Initial pool balance - ) - ); - atomicBridgeInitiatorMOVE = AtomicBridgeInitiatorMOVE(address(proxy)); - - // Deploy the AtomicBridgeCounterparty contract with a 24-hour time lock - atomicBridgeCounterpartyMOVEImplementation = new AtomicBridgeCounterpartyMOVE(); - proxy = new TransparentUpgradeableProxy( - address(atomicBridgeCounterpartyMOVEImplementation), - address(proxyAdmin), - abi.encodeWithSignature( - "initialize(address,address,uint256)", - address(atomicBridgeInitiatorMOVE), - deployer, - counterpartyTimeLockDuration - ) - ); - atomicBridgeCounterpartyMOVE = AtomicBridgeCounterpartyMOVE(address(proxy)); - - // Set the counterparty contract in the AtomicBridgeInitiator contract - vm.startPrank(deployer); - atomicBridgeInitiatorMOVE.setCounterpartyAddress( - address(atomicBridgeCounterpartyMOVE) - ); - vm.stopPrank(); - } - - function testLockBridgeTransfer() public { - uint256 moveAmount = 100 * 10**8; - moveToken.transfer(originator, moveAmount); - vm.startPrank(originator); - - // Approve the AtomicBridgeInitiatorMOVE contract to spend MOVEToken - moveToken.approve(address(atomicBridgeInitiatorMOVE), amount); - - // Initiate the bridge transfer - atomicBridgeInitiatorMOVE.initiateBridgeTransfer( - amount, - initiator, - hashLock - ); - - vm.stopPrank(); - - vm.startPrank(deployer); // Only the owner (deployer) can call lockBridgeTransfer - bool result = atomicBridgeCounterpartyMOVE.lockBridgeTransfer( - initiator, - bridgeTransferId, - hashLock, - recipient, - amount - ); - vm.stopPrank(); - - ( - bytes32 pendingInitiator, - address pendingRecipient, - uint256 pendingAmount, - bytes32 pendingHashLock, - uint256 pendingTimelock, - AtomicBridgeCounterpartyMOVE.MessageState pendingState - ) = atomicBridgeCounterpartyMOVE.bridgeTransfers(bridgeTransferId); - - assert(result); - assertEq(pendingInitiator, initiator); - assertEq(pendingRecipient, recipient); - assertEq(pendingAmount, amount); - assertEq(pendingHashLock, hashLock); - assertGt(pendingTimelock, block.timestamp); - assertEq( - uint8(pendingState), - uint8(AtomicBridgeCounterpartyMOVE.MessageState.PENDING) - ); - } - - function testCompleteBridgeTransfer() public { - bytes32 preImage = "secret"; - bytes32 testHashLock = keccak256(abi.encodePacked(preImage)); - - uint256 moveAmount = 100 * 10**8; - moveToken.transfer(originator, moveAmount); - vm.startPrank(originator); - - // Approve the AtomicBridgeInitiatorMOVE contract to spend MOVEToken - moveToken.approve(address(atomicBridgeInitiatorMOVE), amount); - - // Initiate the bridge transfer - atomicBridgeInitiatorMOVE.initiateBridgeTransfer( - amount, - initiator, - testHashLock - ); - - vm.stopPrank(); - - vm.startPrank(deployer); // Only the owner (deployer) can call lockBridgeTransfer - atomicBridgeCounterpartyMOVE.lockBridgeTransfer( - initiator, - bridgeTransferId, - testHashLock, - recipient, - amount - ); - vm.stopPrank(); - - vm.startPrank(otherUser); - - atomicBridgeCounterpartyMOVE.completeBridgeTransfer( - bridgeTransferId, - preImage - ); - - ( - bytes32 completedInitiator, - address completedRecipient, - uint256 completedAmount, - bytes32 completedHashLock, - uint256 completedTimeLock, - AtomicBridgeCounterpartyMOVE.MessageState completedState - ) = atomicBridgeCounterpartyMOVE.bridgeTransfers(bridgeTransferId); - - assertEq(completedInitiator, initiator); - assertEq(completedRecipient, recipient); - assertEq(completedAmount, amount); - assertEq(completedHashLock, testHashLock); - assertGt(completedTimeLock, block.timestamp); - assertEq( - uint8(completedState), - uint8(AtomicBridgeCounterpartyMOVE.MessageState.COMPLETED) - ); - - vm.stopPrank(); - } - -function testAbortBridgeTransfer() public { - uint256 moveAmount = 100 * 10**8; - moveToken.transfer(originator, moveAmount); - vm.startPrank(originator); - - // Approve the AtomicBridgeInitiatorMOVE contract to spend MOVEToken - moveToken.approve(address(atomicBridgeInitiatorMOVE), amount); - - // Initiate the bridge transfer - atomicBridgeInitiatorMOVE.initiateBridgeTransfer( - amount, - initiator, - hashLock - ); - - vm.stopPrank(); - - vm.startPrank(deployer); - - atomicBridgeCounterpartyMOVE.lockBridgeTransfer( - initiator, - bridgeTransferId, - hashLock, - recipient, - amount - ); - - vm.stopPrank(); - - // Advance the block number to beyond the timelock period - vm.warp(block.timestamp + COUNTERPARTY_TIME_LOCK_DURATION + 1); - - // Try to abort as a malicious user (this should fail) - //vm.startPrank(otherUser); - //vm.expectRevert("Ownable: caller is not the owner"); - //atomicBridgeCounterpartyMOVE.abortBridgeTransfer(bridgeTransferId); - //vm.stopPrank(); - - // Abort as the owner (this should pass) - vm.startPrank(deployer); // The deployer is the owner - atomicBridgeCounterpartyMOVE.abortBridgeTransfer(bridgeTransferId); - - ( - bytes32 abortedInitiator, - address abortedRecipient, - uint256 abortedAmount, - bytes32 abortedHashLock, - uint256 abortedTimeLock, - AtomicBridgeCounterpartyMOVE.MessageState abortedState - ) = atomicBridgeCounterpartyMOVE.bridgeTransfers(bridgeTransferId); - - assertEq(abortedInitiator, initiator); - assertEq(abortedRecipient, recipient); - assertEq(abortedAmount, amount); - assertEq(abortedHashLock, hashLock); - assertLe( - abortedTimeLock, - block.timestamp, - "Timelock is not less than or equal to current timestamp" - ); - assertEq( - uint8(abortedState), - uint8(AtomicBridgeCounterpartyMOVE.MessageState.REFUNDED) - ); - - vm.stopPrank(); -} - - -} diff --git a/protocol-units/bridge/contracts/test/NativeBridgeCounterpartyMOVE.t.sol b/protocol-units/bridge/contracts/test/NativeBridgeCounterpartyMOVE.t.sol new file mode 100644 index 000000000..670d91815 --- /dev/null +++ b/protocol-units/bridge/contracts/test/NativeBridgeCounterpartyMOVE.t.sol @@ -0,0 +1,210 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.22; +pragma abicoder v2; + +import {Test, console} from "forge-std/Test.sol"; +import {NativeBridgeCounterpartyMOVE} from "../src/NativeBridgeCounterpartyMOVE.sol"; +import {NativeBridgeInitiatorMOVE} from "../src/NativeBridgeInitiatorMOVE.sol"; +import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; +import {TransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; +import {MockMOVEToken} from "../src/MockMOVEToken.sol"; + +contract NativeBridgeCounterpartyMOVETest is Test { + NativeBridgeCounterpartyMOVE public nativeBridgeCounterpartyMOVEImplementation; + NativeBridgeCounterpartyMOVE public nativeBridgeCounterpartyMOVE; + NativeBridgeInitiatorMOVE public nativeBridgeInitiatorMOVEImplementation; + NativeBridgeInitiatorMOVE public nativeBridgeInitiatorMOVE; + MockMOVEToken public moveToken; + ProxyAdmin public proxyAdmin; + TransparentUpgradeableProxy public proxy; + + address public deployer = address(0x1); + address public originator = address(1); + address public recipient = address(0x2); + address public otherUser = address(0x3); + bytes32 public hashLock = keccak256(abi.encodePacked("secret")); + uint256 public amount = 100 * 10 ** 8; // 100 MOVEToken (assuming 8 decimals) + uint256 public timeLock = 100; + bytes32 public initiator = keccak256(abi.encodePacked(deployer)); + bytes32 public bridgeTransferId = + keccak256(abi.encodePacked(block.timestamp, initiator, recipient, amount, hashLock, timeLock)); + + uint256 public constant COUNTERPARTY_TIME_LOCK_DURATION = 24 * 60 * 60; // 24 hours + + function setUp() public { + // Deploy the MOVEToken contract and mint some tokens to the deployer + moveToken = new MockMOVEToken(); + moveToken.initialize(address(this)); // Contract will hold initial MOVE tokens + + // Time lock durations + uint256 initiatorTimeLockDuration = 48 * 60 * 60; // 48 hours for the initiator + uint256 counterpartyTimeLockDuration = 24 * 60 * 60; // 24 hours for the counterparty + + originator = vm.addr(uint256(keccak256(abi.encodePacked(block.timestamp, block.prevrandao)))); + + // Deploy the NativeBridgeInitiator contract with a 48-hour time lock + nativeBridgeInitiatorMOVEImplementation = new NativeBridgeInitiatorMOVE(); + proxyAdmin = new ProxyAdmin(deployer); + proxy = new TransparentUpgradeableProxy( + address(nativeBridgeInitiatorMOVEImplementation), + address(proxyAdmin), + abi.encodeWithSignature( + "initialize(address,address,uint256,uint256)", + address(moveToken), + deployer, + initiatorTimeLockDuration, + 0 ether // Initial pool balance + ) + ); + nativeBridgeInitiatorMOVE = NativeBridgeInitiatorMOVE(address(proxy)); + + // Deploy the NativeBridgeCounterparty contract with a 24-hour time lock + nativeBridgeCounterpartyMOVEImplementation = new NativeBridgeCounterpartyMOVE(); + proxy = new TransparentUpgradeableProxy( + address(nativeBridgeCounterpartyMOVEImplementation), + address(proxyAdmin), + abi.encodeWithSignature( + "initialize(address,address,uint256)", + address(nativeBridgeInitiatorMOVE), + deployer, + counterpartyTimeLockDuration + ) + ); + nativeBridgeCounterpartyMOVE = NativeBridgeCounterpartyMOVE(address(proxy)); + + // Set the counterparty contract in the NativeBridgeInitiator contract + vm.startPrank(deployer); + nativeBridgeInitiatorMOVE.setCounterpartyAddress(address(nativeBridgeCounterpartyMOVE)); + vm.stopPrank(); + } + + function testLockBridgeTransfer() public { + uint256 moveAmount = 100 * 10 ** 8; + moveToken.transfer(originator, moveAmount); + vm.startPrank(originator); + + // Approve the NativeBridgeInitiatorMOVE contract to spend MOVEToken + moveToken.approve(address(nativeBridgeInitiatorMOVE), amount); + + // Initiate the bridge transfer + nativeBridgeInitiatorMOVE.initiateBridgeTransfer(amount, initiator, hashLock); + + vm.stopPrank(); + + vm.startPrank(deployer); // Only the owner (deployer) can call lockBridgeTransfer + bool result = + nativeBridgeCounterpartyMOVE.lockBridgeTransfer(initiator, bridgeTransferId, hashLock, recipient, amount); + vm.stopPrank(); + + ( + bytes32 pendingInitiator, + address pendingRecipient, + uint256 pendingAmount, + bytes32 pendingHashLock, + uint256 pendingTimelock, + NativeBridgeCounterpartyMOVE.MessageState pendingState + ) = nativeBridgeCounterpartyMOVE.bridgeTransfers(bridgeTransferId); + + assert(result); + assertEq(pendingInitiator, initiator); + assertEq(pendingRecipient, recipient); + assertEq(pendingAmount, amount); + assertEq(pendingHashLock, hashLock); + assertGt(pendingTimelock, block.timestamp); + assertEq(uint8(pendingState), uint8(NativeBridgeCounterpartyMOVE.MessageState.PENDING)); + } + + function testCompleteBridgeTransfer() public { + bytes32 preImage = "secret"; + bytes32 testHashLock = keccak256(abi.encodePacked(preImage)); + + uint256 moveAmount = 100 * 10 ** 8; + moveToken.transfer(originator, moveAmount); + vm.startPrank(originator); + + // Approve the NativeBridgeInitiatorMOVE contract to spend MOVEToken + moveToken.approve(address(nativeBridgeInitiatorMOVE), amount); + + // Initiate the bridge transfer + nativeBridgeInitiatorMOVE.initiateBridgeTransfer(amount, initiator, testHashLock); + + vm.stopPrank(); + + vm.startPrank(deployer); // Only the owner (deployer) can call lockBridgeTransfer + nativeBridgeCounterpartyMOVE.lockBridgeTransfer(initiator, bridgeTransferId, testHashLock, recipient, amount); + vm.stopPrank(); + + vm.startPrank(otherUser); + + nativeBridgeCounterpartyMOVE.completeBridgeTransfer(bridgeTransferId, preImage); + + ( + bytes32 completedInitiator, + address completedRecipient, + uint256 completedAmount, + bytes32 completedHashLock, + uint256 completedTimeLock, + NativeBridgeCounterpartyMOVE.MessageState completedState + ) = nativeBridgeCounterpartyMOVE.bridgeTransfers(bridgeTransferId); + + assertEq(completedInitiator, initiator); + assertEq(completedRecipient, recipient); + assertEq(completedAmount, amount); + assertEq(completedHashLock, testHashLock); + assertGt(completedTimeLock, block.timestamp); + assertEq(uint8(completedState), uint8(NativeBridgeCounterpartyMOVE.MessageState.COMPLETED)); + + vm.stopPrank(); + } + + function testAbortBridgeTransfer() public { + uint256 moveAmount = 100 * 10 ** 8; + moveToken.transfer(originator, moveAmount); + vm.startPrank(originator); + + // Approve the NativeBridgeInitiatorMOVE contract to spend MOVEToken + moveToken.approve(address(nativeBridgeInitiatorMOVE), amount); + + // Initiate the bridge transfer + nativeBridgeInitiatorMOVE.initiateBridgeTransfer(amount, initiator, hashLock); + + vm.stopPrank(); + + vm.startPrank(deployer); + + nativeBridgeCounterpartyMOVE.lockBridgeTransfer(initiator, bridgeTransferId, hashLock, recipient, amount); + + vm.stopPrank(); + + // Advance the block number to beyond the timelock period + vm.warp(block.timestamp + COUNTERPARTY_TIME_LOCK_DURATION + 1); + + // Try to abort as a malicious user (this should fail) + //vm.startPrank(otherUser); + //vm.expectRevert("Ownable: caller is not the owner"); + //nativeBridgeCounterpartyMOVE.abortBridgeTransfer(bridgeTransferId); + //vm.stopPrank(); + + // Abort as the owner (this should pass) + vm.startPrank(deployer); // The deployer is the owner + nativeBridgeCounterpartyMOVE.abortBridgeTransfer(bridgeTransferId); + + ( + bytes32 abortedInitiator, + address abortedRecipient, + uint256 abortedAmount, + bytes32 abortedHashLock, + uint256 abortedTimeLock, + NativeBridgeCounterpartyMOVE.MessageState abortedState + ) = nativeBridgeCounterpartyMOVE.bridgeTransfers(bridgeTransferId); + + assertEq(abortedInitiator, initiator); + assertEq(abortedRecipient, recipient); + assertEq(abortedAmount, amount); + assertEq(abortedHashLock, hashLock); + assertLe(abortedTimeLock, block.timestamp, "Timelock is not less than or equal to current timestamp"); + assertEq(uint8(abortedState), uint8(NativeBridgeCounterpartyMOVE.MessageState.REFUNDED)); + + vm.stopPrank(); + } +} diff --git a/protocol-units/bridge/contracts/test/AtomicBridgeInitiatorMOVE.t.sol b/protocol-units/bridge/contracts/test/NativeBridgeInitiatorMOVE.t.sol similarity index 66% rename from protocol-units/bridge/contracts/test/AtomicBridgeInitiatorMOVE.t.sol rename to protocol-units/bridge/contracts/test/NativeBridgeInitiatorMOVE.t.sol index 0f676f154..c385b1253 100644 --- a/protocol-units/bridge/contracts/test/AtomicBridgeInitiatorMOVE.t.sol +++ b/protocol-units/bridge/contracts/test/NativeBridgeInitiatorMOVE.t.sol @@ -3,18 +3,22 @@ pragma solidity ^0.8.22; pragma abicoder v2; import {Test, console} from "forge-std/Test.sol"; -import {AtomicBridgeInitiatorMOVE, IAtomicBridgeInitiatorMOVE, OwnableUpgradeable} from "../src/AtomicBridgeInitiatorMOVE.sol"; +import { + NativeBridgeInitiatorMOVE, + INativeBridgeInitiatorMOVE, + OwnableUpgradeable +} from "../src/NativeBridgeInitiatorMOVE.sol"; import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; import {TransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; -import {MockMOVEToken} from "../src/MockMOVEToken.sol"; +import {MockMOVEToken} from "../src/MockMOVEToken.sol"; import {console} from "forge-std/console.sol"; -contract AtomicBridgeInitiatorMOVETest is Test { - AtomicBridgeInitiatorMOVE public atomicBridgeInitiatorImplementation; - MockMOVEToken public moveToken; +contract NativeBridgeInitiatorMOVETest is Test { + NativeBridgeInitiatorMOVE public nativeBridgeInitiatorImplementation; + MockMOVEToken public moveToken; ProxyAdmin public proxyAdmin; TransparentUpgradeableProxy public proxy; - AtomicBridgeInitiatorMOVE public atomicBridgeInitiatorMOVE; + NativeBridgeInitiatorMOVE public nativeBridgeInitiatorMOVE; address public originator = address(1); bytes32 public recipient = keccak256(abi.encodePacked(address(2))); @@ -29,40 +33,36 @@ contract AtomicBridgeInitiatorMOVETest is Test { originator = vm.addr(uint256(keccak256(abi.encodePacked(block.timestamp, block.prevrandao)))); - // Deploy the AtomicBridgeInitiatorMOVE contract - atomicBridgeInitiatorImplementation = new AtomicBridgeInitiatorMOVE(); + // Deploy the NativeBridgeInitiatorMOVE contract + nativeBridgeInitiatorImplementation = new NativeBridgeInitiatorMOVE(); proxyAdmin = new ProxyAdmin(msg.sender); proxy = new TransparentUpgradeableProxy( - address(atomicBridgeInitiatorImplementation), + address(nativeBridgeInitiatorImplementation), address(proxyAdmin), abi.encodeWithSignature( - "initialize(address,address,uint256,uint256)", - address(moveToken), - address(this), + "initialize(address,address,uint256,uint256)", + address(moveToken), + address(this), timeLockDuration, 0 ether ) ); - atomicBridgeInitiatorMOVE = AtomicBridgeInitiatorMOVE(address(proxy)); + nativeBridgeInitiatorMOVE = NativeBridgeInitiatorMOVE(address(proxy)); } function testInitiateBridgeTransferWithMove() public { - uint256 moveAmount = 100 * 10**8; + uint256 moveAmount = 100 * 10 ** 8; // Transfer moveAmount tokens to the originator and check initial balance - moveToken.transfer(originator, moveAmount); + moveToken.transfer(originator, moveAmount); uint256 initialBalance = moveToken.balanceOf(originator); vm.startPrank(originator); - moveToken.approve(address(atomicBridgeInitiatorMOVE), moveAmount); + moveToken.approve(address(nativeBridgeInitiatorMOVE), moveAmount); // Initiate the bridge transfer - bytes32 bridgeTransferId = atomicBridgeInitiatorMOVE.initiateBridgeTransfer( - moveAmount, - recipient, - hashLock - ); + bytes32 bridgeTransferId = nativeBridgeInitiatorMOVE.initiateBridgeTransfer(moveAmount, recipient, hashLock); // Verify the bridge transfer details ( @@ -71,15 +71,15 @@ contract AtomicBridgeInitiatorMOVETest is Test { bytes32 transferRecipient, bytes32 transferHashLock, uint256 transferTimeLock, - AtomicBridgeInitiatorMOVE.MessageState transferState - ) = atomicBridgeInitiatorMOVE.bridgeTransfers(bridgeTransferId); + NativeBridgeInitiatorMOVE.MessageState transferState + ) = nativeBridgeInitiatorMOVE.bridgeTransfers(bridgeTransferId); assertEq(transferAmount, moveAmount); assertEq(transferOriginator, originator); assertEq(transferRecipient, recipient); assertEq(transferHashLock, hashLock); assertGt(transferTimeLock, block.timestamp); - assertEq(uint8(transferState), uint8(AtomicBridgeInitiatorMOVE.MessageState.INITIALIZED)); + assertEq(uint8(transferState), uint8(NativeBridgeInitiatorMOVE.MessageState.INITIALIZED)); // Check the originator's MOVE balance after initiating the transfer uint256 finalBalance = moveToken.balanceOf(originator); @@ -91,25 +91,21 @@ contract AtomicBridgeInitiatorMOVETest is Test { function testCompleteBridgeTransfer() public { bytes32 secret = "secret"; bytes32 testHashLock = keccak256(abi.encodePacked(secret)); - uint256 moveAmount = 100 * 10**8; // 100 MOVEToken + uint256 moveAmount = 100 * 10 ** 8; // 100 MOVEToken // Transfer moveAmount tokens to the originator and check initial balance - moveToken.transfer(originator, moveAmount); + moveToken.transfer(originator, moveAmount); uint256 initialBalance = moveToken.balanceOf(originator); vm.startPrank(originator); - moveToken.approve(address(atomicBridgeInitiatorMOVE), moveAmount); + moveToken.approve(address(nativeBridgeInitiatorMOVE), moveAmount); // Initiate the bridge transfer - bytes32 bridgeTransferId = atomicBridgeInitiatorMOVE.initiateBridgeTransfer( - moveAmount, - recipient, - testHashLock - ); + bytes32 bridgeTransferId = nativeBridgeInitiatorMOVE.initiateBridgeTransfer(moveAmount, recipient, testHashLock); vm.stopPrank(); - atomicBridgeInitiatorMOVE.completeBridgeTransfer(bridgeTransferId, secret); + nativeBridgeInitiatorMOVE.completeBridgeTransfer(bridgeTransferId, secret); // Verify the bridge transfer details after completion ( @@ -118,15 +114,15 @@ contract AtomicBridgeInitiatorMOVETest is Test { bytes32 completedRecipient, bytes32 completedHashLock, uint256 completedTimeLock, - AtomicBridgeInitiatorMOVE.MessageState completedState - ) = atomicBridgeInitiatorMOVE.bridgeTransfers(bridgeTransferId); + NativeBridgeInitiatorMOVE.MessageState completedState + ) = nativeBridgeInitiatorMOVE.bridgeTransfers(bridgeTransferId); assertEq(completedAmount, moveAmount); assertEq(completedOriginator, originator); assertEq(completedRecipient, recipient); assertEq(completedHashLock, testHashLock); assertGt(completedTimeLock, block.timestamp); - assertEq(uint8(completedState), uint8(AtomicBridgeInitiatorMOVE.MessageState.COMPLETED)); + assertEq(uint8(completedState), uint8(NativeBridgeInitiatorMOVE.MessageState.COMPLETED)); // Ensure no changes to the originator's balance after the transfer is completed uint256 finalBalance = moveToken.balanceOf(originator); @@ -134,21 +130,17 @@ contract AtomicBridgeInitiatorMOVETest is Test { } function testRefundBridgeTransfer() public { - uint256 moveAmount = 100 * 10**8; // 100 MOVEToken + uint256 moveAmount = 100 * 10 ** 8; // 100 MOVEToken // Transfer moveAmount tokens to the originator and check initial balance moveToken.transfer(originator, moveAmount); uint256 initialBalance = moveToken.balanceOf(originator); vm.startPrank(originator); - moveToken.approve(address(atomicBridgeInitiatorMOVE), moveAmount); + moveToken.approve(address(nativeBridgeInitiatorMOVE), moveAmount); // Initiate the bridge transfer - bytes32 bridgeTransferId = atomicBridgeInitiatorMOVE.initiateBridgeTransfer( - moveAmount, - recipient, - hashLock - ); + bytes32 bridgeTransferId = nativeBridgeInitiatorMOVE.initiateBridgeTransfer(moveAmount, recipient, hashLock); vm.stopPrank(); // Advance time and block height to ensure the time lock has expired @@ -157,17 +149,16 @@ contract AtomicBridgeInitiatorMOVETest is Test { // Test that a non-owner cannot call refund vm.startPrank(originator); vm.expectRevert(abi.encodeWithSelector(OwnableUpgradeable.OwnableUnauthorizedAccount.selector, originator)); - atomicBridgeInitiatorMOVE.refundBridgeTransfer(bridgeTransferId); + nativeBridgeInitiatorMOVE.refundBridgeTransfer(bridgeTransferId); vm.stopPrank(); // Owner refunds the transfer vm.expectEmit(); - emit IAtomicBridgeInitiatorMOVE.BridgeTransferRefunded(bridgeTransferId); - atomicBridgeInitiatorMOVE.refundBridgeTransfer(bridgeTransferId); + emit INativeBridgeInitiatorMOVE.BridgeTransferRefunded(bridgeTransferId); + nativeBridgeInitiatorMOVE.refundBridgeTransfer(bridgeTransferId); // Verify that the originator receives the refund and the balance is restored uint256 finalBalance = moveToken.balanceOf(originator); assertEq(finalBalance, initialBalance, "MOVE balance mismatch"); } } - diff --git a/protocol-units/bridge/integration-tests/README.md b/protocol-units/bridge/integration-tests/README.md index b9837e94c..742280439 100644 --- a/protocol-units/bridge/integration-tests/README.md +++ b/protocol-units/bridge/integration-tests/README.md @@ -1,4 +1,4 @@ -# Running client integration tests against the atomic bridge +# Running client integration tests against the native bridge The client integration tests for the framework bridge modules are in `tests`: diff --git a/protocol-units/bridge/integration-tests/src/utils.rs b/protocol-units/bridge/integration-tests/src/utils.rs index 67a0aa090..8c6de6d4c 100644 --- a/protocol-units/bridge/integration-tests/src/utils.rs +++ b/protocol-units/bridge/integration-tests/src/utils.rs @@ -5,10 +5,10 @@ use aptos_sdk::{ coin_client::CoinClient, rest_client::Transaction, types::account_address::AccountAddress, }; use bridge_service::chains::bridge_contracts::{BridgeContract, BridgeContractError}; +use bridge_service::chains::movement::client_framework::MovementClientFramework; use bridge_service::chains::movement::utils::{ self as movement_utils, MovementAddress, MovementHash, }; -use bridge_service::chains::movement::client_framework::MovementClientFramework; use bridge_service::types::{Amount, BridgeAddress, BridgeTransferDetails, HashLock}; use serde_json::Value; use tracing::debug; @@ -146,7 +146,7 @@ pub async fn fetch_bridge_transfer_details( ) -> Result, anyhow::Error> { let rest_client = movement_client.rest_client(); let account_address = FRAMEWORK_ADDRESS; - let resource_tag = "0x1::atomic_bridge_store::SmartTableWrapper, 0x1::atomic_bridge_store::BridgeTransferDetails>"; + let resource_tag = "0x1::native_bridge_store::SmartTableWrapper, 0x1::native_bridge_store::BridgeTransferDetails>"; let resource_response = rest_client diff --git a/protocol-units/bridge/integration-tests/tests/bridge_e2e_test.rs b/protocol-units/bridge/integration-tests/tests/bridge_e2e_test.rs index f1719298b..ce9a24066 100644 --- a/protocol-units/bridge/integration-tests/tests/bridge_e2e_test.rs +++ b/protocol-units/bridge/integration-tests/tests/bridge_e2e_test.rs @@ -11,7 +11,7 @@ use bridge_integration_tests::TestHarness; use bridge_service::chains::bridge_contracts::BridgeContractError; use bridge_service::chains::bridge_contracts::BridgeContractEvent; use bridge_service::chains::ethereum::event_monitoring::EthMonitoring; -use bridge_service::chains::ethereum::types::AtomicBridgeInitiatorMOVE; +use bridge_service::chains::ethereum::types::NativeBridgeInitiatorMOVE; use bridge_service::chains::ethereum::utils::send_transaction; use bridge_service::chains::ethereum::utils::send_transaction_rules; use bridge_service::chains::{ @@ -43,7 +43,7 @@ async fn initiate_eth_bridge_transfer( .await?; let contract = - AtomicBridgeInitiatorMOVE::new(config.eth.eth_initiator_contract.parse()?, &rpc_provider); + NativeBridgeInitiatorMOVE::new(config.eth.eth_initiator_contract.parse()?, &rpc_provider); let initiator_address = BridgeAddress(EthAddress(initiator_address)); @@ -186,7 +186,7 @@ async fn test_movement_event() -> Result<(), anyhow::Error> { //Wait for the tx to be executed let _ = tokio::time::sleep(tokio::time::Duration::from_millis(2000)).await; let event_type = format!( - "{}::atomic_bridge_initiator::BridgeTransferStore", + "{}::native_bridge_initiator::BridgeTransferStore", config.movement.movement_native_address ); diff --git a/protocol-units/bridge/integration-tests/tests/bridge_e2e_test_framework.rs b/protocol-units/bridge/integration-tests/tests/bridge_e2e_test_framework.rs index 7a3eac8a2..2e74b7656 100644 --- a/protocol-units/bridge/integration-tests/tests/bridge_e2e_test_framework.rs +++ b/protocol-units/bridge/integration-tests/tests/bridge_e2e_test_framework.rs @@ -12,7 +12,7 @@ use bridge_service::{ bridge_contracts::{BridgeContractError, BridgeContractEvent}, ethereum::{ event_monitoring::EthMonitoring, - types::{AtomicBridgeInitiatorMOVE, EthAddress, MockMOVEToken}, + types::{NativeBridgeInitiatorMOVE, EthAddress, MockMOVEToken}, utils::{send_transaction, send_transaction_rules}, }, movement::{ @@ -85,7 +85,7 @@ async fn initiate_eth_bridge_transfer( info!("After token approval, transaction receipt: {:?}", transaction_receipt); let contract = - AtomicBridgeInitiatorMOVE::new(config.eth.eth_initiator_contract.parse()?, &rpc_provider); + NativeBridgeInitiatorMOVE::new(config.eth.eth_initiator_contract.parse()?, &rpc_provider); let initiator_address = BridgeAddress(EthAddress(initiator_address)); @@ -230,7 +230,7 @@ async fn test_movement_event() -> Result<(), anyhow::Error> { //Wait for the tx to be executed let _ = tokio::time::sleep(tokio::time::Duration::from_millis(2000)).await; let event_type = format!( - "{}::atomic_bridge_initiator::BridgeTransferStore", + "{}::native_bridge_initiator::BridgeTransferStore", config.movement.movement_native_address ); diff --git a/protocol-units/bridge/move-modules/scripts/enable_bridge_feature.move b/protocol-units/bridge/move-modules/scripts/enable_bridge_feature.move index 961b9297b..b6742646d 100644 --- a/protocol-units/bridge/move-modules/scripts/enable_bridge_feature.move +++ b/protocol-units/bridge/move-modules/scripts/enable_bridge_feature.move @@ -6,7 +6,7 @@ script { let framework_signer = aptos_governance::get_signer_testnet_only(core_resources, @0x1); let enabled_blob: vector = vector[ - features::get_atomic_bridge_feature() + features::get_native_bridge_feature() ]; let disabled_blob: vector = vector[]; diff --git a/protocol-units/bridge/move-modules/scripts/set_counterparty_time_lock_duration.move b/protocol-units/bridge/move-modules/scripts/set_counterparty_time_lock_duration.move index 20da131f4..947e5b1b0 100644 --- a/protocol-units/bridge/move-modules/scripts/set_counterparty_time_lock_duration.move +++ b/protocol-units/bridge/move-modules/scripts/set_counterparty_time_lock_duration.move @@ -1,9 +1,9 @@ script { use aptos_framework::aptos_governance; - use aptos_framework::atomic_bridge_configuration; + use aptos_framework::native_bridge_configuration; fun set_counterparty_time_lock_duration(core_resources: &signer, new_timelock: u64) { let framework_signer = aptos_governance::get_signer_testnet_only(core_resources, @aptos_framework); - atomic_bridge_configuration::set_counterparty_time_lock_duration(&framework_signer, new_timelock); + native_bridge_configuration::set_counterparty_time_lock_duration(&framework_signer, new_timelock); } } diff --git a/protocol-units/bridge/move-modules/scripts/set_initiator_time_lock_duration.move b/protocol-units/bridge/move-modules/scripts/set_initiator_time_lock_duration.move index 0e779bdcb..4d9a5b50a 100644 --- a/protocol-units/bridge/move-modules/scripts/set_initiator_time_lock_duration.move +++ b/protocol-units/bridge/move-modules/scripts/set_initiator_time_lock_duration.move @@ -1,9 +1,9 @@ script { use aptos_framework::aptos_governance; - use aptos_framework::atomic_bridge_configuration; + use aptos_framework::native_bridge_configuration; fun set_initiator_time_lock_duration(core_resources: &signer, new_timelock: u64) { let framework_signer = aptos_governance::get_signer_testnet_only(core_resources, @aptos_framework); - atomic_bridge_configuration::set_initiator_time_lock_duration(&framework_signer, new_timelock); + native_bridge_configuration::set_initiator_time_lock_duration(&framework_signer, new_timelock); } } diff --git a/protocol-units/bridge/move-modules/scripts/store_mint_burn_caps.move b/protocol-units/bridge/move-modules/scripts/store_mint_burn_caps.move index 0f43463f0..61dcc586c 100644 --- a/protocol-units/bridge/move-modules/scripts/store_mint_burn_caps.move +++ b/protocol-units/bridge/move-modules/scripts/store_mint_burn_caps.move @@ -1,13 +1,13 @@ script { use aptos_framework::aptos_governance; use aptos_framework::transaction_fee; - use aptos_framework::atomic_bridge; + use aptos_framework::native_bridge; fun store_mint_burn_caps(core_resources: &signer) { let framework_signer = aptos_governance::get_signer_testnet_only(core_resources, @aptos_framework); let (mint, burn) = transaction_fee::copy_capabilities_for_bridge(&framework_signer); - atomic_bridge::store_aptos_coin_mint_cap(&framework_signer, mint); - atomic_bridge::store_aptos_coin_burn_cap(&framework_signer, burn); + native_bridge::store_aptos_coin_mint_cap(&framework_signer, mint); + native_bridge::store_aptos_coin_burn_cap(&framework_signer, burn); } } diff --git a/protocol-units/bridge/move-modules/scripts/update_bridge_operator.move b/protocol-units/bridge/move-modules/scripts/update_bridge_operator.move index dc4ee8422..645c8ffd0 100644 --- a/protocol-units/bridge/move-modules/scripts/update_bridge_operator.move +++ b/protocol-units/bridge/move-modules/scripts/update_bridge_operator.move @@ -1,11 +1,11 @@ script { use aptos_framework::aptos_account; use aptos_framework::aptos_governance; - use aptos_framework::atomic_bridge_configuration; + use aptos_framework::native_bridge_configuration; fun update_bridge_operator(core_resources: &signer, new_operator: address) { let framework_signer = aptos_governance::get_signer_testnet_only(core_resources, @aptos_framework); - atomic_bridge_configuration::update_bridge_operator(&framework_signer, new_operator); + native_bridge_configuration::update_bridge_operator(&framework_signer, new_operator); aptos_account::create_account(@0x00000000000000000000000000face); } } diff --git a/protocol-units/bridge/service/abis/AtomicBridgeCounterpartyMOVE.json b/protocol-units/bridge/service/abis/NativeBridgeCounterpartyMOVE.json similarity index 95% rename from protocol-units/bridge/service/abis/AtomicBridgeCounterpartyMOVE.json rename to protocol-units/bridge/service/abis/NativeBridgeCounterpartyMOVE.json index 3bb3498a8..bbb18ec04 100644 --- a/protocol-units/bridge/service/abis/AtomicBridgeCounterpartyMOVE.json +++ b/protocol-units/bridge/service/abis/NativeBridgeCounterpartyMOVE.json @@ -1 +1 @@ -{"abi":[{"type":"function","name":"abortBridgeTransfer","inputs":[{"name":"bridgeTransferId","type":"bytes32","internalType":"bytes32"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"atomicBridgeInitiatorMOVE","inputs":[],"outputs":[{"name":"","type":"address","internalType":"contract AtomicBridgeInitiatorMOVE"}],"stateMutability":"view"},{"type":"function","name":"bridgeTransfers","inputs":[{"name":"","type":"bytes32","internalType":"bytes32"}],"outputs":[{"name":"originator","type":"bytes32","internalType":"bytes32"},{"name":"recipient","type":"address","internalType":"address"},{"name":"amount","type":"uint256","internalType":"uint256"},{"name":"hashLock","type":"bytes32","internalType":"bytes32"},{"name":"timeLock","type":"uint256","internalType":"uint256"},{"name":"state","type":"uint8","internalType":"enum AtomicBridgeCounterpartyMOVE.MessageState"}],"stateMutability":"view"},{"type":"function","name":"completeBridgeTransfer","inputs":[{"name":"bridgeTransferId","type":"bytes32","internalType":"bytes32"},{"name":"preImage","type":"bytes32","internalType":"bytes32"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"counterpartyTimeLockDuration","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"initialize","inputs":[{"name":"_atomicBridgeInitiator","type":"address","internalType":"address"},{"name":"owner","type":"address","internalType":"address"},{"name":"_timeLockDuration","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"lockBridgeTransfer","inputs":[{"name":"originator","type":"bytes32","internalType":"bytes32"},{"name":"bridgeTransferId","type":"bytes32","internalType":"bytes32"},{"name":"hashLock","type":"bytes32","internalType":"bytes32"},{"name":"recipient","type":"address","internalType":"address"},{"name":"amount","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"nonpayable"},{"type":"function","name":"owner","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"renounceOwnership","inputs":[],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setAtomicBridgeInitiator","inputs":[{"name":"_atomicBridgeInitiator","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setTimeLockDuration","inputs":[{"name":"_timeLockDuration","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"transferOwnership","inputs":[{"name":"newOwner","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"event","name":"BridgeTransferAborted","inputs":[{"name":"bridgeTransferId","type":"bytes32","indexed":true,"internalType":"bytes32"}],"anonymous":false},{"type":"event","name":"BridgeTransferCompleted","inputs":[{"name":"bridgeTransferId","type":"bytes32","indexed":true,"internalType":"bytes32"},{"name":"pre_image","type":"bytes32","indexed":false,"internalType":"bytes32"}],"anonymous":false},{"type":"event","name":"BridgeTransferLocked","inputs":[{"name":"bridgeTransferId","type":"bytes32","indexed":true,"internalType":"bytes32"},{"name":"recipient","type":"address","indexed":true,"internalType":"address"},{"name":"amount","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"hashLock","type":"bytes32","indexed":false,"internalType":"bytes32"},{"name":"timeLock","type":"uint256","indexed":false,"internalType":"uint256"}],"anonymous":false},{"type":"event","name":"Initialized","inputs":[{"name":"version","type":"uint64","indexed":false,"internalType":"uint64"}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"name":"previousOwner","type":"address","indexed":true,"internalType":"address"},{"name":"newOwner","type":"address","indexed":true,"internalType":"address"}],"anonymous":false},{"type":"error","name":"BridgeTransferHasBeenCompleted","inputs":[]},{"type":"error","name":"BridgeTransferInvalid","inputs":[]},{"type":"error","name":"BridgeTransferStateNotInitialized","inputs":[]},{"type":"error","name":"BridgeTransferStateNotPending","inputs":[]},{"type":"error","name":"InsufficientMOVEBalance","inputs":[]},{"type":"error","name":"InvalidInitialization","inputs":[]},{"type":"error","name":"InvalidSecret","inputs":[]},{"type":"error","name":"MOVETransferFailed","inputs":[]},{"type":"error","name":"NotInitializing","inputs":[]},{"type":"error","name":"OwnableInvalidOwner","inputs":[{"name":"owner","type":"address","internalType":"address"}]},{"type":"error","name":"OwnableUnauthorizedAccount","inputs":[{"name":"account","type":"address","internalType":"address"}]},{"type":"error","name":"TimeLockExpired","inputs":[]},{"type":"error","name":"TimeLockNotExpired","inputs":[]},{"type":"error","name":"Unauthorized","inputs":[]},{"type":"error","name":"ZeroAddress","inputs":[]},{"type":"error","name":"ZeroAmount","inputs":[]}],"bytecode":{"object":"0x6080604052348015600e575f80fd5b50610b418061001c5f395ff3fe608060405234801561000f575f80fd5b50600436106100b1575f3560e01c80638da5cb5b1161006e5780638da5cb5b1461014a57806396d17d491461017a5780639f8f879914610191578063c95b659f146101a4578063e0d9cbc4146101b7578063f2fde38b14610219575f80fd5b80631794bb3c146100b557806327b3ea07146100ca5780633b9b4640146100f257806371115eb21461011c578063715018a61461012f5780637ce0874814610137575b5f80fd5b6100c86100c336600461098f565b61022c565b005b6100dd6100d83660046109c9565b610382565b60405190151581526020015b60405180910390f35b5f54610104906001600160a01b031681565b6040516001600160a01b0390911681526020016100e9565b6100c861012a366004610a0c565b610572565b6100c861057f565b6100c8610145366004610a23565b610592565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b0316610104565b61018360025481565b6040519081526020016100e9565b6100c861019f366004610a43565b6105e2565b6100c86101b2366004610a0c565b610757565b6102076101c5366004610a0c565b600160208190525f91825260409091208054918101546002820154600383015460048401546005909401546001600160a01b0390931693919290919060ff1686565b6040516100e996959493929190610a77565b6100c8610227366004610a23565b610805565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff165f811580156102715750825b90505f8267ffffffffffffffff16600114801561028d5750303b155b90508115801561029b575080155b156102b95760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff1916600117855583156102e357845460ff60401b1916600160401b1785555b6001600160a01b03881661030a5760405163d92e233d60e01b815260040160405180910390fd5b5f80546001600160a01b0319166001600160a01b038a1617905561032d87610847565b6002869055831561037857845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b5050505050505050565b5f61038b610858565b815f036103ab57604051631f2a200560e01b815260040160405180910390fd5b5f546040805163258d975160e21b8152905184926001600160a01b0316916396365d449160048083019260209291908290030181865afa1580156103f1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104159190610acf565b1015610434576040516381a6aee360e01b815260040160405180910390fd5b5f600254426104439190610ae6565b90506040518060c00160405280888152602001856001600160a01b031681526020018481526020018681526020018281526020015f600281111561048957610489610a63565b90525f87815260016020818152604092839020845181559084015181830180546001600160a01b0319166001600160a01b0390921691909117905591830151600280840191909155606084015160038401556080840151600484015560a08401516005840180549193909260ff1990921691849081111561050c5761050c610a63565b0217905550506002546040805186815260208101899052908101919091526001600160a01b038616915087907fa03230f5967404ba170c5be8445486911e87267000597e4ba9ed9d4b014fa4bd9060600160405180910390a35060019695505050505050565b61057a610858565b600255565b610587610858565b6105905f6108b3565b565b61059a610858565b6001600160a01b0381166105c15760405163d92e233d60e01b815260040160405180910390fd5b5f80546001600160a01b0319166001600160a01b0392909216919091179055565b5f82815260016020526040812090600582015460ff16600281111561060957610609610a63565b146106275760405163a92c04c760e01b815260040160405180910390fd5b5f8260405160200161063b91815260200190565b604051602081830303815290604052805190602001209050816003015481146106775760405163abab6bd760e01b815260040160405180910390fd5b816004015442111561069c5760405163179a39d160e01b815260040160405180910390fd5b60058201805460ff191660019081179091555f5490830154600284015460405163cacfb16160e01b81526001600160a01b039283166004820152602481019190915291169063cacfb161906044015f604051808303815f87803b158015610701575f80fd5b505af1158015610713573d5f803e3d5ffd5b50505050837f05ddc886acde01b77731bfad1dcfb6abf529f05c28ea66556fe87429bb2789ea8460405161074991815260200190565b60405180910390a250505050565b61075f610858565b5f81815260016020526040812090600582015460ff16600281111561078657610786610a63565b146107a45760405163a92c04c760e01b815260040160405180910390fd5b806004015442116107c85760405163191f4d1b60e31b815260040160405180910390fd5b60058101805460ff1916600217905560405182907f9b398e0a546c4aa218ac0b98f5e2196a7aff605b50c19eb795f9cb3b2f5d5b55905f90a25050565b61080d610858565b6001600160a01b03811661083b57604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b610844816108b3565b50565b61084f610923565b6108448161096c565b3361088a7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b031690565b6001600160a01b0316146105905760405163118cdaa760e01b8152336004820152602401610832565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a3505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff1661059057604051631afcd79f60e31b815260040160405180910390fd5b61080d610923565b80356001600160a01b038116811461098a575f80fd5b919050565b5f805f606084860312156109a1575f80fd5b6109aa84610974565b92506109b860208501610974565b929592945050506040919091013590565b5f805f805f60a086880312156109dd575f80fd5b8535945060208601359350604086013592506109fb60608701610974565b949793965091946080013592915050565b5f60208284031215610a1c575f80fd5b5035919050565b5f60208284031215610a33575f80fd5b610a3c82610974565b9392505050565b5f8060408385031215610a54575f80fd5b50508035926020909101359150565b634e487b7160e01b5f52602160045260245ffd5b8681526001600160a01b038616602082015260408101859052606081018490526080810183905260c0810160038310610abe57634e487b7160e01b5f52602160045260245ffd5b8260a0830152979650505050505050565b5f60208284031215610adf575f80fd5b5051919050565b80820180821115610b0557634e487b7160e01b5f52601160045260245ffd5b9291505056fea2646970667358221220b3b8a3c1d782421f941dfc08fe283db1ea0a96a2ddf52fb3415fe6a21ae7a71e64736f6c634300081a0033","sourceMap":"319:3481:43:-:0;;;;;;;;;;;;;;;;;;;","linkReferences":{}},"deployedBytecode":{"object":"0x608060405234801561000f575f80fd5b50600436106100b1575f3560e01c80638da5cb5b1161006e5780638da5cb5b1461014a57806396d17d491461017a5780639f8f879914610191578063c95b659f146101a4578063e0d9cbc4146101b7578063f2fde38b14610219575f80fd5b80631794bb3c146100b557806327b3ea07146100ca5780633b9b4640146100f257806371115eb21461011c578063715018a61461012f5780637ce0874814610137575b5f80fd5b6100c86100c336600461098f565b61022c565b005b6100dd6100d83660046109c9565b610382565b60405190151581526020015b60405180910390f35b5f54610104906001600160a01b031681565b6040516001600160a01b0390911681526020016100e9565b6100c861012a366004610a0c565b610572565b6100c861057f565b6100c8610145366004610a23565b610592565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b0316610104565b61018360025481565b6040519081526020016100e9565b6100c861019f366004610a43565b6105e2565b6100c86101b2366004610a0c565b610757565b6102076101c5366004610a0c565b600160208190525f91825260409091208054918101546002820154600383015460048401546005909401546001600160a01b0390931693919290919060ff1686565b6040516100e996959493929190610a77565b6100c8610227366004610a23565b610805565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff165f811580156102715750825b90505f8267ffffffffffffffff16600114801561028d5750303b155b90508115801561029b575080155b156102b95760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff1916600117855583156102e357845460ff60401b1916600160401b1785555b6001600160a01b03881661030a5760405163d92e233d60e01b815260040160405180910390fd5b5f80546001600160a01b0319166001600160a01b038a1617905561032d87610847565b6002869055831561037857845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b5050505050505050565b5f61038b610858565b815f036103ab57604051631f2a200560e01b815260040160405180910390fd5b5f546040805163258d975160e21b8152905184926001600160a01b0316916396365d449160048083019260209291908290030181865afa1580156103f1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104159190610acf565b1015610434576040516381a6aee360e01b815260040160405180910390fd5b5f600254426104439190610ae6565b90506040518060c00160405280888152602001856001600160a01b031681526020018481526020018681526020018281526020015f600281111561048957610489610a63565b90525f87815260016020818152604092839020845181559084015181830180546001600160a01b0319166001600160a01b0390921691909117905591830151600280840191909155606084015160038401556080840151600484015560a08401516005840180549193909260ff1990921691849081111561050c5761050c610a63565b0217905550506002546040805186815260208101899052908101919091526001600160a01b038616915087907fa03230f5967404ba170c5be8445486911e87267000597e4ba9ed9d4b014fa4bd9060600160405180910390a35060019695505050505050565b61057a610858565b600255565b610587610858565b6105905f6108b3565b565b61059a610858565b6001600160a01b0381166105c15760405163d92e233d60e01b815260040160405180910390fd5b5f80546001600160a01b0319166001600160a01b0392909216919091179055565b5f82815260016020526040812090600582015460ff16600281111561060957610609610a63565b146106275760405163a92c04c760e01b815260040160405180910390fd5b5f8260405160200161063b91815260200190565b604051602081830303815290604052805190602001209050816003015481146106775760405163abab6bd760e01b815260040160405180910390fd5b816004015442111561069c5760405163179a39d160e01b815260040160405180910390fd5b60058201805460ff191660019081179091555f5490830154600284015460405163cacfb16160e01b81526001600160a01b039283166004820152602481019190915291169063cacfb161906044015f604051808303815f87803b158015610701575f80fd5b505af1158015610713573d5f803e3d5ffd5b50505050837f05ddc886acde01b77731bfad1dcfb6abf529f05c28ea66556fe87429bb2789ea8460405161074991815260200190565b60405180910390a250505050565b61075f610858565b5f81815260016020526040812090600582015460ff16600281111561078657610786610a63565b146107a45760405163a92c04c760e01b815260040160405180910390fd5b806004015442116107c85760405163191f4d1b60e31b815260040160405180910390fd5b60058101805460ff1916600217905560405182907f9b398e0a546c4aa218ac0b98f5e2196a7aff605b50c19eb795f9cb3b2f5d5b55905f90a25050565b61080d610858565b6001600160a01b03811661083b57604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b610844816108b3565b50565b61084f610923565b6108448161096c565b3361088a7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b031690565b6001600160a01b0316146105905760405163118cdaa760e01b8152336004820152602401610832565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a3505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff1661059057604051631afcd79f60e31b815260040160405180910390fd5b61080d610923565b80356001600160a01b038116811461098a575f80fd5b919050565b5f805f606084860312156109a1575f80fd5b6109aa84610974565b92506109b860208501610974565b929592945050506040919091013590565b5f805f805f60a086880312156109dd575f80fd5b8535945060208601359350604086013592506109fb60608701610974565b949793965091946080013592915050565b5f60208284031215610a1c575f80fd5b5035919050565b5f60208284031215610a33575f80fd5b610a3c82610974565b9392505050565b5f8060408385031215610a54575f80fd5b50508035926020909101359150565b634e487b7160e01b5f52602160045260245ffd5b8681526001600160a01b038616602082015260408101859052606081018490526080810183905260c0810160038310610abe57634e487b7160e01b5f52602160045260245ffd5b8260a0830152979650505050505050565b5f60208284031215610adf575f80fd5b5051919050565b80820180821115610b0557634e487b7160e01b5f52601160045260245ffd5b9291505056fea2646970667358221220b3b8a3c1d782421f941dfc08fe283db1ea0a96a2ddf52fb3415fe6a21ae7a71e64736f6c634300081a0033","sourceMap":"319:3481:43:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;925:420;;;;;;:::i;:::-;;:::i;:::-;;1754:916;;;;;;:::i;:::-;;:::i;:::-;;;1403:14:57;;1396:22;1378:41;;1366:2;1351:18;1754:916:43;;;;;;;;701:58;;;;;-1:-1:-1;;;;;701:58:43;;;;;;-1:-1:-1;;;;;1629:32:57;;;1611:51;;1599:2;1584:18;701:58:43;1430:238:57;1608:140:43;;;;;;:::i;:::-;;:::i;3155:101:23:-;;;:::i;1351:251:43:-;;;;;;:::i;:::-;;:::i;2441:144:23:-;1313:22;2570:8;-1:-1:-1;;;;;2570:8:23;2441:144;;875:43:43;;;;;;;;;2449:25:57;;;2437:2;2422:18;875:43:43;2303:177:57;2676:680:43;;;;;;:::i;:::-;;:::i;3362:436::-;;;;;;:::i;:::-;;:::i;765:64::-;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;765:64:43;;;;;;;;;;;;;;;;;;;;;;;;;:::i;3405:215:23:-;;;;;;:::i;:::-;;:::i;925:420:43:-;8870:21:24;4302:15;;-1:-1:-1;;;4302:15:24;;;;4301:16;;4348:14;;4158:30;4726:16;;:34;;;;;4746:14;4726:34;4706:54;;4770:17;4790:11;:16;;4805:1;4790:16;:50;;;;-1:-1:-1;4818:4:24;4810:25;:30;4790:50;4770:70;;4856:12;4855:13;:30;;;;;4873:12;4872:13;4855:30;4851:91;;;4908:23;;-1:-1:-1;;;4908:23:24;;;;;;;;;;;4851:91;4951:18;;-1:-1:-1;;4951:18:24;4968:1;4951:18;;;4979:67;;;;5013:22;;-1:-1:-1;;;;5013:22:24;-1:-1:-1;;;5013:22:24;;;4979:67;-1:-1:-1;;;;;1052:36:43;::::1;1048:62;;1097:13;;-1:-1:-1::0;;;1097:13:43::1;;;;;;;;;;;1048:62;1120:25;:77:::0;;-1:-1:-1;;;;;;1120:77:43::1;-1:-1:-1::0;;;;;1120:77:43;::::1;;::::0;;1207:21:::1;1222:5:::0;1207:14:::1;:21::i;:::-;1290:28;:48:::0;;;5066:101:24;;;;5100:23;;-1:-1:-1;;;;5100:23:24;;;5142:14;;-1:-1:-1;4087:50:57;;5142:14:24;;4075:2:57;4060:18;5142:14:24;;;;;;;5066:101;4092:1081;;;;;925:420:43;;;:::o;1754:916::-;1955:4;2334:13:23;:11;:13::i;:::-;1975:6:43::1;1985:1;1975:11:::0;1971:36:::1;;1995:12;;-1:-1:-1::0;;;1995:12:43::1;;;;;;;;;;;1971:36;2021:25;::::0;:39:::1;::::0;;-1:-1:-1;;;2021:39:43;;;;2063:6;;-1:-1:-1;;;;;2021:25:43::1;::::0;:37:::1;::::0;:39:::1;::::0;;::::1;::::0;::::1;::::0;;;;;;;;:25;:39:::1;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:48;2017:86;;;2078:25;;-1:-1:-1::0;;;2078:25:43::1;;;;;;;;;;;2017:86;2181:16;2218:28;;2200:15;:46;;;;:::i;:::-;2181:65;;2293:236;;;;;;;;2375:10;2293:236;;;;2340:9;-1:-1:-1::0;;;;;2293:236:43::1;;;;;2407:6;2293:236;;;;2437:8;2293:236;;;;2469:8;2293:236;;;;2498:20;2293:236;;;;;;;;:::i;:::-;::::0;;2257:33:::1;::::0;;;:15:::1;:33;::::0;;;;;;;;:272;;;;;;::::1;::::0;;;::::1;::::0;;-1:-1:-1;;;;;;2257:272:43::1;-1:-1:-1::0;;;;;2257:272:43;;::::1;::::0;;;::::1;::::0;;;;::::1;::::0;::::1;::::0;;::::1;::::0;;;;::::1;::::0;::::1;::::0;::::1;::::0;::::1;::::0;::::1;::::0;::::1;::::0;::::1;::::0;::::1;::::0;::::1;::::0;::::1;::::0;::::1;::::0;::::1;::::0;;;;;;-1:-1:-1;;2257:272:43;;::::1;::::0;;;;::::1;;;;;;:::i;:::-;;;::::0;;-1:-1:-1;;2613:28:43::1;::::0;2545:97:::1;::::0;;4766:25:57;;;4822:2;4807:18;;4800:34;;;4850:18;;;4843:34;;;;-1:-1:-1;;;;;2545:97:43;::::1;::::0;-1:-1:-1;2566:16:43;;2545:97:::1;::::0;4754:2:57;4739:18;2545:97:43::1;;;;;;;-1:-1:-1::0;2659:4:43::1;::::0;1754:916;-1:-1:-1;;;;;;1754:916:43:o;1608:140::-;2334:13:23;:11;:13::i;:::-;1693:28:43::1;:48:::0;1608:140::o;3155:101:23:-;2334:13;:11;:13::i;:::-;3219:30:::1;3246:1;3219:18;:30::i;:::-;3155:101::o:0;1351:251:43:-;2334:13:23;:11;:13::i;:::-;-1:-1:-1;;;;;1450:36:43;::::1;1446:62;;1495:13;;-1:-1:-1::0;;;1495:13:43::1;;;;;;;;;;;1446:62;1518:25;:77:::0;;-1:-1:-1;;;;;;1518:77:43::1;-1:-1:-1::0;;;;;1518:77:43;;;::::1;::::0;;;::::1;::::0;;1351:251::o;2676:680::-;2771:37;2811:33;;;:15;:33;;;;;;2858:13;;;;;;:37;;;;;;;;:::i;:::-;;2854:81;;2904:31;;-1:-1:-1;;;2904:31:43;;;;;;;;;;;2854:81;2945:20;2995:8;2978:26;;;;;;5017:19:57;;5061:2;5052:12;;4888:182;2978:26:43;;;;;;;;;;;;;2968:37;;;;;;2945:60;;3035:7;:16;;;3019:12;:32;3015:60;;3060:15;;-1:-1:-1;;;3060:15:43;;;;;;;;;;;3015:60;3107:7;:16;;;3089:15;:34;3085:64;;;3132:17;;-1:-1:-1;;;3132:17:43;;;;;;;;;;;3085:64;3160:13;;;:38;;-1:-1:-1;;3160:38:43;3176:22;3160:38;;;;;;-1:-1:-1;3209:25:43;3248:17;;;;3267:14;;;;3209:73;;-1:-1:-1;;;3209:73:43;;-1:-1:-1;;;;;3248:17:43;;;3209:73;;;5249:51:57;5316:18;;;5309:34;;;;3209:25:43;;;:38;;5222:18:57;;3209:73:43;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3322:16;3298:51;3340:8;3298:51;;;;2449:25:57;;2437:2;2422:18;;2303:177;3298:51:43;;;;;;;;2761:595;;2676:680;;:::o;3362:436::-;2334:13:23;:11;:13::i;:::-;3446:37:43::1;3486:33:::0;;;:15:::1;:33;::::0;;;;;3533:13:::1;::::0;::::1;::::0;::::1;;:37;::::0;::::1;;;;;;:::i;:::-;;3529:81;;3579:31;;-1:-1:-1::0;;;3579:31:43::1;;;;;;;;;;;3529:81;3643:7;:16;;;3624:15;:35;3620:68;;3668:20;;-1:-1:-1::0;;;3668:20:43::1;;;;;;;;;;;3620:68;3699:13;::::0;::::1;:37:::0;;-1:-1:-1;;3699:37:43::1;3715:21;3699:37;::::0;;3752:39:::1;::::0;3774:16;;3752:39:::1;::::0;-1:-1:-1;;3752:39:43::1;3436:362;3362:436:::0;:::o;3405:215:23:-;2334:13;:11;:13::i;:::-;-1:-1:-1;;;;;3489:22:23;::::1;3485:91;;3534:31;::::0;-1:-1:-1;;;3534:31:23;;3562:1:::1;3534:31;::::0;::::1;1611:51:57::0;1584:18;;3534:31:23::1;;;;;;;;3485:91;3585:28;3604:8;3585:18;:28::i;:::-;3405:215:::0;:::o;1847:127::-;6931:20:24;:18;:20::i;:::-;1929:38:23::1;1954:12;1929:24;:38::i;2658:162::-:0;966:10:26;2717:7:23;1313:22;2570:8;-1:-1:-1;;;;;2570:8:23;;2441:144;2717:7;-1:-1:-1;;;;;2717:23:23;;2713:101;;2763:40;;-1:-1:-1;;;2763:40:23;;966:10:26;2763:40:23;;;1611:51:57;1584:18;;2763:40:23;1430:238:57;3774:248:23;1313:22;3923:8;;-1:-1:-1;;;;;;3941:19:23;;-1:-1:-1;;;;;3941:19:23;;;;;;;;3975:40;;3923:8;;;;;3975:40;;3847:24;;3975:40;3837:185;;3774:248;:::o;7084:141:24:-;8870:21;8560:40;-1:-1:-1;;;8560:40:24;;;;7146:73;;7191:17;;-1:-1:-1;;;7191:17:24;;;;;;;;;;;1980:235:23;6931:20:24;:18;:20::i;14:173:57:-;82:20;;-1:-1:-1;;;;;131:31:57;;121:42;;111:70;;177:1;174;167:12;111:70;14:173;;;:::o;192:374::-;269:6;277;285;338:2;326:9;317:7;313:23;309:32;306:52;;;354:1;351;344:12;306:52;377:29;396:9;377:29;:::i;:::-;367:39;;425:38;459:2;448:9;444:18;425:38;:::i;:::-;192:374;;415:48;;-1:-1:-1;;;532:2:57;517:18;;;;504:32;;192:374::o;571:662::-;666:6;674;682;690;698;751:3;739:9;730:7;726:23;722:33;719:53;;;768:1;765;758:12;719:53;813:23;;;-1:-1:-1;933:2:57;918:18;;905:32;;-1:-1:-1;1036:2:57;1021:18;;1008:32;;-1:-1:-1;1085:38:57;1119:2;1104:18;;1085:38;:::i;:::-;571:662;;;;-1:-1:-1;571:662:57;;1196:3;1181:19;1168:33;;571:662;-1:-1:-1;;571:662:57:o;1673:226::-;1732:6;1785:2;1773:9;1764:7;1760:23;1756:32;1753:52;;;1801:1;1798;1791:12;1753:52;-1:-1:-1;1846:23:57;;1673:226;-1:-1:-1;1673:226:57:o;1904:186::-;1963:6;2016:2;2004:9;1995:7;1991:23;1987:32;1984:52;;;2032:1;2029;2022:12;1984:52;2055:29;2074:9;2055:29;:::i;:::-;2045:39;1904:186;-1:-1:-1;;;1904:186:57:o;2485:346::-;2553:6;2561;2614:2;2602:9;2593:7;2589:23;2585:32;2582:52;;;2630:1;2627;2620:12;2582:52;-1:-1:-1;;2675:23:57;;;2795:2;2780:18;;;2767:32;;-1:-1:-1;2485:346:57:o;3067:127::-;3128:10;3123:3;3119:20;3116:1;3109:31;3159:4;3156:1;3149:15;3183:4;3180:1;3173:15;3199:730;3502:25;;;-1:-1:-1;;;;;3563:32:57;;3558:2;3543:18;;3536:60;3627:2;3612:18;;3605:34;;;3670:2;3655:18;;3648:34;;;3713:3;3698:19;;3691:35;;;3489:3;3474:19;;3756:1;3745:13;;3735:144;;3801:10;3796:3;3792:20;3789:1;3782:31;3836:4;3833:1;3826:15;3864:4;3861:1;3854:15;3735:144;3916:6;3910:3;3899:9;3895:19;3888:35;3199:730;;;;;;;;;:::o;4148:184::-;4218:6;4271:2;4259:9;4250:7;4246:23;4242:32;4239:52;;;4287:1;4284;4277:12;4239:52;-1:-1:-1;4310:16:57;;4148:184;-1:-1:-1;4148:184:57:o;4337:222::-;4402:9;;;4423:10;;;4420:133;;;4475:10;4470:3;4466:20;4463:1;4456:31;4510:4;4507:1;4500:15;4538:4;4535:1;4528:15;4420:133;4337:222;;;;:::o","linkReferences":{}},"methodIdentifiers":{"abortBridgeTransfer(bytes32)":"c95b659f","atomicBridgeInitiatorMOVE()":"3b9b4640","bridgeTransfers(bytes32)":"e0d9cbc4","completeBridgeTransfer(bytes32,bytes32)":"9f8f8799","counterpartyTimeLockDuration()":"96d17d49","initialize(address,address,uint256)":"1794bb3c","lockBridgeTransfer(bytes32,bytes32,bytes32,address,uint256)":"27b3ea07","owner()":"8da5cb5b","renounceOwnership()":"715018a6","setAtomicBridgeInitiator(address)":"7ce08748","setTimeLockDuration(uint256)":"71115eb2","transferOwnership(address)":"f2fde38b"},"rawMetadata":"{\"compiler\":{\"version\":\"0.8.26+commit.8a97fa7a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"BridgeTransferHasBeenCompleted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BridgeTransferInvalid\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BridgeTransferStateNotInitialized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BridgeTransferStateNotPending\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientMOVEBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidInitialization\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSecret\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MOVETransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotInitializing\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"OwnableInvalidOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"OwnableUnauthorizedAccount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TimeLockExpired\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TimeLockNotExpired\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Unauthorized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAmount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"bridgeTransferId\",\"type\":\"bytes32\"}],\"name\":\"BridgeTransferAborted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"bridgeTransferId\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"pre_image\",\"type\":\"bytes32\"}],\"name\":\"BridgeTransferCompleted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"bridgeTransferId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"hashLock\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"timeLock\",\"type\":\"uint256\"}],\"name\":\"BridgeTransferLocked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"version\",\"type\":\"uint64\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"bridgeTransferId\",\"type\":\"bytes32\"}],\"name\":\"abortBridgeTransfer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"atomicBridgeInitiatorMOVE\",\"outputs\":[{\"internalType\":\"contract AtomicBridgeInitiatorMOVE\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"bridgeTransfers\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"originator\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"hashLock\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"timeLock\",\"type\":\"uint256\"},{\"internalType\":\"enum AtomicBridgeCounterpartyMOVE.MessageState\",\"name\":\"state\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"bridgeTransferId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"preImage\",\"type\":\"bytes32\"}],\"name\":\"completeBridgeTransfer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"counterpartyTimeLockDuration\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_atomicBridgeInitiator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_timeLockDuration\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originator\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"bridgeTransferId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"hashLock\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"lockBridgeTransfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_atomicBridgeInitiator\",\"type\":\"address\"}],\"name\":\"setAtomicBridgeInitiator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_timeLockDuration\",\"type\":\"uint256\"}],\"name\":\"setTimeLockDuration\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"InvalidInitialization()\":[{\"details\":\"The contract is already initialized.\"}],\"NotInitializing()\":[{\"details\":\"The contract is not initializing.\"}],\"OwnableInvalidOwner(address)\":[{\"details\":\"The owner is not a valid owner account. (eg. `address(0)`)\"}],\"OwnableUnauthorizedAccount(address)\":[{\"details\":\"The caller account is not authorized to perform an operation.\"}]},\"events\":{\"Initialized(uint64)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"abortBridgeTransfer(bytes32)\":{\"details\":\"Cancels the bridge transfer and refunds the initiator if the timelock has expired\",\"params\":{\"bridgeTransferId\":\"Unique identifier for the BridgeTransfer\"}},\"completeBridgeTransfer(bytes32,bytes32)\":{\"details\":\"Completes the bridge transfer and withdraws WETH to the recipient\",\"params\":{\"bridgeTransferId\":\"Unique identifier for the BridgeTransfer\",\"preImage\":\"The secret that unlocks the funds\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/AtomicBridgeCounterpartyMOVE.sol\":\"AtomicBridgeCounterpartyMOVE\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[\":@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/\",\":@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/\",\":ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/\",\":erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/\",\":forge-std/=lib/forge-std/src/\",\":halmos-cheatcodes/=lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/\",\":openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/\",\":openzeppelin-contracts/=lib/openzeppelin-contracts/\"]},\"sources\":{\"lib/openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"keccak256\":\"0xc163fcf9bb10138631a9ba5564df1fa25db9adff73bd9ee868a8ae1858fe093a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9706d43a0124053d9880f6e31a59f31bc0a6a3dc1acd66ce0a16e1111658c5f6\",\"dweb:/ipfs/QmUFmfowzkRwGtDu36cXV9SPTBHJ3n7dG9xQiK5B28jTf2\"]},\"lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"keccak256\":\"0x631188737069917d2f909d29ce62c4d48611d326686ba6683e26b72a23bfac0b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7a61054ae84cd6c4d04c0c4450ba1d6de41e27e0a2c4f1bcdf58f796b401c609\",\"dweb:/ipfs/QmUvtdp7X1mRVyC3CsHrtPbgoqWaXHp3S1ZR24tpAQYJWM\"]},\"lib/openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\":{\"keccak256\":\"0x5a5f22721ffb66d3e1ecc568c0d37c91f91223d8663c8a5e78396e780b849c72\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bdd108133c98ea251513424bf17905090c8a7e0755562a6d12a81b8bccbd6152\",\"dweb:/ipfs/QmahpnB63Up9aVx4jDqxEgry5BRN5itHRvy9rwBvMT2yqL\"]},\"lib/openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"keccak256\":\"0xdbef5f0c787055227243a7318ef74c8a5a1108ca3a07f2b3a00ef67769e1e397\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://08e39f23d5b4692f9a40803e53a8156b72b4c1f9902a88cd65ba964db103dab9\",\"dweb:/ipfs/QmPKn6EYDgpga7KtpkA8wV2yJCYGMtc9K4LkJfhKX2RVSV\"]},\"lib/openzeppelin-contracts/contracts/interfaces/draft-IERC6093.sol\":{\"keccak256\":\"0x9cac1f97ecc92043dd19235d6677e40cf6bac382886a94f7a80a957846b24229\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a1e0c924e0edfdfd4abceeb552d99f1cd95c0d387b38ccb1f67c583607e3d155\",\"dweb:/ipfs/QmZAi6qKa66zuS3jyEhsQR9bBNnZe1wSognYqw9nvseyUz\"]},\"lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0xee2337af2dc162a973b4be6d3f7c16f06298259e0af48c5470d2839bfa8a22f4\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://30c476b4b2f405c1bb3f0bae15b006d129c80f1bfd9d0f2038160a3bb9745009\",\"dweb:/ipfs/Qmb3VcuDufv6xbHeVgksC4tHpc5gKYVqBEwjEXW72XzSvN\"]},\"lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"keccak256\":\"0x88f7b6f070ad1de2bf899da6978ed74b5038eac78c01b7359b92b60c3d965c28\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c436edb6733a036607c6f17cc590e8ee351363a8cb4c564a98d9a66392c89323\",\"dweb:/ipfs/QmcJvJR2K3EtYcKEXVpQ1WqT6TvAbVem5HR1FirAsqEXFR\"]},\"src/AtomicBridgeCounterpartyMOVE.sol\":{\"keccak256\":\"0xed0faadcc2d86d20e6b8ddcafc8465007800c72caa5798c12cdb51ce9e06386e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2da6e0c975c882f4f4db39bf810e9d467a5e8c11ab3cf8e4b39112a590eb3827\",\"dweb:/ipfs/QmQy1UVG76s1kFW53EduMmm6UaHbUwXpwLHRUqYxExpiut\"]},\"src/AtomicBridgeInitiatorMOVE.sol\":{\"keccak256\":\"0xb6431a67dd2961b54aeed2a51a2f1c3a80a8fbe42b1fdbecaff64ed542eb138c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://051743bcc1f901d33fbdfcd307f317909e5c5442adb088f49cf05d245bec7f89\",\"dweb:/ipfs/QmVywZzJ5K56U58X46W4A6jKcQDfwmZiyFWZFF3utWWKmV\"]},\"src/IAtomicBridgeCounterpartyMOVE.sol\":{\"keccak256\":\"0xfc0edebea7371d55fc8ea04b31180bb20d935e876b0c616a57c36ac91964c83a\",\"urls\":[\"bzz-raw://5c55ae7cdd96a16dd30f1fab4c59eba565c3d08f56884231a054adec45c2ace8\",\"dweb:/ipfs/QmURFF2khftD1FpUnAhtTxV1z7wW5wnQYcP4FkjtWDyy1p\"]},\"src/IAtomicBridgeInitiatorMOVE.sol\":{\"keccak256\":\"0x3705cbaaf8910b786e5cb99d8d1bfa3f591add9a1d835703a69d6a77020ad841\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://12cca43905283adf49be8a23853952b90be09d3ba38b583fd8c2821e97ad8c0a\",\"dweb:/ipfs/QmaxHt6YUKb97dCz1rUjvjfM3XLcoLNvoFrUkDA6a77ER5\"]},\"src/MockMOVEToken.sol\":{\"keccak256\":\"0x71768bf12ff974ee8589bee8b951fa63c7db1f74f251c5997232643bc749a8e4\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://38474add7fec1c814adf1ad614e4ca233b9f789f279690c698a3a94334c029cf\",\"dweb:/ipfs/Qmah2K8YEmLqnKjXcGvbSD55sm61zkKVvNMhehmrj6VzBs\"]}},\"version\":1}","metadata":{"compiler":{"version":"0.8.26+commit.8a97fa7a"},"language":"Solidity","output":{"abi":[{"inputs":[],"type":"error","name":"BridgeTransferHasBeenCompleted"},{"inputs":[],"type":"error","name":"BridgeTransferInvalid"},{"inputs":[],"type":"error","name":"BridgeTransferStateNotInitialized"},{"inputs":[],"type":"error","name":"BridgeTransferStateNotPending"},{"inputs":[],"type":"error","name":"InsufficientMOVEBalance"},{"inputs":[],"type":"error","name":"InvalidInitialization"},{"inputs":[],"type":"error","name":"InvalidSecret"},{"inputs":[],"type":"error","name":"MOVETransferFailed"},{"inputs":[],"type":"error","name":"NotInitializing"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"type":"error","name":"OwnableInvalidOwner"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"type":"error","name":"OwnableUnauthorizedAccount"},{"inputs":[],"type":"error","name":"TimeLockExpired"},{"inputs":[],"type":"error","name":"TimeLockNotExpired"},{"inputs":[],"type":"error","name":"Unauthorized"},{"inputs":[],"type":"error","name":"ZeroAddress"},{"inputs":[],"type":"error","name":"ZeroAmount"},{"inputs":[{"internalType":"bytes32","name":"bridgeTransferId","type":"bytes32","indexed":true}],"type":"event","name":"BridgeTransferAborted","anonymous":false},{"inputs":[{"internalType":"bytes32","name":"bridgeTransferId","type":"bytes32","indexed":true},{"internalType":"bytes32","name":"pre_image","type":"bytes32","indexed":false}],"type":"event","name":"BridgeTransferCompleted","anonymous":false},{"inputs":[{"internalType":"bytes32","name":"bridgeTransferId","type":"bytes32","indexed":true},{"internalType":"address","name":"recipient","type":"address","indexed":true},{"internalType":"uint256","name":"amount","type":"uint256","indexed":false},{"internalType":"bytes32","name":"hashLock","type":"bytes32","indexed":false},{"internalType":"uint256","name":"timeLock","type":"uint256","indexed":false}],"type":"event","name":"BridgeTransferLocked","anonymous":false},{"inputs":[{"internalType":"uint64","name":"version","type":"uint64","indexed":false}],"type":"event","name":"Initialized","anonymous":false},{"inputs":[{"internalType":"address","name":"previousOwner","type":"address","indexed":true},{"internalType":"address","name":"newOwner","type":"address","indexed":true}],"type":"event","name":"OwnershipTransferred","anonymous":false},{"inputs":[{"internalType":"bytes32","name":"bridgeTransferId","type":"bytes32"}],"stateMutability":"nonpayable","type":"function","name":"abortBridgeTransfer"},{"inputs":[],"stateMutability":"view","type":"function","name":"atomicBridgeInitiatorMOVE","outputs":[{"internalType":"contract AtomicBridgeInitiatorMOVE","name":"","type":"address"}]},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function","name":"bridgeTransfers","outputs":[{"internalType":"bytes32","name":"originator","type":"bytes32"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes32","name":"hashLock","type":"bytes32"},{"internalType":"uint256","name":"timeLock","type":"uint256"},{"internalType":"enum AtomicBridgeCounterpartyMOVE.MessageState","name":"state","type":"uint8"}]},{"inputs":[{"internalType":"bytes32","name":"bridgeTransferId","type":"bytes32"},{"internalType":"bytes32","name":"preImage","type":"bytes32"}],"stateMutability":"nonpayable","type":"function","name":"completeBridgeTransfer"},{"inputs":[],"stateMutability":"view","type":"function","name":"counterpartyTimeLockDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}]},{"inputs":[{"internalType":"address","name":"_atomicBridgeInitiator","type":"address"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"_timeLockDuration","type":"uint256"}],"stateMutability":"nonpayable","type":"function","name":"initialize"},{"inputs":[{"internalType":"bytes32","name":"originator","type":"bytes32"},{"internalType":"bytes32","name":"bridgeTransferId","type":"bytes32"},{"internalType":"bytes32","name":"hashLock","type":"bytes32"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"nonpayable","type":"function","name":"lockBridgeTransfer","outputs":[{"internalType":"bool","name":"","type":"bool"}]},{"inputs":[],"stateMutability":"view","type":"function","name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}]},{"inputs":[],"stateMutability":"nonpayable","type":"function","name":"renounceOwnership"},{"inputs":[{"internalType":"address","name":"_atomicBridgeInitiator","type":"address"}],"stateMutability":"nonpayable","type":"function","name":"setAtomicBridgeInitiator"},{"inputs":[{"internalType":"uint256","name":"_timeLockDuration","type":"uint256"}],"stateMutability":"nonpayable","type":"function","name":"setTimeLockDuration"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"stateMutability":"nonpayable","type":"function","name":"transferOwnership"}],"devdoc":{"kind":"dev","methods":{"abortBridgeTransfer(bytes32)":{"details":"Cancels the bridge transfer and refunds the initiator if the timelock has expired","params":{"bridgeTransferId":"Unique identifier for the BridgeTransfer"}},"completeBridgeTransfer(bytes32,bytes32)":{"details":"Completes the bridge transfer and withdraws WETH to the recipient","params":{"bridgeTransferId":"Unique identifier for the BridgeTransfer","preImage":"The secret that unlocks the funds"}},"owner()":{"details":"Returns the address of the current owner."},"renounceOwnership()":{"details":"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner."},"transferOwnership(address)":{"details":"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner."}},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"remappings":["@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/","@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/","ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/","erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/","forge-std/=lib/forge-std/src/","halmos-cheatcodes/=lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/","openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/","openzeppelin-contracts/=lib/openzeppelin-contracts/"],"optimizer":{"enabled":true,"runs":200},"metadata":{"bytecodeHash":"ipfs"},"compilationTarget":{"src/AtomicBridgeCounterpartyMOVE.sol":"AtomicBridgeCounterpartyMOVE"},"evmVersion":"cancun","libraries":{}},"sources":{"lib/openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol":{"keccak256":"0xc163fcf9bb10138631a9ba5564df1fa25db9adff73bd9ee868a8ae1858fe093a","urls":["bzz-raw://9706d43a0124053d9880f6e31a59f31bc0a6a3dc1acd66ce0a16e1111658c5f6","dweb:/ipfs/QmUFmfowzkRwGtDu36cXV9SPTBHJ3n7dG9xQiK5B28jTf2"],"license":"MIT"},"lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol":{"keccak256":"0x631188737069917d2f909d29ce62c4d48611d326686ba6683e26b72a23bfac0b","urls":["bzz-raw://7a61054ae84cd6c4d04c0c4450ba1d6de41e27e0a2c4f1bcdf58f796b401c609","dweb:/ipfs/QmUvtdp7X1mRVyC3CsHrtPbgoqWaXHp3S1ZR24tpAQYJWM"],"license":"MIT"},"lib/openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol":{"keccak256":"0x5a5f22721ffb66d3e1ecc568c0d37c91f91223d8663c8a5e78396e780b849c72","urls":["bzz-raw://bdd108133c98ea251513424bf17905090c8a7e0755562a6d12a81b8bccbd6152","dweb:/ipfs/QmahpnB63Up9aVx4jDqxEgry5BRN5itHRvy9rwBvMT2yqL"],"license":"MIT"},"lib/openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol":{"keccak256":"0xdbef5f0c787055227243a7318ef74c8a5a1108ca3a07f2b3a00ef67769e1e397","urls":["bzz-raw://08e39f23d5b4692f9a40803e53a8156b72b4c1f9902a88cd65ba964db103dab9","dweb:/ipfs/QmPKn6EYDgpga7KtpkA8wV2yJCYGMtc9K4LkJfhKX2RVSV"],"license":"MIT"},"lib/openzeppelin-contracts/contracts/interfaces/draft-IERC6093.sol":{"keccak256":"0x9cac1f97ecc92043dd19235d6677e40cf6bac382886a94f7a80a957846b24229","urls":["bzz-raw://a1e0c924e0edfdfd4abceeb552d99f1cd95c0d387b38ccb1f67c583607e3d155","dweb:/ipfs/QmZAi6qKa66zuS3jyEhsQR9bBNnZe1wSognYqw9nvseyUz"],"license":"MIT"},"lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol":{"keccak256":"0xee2337af2dc162a973b4be6d3f7c16f06298259e0af48c5470d2839bfa8a22f4","urls":["bzz-raw://30c476b4b2f405c1bb3f0bae15b006d129c80f1bfd9d0f2038160a3bb9745009","dweb:/ipfs/Qmb3VcuDufv6xbHeVgksC4tHpc5gKYVqBEwjEXW72XzSvN"],"license":"MIT"},"lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol":{"keccak256":"0x88f7b6f070ad1de2bf899da6978ed74b5038eac78c01b7359b92b60c3d965c28","urls":["bzz-raw://c436edb6733a036607c6f17cc590e8ee351363a8cb4c564a98d9a66392c89323","dweb:/ipfs/QmcJvJR2K3EtYcKEXVpQ1WqT6TvAbVem5HR1FirAsqEXFR"],"license":"MIT"},"src/AtomicBridgeCounterpartyMOVE.sol":{"keccak256":"0xed0faadcc2d86d20e6b8ddcafc8465007800c72caa5798c12cdb51ce9e06386e","urls":["bzz-raw://2da6e0c975c882f4f4db39bf810e9d467a5e8c11ab3cf8e4b39112a590eb3827","dweb:/ipfs/QmQy1UVG76s1kFW53EduMmm6UaHbUwXpwLHRUqYxExpiut"],"license":"MIT"},"src/AtomicBridgeInitiatorMOVE.sol":{"keccak256":"0xb6431a67dd2961b54aeed2a51a2f1c3a80a8fbe42b1fdbecaff64ed542eb138c","urls":["bzz-raw://051743bcc1f901d33fbdfcd307f317909e5c5442adb088f49cf05d245bec7f89","dweb:/ipfs/QmVywZzJ5K56U58X46W4A6jKcQDfwmZiyFWZFF3utWWKmV"],"license":"MIT"},"src/IAtomicBridgeCounterpartyMOVE.sol":{"keccak256":"0xfc0edebea7371d55fc8ea04b31180bb20d935e876b0c616a57c36ac91964c83a","urls":["bzz-raw://5c55ae7cdd96a16dd30f1fab4c59eba565c3d08f56884231a054adec45c2ace8","dweb:/ipfs/QmURFF2khftD1FpUnAhtTxV1z7wW5wnQYcP4FkjtWDyy1p"],"license":null},"src/IAtomicBridgeInitiatorMOVE.sol":{"keccak256":"0x3705cbaaf8910b786e5cb99d8d1bfa3f591add9a1d835703a69d6a77020ad841","urls":["bzz-raw://12cca43905283adf49be8a23853952b90be09d3ba38b583fd8c2821e97ad8c0a","dweb:/ipfs/QmaxHt6YUKb97dCz1rUjvjfM3XLcoLNvoFrUkDA6a77ER5"],"license":"MIT"},"src/MockMOVEToken.sol":{"keccak256":"0x71768bf12ff974ee8589bee8b951fa63c7db1f74f251c5997232643bc749a8e4","urls":["bzz-raw://38474add7fec1c814adf1ad614e4ca233b9f789f279690c698a3a94334c029cf","dweb:/ipfs/Qmah2K8YEmLqnKjXcGvbSD55sm61zkKVvNMhehmrj6VzBs"],"license":"MIT"}},"version":1},"id":43} \ No newline at end of file +{"abi":[{"type":"function","name":"abortBridgeTransfer","inputs":[{"name":"bridgeTransferId","type":"bytes32","internalType":"bytes32"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"nativeBridgeInitiatorMOVE","inputs":[],"outputs":[{"name":"","type":"address","internalType":"contract NativeBridgeInitiatorMOVE"}],"stateMutability":"view"},{"type":"function","name":"bridgeTransfers","inputs":[{"name":"","type":"bytes32","internalType":"bytes32"}],"outputs":[{"name":"originator","type":"bytes32","internalType":"bytes32"},{"name":"recipient","type":"address","internalType":"address"},{"name":"amount","type":"uint256","internalType":"uint256"},{"name":"hashLock","type":"bytes32","internalType":"bytes32"},{"name":"timeLock","type":"uint256","internalType":"uint256"},{"name":"state","type":"uint8","internalType":"enum NativeBridgeCounterpartyMOVE.MessageState"}],"stateMutability":"view"},{"type":"function","name":"completeBridgeTransfer","inputs":[{"name":"bridgeTransferId","type":"bytes32","internalType":"bytes32"},{"name":"preImage","type":"bytes32","internalType":"bytes32"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"counterpartyTimeLockDuration","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"initialize","inputs":[{"name":"_nativeBridgeInitiator","type":"address","internalType":"address"},{"name":"owner","type":"address","internalType":"address"},{"name":"_timeLockDuration","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"lockBridgeTransfer","inputs":[{"name":"originator","type":"bytes32","internalType":"bytes32"},{"name":"bridgeTransferId","type":"bytes32","internalType":"bytes32"},{"name":"hashLock","type":"bytes32","internalType":"bytes32"},{"name":"recipient","type":"address","internalType":"address"},{"name":"amount","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"nonpayable"},{"type":"function","name":"owner","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"renounceOwnership","inputs":[],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setNativeBridgeInitiator","inputs":[{"name":"_nativeBridgeInitiator","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setTimeLockDuration","inputs":[{"name":"_timeLockDuration","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"transferOwnership","inputs":[{"name":"newOwner","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"event","name":"BridgeTransferAborted","inputs":[{"name":"bridgeTransferId","type":"bytes32","indexed":true,"internalType":"bytes32"}],"anonymous":false},{"type":"event","name":"BridgeTransferCompleted","inputs":[{"name":"bridgeTransferId","type":"bytes32","indexed":true,"internalType":"bytes32"},{"name":"pre_image","type":"bytes32","indexed":false,"internalType":"bytes32"}],"anonymous":false},{"type":"event","name":"BridgeTransferLocked","inputs":[{"name":"bridgeTransferId","type":"bytes32","indexed":true,"internalType":"bytes32"},{"name":"recipient","type":"address","indexed":true,"internalType":"address"},{"name":"amount","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"hashLock","type":"bytes32","indexed":false,"internalType":"bytes32"},{"name":"timeLock","type":"uint256","indexed":false,"internalType":"uint256"}],"anonymous":false},{"type":"event","name":"Initialized","inputs":[{"name":"version","type":"uint64","indexed":false,"internalType":"uint64"}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"name":"previousOwner","type":"address","indexed":true,"internalType":"address"},{"name":"newOwner","type":"address","indexed":true,"internalType":"address"}],"anonymous":false},{"type":"error","name":"BridgeTransferHasBeenCompleted","inputs":[]},{"type":"error","name":"BridgeTransferInvalid","inputs":[]},{"type":"error","name":"BridgeTransferStateNotInitialized","inputs":[]},{"type":"error","name":"BridgeTransferStateNotPending","inputs":[]},{"type":"error","name":"InsufficientMOVEBalance","inputs":[]},{"type":"error","name":"InvalidInitialization","inputs":[]},{"type":"error","name":"InvalidSecret","inputs":[]},{"type":"error","name":"MOVETransferFailed","inputs":[]},{"type":"error","name":"NotInitializing","inputs":[]},{"type":"error","name":"OwnableInvalidOwner","inputs":[{"name":"owner","type":"address","internalType":"address"}]},{"type":"error","name":"OwnableUnauthorizedAccount","inputs":[{"name":"account","type":"address","internalType":"address"}]},{"type":"error","name":"TimeLockExpired","inputs":[]},{"type":"error","name":"TimeLockNotExpired","inputs":[]},{"type":"error","name":"Unauthorized","inputs":[]},{"type":"error","name":"ZeroAddress","inputs":[]},{"type":"error","name":"ZeroAmount","inputs":[]}],"bytecode":{"object":"0x6080604052348015600e575f80fd5b50610b418061001c5f395ff3fe608060405234801561000f575f80fd5b50600436106100b1575f3560e01c80638da5cb5b1161006e5780638da5cb5b1461014a57806396d17d491461017a5780639f8f879914610191578063c95b659f146101a4578063e0d9cbc4146101b7578063f2fde38b14610219575f80fd5b80631794bb3c146100b557806327b3ea07146100ca5780633b9b4640146100f257806371115eb21461011c578063715018a61461012f5780637ce0874814610137575b5f80fd5b6100c86100c336600461098f565b61022c565b005b6100dd6100d83660046109c9565b610382565b60405190151581526020015b60405180910390f35b5f54610104906001600160a01b031681565b6040516001600160a01b0390911681526020016100e9565b6100c861012a366004610a0c565b610572565b6100c861057f565b6100c8610145366004610a23565b610592565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b0316610104565b61018360025481565b6040519081526020016100e9565b6100c861019f366004610a43565b6105e2565b6100c86101b2366004610a0c565b610757565b6102076101c5366004610a0c565b600160208190525f91825260409091208054918101546002820154600383015460048401546005909401546001600160a01b0390931693919290919060ff1686565b6040516100e996959493929190610a77565b6100c8610227366004610a23565b610805565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff165f811580156102715750825b90505f8267ffffffffffffffff16600114801561028d5750303b155b90508115801561029b575080155b156102b95760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff1916600117855583156102e357845460ff60401b1916600160401b1785555b6001600160a01b03881661030a5760405163d92e233d60e01b815260040160405180910390fd5b5f80546001600160a01b0319166001600160a01b038a1617905561032d87610847565b6002869055831561037857845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b5050505050505050565b5f61038b610858565b815f036103ab57604051631f2a200560e01b815260040160405180910390fd5b5f546040805163258d975160e21b8152905184926001600160a01b0316916396365d449160048083019260209291908290030181865afa1580156103f1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104159190610acf565b1015610434576040516381a6aee360e01b815260040160405180910390fd5b5f600254426104439190610ae6565b90506040518060c00160405280888152602001856001600160a01b031681526020018481526020018681526020018281526020015f600281111561048957610489610a63565b90525f87815260016020818152604092839020845181559084015181830180546001600160a01b0319166001600160a01b0390921691909117905591830151600280840191909155606084015160038401556080840151600484015560a08401516005840180549193909260ff1990921691849081111561050c5761050c610a63565b0217905550506002546040805186815260208101899052908101919091526001600160a01b038616915087907fa03230f5967404ba170c5be8445486911e87267000597e4ba9ed9d4b014fa4bd9060600160405180910390a35060019695505050505050565b61057a610858565b600255565b610587610858565b6105905f6108b3565b565b61059a610858565b6001600160a01b0381166105c15760405163d92e233d60e01b815260040160405180910390fd5b5f80546001600160a01b0319166001600160a01b0392909216919091179055565b5f82815260016020526040812090600582015460ff16600281111561060957610609610a63565b146106275760405163a92c04c760e01b815260040160405180910390fd5b5f8260405160200161063b91815260200190565b604051602081830303815290604052805190602001209050816003015481146106775760405163abab6bd760e01b815260040160405180910390fd5b816004015442111561069c5760405163179a39d160e01b815260040160405180910390fd5b60058201805460ff191660019081179091555f5490830154600284015460405163cacfb16160e01b81526001600160a01b039283166004820152602481019190915291169063cacfb161906044015f604051808303815f87803b158015610701575f80fd5b505af1158015610713573d5f803e3d5ffd5b50505050837f05ddc886acde01b77731bfad1dcfb6abf529f05c28ea66556fe87429bb2789ea8460405161074991815260200190565b60405180910390a250505050565b61075f610858565b5f81815260016020526040812090600582015460ff16600281111561078657610786610a63565b146107a45760405163a92c04c760e01b815260040160405180910390fd5b806004015442116107c85760405163191f4d1b60e31b815260040160405180910390fd5b60058101805460ff1916600217905560405182907f9b398e0a546c4aa218ac0b98f5e2196a7aff605b50c19eb795f9cb3b2f5d5b55905f90a25050565b61080d610858565b6001600160a01b03811661083b57604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b610844816108b3565b50565b61084f610923565b6108448161096c565b3361088a7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b031690565b6001600160a01b0316146105905760405163118cdaa760e01b8152336004820152602401610832565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a3505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff1661059057604051631afcd79f60e31b815260040160405180910390fd5b61080d610923565b80356001600160a01b038116811461098a575f80fd5b919050565b5f805f606084860312156109a1575f80fd5b6109aa84610974565b92506109b860208501610974565b929592945050506040919091013590565b5f805f805f60a086880312156109dd575f80fd5b8535945060208601359350604086013592506109fb60608701610974565b949793965091946080013592915050565b5f60208284031215610a1c575f80fd5b5035919050565b5f60208284031215610a33575f80fd5b610a3c82610974565b9392505050565b5f8060408385031215610a54575f80fd5b50508035926020909101359150565b634e487b7160e01b5f52602160045260245ffd5b8681526001600160a01b038616602082015260408101859052606081018490526080810183905260c0810160038310610abe57634e487b7160e01b5f52602160045260245ffd5b8260a0830152979650505050505050565b5f60208284031215610adf575f80fd5b5051919050565b80820180821115610b0557634e487b7160e01b5f52601160045260245ffd5b9291505056fea2646970667358221220b3b8a3c1d782421f941dfc08fe283db1ea0a96a2ddf52fb3415fe6a21ae7a71e64736f6c634300081a0033","sourceMap":"319:3481:43:-:0;;;;;;;;;;;;;;;;;;;","linkReferences":{}},"deployedBytecode":{"object":"0x608060405234801561000f575f80fd5b50600436106100b1575f3560e01c80638da5cb5b1161006e5780638da5cb5b1461014a57806396d17d491461017a5780639f8f879914610191578063c95b659f146101a4578063e0d9cbc4146101b7578063f2fde38b14610219575f80fd5b80631794bb3c146100b557806327b3ea07146100ca5780633b9b4640146100f257806371115eb21461011c578063715018a61461012f5780637ce0874814610137575b5f80fd5b6100c86100c336600461098f565b61022c565b005b6100dd6100d83660046109c9565b610382565b60405190151581526020015b60405180910390f35b5f54610104906001600160a01b031681565b6040516001600160a01b0390911681526020016100e9565b6100c861012a366004610a0c565b610572565b6100c861057f565b6100c8610145366004610a23565b610592565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b0316610104565b61018360025481565b6040519081526020016100e9565b6100c861019f366004610a43565b6105e2565b6100c86101b2366004610a0c565b610757565b6102076101c5366004610a0c565b600160208190525f91825260409091208054918101546002820154600383015460048401546005909401546001600160a01b0390931693919290919060ff1686565b6040516100e996959493929190610a77565b6100c8610227366004610a23565b610805565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff165f811580156102715750825b90505f8267ffffffffffffffff16600114801561028d5750303b155b90508115801561029b575080155b156102b95760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff1916600117855583156102e357845460ff60401b1916600160401b1785555b6001600160a01b03881661030a5760405163d92e233d60e01b815260040160405180910390fd5b5f80546001600160a01b0319166001600160a01b038a1617905561032d87610847565b6002869055831561037857845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b5050505050505050565b5f61038b610858565b815f036103ab57604051631f2a200560e01b815260040160405180910390fd5b5f546040805163258d975160e21b8152905184926001600160a01b0316916396365d449160048083019260209291908290030181865afa1580156103f1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104159190610acf565b1015610434576040516381a6aee360e01b815260040160405180910390fd5b5f600254426104439190610ae6565b90506040518060c00160405280888152602001856001600160a01b031681526020018481526020018681526020018281526020015f600281111561048957610489610a63565b90525f87815260016020818152604092839020845181559084015181830180546001600160a01b0319166001600160a01b0390921691909117905591830151600280840191909155606084015160038401556080840151600484015560a08401516005840180549193909260ff1990921691849081111561050c5761050c610a63565b0217905550506002546040805186815260208101899052908101919091526001600160a01b038616915087907fa03230f5967404ba170c5be8445486911e87267000597e4ba9ed9d4b014fa4bd9060600160405180910390a35060019695505050505050565b61057a610858565b600255565b610587610858565b6105905f6108b3565b565b61059a610858565b6001600160a01b0381166105c15760405163d92e233d60e01b815260040160405180910390fd5b5f80546001600160a01b0319166001600160a01b0392909216919091179055565b5f82815260016020526040812090600582015460ff16600281111561060957610609610a63565b146106275760405163a92c04c760e01b815260040160405180910390fd5b5f8260405160200161063b91815260200190565b604051602081830303815290604052805190602001209050816003015481146106775760405163abab6bd760e01b815260040160405180910390fd5b816004015442111561069c5760405163179a39d160e01b815260040160405180910390fd5b60058201805460ff191660019081179091555f5490830154600284015460405163cacfb16160e01b81526001600160a01b039283166004820152602481019190915291169063cacfb161906044015f604051808303815f87803b158015610701575f80fd5b505af1158015610713573d5f803e3d5ffd5b50505050837f05ddc886acde01b77731bfad1dcfb6abf529f05c28ea66556fe87429bb2789ea8460405161074991815260200190565b60405180910390a250505050565b61075f610858565b5f81815260016020526040812090600582015460ff16600281111561078657610786610a63565b146107a45760405163a92c04c760e01b815260040160405180910390fd5b806004015442116107c85760405163191f4d1b60e31b815260040160405180910390fd5b60058101805460ff1916600217905560405182907f9b398e0a546c4aa218ac0b98f5e2196a7aff605b50c19eb795f9cb3b2f5d5b55905f90a25050565b61080d610858565b6001600160a01b03811661083b57604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b610844816108b3565b50565b61084f610923565b6108448161096c565b3361088a7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b031690565b6001600160a01b0316146105905760405163118cdaa760e01b8152336004820152602401610832565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a3505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff1661059057604051631afcd79f60e31b815260040160405180910390fd5b61080d610923565b80356001600160a01b038116811461098a575f80fd5b919050565b5f805f606084860312156109a1575f80fd5b6109aa84610974565b92506109b860208501610974565b929592945050506040919091013590565b5f805f805f60a086880312156109dd575f80fd5b8535945060208601359350604086013592506109fb60608701610974565b949793965091946080013592915050565b5f60208284031215610a1c575f80fd5b5035919050565b5f60208284031215610a33575f80fd5b610a3c82610974565b9392505050565b5f8060408385031215610a54575f80fd5b50508035926020909101359150565b634e487b7160e01b5f52602160045260245ffd5b8681526001600160a01b038616602082015260408101859052606081018490526080810183905260c0810160038310610abe57634e487b7160e01b5f52602160045260245ffd5b8260a0830152979650505050505050565b5f60208284031215610adf575f80fd5b5051919050565b80820180821115610b0557634e487b7160e01b5f52601160045260245ffd5b9291505056fea2646970667358221220b3b8a3c1d782421f941dfc08fe283db1ea0a96a2ddf52fb3415fe6a21ae7a71e64736f6c634300081a0033","sourceMap":"319:3481:43:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;925:420;;;;;;:::i;:::-;;:::i;:::-;;1754:916;;;;;;:::i;:::-;;:::i;:::-;;;1403:14:57;;1396:22;1378:41;;1366:2;1351:18;1754:916:43;;;;;;;;701:58;;;;;-1:-1:-1;;;;;701:58:43;;;;;;-1:-1:-1;;;;;1629:32:57;;;1611:51;;1599:2;1584:18;701:58:43;1430:238:57;1608:140:43;;;;;;:::i;:::-;;:::i;3155:101:23:-;;;:::i;1351:251:43:-;;;;;;:::i;:::-;;:::i;2441:144:23:-;1313:22;2570:8;-1:-1:-1;;;;;2570:8:23;2441:144;;875:43:43;;;;;;;;;2449:25:57;;;2437:2;2422:18;875:43:43;2303:177:57;2676:680:43;;;;;;:::i;:::-;;:::i;3362:436::-;;;;;;:::i;:::-;;:::i;765:64::-;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;765:64:43;;;;;;;;;;;;;;;;;;;;;;;;;:::i;3405:215:23:-;;;;;;:::i;:::-;;:::i;925:420:43:-;8870:21:24;4302:15;;-1:-1:-1;;;4302:15:24;;;;4301:16;;4348:14;;4158:30;4726:16;;:34;;;;;4746:14;4726:34;4706:54;;4770:17;4790:11;:16;;4805:1;4790:16;:50;;;;-1:-1:-1;4818:4:24;4810:25;:30;4790:50;4770:70;;4856:12;4855:13;:30;;;;;4873:12;4872:13;4855:30;4851:91;;;4908:23;;-1:-1:-1;;;4908:23:24;;;;;;;;;;;4851:91;4951:18;;-1:-1:-1;;4951:18:24;4968:1;4951:18;;;4979:67;;;;5013:22;;-1:-1:-1;;;;5013:22:24;-1:-1:-1;;;5013:22:24;;;4979:67;-1:-1:-1;;;;;1052:36:43;::::1;1048:62;;1097:13;;-1:-1:-1::0;;;1097:13:43::1;;;;;;;;;;;1048:62;1120:25;:77:::0;;-1:-1:-1;;;;;;1120:77:43::1;-1:-1:-1::0;;;;;1120:77:43;::::1;;::::0;;1207:21:::1;1222:5:::0;1207:14:::1;:21::i;:::-;1290:28;:48:::0;;;5066:101:24;;;;5100:23;;-1:-1:-1;;;;5100:23:24;;;5142:14;;-1:-1:-1;4087:50:57;;5142:14:24;;4075:2:57;4060:18;5142:14:24;;;;;;;5066:101;4092:1081;;;;;925:420:43;;;:::o;1754:916::-;1955:4;2334:13:23;:11;:13::i;:::-;1975:6:43::1;1985:1;1975:11:::0;1971:36:::1;;1995:12;;-1:-1:-1::0;;;1995:12:43::1;;;;;;;;;;;1971:36;2021:25;::::0;:39:::1;::::0;;-1:-1:-1;;;2021:39:43;;;;2063:6;;-1:-1:-1;;;;;2021:25:43::1;::::0;:37:::1;::::0;:39:::1;::::0;;::::1;::::0;::::1;::::0;;;;;;;;:25;:39:::1;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:48;2017:86;;;2078:25;;-1:-1:-1::0;;;2078:25:43::1;;;;;;;;;;;2017:86;2181:16;2218:28;;2200:15;:46;;;;:::i;:::-;2181:65;;2293:236;;;;;;;;2375:10;2293:236;;;;2340:9;-1:-1:-1::0;;;;;2293:236:43::1;;;;;2407:6;2293:236;;;;2437:8;2293:236;;;;2469:8;2293:236;;;;2498:20;2293:236;;;;;;;;:::i;:::-;::::0;;2257:33:::1;::::0;;;:15:::1;:33;::::0;;;;;;;;:272;;;;;;::::1;::::0;;;::::1;::::0;;-1:-1:-1;;;;;;2257:272:43::1;-1:-1:-1::0;;;;;2257:272:43;;::::1;::::0;;;::::1;::::0;;;;::::1;::::0;::::1;::::0;;::::1;::::0;;;;::::1;::::0;::::1;::::0;::::1;::::0;::::1;::::0;::::1;::::0;::::1;::::0;::::1;::::0;::::1;::::0;::::1;::::0;::::1;::::0;::::1;::::0;::::1;::::0;;;;;;-1:-1:-1;;2257:272:43;;::::1;::::0;;;;::::1;;;;;;:::i;:::-;;;::::0;;-1:-1:-1;;2613:28:43::1;::::0;2545:97:::1;::::0;;4766:25:57;;;4822:2;4807:18;;4800:34;;;4850:18;;;4843:34;;;;-1:-1:-1;;;;;2545:97:43;::::1;::::0;-1:-1:-1;2566:16:43;;2545:97:::1;::::0;4754:2:57;4739:18;2545:97:43::1;;;;;;;-1:-1:-1::0;2659:4:43::1;::::0;1754:916;-1:-1:-1;;;;;;1754:916:43:o;1608:140::-;2334:13:23;:11;:13::i;:::-;1693:28:43::1;:48:::0;1608:140::o;3155:101:23:-;2334:13;:11;:13::i;:::-;3219:30:::1;3246:1;3219:18;:30::i;:::-;3155:101::o:0;1351:251:43:-;2334:13:23;:11;:13::i;:::-;-1:-1:-1;;;;;1450:36:43;::::1;1446:62;;1495:13;;-1:-1:-1::0;;;1495:13:43::1;;;;;;;;;;;1446:62;1518:25;:77:::0;;-1:-1:-1;;;;;;1518:77:43::1;-1:-1:-1::0;;;;;1518:77:43;;;::::1;::::0;;;::::1;::::0;;1351:251::o;2676:680::-;2771:37;2811:33;;;:15;:33;;;;;;2858:13;;;;;;:37;;;;;;;;:::i;:::-;;2854:81;;2904:31;;-1:-1:-1;;;2904:31:43;;;;;;;;;;;2854:81;2945:20;2995:8;2978:26;;;;;;5017:19:57;;5061:2;5052:12;;4888:182;2978:26:43;;;;;;;;;;;;;2968:37;;;;;;2945:60;;3035:7;:16;;;3019:12;:32;3015:60;;3060:15;;-1:-1:-1;;;3060:15:43;;;;;;;;;;;3015:60;3107:7;:16;;;3089:15;:34;3085:64;;;3132:17;;-1:-1:-1;;;3132:17:43;;;;;;;;;;;3085:64;3160:13;;;:38;;-1:-1:-1;;3160:38:43;3176:22;3160:38;;;;;;-1:-1:-1;3209:25:43;3248:17;;;;3267:14;;;;3209:73;;-1:-1:-1;;;3209:73:43;;-1:-1:-1;;;;;3248:17:43;;;3209:73;;;5249:51:57;5316:18;;;5309:34;;;;3209:25:43;;;:38;;5222:18:57;;3209:73:43;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3322:16;3298:51;3340:8;3298:51;;;;2449:25:57;;2437:2;2422:18;;2303:177;3298:51:43;;;;;;;;2761:595;;2676:680;;:::o;3362:436::-;2334:13:23;:11;:13::i;:::-;3446:37:43::1;3486:33:::0;;;:15:::1;:33;::::0;;;;;3533:13:::1;::::0;::::1;::::0;::::1;;:37;::::0;::::1;;;;;;:::i;:::-;;3529:81;;3579:31;;-1:-1:-1::0;;;3579:31:43::1;;;;;;;;;;;3529:81;3643:7;:16;;;3624:15;:35;3620:68;;3668:20;;-1:-1:-1::0;;;3668:20:43::1;;;;;;;;;;;3620:68;3699:13;::::0;::::1;:37:::0;;-1:-1:-1;;3699:37:43::1;3715:21;3699:37;::::0;;3752:39:::1;::::0;3774:16;;3752:39:::1;::::0;-1:-1:-1;;3752:39:43::1;3436:362;3362:436:::0;:::o;3405:215:23:-;2334:13;:11;:13::i;:::-;-1:-1:-1;;;;;3489:22:23;::::1;3485:91;;3534:31;::::0;-1:-1:-1;;;3534:31:23;;3562:1:::1;3534:31;::::0;::::1;1611:51:57::0;1584:18;;3534:31:23::1;;;;;;;;3485:91;3585:28;3604:8;3585:18;:28::i;:::-;3405:215:::0;:::o;1847:127::-;6931:20:24;:18;:20::i;:::-;1929:38:23::1;1954:12;1929:24;:38::i;2658:162::-:0;966:10:26;2717:7:23;1313:22;2570:8;-1:-1:-1;;;;;2570:8:23;;2441:144;2717:7;-1:-1:-1;;;;;2717:23:23;;2713:101;;2763:40;;-1:-1:-1;;;2763:40:23;;966:10:26;2763:40:23;;;1611:51:57;1584:18;;2763:40:23;1430:238:57;3774:248:23;1313:22;3923:8;;-1:-1:-1;;;;;;3941:19:23;;-1:-1:-1;;;;;3941:19:23;;;;;;;;3975:40;;3923:8;;;;;3975:40;;3847:24;;3975:40;3837:185;;3774:248;:::o;7084:141:24:-;8870:21;8560:40;-1:-1:-1;;;8560:40:24;;;;7146:73;;7191:17;;-1:-1:-1;;;7191:17:24;;;;;;;;;;;1980:235:23;6931:20:24;:18;:20::i;14:173:57:-;82:20;;-1:-1:-1;;;;;131:31:57;;121:42;;111:70;;177:1;174;167:12;111:70;14:173;;;:::o;192:374::-;269:6;277;285;338:2;326:9;317:7;313:23;309:32;306:52;;;354:1;351;344:12;306:52;377:29;396:9;377:29;:::i;:::-;367:39;;425:38;459:2;448:9;444:18;425:38;:::i;:::-;192:374;;415:48;;-1:-1:-1;;;532:2:57;517:18;;;;504:32;;192:374::o;571:662::-;666:6;674;682;690;698;751:3;739:9;730:7;726:23;722:33;719:53;;;768:1;765;758:12;719:53;813:23;;;-1:-1:-1;933:2:57;918:18;;905:32;;-1:-1:-1;1036:2:57;1021:18;;1008:32;;-1:-1:-1;1085:38:57;1119:2;1104:18;;1085:38;:::i;:::-;571:662;;;;-1:-1:-1;571:662:57;;1196:3;1181:19;1168:33;;571:662;-1:-1:-1;;571:662:57:o;1673:226::-;1732:6;1785:2;1773:9;1764:7;1760:23;1756:32;1753:52;;;1801:1;1798;1791:12;1753:52;-1:-1:-1;1846:23:57;;1673:226;-1:-1:-1;1673:226:57:o;1904:186::-;1963:6;2016:2;2004:9;1995:7;1991:23;1987:32;1984:52;;;2032:1;2029;2022:12;1984:52;2055:29;2074:9;2055:29;:::i;:::-;2045:39;1904:186;-1:-1:-1;;;1904:186:57:o;2485:346::-;2553:6;2561;2614:2;2602:9;2593:7;2589:23;2585:32;2582:52;;;2630:1;2627;2620:12;2582:52;-1:-1:-1;;2675:23:57;;;2795:2;2780:18;;;2767:32;;-1:-1:-1;2485:346:57:o;3067:127::-;3128:10;3123:3;3119:20;3116:1;3109:31;3159:4;3156:1;3149:15;3183:4;3180:1;3173:15;3199:730;3502:25;;;-1:-1:-1;;;;;3563:32:57;;3558:2;3543:18;;3536:60;3627:2;3612:18;;3605:34;;;3670:2;3655:18;;3648:34;;;3713:3;3698:19;;3691:35;;;3489:3;3474:19;;3756:1;3745:13;;3735:144;;3801:10;3796:3;3792:20;3789:1;3782:31;3836:4;3833:1;3826:15;3864:4;3861:1;3854:15;3735:144;3916:6;3910:3;3899:9;3895:19;3888:35;3199:730;;;;;;;;;:::o;4148:184::-;4218:6;4271:2;4259:9;4250:7;4246:23;4242:32;4239:52;;;4287:1;4284;4277:12;4239:52;-1:-1:-1;4310:16:57;;4148:184;-1:-1:-1;4148:184:57:o;4337:222::-;4402:9;;;4423:10;;;4420:133;;;4475:10;4470:3;4466:20;4463:1;4456:31;4510:4;4507:1;4500:15;4538:4;4535:1;4528:15;4420:133;4337:222;;;;:::o","linkReferences":{}},"methodIdentifiers":{"abortBridgeTransfer(bytes32)":"c95b659f","nativeBridgeInitiatorMOVE()":"3b9b4640","bridgeTransfers(bytes32)":"e0d9cbc4","completeBridgeTransfer(bytes32,bytes32)":"9f8f8799","counterpartyTimeLockDuration()":"96d17d49","initialize(address,address,uint256)":"1794bb3c","lockBridgeTransfer(bytes32,bytes32,bytes32,address,uint256)":"27b3ea07","owner()":"8da5cb5b","renounceOwnership()":"715018a6","setNativeBridgeInitiator(address)":"7ce08748","setTimeLockDuration(uint256)":"71115eb2","transferOwnership(address)":"f2fde38b"},"rawMetadata":"{\"compiler\":{\"version\":\"0.8.26+commit.8a97fa7a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"BridgeTransferHasBeenCompleted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BridgeTransferInvalid\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BridgeTransferStateNotInitialized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BridgeTransferStateNotPending\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientMOVEBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidInitialization\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSecret\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MOVETransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotInitializing\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"OwnableInvalidOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"OwnableUnauthorizedAccount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TimeLockExpired\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TimeLockNotExpired\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Unauthorized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAmount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"bridgeTransferId\",\"type\":\"bytes32\"}],\"name\":\"BridgeTransferAborted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"bridgeTransferId\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"pre_image\",\"type\":\"bytes32\"}],\"name\":\"BridgeTransferCompleted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"bridgeTransferId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"hashLock\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"timeLock\",\"type\":\"uint256\"}],\"name\":\"BridgeTransferLocked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"version\",\"type\":\"uint64\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"bridgeTransferId\",\"type\":\"bytes32\"}],\"name\":\"abortBridgeTransfer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeBridgeInitiatorMOVE\",\"outputs\":[{\"internalType\":\"contract NativeBridgeInitiatorMOVE\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"bridgeTransfers\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"originator\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"hashLock\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"timeLock\",\"type\":\"uint256\"},{\"internalType\":\"enum NativeBridgeCounterpartyMOVE.MessageState\",\"name\":\"state\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"bridgeTransferId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"preImage\",\"type\":\"bytes32\"}],\"name\":\"completeBridgeTransfer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"counterpartyTimeLockDuration\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_nativeBridgeInitiator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_timeLockDuration\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originator\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"bridgeTransferId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"hashLock\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"lockBridgeTransfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_nativeBridgeInitiator\",\"type\":\"address\"}],\"name\":\"setNativeBridgeInitiator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_timeLockDuration\",\"type\":\"uint256\"}],\"name\":\"setTimeLockDuration\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"InvalidInitialization()\":[{\"details\":\"The contract is already initialized.\"}],\"NotInitializing()\":[{\"details\":\"The contract is not initializing.\"}],\"OwnableInvalidOwner(address)\":[{\"details\":\"The owner is not a valid owner account. (eg. `address(0)`)\"}],\"OwnableUnauthorizedAccount(address)\":[{\"details\":\"The caller account is not authorized to perform an operation.\"}]},\"events\":{\"Initialized(uint64)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"abortBridgeTransfer(bytes32)\":{\"details\":\"Cancels the bridge transfer and refunds the initiator if the timelock has expired\",\"params\":{\"bridgeTransferId\":\"Unique identifier for the BridgeTransfer\"}},\"completeBridgeTransfer(bytes32,bytes32)\":{\"details\":\"Completes the bridge transfer and withdraws WETH to the recipient\",\"params\":{\"bridgeTransferId\":\"Unique identifier for the BridgeTransfer\",\"preImage\":\"The secret that unlocks the funds\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/NativeBridgeCounterpartyMOVE.sol\":\"NativeBridgeCounterpartyMOVE\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[\":@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/\",\":@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/\",\":ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/\",\":erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/\",\":forge-std/=lib/forge-std/src/\",\":halmos-cheatcodes/=lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/\",\":openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/\",\":openzeppelin-contracts/=lib/openzeppelin-contracts/\"]},\"sources\":{\"lib/openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"keccak256\":\"0xc163fcf9bb10138631a9ba5564df1fa25db9adff73bd9ee868a8ae1858fe093a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9706d43a0124053d9880f6e31a59f31bc0a6a3dc1acd66ce0a16e1111658c5f6\",\"dweb:/ipfs/QmUFmfowzkRwGtDu36cXV9SPTBHJ3n7dG9xQiK5B28jTf2\"]},\"lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"keccak256\":\"0x631188737069917d2f909d29ce62c4d48611d326686ba6683e26b72a23bfac0b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7a61054ae84cd6c4d04c0c4450ba1d6de41e27e0a2c4f1bcdf58f796b401c609\",\"dweb:/ipfs/QmUvtdp7X1mRVyC3CsHrtPbgoqWaXHp3S1ZR24tpAQYJWM\"]},\"lib/openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\":{\"keccak256\":\"0x5a5f22721ffb66d3e1ecc568c0d37c91f91223d8663c8a5e78396e780b849c72\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bdd108133c98ea251513424bf17905090c8a7e0755562a6d12a81b8bccbd6152\",\"dweb:/ipfs/QmahpnB63Up9aVx4jDqxEgry5BRN5itHRvy9rwBvMT2yqL\"]},\"lib/openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"keccak256\":\"0xdbef5f0c787055227243a7318ef74c8a5a1108ca3a07f2b3a00ef67769e1e397\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://08e39f23d5b4692f9a40803e53a8156b72b4c1f9902a88cd65ba964db103dab9\",\"dweb:/ipfs/QmPKn6EYDgpga7KtpkA8wV2yJCYGMtc9K4LkJfhKX2RVSV\"]},\"lib/openzeppelin-contracts/contracts/interfaces/draft-IERC6093.sol\":{\"keccak256\":\"0x9cac1f97ecc92043dd19235d6677e40cf6bac382886a94f7a80a957846b24229\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a1e0c924e0edfdfd4abceeb552d99f1cd95c0d387b38ccb1f67c583607e3d155\",\"dweb:/ipfs/QmZAi6qKa66zuS3jyEhsQR9bBNnZe1wSognYqw9nvseyUz\"]},\"lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0xee2337af2dc162a973b4be6d3f7c16f06298259e0af48c5470d2839bfa8a22f4\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://30c476b4b2f405c1bb3f0bae15b006d129c80f1bfd9d0f2038160a3bb9745009\",\"dweb:/ipfs/Qmb3VcuDufv6xbHeVgksC4tHpc5gKYVqBEwjEXW72XzSvN\"]},\"lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"keccak256\":\"0x88f7b6f070ad1de2bf899da6978ed74b5038eac78c01b7359b92b60c3d965c28\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c436edb6733a036607c6f17cc590e8ee351363a8cb4c564a98d9a66392c89323\",\"dweb:/ipfs/QmcJvJR2K3EtYcKEXVpQ1WqT6TvAbVem5HR1FirAsqEXFR\"]},\"src/NativeBridgeCounterpartyMOVE.sol\":{\"keccak256\":\"0xed0faadcc2d86d20e6b8ddcafc8465007800c72caa5798c12cdb51ce9e06386e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2da6e0c975c882f4f4db39bf810e9d467a5e8c11ab3cf8e4b39112a590eb3827\",\"dweb:/ipfs/QmQy1UVG76s1kFW53EduMmm6UaHbUwXpwLHRUqYxExpiut\"]},\"src/NativeBridgeInitiatorMOVE.sol\":{\"keccak256\":\"0xb6431a67dd2961b54aeed2a51a2f1c3a80a8fbe42b1fdbecaff64ed542eb138c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://051743bcc1f901d33fbdfcd307f317909e5c5442adb088f49cf05d245bec7f89\",\"dweb:/ipfs/QmVywZzJ5K56U58X46W4A6jKcQDfwmZiyFWZFF3utWWKmV\"]},\"src/INativeBridgeCounterpartyMOVE.sol\":{\"keccak256\":\"0xfc0edebea7371d55fc8ea04b31180bb20d935e876b0c616a57c36ac91964c83a\",\"urls\":[\"bzz-raw://5c55ae7cdd96a16dd30f1fab4c59eba565c3d08f56884231a054adec45c2ace8\",\"dweb:/ipfs/QmURFF2khftD1FpUnAhtTxV1z7wW5wnQYcP4FkjtWDyy1p\"]},\"src/INativeBridgeInitiatorMOVE.sol\":{\"keccak256\":\"0x3705cbaaf8910b786e5cb99d8d1bfa3f591add9a1d835703a69d6a77020ad841\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://12cca43905283adf49be8a23853952b90be09d3ba38b583fd8c2821e97ad8c0a\",\"dweb:/ipfs/QmaxHt6YUKb97dCz1rUjvjfM3XLcoLNvoFrUkDA6a77ER5\"]},\"src/MockMOVEToken.sol\":{\"keccak256\":\"0x71768bf12ff974ee8589bee8b951fa63c7db1f74f251c5997232643bc749a8e4\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://38474add7fec1c814adf1ad614e4ca233b9f789f279690c698a3a94334c029cf\",\"dweb:/ipfs/Qmah2K8YEmLqnKjXcGvbSD55sm61zkKVvNMhehmrj6VzBs\"]}},\"version\":1}","metadata":{"compiler":{"version":"0.8.26+commit.8a97fa7a"},"language":"Solidity","output":{"abi":[{"inputs":[],"type":"error","name":"BridgeTransferHasBeenCompleted"},{"inputs":[],"type":"error","name":"BridgeTransferInvalid"},{"inputs":[],"type":"error","name":"BridgeTransferStateNotInitialized"},{"inputs":[],"type":"error","name":"BridgeTransferStateNotPending"},{"inputs":[],"type":"error","name":"InsufficientMOVEBalance"},{"inputs":[],"type":"error","name":"InvalidInitialization"},{"inputs":[],"type":"error","name":"InvalidSecret"},{"inputs":[],"type":"error","name":"MOVETransferFailed"},{"inputs":[],"type":"error","name":"NotInitializing"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"type":"error","name":"OwnableInvalidOwner"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"type":"error","name":"OwnableUnauthorizedAccount"},{"inputs":[],"type":"error","name":"TimeLockExpired"},{"inputs":[],"type":"error","name":"TimeLockNotExpired"},{"inputs":[],"type":"error","name":"Unauthorized"},{"inputs":[],"type":"error","name":"ZeroAddress"},{"inputs":[],"type":"error","name":"ZeroAmount"},{"inputs":[{"internalType":"bytes32","name":"bridgeTransferId","type":"bytes32","indexed":true}],"type":"event","name":"BridgeTransferAborted","anonymous":false},{"inputs":[{"internalType":"bytes32","name":"bridgeTransferId","type":"bytes32","indexed":true},{"internalType":"bytes32","name":"pre_image","type":"bytes32","indexed":false}],"type":"event","name":"BridgeTransferCompleted","anonymous":false},{"inputs":[{"internalType":"bytes32","name":"bridgeTransferId","type":"bytes32","indexed":true},{"internalType":"address","name":"recipient","type":"address","indexed":true},{"internalType":"uint256","name":"amount","type":"uint256","indexed":false},{"internalType":"bytes32","name":"hashLock","type":"bytes32","indexed":false},{"internalType":"uint256","name":"timeLock","type":"uint256","indexed":false}],"type":"event","name":"BridgeTransferLocked","anonymous":false},{"inputs":[{"internalType":"uint64","name":"version","type":"uint64","indexed":false}],"type":"event","name":"Initialized","anonymous":false},{"inputs":[{"internalType":"address","name":"previousOwner","type":"address","indexed":true},{"internalType":"address","name":"newOwner","type":"address","indexed":true}],"type":"event","name":"OwnershipTransferred","anonymous":false},{"inputs":[{"internalType":"bytes32","name":"bridgeTransferId","type":"bytes32"}],"stateMutability":"nonpayable","type":"function","name":"abortBridgeTransfer"},{"inputs":[],"stateMutability":"view","type":"function","name":"nativeBridgeInitiatorMOVE","outputs":[{"internalType":"contract NativeBridgeInitiatorMOVE","name":"","type":"address"}]},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function","name":"bridgeTransfers","outputs":[{"internalType":"bytes32","name":"originator","type":"bytes32"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes32","name":"hashLock","type":"bytes32"},{"internalType":"uint256","name":"timeLock","type":"uint256"},{"internalType":"enum NativeBridgeCounterpartyMOVE.MessageState","name":"state","type":"uint8"}]},{"inputs":[{"internalType":"bytes32","name":"bridgeTransferId","type":"bytes32"},{"internalType":"bytes32","name":"preImage","type":"bytes32"}],"stateMutability":"nonpayable","type":"function","name":"completeBridgeTransfer"},{"inputs":[],"stateMutability":"view","type":"function","name":"counterpartyTimeLockDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}]},{"inputs":[{"internalType":"address","name":"_nativeBridgeInitiator","type":"address"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"_timeLockDuration","type":"uint256"}],"stateMutability":"nonpayable","type":"function","name":"initialize"},{"inputs":[{"internalType":"bytes32","name":"originator","type":"bytes32"},{"internalType":"bytes32","name":"bridgeTransferId","type":"bytes32"},{"internalType":"bytes32","name":"hashLock","type":"bytes32"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"nonpayable","type":"function","name":"lockBridgeTransfer","outputs":[{"internalType":"bool","name":"","type":"bool"}]},{"inputs":[],"stateMutability":"view","type":"function","name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}]},{"inputs":[],"stateMutability":"nonpayable","type":"function","name":"renounceOwnership"},{"inputs":[{"internalType":"address","name":"_nativeBridgeInitiator","type":"address"}],"stateMutability":"nonpayable","type":"function","name":"setNativeBridgeInitiator"},{"inputs":[{"internalType":"uint256","name":"_timeLockDuration","type":"uint256"}],"stateMutability":"nonpayable","type":"function","name":"setTimeLockDuration"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"stateMutability":"nonpayable","type":"function","name":"transferOwnership"}],"devdoc":{"kind":"dev","methods":{"abortBridgeTransfer(bytes32)":{"details":"Cancels the bridge transfer and refunds the initiator if the timelock has expired","params":{"bridgeTransferId":"Unique identifier for the BridgeTransfer"}},"completeBridgeTransfer(bytes32,bytes32)":{"details":"Completes the bridge transfer and withdraws WETH to the recipient","params":{"bridgeTransferId":"Unique identifier for the BridgeTransfer","preImage":"The secret that unlocks the funds"}},"owner()":{"details":"Returns the address of the current owner."},"renounceOwnership()":{"details":"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner."},"transferOwnership(address)":{"details":"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner."}},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"remappings":["@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/","@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/","ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/","erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/","forge-std/=lib/forge-std/src/","halmos-cheatcodes/=lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/","openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/","openzeppelin-contracts/=lib/openzeppelin-contracts/"],"optimizer":{"enabled":true,"runs":200},"metadata":{"bytecodeHash":"ipfs"},"compilationTarget":{"src/NativeBridgeCounterpartyMOVE.sol":"NativeBridgeCounterpartyMOVE"},"evmVersion":"cancun","libraries":{}},"sources":{"lib/openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol":{"keccak256":"0xc163fcf9bb10138631a9ba5564df1fa25db9adff73bd9ee868a8ae1858fe093a","urls":["bzz-raw://9706d43a0124053d9880f6e31a59f31bc0a6a3dc1acd66ce0a16e1111658c5f6","dweb:/ipfs/QmUFmfowzkRwGtDu36cXV9SPTBHJ3n7dG9xQiK5B28jTf2"],"license":"MIT"},"lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol":{"keccak256":"0x631188737069917d2f909d29ce62c4d48611d326686ba6683e26b72a23bfac0b","urls":["bzz-raw://7a61054ae84cd6c4d04c0c4450ba1d6de41e27e0a2c4f1bcdf58f796b401c609","dweb:/ipfs/QmUvtdp7X1mRVyC3CsHrtPbgoqWaXHp3S1ZR24tpAQYJWM"],"license":"MIT"},"lib/openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol":{"keccak256":"0x5a5f22721ffb66d3e1ecc568c0d37c91f91223d8663c8a5e78396e780b849c72","urls":["bzz-raw://bdd108133c98ea251513424bf17905090c8a7e0755562a6d12a81b8bccbd6152","dweb:/ipfs/QmahpnB63Up9aVx4jDqxEgry5BRN5itHRvy9rwBvMT2yqL"],"license":"MIT"},"lib/openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol":{"keccak256":"0xdbef5f0c787055227243a7318ef74c8a5a1108ca3a07f2b3a00ef67769e1e397","urls":["bzz-raw://08e39f23d5b4692f9a40803e53a8156b72b4c1f9902a88cd65ba964db103dab9","dweb:/ipfs/QmPKn6EYDgpga7KtpkA8wV2yJCYGMtc9K4LkJfhKX2RVSV"],"license":"MIT"},"lib/openzeppelin-contracts/contracts/interfaces/draft-IERC6093.sol":{"keccak256":"0x9cac1f97ecc92043dd19235d6677e40cf6bac382886a94f7a80a957846b24229","urls":["bzz-raw://a1e0c924e0edfdfd4abceeb552d99f1cd95c0d387b38ccb1f67c583607e3d155","dweb:/ipfs/QmZAi6qKa66zuS3jyEhsQR9bBNnZe1wSognYqw9nvseyUz"],"license":"MIT"},"lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol":{"keccak256":"0xee2337af2dc162a973b4be6d3f7c16f06298259e0af48c5470d2839bfa8a22f4","urls":["bzz-raw://30c476b4b2f405c1bb3f0bae15b006d129c80f1bfd9d0f2038160a3bb9745009","dweb:/ipfs/Qmb3VcuDufv6xbHeVgksC4tHpc5gKYVqBEwjEXW72XzSvN"],"license":"MIT"},"lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol":{"keccak256":"0x88f7b6f070ad1de2bf899da6978ed74b5038eac78c01b7359b92b60c3d965c28","urls":["bzz-raw://c436edb6733a036607c6f17cc590e8ee351363a8cb4c564a98d9a66392c89323","dweb:/ipfs/QmcJvJR2K3EtYcKEXVpQ1WqT6TvAbVem5HR1FirAsqEXFR"],"license":"MIT"},"src/NativeBridgeCounterpartyMOVE.sol":{"keccak256":"0xed0faadcc2d86d20e6b8ddcafc8465007800c72caa5798c12cdb51ce9e06386e","urls":["bzz-raw://2da6e0c975c882f4f4db39bf810e9d467a5e8c11ab3cf8e4b39112a590eb3827","dweb:/ipfs/QmQy1UVG76s1kFW53EduMmm6UaHbUwXpwLHRUqYxExpiut"],"license":"MIT"},"src/NativeBridgeInitiatorMOVE.sol":{"keccak256":"0xb6431a67dd2961b54aeed2a51a2f1c3a80a8fbe42b1fdbecaff64ed542eb138c","urls":["bzz-raw://051743bcc1f901d33fbdfcd307f317909e5c5442adb088f49cf05d245bec7f89","dweb:/ipfs/QmVywZzJ5K56U58X46W4A6jKcQDfwmZiyFWZFF3utWWKmV"],"license":"MIT"},"src/INativeBridgeCounterpartyMOVE.sol":{"keccak256":"0xfc0edebea7371d55fc8ea04b31180bb20d935e876b0c616a57c36ac91964c83a","urls":["bzz-raw://5c55ae7cdd96a16dd30f1fab4c59eba565c3d08f56884231a054adec45c2ace8","dweb:/ipfs/QmURFF2khftD1FpUnAhtTxV1z7wW5wnQYcP4FkjtWDyy1p"],"license":null},"src/INativeBridgeInitiatorMOVE.sol":{"keccak256":"0x3705cbaaf8910b786e5cb99d8d1bfa3f591add9a1d835703a69d6a77020ad841","urls":["bzz-raw://12cca43905283adf49be8a23853952b90be09d3ba38b583fd8c2821e97ad8c0a","dweb:/ipfs/QmaxHt6YUKb97dCz1rUjvjfM3XLcoLNvoFrUkDA6a77ER5"],"license":"MIT"},"src/MockMOVEToken.sol":{"keccak256":"0x71768bf12ff974ee8589bee8b951fa63c7db1f74f251c5997232643bc749a8e4","urls":["bzz-raw://38474add7fec1c814adf1ad614e4ca233b9f789f279690c698a3a94334c029cf","dweb:/ipfs/Qmah2K8YEmLqnKjXcGvbSD55sm61zkKVvNMhehmrj6VzBs"],"license":"MIT"}},"version":1},"id":43} \ No newline at end of file diff --git a/protocol-units/bridge/service/abis/AtomicBridgeInitiatorMOVE.json b/protocol-units/bridge/service/abis/NativeBridgeInitiatorMOVE.json similarity index 98% rename from protocol-units/bridge/service/abis/AtomicBridgeInitiatorMOVE.json rename to protocol-units/bridge/service/abis/NativeBridgeInitiatorMOVE.json index 97641127e..80cec7fc3 100644 --- a/protocol-units/bridge/service/abis/AtomicBridgeInitiatorMOVE.json +++ b/protocol-units/bridge/service/abis/NativeBridgeInitiatorMOVE.json @@ -1 +1 @@ -{"abi":[{"type":"function","name":"bridgeTransfers","inputs":[{"name":"","type":"bytes32","internalType":"bytes32"}],"outputs":[{"name":"amount","type":"uint256","internalType":"uint256"},{"name":"originator","type":"address","internalType":"address"},{"name":"recipient","type":"bytes32","internalType":"bytes32"},{"name":"hashLock","type":"bytes32","internalType":"bytes32"},{"name":"timeLock","type":"uint256","internalType":"uint256"},{"name":"state","type":"uint8","internalType":"enum AtomicBridgeInitiatorMOVE.MessageState"}],"stateMutability":"view"},{"type":"function","name":"completeBridgeTransfer","inputs":[{"name":"bridgeTransferId","type":"bytes32","internalType":"bytes32"},{"name":"preImage","type":"bytes32","internalType":"bytes32"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"counterpartyAddress","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"initialize","inputs":[{"name":"_moveToken","type":"address","internalType":"address"},{"name":"owner","type":"address","internalType":"address"},{"name":"_timeLockDuration","type":"uint256","internalType":"uint256"},{"name":"_initialPoolBalance","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"initiateBridgeTransfer","inputs":[{"name":"moveAmount","type":"uint256","internalType":"uint256"},{"name":"recipient","type":"bytes32","internalType":"bytes32"},{"name":"hashLock","type":"bytes32","internalType":"bytes32"}],"outputs":[{"name":"bridgeTransferId","type":"bytes32","internalType":"bytes32"}],"stateMutability":"nonpayable"},{"type":"function","name":"initiatorTimeLockDuration","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"moveToken","inputs":[],"outputs":[{"name":"","type":"address","internalType":"contract ERC20Upgradeable"}],"stateMutability":"view"},{"type":"function","name":"owner","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"poolBalance","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"refundBridgeTransfer","inputs":[{"name":"bridgeTransferId","type":"bytes32","internalType":"bytes32"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"renounceOwnership","inputs":[],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setCounterpartyAddress","inputs":[{"name":"_counterpartyAddress","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"transferOwnership","inputs":[{"name":"newOwner","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"withdrawMOVE","inputs":[{"name":"recipient","type":"address","internalType":"address"},{"name":"amount","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"event","name":"BridgeTransferCompleted","inputs":[{"name":"_bridgeTransferId","type":"bytes32","indexed":true,"internalType":"bytes32"},{"name":"pre_image","type":"bytes32","indexed":false,"internalType":"bytes32"}],"anonymous":false},{"type":"event","name":"BridgeTransferInitiated","inputs":[{"name":"_bridgeTransferId","type":"bytes32","indexed":true,"internalType":"bytes32"},{"name":"_originator","type":"address","indexed":true,"internalType":"address"},{"name":"_recipient","type":"bytes32","indexed":true,"internalType":"bytes32"},{"name":"amount","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"_hashLock","type":"bytes32","indexed":false,"internalType":"bytes32"},{"name":"_timeLock","type":"uint256","indexed":false,"internalType":"uint256"}],"anonymous":false},{"type":"event","name":"BridgeTransferRefunded","inputs":[{"name":"_bridgeTransferId","type":"bytes32","indexed":true,"internalType":"bytes32"}],"anonymous":false},{"type":"event","name":"Initialized","inputs":[{"name":"version","type":"uint64","indexed":false,"internalType":"uint64"}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"name":"previousOwner","type":"address","indexed":true,"internalType":"address"},{"name":"newOwner","type":"address","indexed":true,"internalType":"address"}],"anonymous":false},{"type":"error","name":"BridgeTransferHasBeenCompleted","inputs":[]},{"type":"error","name":"BridgeTransferInvalid","inputs":[]},{"type":"error","name":"BridgeTransferStateNotInitialized","inputs":[]},{"type":"error","name":"InsufficientMOVEBalance","inputs":[]},{"type":"error","name":"InvalidInitialization","inputs":[]},{"type":"error","name":"InvalidSecret","inputs":[]},{"type":"error","name":"MOVETransferFailed","inputs":[]},{"type":"error","name":"NotInitializing","inputs":[]},{"type":"error","name":"OwnableInvalidOwner","inputs":[{"name":"owner","type":"address","internalType":"address"}]},{"type":"error","name":"OwnableUnauthorizedAccount","inputs":[{"name":"account","type":"address","internalType":"address"}]},{"type":"error","name":"TimeLockNotExpired","inputs":[]},{"type":"error","name":"TimelockExpired","inputs":[]},{"type":"error","name":"Unauthorized","inputs":[]},{"type":"error","name":"ZeroAddress","inputs":[]},{"type":"error","name":"ZeroAmount","inputs":[]}],"bytecode":{"object":"0x6080604052348015600e575f80fd5b50610d6d8061001c5f395ff3fe608060405234801561000f575f80fd5b50600436106100e4575f3560e01c806396365d4411610088578063e0d9cbc411610063578063e0d9cbc4146101d1578063e20c95ec14610232578063eb990c5914610245578063f2fde38b14610258575f80fd5b806396365d44146101a25780639f8f8799146101ab578063cacfb161146101be575f80fd5b80632b3948bb116100c35780632b3948bb1461014e5780635780802014610157578063715018a61461016a5780638da5cb5b14610172575f80fd5b80621a153e146100e85780631a8849a4146100fd5780631f92c08e14610123575b5f80fd5b6100fb6100f6366004610b6d565b61026b565b005b61011061010b366004610b8d565b6102bc565b6040519081526020015b60405180910390f35b600254610136906001600160a01b031681565b6040516001600160a01b03909116815260200161011a565b61011060055481565b6100fb610165366004610bb6565b610524565b6100fb610683565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b0316610136565b61011060015481565b6100fb6101b9366004610bcd565b610696565b6100fb6101cc366004610bed565b61078e565b6102206101df366004610bb6565b5f6020819052908152604090208054600182015460028301546003840154600485015460059095015493946001600160a01b03909316939192909160ff1686565b60405161011a96959493929190610c29565b600354610136906001600160a01b031681565b6100fb610253366004610c81565b610886565b6100fb610266366004610b6d565b6109e3565b610273610a25565b6001600160a01b03811661029a5760405163d92e233d60e01b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b5f338482036102de57604051631f2a200560e01b815260040160405180910390fd5b6003546040516323b872dd60e01b81526001600160a01b03838116600483015230602483015260448201889052909116906323b872dd906064016020604051808303815f875af1158015610334573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103589190610cc0565b61037557604051631a67cf2760e31b815260040160405180910390fd5b8460015f8282546103869190610cf3565b90915550506005546004805483928792879242915f6103a483610d0c565b9091555060405160609690961b6bffffffffffffffffffffffff19166020870152603486019490945260548501929092526074840152609483015260b482015260d4016040516020818303038152906040528051906020012091506040518060c00160405280868152602001826001600160a01b03168152602001858152602001848152602001600554426104399190610cf3565b81525f60209182018190528481528082526040908190208351815591830151600180840180546001600160a01b0319166001600160a01b039093169290921790915590830151600280840191909155606084015160038401556080840151600484015560a08401516005840180549193909260ff199092169184908111156104c3576104c3610c15565b021790555050600554604080518881526020810187905280820192909252518692506001600160a01b0384169185917f44e287be4fbd3a2dcc143a376301094fd2f809dcc2a8d3c09d0a0715224766c49181900360600190a4509392505050565b61052c610a25565b5f81815260208190526040812090600582015460ff16600281111561055357610553610c15565b1461057157604051630ffb9dcb60e01b815260040160405180910390fd5b80600401544210156105965760405163191f4d1b60e31b815260040160405180910390fd5b60058101805460ff191660021790558054600180545f906105b8908490610d24565b90915550506003546001820154825460405163a9059cbb60e01b81526001600160a01b039283166004820152602481019190915291169063a9059cbb906044016020604051808303815f875af1158015610614573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106389190610cc0565b61065557604051631a67cf2760e31b815260040160405180910390fd5b60405182907f4fee0a65c921e50a9623c3abe10a4067e49c03ef491e7b406dace7cb79c12c61905f90a25050565b61068b610a25565b6106945f610a80565b565b5f82815260208190526040812090600582015460ff1660028111156106bd576106bd610c15565b146106db57604051630437880960e41b815260040160405180910390fd5b600381015460408051602081018590520160405160208183030381529060405280519060200120146107205760405163abab6bd760e01b815260040160405180910390fd5b806004015442111561074557604051633d37e55360e11b815260040160405180910390fd5b60058101805460ff1916600117905560405182815283907f05ddc886acde01b77731bfad1dcfb6abf529f05c28ea66556fe87429bb2789ea9060200160405180910390a2505050565b6002546001600160a01b031633146107b8576040516282b42960e81b815260040160405180910390fd5b8060015410156107db576040516381a6aee360e01b815260040160405180910390fd5b8060015f8282546107ec9190610d24565b909155505060035460405163a9059cbb60e01b81526001600160a01b038481166004830152602482018490529091169063a9059cbb906044016020604051808303815f875af1158015610841573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108659190610cc0565b61088257604051631a67cf2760e31b815260040160405180910390fd5b5050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff165f811580156108cb5750825b90505f8267ffffffffffffffff1660011480156108e75750303b155b9050811580156108f5575080155b156109135760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff19166001178555831561093d57845460ff60401b1916600160401b1785555b6001600160a01b0389166109645760405163d92e233d60e01b815260040160405180910390fd5b600380546001600160a01b0319166001600160a01b038b1617905561098888610af0565b6005879055600186905583156109d857845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b505050505050505050565b6109eb610a25565b6001600160a01b038116610a1957604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b610a2281610a80565b50565b33610a577f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b031690565b6001600160a01b0316146106945760405163118cdaa760e01b8152336004820152602401610a10565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a3505050565b610af8610b01565b610a2281610b4a565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff1661069457604051631afcd79f60e31b815260040160405180910390fd5b6109eb610b01565b80356001600160a01b0381168114610b68575f80fd5b919050565b5f60208284031215610b7d575f80fd5b610b8682610b52565b9392505050565b5f805f60608486031215610b9f575f80fd5b505081359360208301359350604090920135919050565b5f60208284031215610bc6575f80fd5b5035919050565b5f8060408385031215610bde575f80fd5b50508035926020909101359150565b5f8060408385031215610bfe575f80fd5b610c0783610b52565b946020939093013593505050565b634e487b7160e01b5f52602160045260245ffd5b8681526001600160a01b038616602082015260408101859052606081018490526080810183905260c0810160038310610c7057634e487b7160e01b5f52602160045260245ffd5b8260a0830152979650505050505050565b5f805f8060808587031215610c94575f80fd5b610c9d85610b52565b9350610cab60208601610b52565b93969395505050506040820135916060013590565b5f60208284031215610cd0575f80fd5b81518015158114610b86575f80fd5b634e487b7160e01b5f52601160045260245ffd5b80820180821115610d0657610d06610cdf565b92915050565b5f60018201610d1d57610d1d610cdf565b5060010190565b81810381811115610d0657610d06610cdf56fea2646970667358221220aed2fc8fb2e8cd0dfa9263a977bf0c5376c006353fd623bd4c78028692d5081c64736f6c634300081a0033","sourceMap":"392:4589:45:-:0;;;;;;;;;;;;;;;;;;;","linkReferences":{}},"deployedBytecode":{"object":"0x608060405234801561000f575f80fd5b50600436106100e4575f3560e01c806396365d4411610088578063e0d9cbc411610063578063e0d9cbc4146101d1578063e20c95ec14610232578063eb990c5914610245578063f2fde38b14610258575f80fd5b806396365d44146101a25780639f8f8799146101ab578063cacfb161146101be575f80fd5b80632b3948bb116100c35780632b3948bb1461014e5780635780802014610157578063715018a61461016a5780638da5cb5b14610172575f80fd5b80621a153e146100e85780631a8849a4146100fd5780631f92c08e14610123575b5f80fd5b6100fb6100f6366004610b6d565b61026b565b005b61011061010b366004610b8d565b6102bc565b6040519081526020015b60405180910390f35b600254610136906001600160a01b031681565b6040516001600160a01b03909116815260200161011a565b61011060055481565b6100fb610165366004610bb6565b610524565b6100fb610683565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b0316610136565b61011060015481565b6100fb6101b9366004610bcd565b610696565b6100fb6101cc366004610bed565b61078e565b6102206101df366004610bb6565b5f6020819052908152604090208054600182015460028301546003840154600485015460059095015493946001600160a01b03909316939192909160ff1686565b60405161011a96959493929190610c29565b600354610136906001600160a01b031681565b6100fb610253366004610c81565b610886565b6100fb610266366004610b6d565b6109e3565b610273610a25565b6001600160a01b03811661029a5760405163d92e233d60e01b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b5f338482036102de57604051631f2a200560e01b815260040160405180910390fd5b6003546040516323b872dd60e01b81526001600160a01b03838116600483015230602483015260448201889052909116906323b872dd906064016020604051808303815f875af1158015610334573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103589190610cc0565b61037557604051631a67cf2760e31b815260040160405180910390fd5b8460015f8282546103869190610cf3565b90915550506005546004805483928792879242915f6103a483610d0c565b9091555060405160609690961b6bffffffffffffffffffffffff19166020870152603486019490945260548501929092526074840152609483015260b482015260d4016040516020818303038152906040528051906020012091506040518060c00160405280868152602001826001600160a01b03168152602001858152602001848152602001600554426104399190610cf3565b81525f60209182018190528481528082526040908190208351815591830151600180840180546001600160a01b0319166001600160a01b039093169290921790915590830151600280840191909155606084015160038401556080840151600484015560a08401516005840180549193909260ff199092169184908111156104c3576104c3610c15565b021790555050600554604080518881526020810187905280820192909252518692506001600160a01b0384169185917f44e287be4fbd3a2dcc143a376301094fd2f809dcc2a8d3c09d0a0715224766c49181900360600190a4509392505050565b61052c610a25565b5f81815260208190526040812090600582015460ff16600281111561055357610553610c15565b1461057157604051630ffb9dcb60e01b815260040160405180910390fd5b80600401544210156105965760405163191f4d1b60e31b815260040160405180910390fd5b60058101805460ff191660021790558054600180545f906105b8908490610d24565b90915550506003546001820154825460405163a9059cbb60e01b81526001600160a01b039283166004820152602481019190915291169063a9059cbb906044016020604051808303815f875af1158015610614573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106389190610cc0565b61065557604051631a67cf2760e31b815260040160405180910390fd5b60405182907f4fee0a65c921e50a9623c3abe10a4067e49c03ef491e7b406dace7cb79c12c61905f90a25050565b61068b610a25565b6106945f610a80565b565b5f82815260208190526040812090600582015460ff1660028111156106bd576106bd610c15565b146106db57604051630437880960e41b815260040160405180910390fd5b600381015460408051602081018590520160405160208183030381529060405280519060200120146107205760405163abab6bd760e01b815260040160405180910390fd5b806004015442111561074557604051633d37e55360e11b815260040160405180910390fd5b60058101805460ff1916600117905560405182815283907f05ddc886acde01b77731bfad1dcfb6abf529f05c28ea66556fe87429bb2789ea9060200160405180910390a2505050565b6002546001600160a01b031633146107b8576040516282b42960e81b815260040160405180910390fd5b8060015410156107db576040516381a6aee360e01b815260040160405180910390fd5b8060015f8282546107ec9190610d24565b909155505060035460405163a9059cbb60e01b81526001600160a01b038481166004830152602482018490529091169063a9059cbb906044016020604051808303815f875af1158015610841573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108659190610cc0565b61088257604051631a67cf2760e31b815260040160405180910390fd5b5050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff165f811580156108cb5750825b90505f8267ffffffffffffffff1660011480156108e75750303b155b9050811580156108f5575080155b156109135760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff19166001178555831561093d57845460ff60401b1916600160401b1785555b6001600160a01b0389166109645760405163d92e233d60e01b815260040160405180910390fd5b600380546001600160a01b0319166001600160a01b038b1617905561098888610af0565b6005879055600186905583156109d857845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b505050505050505050565b6109eb610a25565b6001600160a01b038116610a1957604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b610a2281610a80565b50565b33610a577f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b031690565b6001600160a01b0316146106945760405163118cdaa760e01b8152336004820152602401610a10565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a3505050565b610af8610b01565b610a2281610b4a565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff1661069457604051631afcd79f60e31b815260040160405180910390fd5b6109eb610b01565b80356001600160a01b0381168114610b68575f80fd5b919050565b5f60208284031215610b7d575f80fd5b610b8682610b52565b9392505050565b5f805f60608486031215610b9f575f80fd5b505081359360208301359350604090920135919050565b5f60208284031215610bc6575f80fd5b5035919050565b5f8060408385031215610bde575f80fd5b50508035926020909101359150565b5f8060408385031215610bfe575f80fd5b610c0783610b52565b946020939093013593505050565b634e487b7160e01b5f52602160045260245ffd5b8681526001600160a01b038616602082015260408101859052606081018490526080810183905260c0810160038310610c7057634e487b7160e01b5f52602160045260245ffd5b8260a0830152979650505050505050565b5f805f8060808587031215610c94575f80fd5b610c9d85610b52565b9350610cab60208601610b52565b93969395505050506040820135916060013590565b5f60208284031215610cd0575f80fd5b81518015158114610b86575f80fd5b634e487b7160e01b5f52601160045260245ffd5b80820180821115610d0657610d06610cdf565b92915050565b5f60018201610d1d57610d1d610cdf565b5060010190565b81810381811115610d0657610d06610cdf56fea2646970667358221220aed2fc8fb2e8cd0dfa9263a977bf0c5376c006353fd623bd4c78028692d5081c64736f6c634300081a0033","sourceMap":"392:4589:45:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1828:210;;;;;;:::i;:::-;;:::i;:::-;;2044:1298;;;;;;:::i;:::-;;:::i;:::-;;;1000:25:57;;;988:2;973:18;2044:1298:45;;;;;;;;989:34;;;;;-1:-1:-1;;;;;989:34:45;;;;;;-1:-1:-1;;;;;1200:32:57;;;1182:51;;1170:2;1155:18;989:34:45;1036:203:57;1135:40:45;;;;;;3937:713;;;;;;:::i;:::-;;:::i;3155:101:23:-;;;:::i;2441:144::-;1313:22;2570:8;-1:-1:-1;;;;;2570:8:23;2441:144;;956:26:45;;;;;;3348:583;;;;;;:::i;:::-;;:::i;4656:323::-;;;;;;:::i;:::-;;:::i;855:57::-;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;855:57:45;;;;;;;;;;;;;;;;;;;;;;;;:::i;1029:33::-;;;;;-1:-1:-1;;;;;1029:33:45;;;1297:525;;;;;;:::i;:::-;;:::i;3405:215:23:-;;;;;;:::i;:::-;;:::i;1828:210:45:-;2334:13:23;:11;:13::i;:::-;-1:-1:-1;;;;;1923:34:45;::::1;1919:60;;1966:13;;-1:-1:-1::0;;;1966:13:45::1;;;;;;;;;;;1919:60;1989:19;:42:::0;;-1:-1:-1;;;;;;1989:42:45::1;-1:-1:-1::0;;;;;1989:42:45;;;::::1;::::0;;;::::1;::::0;;1828:210::o;2044:1298::-;2167:24;2228:10;2295:15;;;2291:65;;2333:12;;-1:-1:-1;;;2333:12:45;;;;;;;;;;;2291:65;2437:9;;:61;;-1:-1:-1;;;2437:61:45;;-1:-1:-1;;;;;4134:32:57;;;2437:61:45;;;4116:51:57;2480:4:45;4183:18:57;;;4176:60;4252:18;;;4245:34;;;2437:9:45;;;;:22;;4089:18:57;;2437:61:45;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;2432:120;;2521:20;;-1:-1:-1;;;2521:20:45;;;;;;;;;;;2432:120;2612:10;2597:11;;:25;;;;;;;:::i;:::-;;;;-1:-1:-1;;2801:25:45;;2845:5;:7;;2768:10;;2780:9;;2791:8;;2828:15;;2845:5;:7;;;:::i;:::-;;;;-1:-1:-1;2751:102:45;;5263:2:57;5259:15;;;;-1:-1:-1;;5255:53:57;2751:102:45;;;5243:66:57;5325:12;;;5318:28;;;;5362:12;;;5355:28;;;;5399:12;;;5392:28;5436:13;;;5429:29;5474:13;;;5467:29;5512:13;;2751:102:45;;;;;;;;;;;;2741:113;;;;;;2722:132;;2901:272;;;;;;;;2938:10;2901:272;;;;2974:10;-1:-1:-1;;;;;2901:272:45;;;;;3009:9;2901:272;;;;3042:8;2901:272;;;;3092:25;;3074:15;:43;;;;:::i;:::-;2901:272;;3138:24;2901:272;;;;;;;2865:33;;;;;;;;;;;:308;;;;;;;;;;;;;;-1:-1:-1;;;;;;2865:308:45;-1:-1:-1;;;;;2865:308:45;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;2865:308:45;;;;;;;;;;;;;:::i;:::-;;;;;-1:-1:-1;;3276:25:45;;3189:113;;;5738:25:57;;;5794:2;5779:18;;5772:34;;;5822:18;;;5815:34;;;;3189:113:45;3243:9;;-1:-1:-1;;;;;;3189:113:45;;;3213:16;;3189:113;;;;;5726:2:57;3189:113:45;;;3312:23;2044:1298;;;;;:::o;3937:713::-;2334:13:23;:11;:13::i;:::-;4022:37:45::1;4062:33:::0;;;::::1;::::0;;;;;;;4109:20:::1;::::0;::::1;::::0;::::1;;:48;::::0;::::1;;;;;;:::i;:::-;;4105:96;;4166:35;;-1:-1:-1::0;;;4166:35:45::1;;;;;;;;;;;4105:96;4233:14;:23;;;4215:15;:41;4211:74;;;4265:20;;-1:-1:-1::0;;;4265:20:45::1;;;;;;;;;;;4211:74;4295:20;::::0;::::1;:44:::0;;-1:-1:-1;;4295:44:45::1;4318:21;4295:44;::::0;;4454:21;;4295:44;4439:36;;-1:-1:-1;;4439:36:45::1;::::0;4454:21;;4439:36:::1;:::i;:::-;::::0;;;-1:-1:-1;;4490:9:45::1;::::0;;4509:25;::::1;::::0;4536:21;;4490:68:::1;::::0;-1:-1:-1;;;4490:68:45;;-1:-1:-1;;;;;4509:25:45;;::::1;4490:68;::::0;::::1;6167:51:57::0;6234:18;;;6227:34;;;;4490:9:45;::::1;::::0;:18:::1;::::0;6140::57;;4490:68:45::1;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;4485:102;;4567:20;;-1:-1:-1::0;;;4567:20:45::1;;;;;;;;;;;4485:102;4603:40;::::0;4626:16;;4603:40:::1;::::0;;;::::1;4012:638;3937:713:::0;:::o;3155:101:23:-;2334:13;:11;:13::i;:::-;3219:30:::1;3246:1;3219:18;:30::i;:::-;3155:101::o:0;3348:583:45:-;3443:37;3483:33;;;;;;;;;;;3530:20;;;;;;:48;;;;;;;;:::i;:::-;;3526:93;;3587:32;;-1:-1:-1;;;3587:32:45;;;;;;;;;;;3526:93;3674:23;;;;3643:26;;;;;;6401:19:57;;;6436:12;3643:26:45;;;;;;;;;;;;3633:37;;;;;;:64;3629:92;;3706:15;;-1:-1:-1;;;3706:15:45;;;;;;;;;;;3629:92;3753:14;:23;;;3735:15;:41;3731:71;;;3785:17;;-1:-1:-1;;;3785:17:45;;;;;;;;;;;3731:71;3812:20;;;:45;;-1:-1:-1;;3812:45:45;3835:22;3812:45;;;3873:51;;1000:25:57;;;3897:16:45;;3873:51;;988:2:57;973:18;3873:51:45;;;;;;;3433:498;3348:583;;:::o;4656:323::-;4750:19;;-1:-1:-1;;;;;4750:19:45;4736:10;:33;4732:60;;4778:14;;-1:-1:-1;;;4778:14:45;;;;;;;;;;;4732:60;4820:6;4806:11;;:20;4802:58;;;4835:25;;-1:-1:-1;;;4835:25:45;;;;;;;;;;;4802:58;4885:6;4870:11;;:21;;;;;;;:::i;:::-;;;;-1:-1:-1;;4906:9:45;;:37;;-1:-1:-1;;;4906:37:45;;-1:-1:-1;;;;;6185:32:57;;;4906:37:45;;;6167:51:57;6234:18;;;6227:34;;;4906:9:45;;;;:18;;6140::57;;4906:37:45;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;4901:71;;4952:20;;-1:-1:-1;;;4952:20:45;;;;;;;;;;;4901:71;4656:323;;:::o;1297:525::-;8870:21:24;4302:15;;-1:-1:-1;;;4302:15:24;;;;4301:16;;4348:14;;4158:30;4726:16;;:34;;;;;4746:14;4726:34;4706:54;;4770:17;4790:11;:16;;4805:1;4790:16;:50;;;;-1:-1:-1;4818:4:24;4810:25;:30;4790:50;4770:70;;4856:12;4855:13;:30;;;;;4873:12;4872:13;4855:30;4851:91;;;4908:23;;-1:-1:-1;;;4908:23:24;;;;;;;;;;;4851:91;4951:18;;-1:-1:-1;;4951:18:24;4968:1;4951:18;;;4979:67;;;;5013:22;;-1:-1:-1;;;;5013:22:24;-1:-1:-1;;;5013:22:24;;;4979:67;-1:-1:-1;;;;;1479:24:45;::::1;1475:75;;1526:13;;-1:-1:-1::0;;;1526:13:45::1;;;;;;;;;;;1475:75;1559:9;:40:::0;;-1:-1:-1;;;;;;1559:40:45::1;-1:-1:-1::0;;;;;1559:40:45;::::1;;::::0;;1609:21:::1;1624:5:::0;1609:14:::1;:21::i;:::-;1686:25;:45:::0;;;1782:11:::1;:33:::0;;;5066:101:24;;;;5100:23;;-1:-1:-1;;;;5100:23:24;;;5142:14;;-1:-1:-1;6612:50:57;;5142:14:24;;6600:2:57;6585:18;5142:14:24;;;;;;;5066:101;4092:1081;;;;;1297:525:45;;;;:::o;3405:215:23:-;2334:13;:11;:13::i;:::-;-1:-1:-1;;;;;3489:22:23;::::1;3485:91;;3534:31;::::0;-1:-1:-1;;;3534:31:23;;3562:1:::1;3534:31;::::0;::::1;1182:51:57::0;1155:18;;3534:31:23::1;;;;;;;;3485:91;3585:28;3604:8;3585:18;:28::i;:::-;3405:215:::0;:::o;2658:162::-;966:10:26;2717:7:23;1313:22;2570:8;-1:-1:-1;;;;;2570:8:23;;2441:144;2717:7;-1:-1:-1;;;;;2717:23:23;;2713:101;;2763:40;;-1:-1:-1;;;2763:40:23;;966:10:26;2763:40:23;;;1182:51:57;1155:18;;2763:40:23;1036:203:57;3774:248:23;1313:22;3923:8;;-1:-1:-1;;;;;;3941:19:23;;-1:-1:-1;;;;;3941:19:23;;;;;;;;3975:40;;3923:8;;;;;3975:40;;3847:24;;3975:40;3837:185;;3774:248;:::o;1847:127::-;6931:20:24;:18;:20::i;:::-;1929:38:23::1;1954:12;1929:24;:38::i;7084:141:24:-:0;8870:21;8560:40;-1:-1:-1;;;8560:40:24;;;;7146:73;;7191:17;;-1:-1:-1;;;7191:17:24;;;;;;;;;;;1980:235:23;6931:20:24;:18;:20::i;14:173:57:-;82:20;;-1:-1:-1;;;;;131:31:57;;121:42;;111:70;;177:1;174;167:12;111:70;14:173;;;:::o;192:186::-;251:6;304:2;292:9;283:7;279:23;275:32;272:52;;;320:1;317;310:12;272:52;343:29;362:9;343:29;:::i;:::-;333:39;192:186;-1:-1:-1;;;192:186:57:o;383:466::-;460:6;468;476;529:2;517:9;508:7;504:23;500:32;497:52;;;545:1;542;535:12;497:52;-1:-1:-1;;590:23:57;;;710:2;695:18;;682:32;;-1:-1:-1;813:2:57;798:18;;;785:32;;383:466;-1:-1:-1;383:466:57:o;1426:226::-;1485:6;1538:2;1526:9;1517:7;1513:23;1509:32;1506:52;;;1554:1;1551;1544:12;1506:52;-1:-1:-1;1599:23:57;;1426:226;-1:-1:-1;1426:226:57:o;1657:346::-;1725:6;1733;1786:2;1774:9;1765:7;1761:23;1757:32;1754:52;;;1802:1;1799;1792:12;1754:52;-1:-1:-1;;1847:23:57;;;1967:2;1952:18;;;1939:32;;-1:-1:-1;1657:346:57:o;2008:300::-;2076:6;2084;2137:2;2125:9;2116:7;2112:23;2108:32;2105:52;;;2153:1;2150;2143:12;2105:52;2176:29;2195:9;2176:29;:::i;:::-;2166:39;2274:2;2259:18;;;;2246:32;;-1:-1:-1;;;2008:300:57:o;2313:127::-;2374:10;2369:3;2365:20;2362:1;2355:31;2405:4;2402:1;2395:15;2429:4;2426:1;2419:15;2445:730;2748:25;;;-1:-1:-1;;;;;2809:32:57;;2804:2;2789:18;;2782:60;2873:2;2858:18;;2851:34;;;2916:2;2901:18;;2894:34;;;2959:3;2944:19;;2937:35;;;2735:3;2720:19;;3002:1;2991:13;;2981:144;;3047:10;3042:3;3038:20;3035:1;3028:31;3082:4;3079:1;3072:15;3110:4;3107:1;3100:15;2981:144;3162:6;3156:3;3145:9;3141:19;3134:35;2445:730;;;;;;;;;:::o;3414:495::-;3500:6;3508;3516;3524;3577:3;3565:9;3556:7;3552:23;3548:33;3545:53;;;3594:1;3591;3584:12;3545:53;3617:29;3636:9;3617:29;:::i;:::-;3607:39;;3665:38;3699:2;3688:9;3684:18;3665:38;:::i;:::-;3414:495;;3655:48;;-1:-1:-1;;;;3772:2:57;3757:18;;3744:32;;3873:2;3858:18;3845:32;;3414:495::o;4290:277::-;4357:6;4410:2;4398:9;4389:7;4385:23;4381:32;4378:52;;;4426:1;4423;4416:12;4378:52;4458:9;4452:16;4511:5;4504:13;4497:21;4490:5;4487:32;4477:60;;4533:1;4530;4523:12;4572:127;4633:10;4628:3;4624:20;4621:1;4614:31;4664:4;4661:1;4654:15;4688:4;4685:1;4678:15;4704:125;4769:9;;;4790:10;;;4787:36;;;4803:18;;:::i;:::-;4704:125;;;;:::o;4834:135::-;4873:3;4894:17;;;4891:43;;4914:18;;:::i;:::-;-1:-1:-1;4961:1:57;4950:13;;4834:135::o;5860:128::-;5927:9;;;5948:11;;;5945:37;;;5962:18;;:::i","linkReferences":{}},"methodIdentifiers":{"bridgeTransfers(bytes32)":"e0d9cbc4","completeBridgeTransfer(bytes32,bytes32)":"9f8f8799","counterpartyAddress()":"1f92c08e","initialize(address,address,uint256,uint256)":"eb990c59","initiateBridgeTransfer(uint256,bytes32,bytes32)":"1a8849a4","initiatorTimeLockDuration()":"2b3948bb","moveToken()":"e20c95ec","owner()":"8da5cb5b","poolBalance()":"96365d44","refundBridgeTransfer(bytes32)":"57808020","renounceOwnership()":"715018a6","setCounterpartyAddress(address)":"001a153e","transferOwnership(address)":"f2fde38b","withdrawMOVE(address,uint256)":"cacfb161"},"rawMetadata":"{\"compiler\":{\"version\":\"0.8.26+commit.8a97fa7a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"BridgeTransferHasBeenCompleted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BridgeTransferInvalid\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BridgeTransferStateNotInitialized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientMOVEBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidInitialization\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSecret\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MOVETransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotInitializing\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"OwnableInvalidOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"OwnableUnauthorizedAccount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TimeLockNotExpired\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TimelockExpired\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Unauthorized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAmount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"_bridgeTransferId\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"pre_image\",\"type\":\"bytes32\"}],\"name\":\"BridgeTransferCompleted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"_bridgeTransferId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_originator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"_recipient\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_hashLock\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_timeLock\",\"type\":\"uint256\"}],\"name\":\"BridgeTransferInitiated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"_bridgeTransferId\",\"type\":\"bytes32\"}],\"name\":\"BridgeTransferRefunded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"version\",\"type\":\"uint64\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"bridgeTransfers\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"originator\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"recipient\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"hashLock\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"timeLock\",\"type\":\"uint256\"},{\"internalType\":\"enum AtomicBridgeInitiatorMOVE.MessageState\",\"name\":\"state\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"bridgeTransferId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"preImage\",\"type\":\"bytes32\"}],\"name\":\"completeBridgeTransfer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"counterpartyAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_moveToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_timeLockDuration\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_initialPoolBalance\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"moveAmount\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"recipient\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"hashLock\",\"type\":\"bytes32\"}],\"name\":\"initiateBridgeTransfer\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"bridgeTransferId\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initiatorTimeLockDuration\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"moveToken\",\"outputs\":[{\"internalType\":\"contract ERC20Upgradeable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"poolBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"bridgeTransferId\",\"type\":\"bytes32\"}],\"name\":\"refundBridgeTransfer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_counterpartyAddress\",\"type\":\"address\"}],\"name\":\"setCounterpartyAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"withdrawMOVE\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"InvalidInitialization()\":[{\"details\":\"The contract is already initialized.\"}],\"NotInitializing()\":[{\"details\":\"The contract is not initializing.\"}],\"OwnableInvalidOwner(address)\":[{\"details\":\"The owner is not a valid owner account. (eg. `address(0)`)\"}],\"OwnableUnauthorizedAccount(address)\":[{\"details\":\"The caller account is not authorized to perform an operation.\"}]},\"events\":{\"Initialized(uint64)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/AtomicBridgeInitiatorMOVE.sol\":\"AtomicBridgeInitiatorMOVE\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[\":@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/\",\":@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/\",\":ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/\",\":erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/\",\":forge-std/=lib/forge-std/src/\",\":halmos-cheatcodes/=lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/\",\":openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/\",\":openzeppelin-contracts/=lib/openzeppelin-contracts/\"]},\"sources\":{\"lib/openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"keccak256\":\"0xc163fcf9bb10138631a9ba5564df1fa25db9adff73bd9ee868a8ae1858fe093a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9706d43a0124053d9880f6e31a59f31bc0a6a3dc1acd66ce0a16e1111658c5f6\",\"dweb:/ipfs/QmUFmfowzkRwGtDu36cXV9SPTBHJ3n7dG9xQiK5B28jTf2\"]},\"lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"keccak256\":\"0x631188737069917d2f909d29ce62c4d48611d326686ba6683e26b72a23bfac0b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7a61054ae84cd6c4d04c0c4450ba1d6de41e27e0a2c4f1bcdf58f796b401c609\",\"dweb:/ipfs/QmUvtdp7X1mRVyC3CsHrtPbgoqWaXHp3S1ZR24tpAQYJWM\"]},\"lib/openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\":{\"keccak256\":\"0x5a5f22721ffb66d3e1ecc568c0d37c91f91223d8663c8a5e78396e780b849c72\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bdd108133c98ea251513424bf17905090c8a7e0755562a6d12a81b8bccbd6152\",\"dweb:/ipfs/QmahpnB63Up9aVx4jDqxEgry5BRN5itHRvy9rwBvMT2yqL\"]},\"lib/openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"keccak256\":\"0xdbef5f0c787055227243a7318ef74c8a5a1108ca3a07f2b3a00ef67769e1e397\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://08e39f23d5b4692f9a40803e53a8156b72b4c1f9902a88cd65ba964db103dab9\",\"dweb:/ipfs/QmPKn6EYDgpga7KtpkA8wV2yJCYGMtc9K4LkJfhKX2RVSV\"]},\"lib/openzeppelin-contracts/contracts/interfaces/draft-IERC6093.sol\":{\"keccak256\":\"0x9cac1f97ecc92043dd19235d6677e40cf6bac382886a94f7a80a957846b24229\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a1e0c924e0edfdfd4abceeb552d99f1cd95c0d387b38ccb1f67c583607e3d155\",\"dweb:/ipfs/QmZAi6qKa66zuS3jyEhsQR9bBNnZe1wSognYqw9nvseyUz\"]},\"lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0xee2337af2dc162a973b4be6d3f7c16f06298259e0af48c5470d2839bfa8a22f4\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://30c476b4b2f405c1bb3f0bae15b006d129c80f1bfd9d0f2038160a3bb9745009\",\"dweb:/ipfs/Qmb3VcuDufv6xbHeVgksC4tHpc5gKYVqBEwjEXW72XzSvN\"]},\"lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"keccak256\":\"0x88f7b6f070ad1de2bf899da6978ed74b5038eac78c01b7359b92b60c3d965c28\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c436edb6733a036607c6f17cc590e8ee351363a8cb4c564a98d9a66392c89323\",\"dweb:/ipfs/QmcJvJR2K3EtYcKEXVpQ1WqT6TvAbVem5HR1FirAsqEXFR\"]},\"src/AtomicBridgeInitiatorMOVE.sol\":{\"keccak256\":\"0xb6431a67dd2961b54aeed2a51a2f1c3a80a8fbe42b1fdbecaff64ed542eb138c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://051743bcc1f901d33fbdfcd307f317909e5c5442adb088f49cf05d245bec7f89\",\"dweb:/ipfs/QmVywZzJ5K56U58X46W4A6jKcQDfwmZiyFWZFF3utWWKmV\"]},\"src/IAtomicBridgeInitiatorMOVE.sol\":{\"keccak256\":\"0x3705cbaaf8910b786e5cb99d8d1bfa3f591add9a1d835703a69d6a77020ad841\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://12cca43905283adf49be8a23853952b90be09d3ba38b583fd8c2821e97ad8c0a\",\"dweb:/ipfs/QmaxHt6YUKb97dCz1rUjvjfM3XLcoLNvoFrUkDA6a77ER5\"]},\"src/MockMOVEToken.sol\":{\"keccak256\":\"0x71768bf12ff974ee8589bee8b951fa63c7db1f74f251c5997232643bc749a8e4\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://38474add7fec1c814adf1ad614e4ca233b9f789f279690c698a3a94334c029cf\",\"dweb:/ipfs/Qmah2K8YEmLqnKjXcGvbSD55sm61zkKVvNMhehmrj6VzBs\"]}},\"version\":1}","metadata":{"compiler":{"version":"0.8.26+commit.8a97fa7a"},"language":"Solidity","output":{"abi":[{"inputs":[],"type":"error","name":"BridgeTransferHasBeenCompleted"},{"inputs":[],"type":"error","name":"BridgeTransferInvalid"},{"inputs":[],"type":"error","name":"BridgeTransferStateNotInitialized"},{"inputs":[],"type":"error","name":"InsufficientMOVEBalance"},{"inputs":[],"type":"error","name":"InvalidInitialization"},{"inputs":[],"type":"error","name":"InvalidSecret"},{"inputs":[],"type":"error","name":"MOVETransferFailed"},{"inputs":[],"type":"error","name":"NotInitializing"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"type":"error","name":"OwnableInvalidOwner"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"type":"error","name":"OwnableUnauthorizedAccount"},{"inputs":[],"type":"error","name":"TimeLockNotExpired"},{"inputs":[],"type":"error","name":"TimelockExpired"},{"inputs":[],"type":"error","name":"Unauthorized"},{"inputs":[],"type":"error","name":"ZeroAddress"},{"inputs":[],"type":"error","name":"ZeroAmount"},{"inputs":[{"internalType":"bytes32","name":"_bridgeTransferId","type":"bytes32","indexed":true},{"internalType":"bytes32","name":"pre_image","type":"bytes32","indexed":false}],"type":"event","name":"BridgeTransferCompleted","anonymous":false},{"inputs":[{"internalType":"bytes32","name":"_bridgeTransferId","type":"bytes32","indexed":true},{"internalType":"address","name":"_originator","type":"address","indexed":true},{"internalType":"bytes32","name":"_recipient","type":"bytes32","indexed":true},{"internalType":"uint256","name":"amount","type":"uint256","indexed":false},{"internalType":"bytes32","name":"_hashLock","type":"bytes32","indexed":false},{"internalType":"uint256","name":"_timeLock","type":"uint256","indexed":false}],"type":"event","name":"BridgeTransferInitiated","anonymous":false},{"inputs":[{"internalType":"bytes32","name":"_bridgeTransferId","type":"bytes32","indexed":true}],"type":"event","name":"BridgeTransferRefunded","anonymous":false},{"inputs":[{"internalType":"uint64","name":"version","type":"uint64","indexed":false}],"type":"event","name":"Initialized","anonymous":false},{"inputs":[{"internalType":"address","name":"previousOwner","type":"address","indexed":true},{"internalType":"address","name":"newOwner","type":"address","indexed":true}],"type":"event","name":"OwnershipTransferred","anonymous":false},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function","name":"bridgeTransfers","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"originator","type":"address"},{"internalType":"bytes32","name":"recipient","type":"bytes32"},{"internalType":"bytes32","name":"hashLock","type":"bytes32"},{"internalType":"uint256","name":"timeLock","type":"uint256"},{"internalType":"enum AtomicBridgeInitiatorMOVE.MessageState","name":"state","type":"uint8"}]},{"inputs":[{"internalType":"bytes32","name":"bridgeTransferId","type":"bytes32"},{"internalType":"bytes32","name":"preImage","type":"bytes32"}],"stateMutability":"nonpayable","type":"function","name":"completeBridgeTransfer"},{"inputs":[],"stateMutability":"view","type":"function","name":"counterpartyAddress","outputs":[{"internalType":"address","name":"","type":"address"}]},{"inputs":[{"internalType":"address","name":"_moveToken","type":"address"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"_timeLockDuration","type":"uint256"},{"internalType":"uint256","name":"_initialPoolBalance","type":"uint256"}],"stateMutability":"nonpayable","type":"function","name":"initialize"},{"inputs":[{"internalType":"uint256","name":"moveAmount","type":"uint256"},{"internalType":"bytes32","name":"recipient","type":"bytes32"},{"internalType":"bytes32","name":"hashLock","type":"bytes32"}],"stateMutability":"nonpayable","type":"function","name":"initiateBridgeTransfer","outputs":[{"internalType":"bytes32","name":"bridgeTransferId","type":"bytes32"}]},{"inputs":[],"stateMutability":"view","type":"function","name":"initiatorTimeLockDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}]},{"inputs":[],"stateMutability":"view","type":"function","name":"moveToken","outputs":[{"internalType":"contract ERC20Upgradeable","name":"","type":"address"}]},{"inputs":[],"stateMutability":"view","type":"function","name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}]},{"inputs":[],"stateMutability":"view","type":"function","name":"poolBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}]},{"inputs":[{"internalType":"bytes32","name":"bridgeTransferId","type":"bytes32"}],"stateMutability":"nonpayable","type":"function","name":"refundBridgeTransfer"},{"inputs":[],"stateMutability":"nonpayable","type":"function","name":"renounceOwnership"},{"inputs":[{"internalType":"address","name":"_counterpartyAddress","type":"address"}],"stateMutability":"nonpayable","type":"function","name":"setCounterpartyAddress"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"stateMutability":"nonpayable","type":"function","name":"transferOwnership"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"nonpayable","type":"function","name":"withdrawMOVE"}],"devdoc":{"kind":"dev","methods":{"owner()":{"details":"Returns the address of the current owner."},"renounceOwnership()":{"details":"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner."},"transferOwnership(address)":{"details":"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner."}},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"remappings":["@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/","@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/","ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/","erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/","forge-std/=lib/forge-std/src/","halmos-cheatcodes/=lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/","openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/","openzeppelin-contracts/=lib/openzeppelin-contracts/"],"optimizer":{"enabled":true,"runs":200},"metadata":{"bytecodeHash":"ipfs"},"compilationTarget":{"src/AtomicBridgeInitiatorMOVE.sol":"AtomicBridgeInitiatorMOVE"},"evmVersion":"cancun","libraries":{}},"sources":{"lib/openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol":{"keccak256":"0xc163fcf9bb10138631a9ba5564df1fa25db9adff73bd9ee868a8ae1858fe093a","urls":["bzz-raw://9706d43a0124053d9880f6e31a59f31bc0a6a3dc1acd66ce0a16e1111658c5f6","dweb:/ipfs/QmUFmfowzkRwGtDu36cXV9SPTBHJ3n7dG9xQiK5B28jTf2"],"license":"MIT"},"lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol":{"keccak256":"0x631188737069917d2f909d29ce62c4d48611d326686ba6683e26b72a23bfac0b","urls":["bzz-raw://7a61054ae84cd6c4d04c0c4450ba1d6de41e27e0a2c4f1bcdf58f796b401c609","dweb:/ipfs/QmUvtdp7X1mRVyC3CsHrtPbgoqWaXHp3S1ZR24tpAQYJWM"],"license":"MIT"},"lib/openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol":{"keccak256":"0x5a5f22721ffb66d3e1ecc568c0d37c91f91223d8663c8a5e78396e780b849c72","urls":["bzz-raw://bdd108133c98ea251513424bf17905090c8a7e0755562a6d12a81b8bccbd6152","dweb:/ipfs/QmahpnB63Up9aVx4jDqxEgry5BRN5itHRvy9rwBvMT2yqL"],"license":"MIT"},"lib/openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol":{"keccak256":"0xdbef5f0c787055227243a7318ef74c8a5a1108ca3a07f2b3a00ef67769e1e397","urls":["bzz-raw://08e39f23d5b4692f9a40803e53a8156b72b4c1f9902a88cd65ba964db103dab9","dweb:/ipfs/QmPKn6EYDgpga7KtpkA8wV2yJCYGMtc9K4LkJfhKX2RVSV"],"license":"MIT"},"lib/openzeppelin-contracts/contracts/interfaces/draft-IERC6093.sol":{"keccak256":"0x9cac1f97ecc92043dd19235d6677e40cf6bac382886a94f7a80a957846b24229","urls":["bzz-raw://a1e0c924e0edfdfd4abceeb552d99f1cd95c0d387b38ccb1f67c583607e3d155","dweb:/ipfs/QmZAi6qKa66zuS3jyEhsQR9bBNnZe1wSognYqw9nvseyUz"],"license":"MIT"},"lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol":{"keccak256":"0xee2337af2dc162a973b4be6d3f7c16f06298259e0af48c5470d2839bfa8a22f4","urls":["bzz-raw://30c476b4b2f405c1bb3f0bae15b006d129c80f1bfd9d0f2038160a3bb9745009","dweb:/ipfs/Qmb3VcuDufv6xbHeVgksC4tHpc5gKYVqBEwjEXW72XzSvN"],"license":"MIT"},"lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol":{"keccak256":"0x88f7b6f070ad1de2bf899da6978ed74b5038eac78c01b7359b92b60c3d965c28","urls":["bzz-raw://c436edb6733a036607c6f17cc590e8ee351363a8cb4c564a98d9a66392c89323","dweb:/ipfs/QmcJvJR2K3EtYcKEXVpQ1WqT6TvAbVem5HR1FirAsqEXFR"],"license":"MIT"},"src/AtomicBridgeInitiatorMOVE.sol":{"keccak256":"0xb6431a67dd2961b54aeed2a51a2f1c3a80a8fbe42b1fdbecaff64ed542eb138c","urls":["bzz-raw://051743bcc1f901d33fbdfcd307f317909e5c5442adb088f49cf05d245bec7f89","dweb:/ipfs/QmVywZzJ5K56U58X46W4A6jKcQDfwmZiyFWZFF3utWWKmV"],"license":"MIT"},"src/IAtomicBridgeInitiatorMOVE.sol":{"keccak256":"0x3705cbaaf8910b786e5cb99d8d1bfa3f591add9a1d835703a69d6a77020ad841","urls":["bzz-raw://12cca43905283adf49be8a23853952b90be09d3ba38b583fd8c2821e97ad8c0a","dweb:/ipfs/QmaxHt6YUKb97dCz1rUjvjfM3XLcoLNvoFrUkDA6a77ER5"],"license":"MIT"},"src/MockMOVEToken.sol":{"keccak256":"0x71768bf12ff974ee8589bee8b951fa63c7db1f74f251c5997232643bc749a8e4","urls":["bzz-raw://38474add7fec1c814adf1ad614e4ca233b9f789f279690c698a3a94334c029cf","dweb:/ipfs/Qmah2K8YEmLqnKjXcGvbSD55sm61zkKVvNMhehmrj6VzBs"],"license":"MIT"}},"version":1},"id":45} \ No newline at end of file +{"abi":[{"type":"function","name":"bridgeTransfers","inputs":[{"name":"","type":"bytes32","internalType":"bytes32"}],"outputs":[{"name":"amount","type":"uint256","internalType":"uint256"},{"name":"originator","type":"address","internalType":"address"},{"name":"recipient","type":"bytes32","internalType":"bytes32"},{"name":"hashLock","type":"bytes32","internalType":"bytes32"},{"name":"timeLock","type":"uint256","internalType":"uint256"},{"name":"state","type":"uint8","internalType":"enum NativeBridgeInitiatorMOVE.MessageState"}],"stateMutability":"view"},{"type":"function","name":"completeBridgeTransfer","inputs":[{"name":"bridgeTransferId","type":"bytes32","internalType":"bytes32"},{"name":"preImage","type":"bytes32","internalType":"bytes32"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"counterpartyAddress","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"initialize","inputs":[{"name":"_moveToken","type":"address","internalType":"address"},{"name":"owner","type":"address","internalType":"address"},{"name":"_timeLockDuration","type":"uint256","internalType":"uint256"},{"name":"_initialPoolBalance","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"initiateBridgeTransfer","inputs":[{"name":"moveAmount","type":"uint256","internalType":"uint256"},{"name":"recipient","type":"bytes32","internalType":"bytes32"},{"name":"hashLock","type":"bytes32","internalType":"bytes32"}],"outputs":[{"name":"bridgeTransferId","type":"bytes32","internalType":"bytes32"}],"stateMutability":"nonpayable"},{"type":"function","name":"initiatorTimeLockDuration","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"moveToken","inputs":[],"outputs":[{"name":"","type":"address","internalType":"contract ERC20Upgradeable"}],"stateMutability":"view"},{"type":"function","name":"owner","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"poolBalance","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"refundBridgeTransfer","inputs":[{"name":"bridgeTransferId","type":"bytes32","internalType":"bytes32"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"renounceOwnership","inputs":[],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setCounterpartyAddress","inputs":[{"name":"_counterpartyAddress","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"transferOwnership","inputs":[{"name":"newOwner","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"withdrawMOVE","inputs":[{"name":"recipient","type":"address","internalType":"address"},{"name":"amount","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"event","name":"BridgeTransferCompleted","inputs":[{"name":"_bridgeTransferId","type":"bytes32","indexed":true,"internalType":"bytes32"},{"name":"pre_image","type":"bytes32","indexed":false,"internalType":"bytes32"}],"anonymous":false},{"type":"event","name":"BridgeTransferInitiated","inputs":[{"name":"_bridgeTransferId","type":"bytes32","indexed":true,"internalType":"bytes32"},{"name":"_originator","type":"address","indexed":true,"internalType":"address"},{"name":"_recipient","type":"bytes32","indexed":true,"internalType":"bytes32"},{"name":"amount","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"_hashLock","type":"bytes32","indexed":false,"internalType":"bytes32"},{"name":"_timeLock","type":"uint256","indexed":false,"internalType":"uint256"}],"anonymous":false},{"type":"event","name":"BridgeTransferRefunded","inputs":[{"name":"_bridgeTransferId","type":"bytes32","indexed":true,"internalType":"bytes32"}],"anonymous":false},{"type":"event","name":"Initialized","inputs":[{"name":"version","type":"uint64","indexed":false,"internalType":"uint64"}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"name":"previousOwner","type":"address","indexed":true,"internalType":"address"},{"name":"newOwner","type":"address","indexed":true,"internalType":"address"}],"anonymous":false},{"type":"error","name":"BridgeTransferHasBeenCompleted","inputs":[]},{"type":"error","name":"BridgeTransferInvalid","inputs":[]},{"type":"error","name":"BridgeTransferStateNotInitialized","inputs":[]},{"type":"error","name":"InsufficientMOVEBalance","inputs":[]},{"type":"error","name":"InvalidInitialization","inputs":[]},{"type":"error","name":"InvalidSecret","inputs":[]},{"type":"error","name":"MOVETransferFailed","inputs":[]},{"type":"error","name":"NotInitializing","inputs":[]},{"type":"error","name":"OwnableInvalidOwner","inputs":[{"name":"owner","type":"address","internalType":"address"}]},{"type":"error","name":"OwnableUnauthorizedAccount","inputs":[{"name":"account","type":"address","internalType":"address"}]},{"type":"error","name":"TimeLockNotExpired","inputs":[]},{"type":"error","name":"TimelockExpired","inputs":[]},{"type":"error","name":"Unauthorized","inputs":[]},{"type":"error","name":"ZeroAddress","inputs":[]},{"type":"error","name":"ZeroAmount","inputs":[]}],"bytecode":{"object":"0x6080604052348015600e575f80fd5b50610d6d8061001c5f395ff3fe608060405234801561000f575f80fd5b50600436106100e4575f3560e01c806396365d4411610088578063e0d9cbc411610063578063e0d9cbc4146101d1578063e20c95ec14610232578063eb990c5914610245578063f2fde38b14610258575f80fd5b806396365d44146101a25780639f8f8799146101ab578063cacfb161146101be575f80fd5b80632b3948bb116100c35780632b3948bb1461014e5780635780802014610157578063715018a61461016a5780638da5cb5b14610172575f80fd5b80621a153e146100e85780631a8849a4146100fd5780631f92c08e14610123575b5f80fd5b6100fb6100f6366004610b6d565b61026b565b005b61011061010b366004610b8d565b6102bc565b6040519081526020015b60405180910390f35b600254610136906001600160a01b031681565b6040516001600160a01b03909116815260200161011a565b61011060055481565b6100fb610165366004610bb6565b610524565b6100fb610683565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b0316610136565b61011060015481565b6100fb6101b9366004610bcd565b610696565b6100fb6101cc366004610bed565b61078e565b6102206101df366004610bb6565b5f6020819052908152604090208054600182015460028301546003840154600485015460059095015493946001600160a01b03909316939192909160ff1686565b60405161011a96959493929190610c29565b600354610136906001600160a01b031681565b6100fb610253366004610c81565b610886565b6100fb610266366004610b6d565b6109e3565b610273610a25565b6001600160a01b03811661029a5760405163d92e233d60e01b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b5f338482036102de57604051631f2a200560e01b815260040160405180910390fd5b6003546040516323b872dd60e01b81526001600160a01b03838116600483015230602483015260448201889052909116906323b872dd906064016020604051808303815f875af1158015610334573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103589190610cc0565b61037557604051631a67cf2760e31b815260040160405180910390fd5b8460015f8282546103869190610cf3565b90915550506005546004805483928792879242915f6103a483610d0c565b9091555060405160609690961b6bffffffffffffffffffffffff19166020870152603486019490945260548501929092526074840152609483015260b482015260d4016040516020818303038152906040528051906020012091506040518060c00160405280868152602001826001600160a01b03168152602001858152602001848152602001600554426104399190610cf3565b81525f60209182018190528481528082526040908190208351815591830151600180840180546001600160a01b0319166001600160a01b039093169290921790915590830151600280840191909155606084015160038401556080840151600484015560a08401516005840180549193909260ff199092169184908111156104c3576104c3610c15565b021790555050600554604080518881526020810187905280820192909252518692506001600160a01b0384169185917f44e287be4fbd3a2dcc143a376301094fd2f809dcc2a8d3c09d0a0715224766c49181900360600190a4509392505050565b61052c610a25565b5f81815260208190526040812090600582015460ff16600281111561055357610553610c15565b1461057157604051630ffb9dcb60e01b815260040160405180910390fd5b80600401544210156105965760405163191f4d1b60e31b815260040160405180910390fd5b60058101805460ff191660021790558054600180545f906105b8908490610d24565b90915550506003546001820154825460405163a9059cbb60e01b81526001600160a01b039283166004820152602481019190915291169063a9059cbb906044016020604051808303815f875af1158015610614573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106389190610cc0565b61065557604051631a67cf2760e31b815260040160405180910390fd5b60405182907f4fee0a65c921e50a9623c3abe10a4067e49c03ef491e7b406dace7cb79c12c61905f90a25050565b61068b610a25565b6106945f610a80565b565b5f82815260208190526040812090600582015460ff1660028111156106bd576106bd610c15565b146106db57604051630437880960e41b815260040160405180910390fd5b600381015460408051602081018590520160405160208183030381529060405280519060200120146107205760405163abab6bd760e01b815260040160405180910390fd5b806004015442111561074557604051633d37e55360e11b815260040160405180910390fd5b60058101805460ff1916600117905560405182815283907f05ddc886acde01b77731bfad1dcfb6abf529f05c28ea66556fe87429bb2789ea9060200160405180910390a2505050565b6002546001600160a01b031633146107b8576040516282b42960e81b815260040160405180910390fd5b8060015410156107db576040516381a6aee360e01b815260040160405180910390fd5b8060015f8282546107ec9190610d24565b909155505060035460405163a9059cbb60e01b81526001600160a01b038481166004830152602482018490529091169063a9059cbb906044016020604051808303815f875af1158015610841573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108659190610cc0565b61088257604051631a67cf2760e31b815260040160405180910390fd5b5050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff165f811580156108cb5750825b90505f8267ffffffffffffffff1660011480156108e75750303b155b9050811580156108f5575080155b156109135760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff19166001178555831561093d57845460ff60401b1916600160401b1785555b6001600160a01b0389166109645760405163d92e233d60e01b815260040160405180910390fd5b600380546001600160a01b0319166001600160a01b038b1617905561098888610af0565b6005879055600186905583156109d857845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b505050505050505050565b6109eb610a25565b6001600160a01b038116610a1957604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b610a2281610a80565b50565b33610a577f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b031690565b6001600160a01b0316146106945760405163118cdaa760e01b8152336004820152602401610a10565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a3505050565b610af8610b01565b610a2281610b4a565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff1661069457604051631afcd79f60e31b815260040160405180910390fd5b6109eb610b01565b80356001600160a01b0381168114610b68575f80fd5b919050565b5f60208284031215610b7d575f80fd5b610b8682610b52565b9392505050565b5f805f60608486031215610b9f575f80fd5b505081359360208301359350604090920135919050565b5f60208284031215610bc6575f80fd5b5035919050565b5f8060408385031215610bde575f80fd5b50508035926020909101359150565b5f8060408385031215610bfe575f80fd5b610c0783610b52565b946020939093013593505050565b634e487b7160e01b5f52602160045260245ffd5b8681526001600160a01b038616602082015260408101859052606081018490526080810183905260c0810160038310610c7057634e487b7160e01b5f52602160045260245ffd5b8260a0830152979650505050505050565b5f805f8060808587031215610c94575f80fd5b610c9d85610b52565b9350610cab60208601610b52565b93969395505050506040820135916060013590565b5f60208284031215610cd0575f80fd5b81518015158114610b86575f80fd5b634e487b7160e01b5f52601160045260245ffd5b80820180821115610d0657610d06610cdf565b92915050565b5f60018201610d1d57610d1d610cdf565b5060010190565b81810381811115610d0657610d06610cdf56fea2646970667358221220aed2fc8fb2e8cd0dfa9263a977bf0c5376c006353fd623bd4c78028692d5081c64736f6c634300081a0033","sourceMap":"392:4589:45:-:0;;;;;;;;;;;;;;;;;;;","linkReferences":{}},"deployedBytecode":{"object":"0x608060405234801561000f575f80fd5b50600436106100e4575f3560e01c806396365d4411610088578063e0d9cbc411610063578063e0d9cbc4146101d1578063e20c95ec14610232578063eb990c5914610245578063f2fde38b14610258575f80fd5b806396365d44146101a25780639f8f8799146101ab578063cacfb161146101be575f80fd5b80632b3948bb116100c35780632b3948bb1461014e5780635780802014610157578063715018a61461016a5780638da5cb5b14610172575f80fd5b80621a153e146100e85780631a8849a4146100fd5780631f92c08e14610123575b5f80fd5b6100fb6100f6366004610b6d565b61026b565b005b61011061010b366004610b8d565b6102bc565b6040519081526020015b60405180910390f35b600254610136906001600160a01b031681565b6040516001600160a01b03909116815260200161011a565b61011060055481565b6100fb610165366004610bb6565b610524565b6100fb610683565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b0316610136565b61011060015481565b6100fb6101b9366004610bcd565b610696565b6100fb6101cc366004610bed565b61078e565b6102206101df366004610bb6565b5f6020819052908152604090208054600182015460028301546003840154600485015460059095015493946001600160a01b03909316939192909160ff1686565b60405161011a96959493929190610c29565b600354610136906001600160a01b031681565b6100fb610253366004610c81565b610886565b6100fb610266366004610b6d565b6109e3565b610273610a25565b6001600160a01b03811661029a5760405163d92e233d60e01b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b5f338482036102de57604051631f2a200560e01b815260040160405180910390fd5b6003546040516323b872dd60e01b81526001600160a01b03838116600483015230602483015260448201889052909116906323b872dd906064016020604051808303815f875af1158015610334573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103589190610cc0565b61037557604051631a67cf2760e31b815260040160405180910390fd5b8460015f8282546103869190610cf3565b90915550506005546004805483928792879242915f6103a483610d0c565b9091555060405160609690961b6bffffffffffffffffffffffff19166020870152603486019490945260548501929092526074840152609483015260b482015260d4016040516020818303038152906040528051906020012091506040518060c00160405280868152602001826001600160a01b03168152602001858152602001848152602001600554426104399190610cf3565b81525f60209182018190528481528082526040908190208351815591830151600180840180546001600160a01b0319166001600160a01b039093169290921790915590830151600280840191909155606084015160038401556080840151600484015560a08401516005840180549193909260ff199092169184908111156104c3576104c3610c15565b021790555050600554604080518881526020810187905280820192909252518692506001600160a01b0384169185917f44e287be4fbd3a2dcc143a376301094fd2f809dcc2a8d3c09d0a0715224766c49181900360600190a4509392505050565b61052c610a25565b5f81815260208190526040812090600582015460ff16600281111561055357610553610c15565b1461057157604051630ffb9dcb60e01b815260040160405180910390fd5b80600401544210156105965760405163191f4d1b60e31b815260040160405180910390fd5b60058101805460ff191660021790558054600180545f906105b8908490610d24565b90915550506003546001820154825460405163a9059cbb60e01b81526001600160a01b039283166004820152602481019190915291169063a9059cbb906044016020604051808303815f875af1158015610614573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106389190610cc0565b61065557604051631a67cf2760e31b815260040160405180910390fd5b60405182907f4fee0a65c921e50a9623c3abe10a4067e49c03ef491e7b406dace7cb79c12c61905f90a25050565b61068b610a25565b6106945f610a80565b565b5f82815260208190526040812090600582015460ff1660028111156106bd576106bd610c15565b146106db57604051630437880960e41b815260040160405180910390fd5b600381015460408051602081018590520160405160208183030381529060405280519060200120146107205760405163abab6bd760e01b815260040160405180910390fd5b806004015442111561074557604051633d37e55360e11b815260040160405180910390fd5b60058101805460ff1916600117905560405182815283907f05ddc886acde01b77731bfad1dcfb6abf529f05c28ea66556fe87429bb2789ea9060200160405180910390a2505050565b6002546001600160a01b031633146107b8576040516282b42960e81b815260040160405180910390fd5b8060015410156107db576040516381a6aee360e01b815260040160405180910390fd5b8060015f8282546107ec9190610d24565b909155505060035460405163a9059cbb60e01b81526001600160a01b038481166004830152602482018490529091169063a9059cbb906044016020604051808303815f875af1158015610841573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108659190610cc0565b61088257604051631a67cf2760e31b815260040160405180910390fd5b5050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff165f811580156108cb5750825b90505f8267ffffffffffffffff1660011480156108e75750303b155b9050811580156108f5575080155b156109135760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff19166001178555831561093d57845460ff60401b1916600160401b1785555b6001600160a01b0389166109645760405163d92e233d60e01b815260040160405180910390fd5b600380546001600160a01b0319166001600160a01b038b1617905561098888610af0565b6005879055600186905583156109d857845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b505050505050505050565b6109eb610a25565b6001600160a01b038116610a1957604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b610a2281610a80565b50565b33610a577f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b031690565b6001600160a01b0316146106945760405163118cdaa760e01b8152336004820152602401610a10565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a3505050565b610af8610b01565b610a2281610b4a565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff1661069457604051631afcd79f60e31b815260040160405180910390fd5b6109eb610b01565b80356001600160a01b0381168114610b68575f80fd5b919050565b5f60208284031215610b7d575f80fd5b610b8682610b52565b9392505050565b5f805f60608486031215610b9f575f80fd5b505081359360208301359350604090920135919050565b5f60208284031215610bc6575f80fd5b5035919050565b5f8060408385031215610bde575f80fd5b50508035926020909101359150565b5f8060408385031215610bfe575f80fd5b610c0783610b52565b946020939093013593505050565b634e487b7160e01b5f52602160045260245ffd5b8681526001600160a01b038616602082015260408101859052606081018490526080810183905260c0810160038310610c7057634e487b7160e01b5f52602160045260245ffd5b8260a0830152979650505050505050565b5f805f8060808587031215610c94575f80fd5b610c9d85610b52565b9350610cab60208601610b52565b93969395505050506040820135916060013590565b5f60208284031215610cd0575f80fd5b81518015158114610b86575f80fd5b634e487b7160e01b5f52601160045260245ffd5b80820180821115610d0657610d06610cdf565b92915050565b5f60018201610d1d57610d1d610cdf565b5060010190565b81810381811115610d0657610d06610cdf56fea2646970667358221220aed2fc8fb2e8cd0dfa9263a977bf0c5376c006353fd623bd4c78028692d5081c64736f6c634300081a0033","sourceMap":"392:4589:45:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1828:210;;;;;;:::i;:::-;;:::i;:::-;;2044:1298;;;;;;:::i;:::-;;:::i;:::-;;;1000:25:57;;;988:2;973:18;2044:1298:45;;;;;;;;989:34;;;;;-1:-1:-1;;;;;989:34:45;;;;;;-1:-1:-1;;;;;1200:32:57;;;1182:51;;1170:2;1155:18;989:34:45;1036:203:57;1135:40:45;;;;;;3937:713;;;;;;:::i;:::-;;:::i;3155:101:23:-;;;:::i;2441:144::-;1313:22;2570:8;-1:-1:-1;;;;;2570:8:23;2441:144;;956:26:45;;;;;;3348:583;;;;;;:::i;:::-;;:::i;4656:323::-;;;;;;:::i;:::-;;:::i;855:57::-;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;855:57:45;;;;;;;;;;;;;;;;;;;;;;;;:::i;1029:33::-;;;;;-1:-1:-1;;;;;1029:33:45;;;1297:525;;;;;;:::i;:::-;;:::i;3405:215:23:-;;;;;;:::i;:::-;;:::i;1828:210:45:-;2334:13:23;:11;:13::i;:::-;-1:-1:-1;;;;;1923:34:45;::::1;1919:60;;1966:13;;-1:-1:-1::0;;;1966:13:45::1;;;;;;;;;;;1919:60;1989:19;:42:::0;;-1:-1:-1;;;;;;1989:42:45::1;-1:-1:-1::0;;;;;1989:42:45;;;::::1;::::0;;;::::1;::::0;;1828:210::o;2044:1298::-;2167:24;2228:10;2295:15;;;2291:65;;2333:12;;-1:-1:-1;;;2333:12:45;;;;;;;;;;;2291:65;2437:9;;:61;;-1:-1:-1;;;2437:61:45;;-1:-1:-1;;;;;4134:32:57;;;2437:61:45;;;4116:51:57;2480:4:45;4183:18:57;;;4176:60;4252:18;;;4245:34;;;2437:9:45;;;;:22;;4089:18:57;;2437:61:45;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;2432:120;;2521:20;;-1:-1:-1;;;2521:20:45;;;;;;;;;;;2432:120;2612:10;2597:11;;:25;;;;;;;:::i;:::-;;;;-1:-1:-1;;2801:25:45;;2845:5;:7;;2768:10;;2780:9;;2791:8;;2828:15;;2845:5;:7;;;:::i;:::-;;;;-1:-1:-1;2751:102:45;;5263:2:57;5259:15;;;;-1:-1:-1;;5255:53:57;2751:102:45;;;5243:66:57;5325:12;;;5318:28;;;;5362:12;;;5355:28;;;;5399:12;;;5392:28;5436:13;;;5429:29;5474:13;;;5467:29;5512:13;;2751:102:45;;;;;;;;;;;;2741:113;;;;;;2722:132;;2901:272;;;;;;;;2938:10;2901:272;;;;2974:10;-1:-1:-1;;;;;2901:272:45;;;;;3009:9;2901:272;;;;3042:8;2901:272;;;;3092:25;;3074:15;:43;;;;:::i;:::-;2901:272;;3138:24;2901:272;;;;;;;2865:33;;;;;;;;;;;:308;;;;;;;;;;;;;;-1:-1:-1;;;;;;2865:308:45;-1:-1:-1;;;;;2865:308:45;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;2865:308:45;;;;;;;;;;;;;:::i;:::-;;;;;-1:-1:-1;;3276:25:45;;3189:113;;;5738:25:57;;;5794:2;5779:18;;5772:34;;;5822:18;;;5815:34;;;;3189:113:45;3243:9;;-1:-1:-1;;;;;;3189:113:45;;;3213:16;;3189:113;;;;;5726:2:57;3189:113:45;;;3312:23;2044:1298;;;;;:::o;3937:713::-;2334:13:23;:11;:13::i;:::-;4022:37:45::1;4062:33:::0;;;::::1;::::0;;;;;;;4109:20:::1;::::0;::::1;::::0;::::1;;:48;::::0;::::1;;;;;;:::i;:::-;;4105:96;;4166:35;;-1:-1:-1::0;;;4166:35:45::1;;;;;;;;;;;4105:96;4233:14;:23;;;4215:15;:41;4211:74;;;4265:20;;-1:-1:-1::0;;;4265:20:45::1;;;;;;;;;;;4211:74;4295:20;::::0;::::1;:44:::0;;-1:-1:-1;;4295:44:45::1;4318:21;4295:44;::::0;;4454:21;;4295:44;4439:36;;-1:-1:-1;;4439:36:45::1;::::0;4454:21;;4439:36:::1;:::i;:::-;::::0;;;-1:-1:-1;;4490:9:45::1;::::0;;4509:25;::::1;::::0;4536:21;;4490:68:::1;::::0;-1:-1:-1;;;4490:68:45;;-1:-1:-1;;;;;4509:25:45;;::::1;4490:68;::::0;::::1;6167:51:57::0;6234:18;;;6227:34;;;;4490:9:45;::::1;::::0;:18:::1;::::0;6140::57;;4490:68:45::1;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;4485:102;;4567:20;;-1:-1:-1::0;;;4567:20:45::1;;;;;;;;;;;4485:102;4603:40;::::0;4626:16;;4603:40:::1;::::0;;;::::1;4012:638;3937:713:::0;:::o;3155:101:23:-;2334:13;:11;:13::i;:::-;3219:30:::1;3246:1;3219:18;:30::i;:::-;3155:101::o:0;3348:583:45:-;3443:37;3483:33;;;;;;;;;;;3530:20;;;;;;:48;;;;;;;;:::i;:::-;;3526:93;;3587:32;;-1:-1:-1;;;3587:32:45;;;;;;;;;;;3526:93;3674:23;;;;3643:26;;;;;;6401:19:57;;;6436:12;3643:26:45;;;;;;;;;;;;3633:37;;;;;;:64;3629:92;;3706:15;;-1:-1:-1;;;3706:15:45;;;;;;;;;;;3629:92;3753:14;:23;;;3735:15;:41;3731:71;;;3785:17;;-1:-1:-1;;;3785:17:45;;;;;;;;;;;3731:71;3812:20;;;:45;;-1:-1:-1;;3812:45:45;3835:22;3812:45;;;3873:51;;1000:25:57;;;3897:16:45;;3873:51;;988:2:57;973:18;3873:51:45;;;;;;;3433:498;3348:583;;:::o;4656:323::-;4750:19;;-1:-1:-1;;;;;4750:19:45;4736:10;:33;4732:60;;4778:14;;-1:-1:-1;;;4778:14:45;;;;;;;;;;;4732:60;4820:6;4806:11;;:20;4802:58;;;4835:25;;-1:-1:-1;;;4835:25:45;;;;;;;;;;;4802:58;4885:6;4870:11;;:21;;;;;;;:::i;:::-;;;;-1:-1:-1;;4906:9:45;;:37;;-1:-1:-1;;;4906:37:45;;-1:-1:-1;;;;;6185:32:57;;;4906:37:45;;;6167:51:57;6234:18;;;6227:34;;;4906:9:45;;;;:18;;6140::57;;4906:37:45;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;4901:71;;4952:20;;-1:-1:-1;;;4952:20:45;;;;;;;;;;;4901:71;4656:323;;:::o;1297:525::-;8870:21:24;4302:15;;-1:-1:-1;;;4302:15:24;;;;4301:16;;4348:14;;4158:30;4726:16;;:34;;;;;4746:14;4726:34;4706:54;;4770:17;4790:11;:16;;4805:1;4790:16;:50;;;;-1:-1:-1;4818:4:24;4810:25;:30;4790:50;4770:70;;4856:12;4855:13;:30;;;;;4873:12;4872:13;4855:30;4851:91;;;4908:23;;-1:-1:-1;;;4908:23:24;;;;;;;;;;;4851:91;4951:18;;-1:-1:-1;;4951:18:24;4968:1;4951:18;;;4979:67;;;;5013:22;;-1:-1:-1;;;;5013:22:24;-1:-1:-1;;;5013:22:24;;;4979:67;-1:-1:-1;;;;;1479:24:45;::::1;1475:75;;1526:13;;-1:-1:-1::0;;;1526:13:45::1;;;;;;;;;;;1475:75;1559:9;:40:::0;;-1:-1:-1;;;;;;1559:40:45::1;-1:-1:-1::0;;;;;1559:40:45;::::1;;::::0;;1609:21:::1;1624:5:::0;1609:14:::1;:21::i;:::-;1686:25;:45:::0;;;1782:11:::1;:33:::0;;;5066:101:24;;;;5100:23;;-1:-1:-1;;;;5100:23:24;;;5142:14;;-1:-1:-1;6612:50:57;;5142:14:24;;6600:2:57;6585:18;5142:14:24;;;;;;;5066:101;4092:1081;;;;;1297:525:45;;;;:::o;3405:215:23:-;2334:13;:11;:13::i;:::-;-1:-1:-1;;;;;3489:22:23;::::1;3485:91;;3534:31;::::0;-1:-1:-1;;;3534:31:23;;3562:1:::1;3534:31;::::0;::::1;1182:51:57::0;1155:18;;3534:31:23::1;;;;;;;;3485:91;3585:28;3604:8;3585:18;:28::i;:::-;3405:215:::0;:::o;2658:162::-;966:10:26;2717:7:23;1313:22;2570:8;-1:-1:-1;;;;;2570:8:23;;2441:144;2717:7;-1:-1:-1;;;;;2717:23:23;;2713:101;;2763:40;;-1:-1:-1;;;2763:40:23;;966:10:26;2763:40:23;;;1182:51:57;1155:18;;2763:40:23;1036:203:57;3774:248:23;1313:22;3923:8;;-1:-1:-1;;;;;;3941:19:23;;-1:-1:-1;;;;;3941:19:23;;;;;;;;3975:40;;3923:8;;;;;3975:40;;3847:24;;3975:40;3837:185;;3774:248;:::o;1847:127::-;6931:20:24;:18;:20::i;:::-;1929:38:23::1;1954:12;1929:24;:38::i;7084:141:24:-:0;8870:21;8560:40;-1:-1:-1;;;8560:40:24;;;;7146:73;;7191:17;;-1:-1:-1;;;7191:17:24;;;;;;;;;;;1980:235:23;6931:20:24;:18;:20::i;14:173:57:-;82:20;;-1:-1:-1;;;;;131:31:57;;121:42;;111:70;;177:1;174;167:12;111:70;14:173;;;:::o;192:186::-;251:6;304:2;292:9;283:7;279:23;275:32;272:52;;;320:1;317;310:12;272:52;343:29;362:9;343:29;:::i;:::-;333:39;192:186;-1:-1:-1;;;192:186:57:o;383:466::-;460:6;468;476;529:2;517:9;508:7;504:23;500:32;497:52;;;545:1;542;535:12;497:52;-1:-1:-1;;590:23:57;;;710:2;695:18;;682:32;;-1:-1:-1;813:2:57;798:18;;;785:32;;383:466;-1:-1:-1;383:466:57:o;1426:226::-;1485:6;1538:2;1526:9;1517:7;1513:23;1509:32;1506:52;;;1554:1;1551;1544:12;1506:52;-1:-1:-1;1599:23:57;;1426:226;-1:-1:-1;1426:226:57:o;1657:346::-;1725:6;1733;1786:2;1774:9;1765:7;1761:23;1757:32;1754:52;;;1802:1;1799;1792:12;1754:52;-1:-1:-1;;1847:23:57;;;1967:2;1952:18;;;1939:32;;-1:-1:-1;1657:346:57:o;2008:300::-;2076:6;2084;2137:2;2125:9;2116:7;2112:23;2108:32;2105:52;;;2153:1;2150;2143:12;2105:52;2176:29;2195:9;2176:29;:::i;:::-;2166:39;2274:2;2259:18;;;;2246:32;;-1:-1:-1;;;2008:300:57:o;2313:127::-;2374:10;2369:3;2365:20;2362:1;2355:31;2405:4;2402:1;2395:15;2429:4;2426:1;2419:15;2445:730;2748:25;;;-1:-1:-1;;;;;2809:32:57;;2804:2;2789:18;;2782:60;2873:2;2858:18;;2851:34;;;2916:2;2901:18;;2894:34;;;2959:3;2944:19;;2937:35;;;2735:3;2720:19;;3002:1;2991:13;;2981:144;;3047:10;3042:3;3038:20;3035:1;3028:31;3082:4;3079:1;3072:15;3110:4;3107:1;3100:15;2981:144;3162:6;3156:3;3145:9;3141:19;3134:35;2445:730;;;;;;;;;:::o;3414:495::-;3500:6;3508;3516;3524;3577:3;3565:9;3556:7;3552:23;3548:33;3545:53;;;3594:1;3591;3584:12;3545:53;3617:29;3636:9;3617:29;:::i;:::-;3607:39;;3665:38;3699:2;3688:9;3684:18;3665:38;:::i;:::-;3414:495;;3655:48;;-1:-1:-1;;;;3772:2:57;3757:18;;3744:32;;3873:2;3858:18;3845:32;;3414:495::o;4290:277::-;4357:6;4410:2;4398:9;4389:7;4385:23;4381:32;4378:52;;;4426:1;4423;4416:12;4378:52;4458:9;4452:16;4511:5;4504:13;4497:21;4490:5;4487:32;4477:60;;4533:1;4530;4523:12;4572:127;4633:10;4628:3;4624:20;4621:1;4614:31;4664:4;4661:1;4654:15;4688:4;4685:1;4678:15;4704:125;4769:9;;;4790:10;;;4787:36;;;4803:18;;:::i;:::-;4704:125;;;;:::o;4834:135::-;4873:3;4894:17;;;4891:43;;4914:18;;:::i;:::-;-1:-1:-1;4961:1:57;4950:13;;4834:135::o;5860:128::-;5927:9;;;5948:11;;;5945:37;;;5962:18;;:::i","linkReferences":{}},"methodIdentifiers":{"bridgeTransfers(bytes32)":"e0d9cbc4","completeBridgeTransfer(bytes32,bytes32)":"9f8f8799","counterpartyAddress()":"1f92c08e","initialize(address,address,uint256,uint256)":"eb990c59","initiateBridgeTransfer(uint256,bytes32,bytes32)":"1a8849a4","initiatorTimeLockDuration()":"2b3948bb","moveToken()":"e20c95ec","owner()":"8da5cb5b","poolBalance()":"96365d44","refundBridgeTransfer(bytes32)":"57808020","renounceOwnership()":"715018a6","setCounterpartyAddress(address)":"001a153e","transferOwnership(address)":"f2fde38b","withdrawMOVE(address,uint256)":"cacfb161"},"rawMetadata":"{\"compiler\":{\"version\":\"0.8.26+commit.8a97fa7a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"BridgeTransferHasBeenCompleted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BridgeTransferInvalid\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BridgeTransferStateNotInitialized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientMOVEBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidInitialization\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSecret\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MOVETransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotInitializing\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"OwnableInvalidOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"OwnableUnauthorizedAccount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TimeLockNotExpired\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TimelockExpired\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Unauthorized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAmount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"_bridgeTransferId\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"pre_image\",\"type\":\"bytes32\"}],\"name\":\"BridgeTransferCompleted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"_bridgeTransferId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_originator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"_recipient\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_hashLock\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_timeLock\",\"type\":\"uint256\"}],\"name\":\"BridgeTransferInitiated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"_bridgeTransferId\",\"type\":\"bytes32\"}],\"name\":\"BridgeTransferRefunded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"version\",\"type\":\"uint64\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"bridgeTransfers\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"originator\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"recipient\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"hashLock\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"timeLock\",\"type\":\"uint256\"},{\"internalType\":\"enum NativeBridgeInitiatorMOVE.MessageState\",\"name\":\"state\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"bridgeTransferId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"preImage\",\"type\":\"bytes32\"}],\"name\":\"completeBridgeTransfer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"counterpartyAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_moveToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_timeLockDuration\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_initialPoolBalance\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"moveAmount\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"recipient\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"hashLock\",\"type\":\"bytes32\"}],\"name\":\"initiateBridgeTransfer\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"bridgeTransferId\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initiatorTimeLockDuration\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"moveToken\",\"outputs\":[{\"internalType\":\"contract ERC20Upgradeable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"poolBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"bridgeTransferId\",\"type\":\"bytes32\"}],\"name\":\"refundBridgeTransfer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_counterpartyAddress\",\"type\":\"address\"}],\"name\":\"setCounterpartyAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"withdrawMOVE\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"InvalidInitialization()\":[{\"details\":\"The contract is already initialized.\"}],\"NotInitializing()\":[{\"details\":\"The contract is not initializing.\"}],\"OwnableInvalidOwner(address)\":[{\"details\":\"The owner is not a valid owner account. (eg. `address(0)`)\"}],\"OwnableUnauthorizedAccount(address)\":[{\"details\":\"The caller account is not authorized to perform an operation.\"}]},\"events\":{\"Initialized(uint64)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/NativeBridgeInitiatorMOVE.sol\":\"NativeBridgeInitiatorMOVE\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[\":@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/\",\":@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/\",\":ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/\",\":erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/\",\":forge-std/=lib/forge-std/src/\",\":halmos-cheatcodes/=lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/\",\":openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/\",\":openzeppelin-contracts/=lib/openzeppelin-contracts/\"]},\"sources\":{\"lib/openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"keccak256\":\"0xc163fcf9bb10138631a9ba5564df1fa25db9adff73bd9ee868a8ae1858fe093a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9706d43a0124053d9880f6e31a59f31bc0a6a3dc1acd66ce0a16e1111658c5f6\",\"dweb:/ipfs/QmUFmfowzkRwGtDu36cXV9SPTBHJ3n7dG9xQiK5B28jTf2\"]},\"lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"keccak256\":\"0x631188737069917d2f909d29ce62c4d48611d326686ba6683e26b72a23bfac0b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7a61054ae84cd6c4d04c0c4450ba1d6de41e27e0a2c4f1bcdf58f796b401c609\",\"dweb:/ipfs/QmUvtdp7X1mRVyC3CsHrtPbgoqWaXHp3S1ZR24tpAQYJWM\"]},\"lib/openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\":{\"keccak256\":\"0x5a5f22721ffb66d3e1ecc568c0d37c91f91223d8663c8a5e78396e780b849c72\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bdd108133c98ea251513424bf17905090c8a7e0755562a6d12a81b8bccbd6152\",\"dweb:/ipfs/QmahpnB63Up9aVx4jDqxEgry5BRN5itHRvy9rwBvMT2yqL\"]},\"lib/openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"keccak256\":\"0xdbef5f0c787055227243a7318ef74c8a5a1108ca3a07f2b3a00ef67769e1e397\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://08e39f23d5b4692f9a40803e53a8156b72b4c1f9902a88cd65ba964db103dab9\",\"dweb:/ipfs/QmPKn6EYDgpga7KtpkA8wV2yJCYGMtc9K4LkJfhKX2RVSV\"]},\"lib/openzeppelin-contracts/contracts/interfaces/draft-IERC6093.sol\":{\"keccak256\":\"0x9cac1f97ecc92043dd19235d6677e40cf6bac382886a94f7a80a957846b24229\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a1e0c924e0edfdfd4abceeb552d99f1cd95c0d387b38ccb1f67c583607e3d155\",\"dweb:/ipfs/QmZAi6qKa66zuS3jyEhsQR9bBNnZe1wSognYqw9nvseyUz\"]},\"lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0xee2337af2dc162a973b4be6d3f7c16f06298259e0af48c5470d2839bfa8a22f4\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://30c476b4b2f405c1bb3f0bae15b006d129c80f1bfd9d0f2038160a3bb9745009\",\"dweb:/ipfs/Qmb3VcuDufv6xbHeVgksC4tHpc5gKYVqBEwjEXW72XzSvN\"]},\"lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"keccak256\":\"0x88f7b6f070ad1de2bf899da6978ed74b5038eac78c01b7359b92b60c3d965c28\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c436edb6733a036607c6f17cc590e8ee351363a8cb4c564a98d9a66392c89323\",\"dweb:/ipfs/QmcJvJR2K3EtYcKEXVpQ1WqT6TvAbVem5HR1FirAsqEXFR\"]},\"src/NativeBridgeInitiatorMOVE.sol\":{\"keccak256\":\"0xb6431a67dd2961b54aeed2a51a2f1c3a80a8fbe42b1fdbecaff64ed542eb138c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://051743bcc1f901d33fbdfcd307f317909e5c5442adb088f49cf05d245bec7f89\",\"dweb:/ipfs/QmVywZzJ5K56U58X46W4A6jKcQDfwmZiyFWZFF3utWWKmV\"]},\"src/INativeBridgeInitiatorMOVE.sol\":{\"keccak256\":\"0x3705cbaaf8910b786e5cb99d8d1bfa3f591add9a1d835703a69d6a77020ad841\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://12cca43905283adf49be8a23853952b90be09d3ba38b583fd8c2821e97ad8c0a\",\"dweb:/ipfs/QmaxHt6YUKb97dCz1rUjvjfM3XLcoLNvoFrUkDA6a77ER5\"]},\"src/MockMOVEToken.sol\":{\"keccak256\":\"0x71768bf12ff974ee8589bee8b951fa63c7db1f74f251c5997232643bc749a8e4\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://38474add7fec1c814adf1ad614e4ca233b9f789f279690c698a3a94334c029cf\",\"dweb:/ipfs/Qmah2K8YEmLqnKjXcGvbSD55sm61zkKVvNMhehmrj6VzBs\"]}},\"version\":1}","metadata":{"compiler":{"version":"0.8.26+commit.8a97fa7a"},"language":"Solidity","output":{"abi":[{"inputs":[],"type":"error","name":"BridgeTransferHasBeenCompleted"},{"inputs":[],"type":"error","name":"BridgeTransferInvalid"},{"inputs":[],"type":"error","name":"BridgeTransferStateNotInitialized"},{"inputs":[],"type":"error","name":"InsufficientMOVEBalance"},{"inputs":[],"type":"error","name":"InvalidInitialization"},{"inputs":[],"type":"error","name":"InvalidSecret"},{"inputs":[],"type":"error","name":"MOVETransferFailed"},{"inputs":[],"type":"error","name":"NotInitializing"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"type":"error","name":"OwnableInvalidOwner"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"type":"error","name":"OwnableUnauthorizedAccount"},{"inputs":[],"type":"error","name":"TimeLockNotExpired"},{"inputs":[],"type":"error","name":"TimelockExpired"},{"inputs":[],"type":"error","name":"Unauthorized"},{"inputs":[],"type":"error","name":"ZeroAddress"},{"inputs":[],"type":"error","name":"ZeroAmount"},{"inputs":[{"internalType":"bytes32","name":"_bridgeTransferId","type":"bytes32","indexed":true},{"internalType":"bytes32","name":"pre_image","type":"bytes32","indexed":false}],"type":"event","name":"BridgeTransferCompleted","anonymous":false},{"inputs":[{"internalType":"bytes32","name":"_bridgeTransferId","type":"bytes32","indexed":true},{"internalType":"address","name":"_originator","type":"address","indexed":true},{"internalType":"bytes32","name":"_recipient","type":"bytes32","indexed":true},{"internalType":"uint256","name":"amount","type":"uint256","indexed":false},{"internalType":"bytes32","name":"_hashLock","type":"bytes32","indexed":false},{"internalType":"uint256","name":"_timeLock","type":"uint256","indexed":false}],"type":"event","name":"BridgeTransferInitiated","anonymous":false},{"inputs":[{"internalType":"bytes32","name":"_bridgeTransferId","type":"bytes32","indexed":true}],"type":"event","name":"BridgeTransferRefunded","anonymous":false},{"inputs":[{"internalType":"uint64","name":"version","type":"uint64","indexed":false}],"type":"event","name":"Initialized","anonymous":false},{"inputs":[{"internalType":"address","name":"previousOwner","type":"address","indexed":true},{"internalType":"address","name":"newOwner","type":"address","indexed":true}],"type":"event","name":"OwnershipTransferred","anonymous":false},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function","name":"bridgeTransfers","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"originator","type":"address"},{"internalType":"bytes32","name":"recipient","type":"bytes32"},{"internalType":"bytes32","name":"hashLock","type":"bytes32"},{"internalType":"uint256","name":"timeLock","type":"uint256"},{"internalType":"enum NativeBridgeInitiatorMOVE.MessageState","name":"state","type":"uint8"}]},{"inputs":[{"internalType":"bytes32","name":"bridgeTransferId","type":"bytes32"},{"internalType":"bytes32","name":"preImage","type":"bytes32"}],"stateMutability":"nonpayable","type":"function","name":"completeBridgeTransfer"},{"inputs":[],"stateMutability":"view","type":"function","name":"counterpartyAddress","outputs":[{"internalType":"address","name":"","type":"address"}]},{"inputs":[{"internalType":"address","name":"_moveToken","type":"address"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"_timeLockDuration","type":"uint256"},{"internalType":"uint256","name":"_initialPoolBalance","type":"uint256"}],"stateMutability":"nonpayable","type":"function","name":"initialize"},{"inputs":[{"internalType":"uint256","name":"moveAmount","type":"uint256"},{"internalType":"bytes32","name":"recipient","type":"bytes32"},{"internalType":"bytes32","name":"hashLock","type":"bytes32"}],"stateMutability":"nonpayable","type":"function","name":"initiateBridgeTransfer","outputs":[{"internalType":"bytes32","name":"bridgeTransferId","type":"bytes32"}]},{"inputs":[],"stateMutability":"view","type":"function","name":"initiatorTimeLockDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}]},{"inputs":[],"stateMutability":"view","type":"function","name":"moveToken","outputs":[{"internalType":"contract ERC20Upgradeable","name":"","type":"address"}]},{"inputs":[],"stateMutability":"view","type":"function","name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}]},{"inputs":[],"stateMutability":"view","type":"function","name":"poolBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}]},{"inputs":[{"internalType":"bytes32","name":"bridgeTransferId","type":"bytes32"}],"stateMutability":"nonpayable","type":"function","name":"refundBridgeTransfer"},{"inputs":[],"stateMutability":"nonpayable","type":"function","name":"renounceOwnership"},{"inputs":[{"internalType":"address","name":"_counterpartyAddress","type":"address"}],"stateMutability":"nonpayable","type":"function","name":"setCounterpartyAddress"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"stateMutability":"nonpayable","type":"function","name":"transferOwnership"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"nonpayable","type":"function","name":"withdrawMOVE"}],"devdoc":{"kind":"dev","methods":{"owner()":{"details":"Returns the address of the current owner."},"renounceOwnership()":{"details":"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner."},"transferOwnership(address)":{"details":"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner."}},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"remappings":["@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/","@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/","ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/","erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/","forge-std/=lib/forge-std/src/","halmos-cheatcodes/=lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/","openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/","openzeppelin-contracts/=lib/openzeppelin-contracts/"],"optimizer":{"enabled":true,"runs":200},"metadata":{"bytecodeHash":"ipfs"},"compilationTarget":{"src/NativeBridgeInitiatorMOVE.sol":"NativeBridgeInitiatorMOVE"},"evmVersion":"cancun","libraries":{}},"sources":{"lib/openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol":{"keccak256":"0xc163fcf9bb10138631a9ba5564df1fa25db9adff73bd9ee868a8ae1858fe093a","urls":["bzz-raw://9706d43a0124053d9880f6e31a59f31bc0a6a3dc1acd66ce0a16e1111658c5f6","dweb:/ipfs/QmUFmfowzkRwGtDu36cXV9SPTBHJ3n7dG9xQiK5B28jTf2"],"license":"MIT"},"lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol":{"keccak256":"0x631188737069917d2f909d29ce62c4d48611d326686ba6683e26b72a23bfac0b","urls":["bzz-raw://7a61054ae84cd6c4d04c0c4450ba1d6de41e27e0a2c4f1bcdf58f796b401c609","dweb:/ipfs/QmUvtdp7X1mRVyC3CsHrtPbgoqWaXHp3S1ZR24tpAQYJWM"],"license":"MIT"},"lib/openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol":{"keccak256":"0x5a5f22721ffb66d3e1ecc568c0d37c91f91223d8663c8a5e78396e780b849c72","urls":["bzz-raw://bdd108133c98ea251513424bf17905090c8a7e0755562a6d12a81b8bccbd6152","dweb:/ipfs/QmahpnB63Up9aVx4jDqxEgry5BRN5itHRvy9rwBvMT2yqL"],"license":"MIT"},"lib/openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol":{"keccak256":"0xdbef5f0c787055227243a7318ef74c8a5a1108ca3a07f2b3a00ef67769e1e397","urls":["bzz-raw://08e39f23d5b4692f9a40803e53a8156b72b4c1f9902a88cd65ba964db103dab9","dweb:/ipfs/QmPKn6EYDgpga7KtpkA8wV2yJCYGMtc9K4LkJfhKX2RVSV"],"license":"MIT"},"lib/openzeppelin-contracts/contracts/interfaces/draft-IERC6093.sol":{"keccak256":"0x9cac1f97ecc92043dd19235d6677e40cf6bac382886a94f7a80a957846b24229","urls":["bzz-raw://a1e0c924e0edfdfd4abceeb552d99f1cd95c0d387b38ccb1f67c583607e3d155","dweb:/ipfs/QmZAi6qKa66zuS3jyEhsQR9bBNnZe1wSognYqw9nvseyUz"],"license":"MIT"},"lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol":{"keccak256":"0xee2337af2dc162a973b4be6d3f7c16f06298259e0af48c5470d2839bfa8a22f4","urls":["bzz-raw://30c476b4b2f405c1bb3f0bae15b006d129c80f1bfd9d0f2038160a3bb9745009","dweb:/ipfs/Qmb3VcuDufv6xbHeVgksC4tHpc5gKYVqBEwjEXW72XzSvN"],"license":"MIT"},"lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol":{"keccak256":"0x88f7b6f070ad1de2bf899da6978ed74b5038eac78c01b7359b92b60c3d965c28","urls":["bzz-raw://c436edb6733a036607c6f17cc590e8ee351363a8cb4c564a98d9a66392c89323","dweb:/ipfs/QmcJvJR2K3EtYcKEXVpQ1WqT6TvAbVem5HR1FirAsqEXFR"],"license":"MIT"},"src/NativeBridgeInitiatorMOVE.sol":{"keccak256":"0xb6431a67dd2961b54aeed2a51a2f1c3a80a8fbe42b1fdbecaff64ed542eb138c","urls":["bzz-raw://051743bcc1f901d33fbdfcd307f317909e5c5442adb088f49cf05d245bec7f89","dweb:/ipfs/QmVywZzJ5K56U58X46W4A6jKcQDfwmZiyFWZFF3utWWKmV"],"license":"MIT"},"src/INativeBridgeInitiatorMOVE.sol":{"keccak256":"0x3705cbaaf8910b786e5cb99d8d1bfa3f591add9a1d835703a69d6a77020ad841","urls":["bzz-raw://12cca43905283adf49be8a23853952b90be09d3ba38b583fd8c2821e97ad8c0a","dweb:/ipfs/QmaxHt6YUKb97dCz1rUjvjfM3XLcoLNvoFrUkDA6a77ER5"],"license":"MIT"},"src/MockMOVEToken.sol":{"keccak256":"0x71768bf12ff974ee8589bee8b951fa63c7db1f74f251c5997232643bc749a8e4","urls":["bzz-raw://38474add7fec1c814adf1ad614e4ca233b9f789f279690c698a3a94334c029cf","dweb:/ipfs/Qmah2K8YEmLqnKjXcGvbSD55sm61zkKVvNMhehmrj6VzBs"],"license":"MIT"}},"version":1},"id":45} \ No newline at end of file diff --git a/protocol-units/bridge/service/src/chains/ethereum/client.rs b/protocol-units/bridge/service/src/chains/ethereum/client.rs index 0cc275219..93b0d19db 100644 --- a/protocol-units/bridge/service/src/chains/ethereum/client.rs +++ b/protocol-units/bridge/service/src/chains/ethereum/client.rs @@ -1,6 +1,6 @@ use super::types::{ - AlloyProvider, AssetKind, AtomicBridgeCounterpartyMOVE, AtomicBridgeInitiatorMOVE, - CounterpartyContract, EthAddress, InitiatorContract, + AlloyProvider, AssetKind, CounterpartyContract, EthAddress, InitiatorContract, + NativeBridgeCounterpartyMOVE, NativeBridgeInitiatorMOVE, }; use super::utils::{calculate_storage_slot, send_transaction, send_transaction_rules}; use alloy::{ @@ -95,9 +95,9 @@ impl EthClient { .await?; let initiator_contract = - AtomicBridgeInitiatorMOVE::new(config.initiator_contract, rpc_provider.clone()); + NativeBridgeInitiatorMOVE::new(config.initiator_contract, rpc_provider.clone()); let counterparty_contract = - AtomicBridgeCounterpartyMOVE::new(config.counterparty_contract, rpc_provider.clone()); + NativeBridgeCounterpartyMOVE::new(config.counterparty_contract, rpc_provider.clone()); Ok(EthClient { rpc_provider, @@ -129,7 +129,7 @@ impl EthClient { owner: EthAddress, timelock: TimeLock, ) -> Result<(), anyhow::Error> { - let contract = AtomicBridgeInitiatorMOVE::new( + let contract = NativeBridgeInitiatorMOVE::new( self.config.initiator_contract, self.rpc_provider.clone(), ); @@ -187,7 +187,7 @@ impl bridge_util::chains::bridge_contracts::BridgeContract for EthCl "Failed to convert in [u8; 32] recipient_address: {e:?}" )) })?; - let contract = AtomicBridgeInitiatorMOVE::new( + let contract = NativeBridgeInitiatorMOVE::new( self.config.initiator_contract, self.rpc_provider.clone(), ); @@ -229,7 +229,7 @@ impl bridge_util::chains::bridge_contracts::BridgeContract for EthCl .try_into() .map_err(|_| generic_error("Could not convert pre-image to [u8; 32]"))?; info! {"Pre-image: {:?}", pre_image}; - let contract = AtomicBridgeInitiatorMOVE::new( + let contract = NativeBridgeInitiatorMOVE::new( self.config.initiator_contract, self.rpc_provider.clone(), ); @@ -265,7 +265,7 @@ impl bridge_util::chains::bridge_contracts::BridgeContract for EthCl .try_into() .map_err(|_| generic_error("Could not convert pre-image to [u8; 32]"))?; - let contract = AtomicBridgeCounterpartyMOVE::new( + let contract = NativeBridgeCounterpartyMOVE::new( self.config.counterparty_contract, self.rpc_provider.clone(), ); @@ -291,7 +291,7 @@ impl bridge_util::chains::bridge_contracts::BridgeContract for EthCl &mut self, bridge_transfer_id: BridgeTransferId, ) -> BridgeContractResult<()> { - let contract = AtomicBridgeInitiatorMOVE::new( + let contract = NativeBridgeInitiatorMOVE::new( self.config.counterparty_contract, self.rpc_provider.clone(), ); @@ -351,7 +351,7 @@ impl bridge_util::chains::bridge_contracts::BridgeContract for EthCl &mut self, bridge_transfer_id: BridgeTransferId, ) -> BridgeContractResult<()> { - let contract = AtomicBridgeCounterpartyMOVE::new( + let contract = NativeBridgeCounterpartyMOVE::new( self.config.counterparty_contract, self.rpc_provider.clone(), ); diff --git a/protocol-units/bridge/service/src/chains/ethereum/event_monitoring.rs b/protocol-units/bridge/service/src/chains/ethereum/event_monitoring.rs index dfcc7a8a8..1e9894779 100644 --- a/protocol-units/bridge/service/src/chains/ethereum/event_monitoring.rs +++ b/protocol-units/bridge/service/src/chains/ethereum/event_monitoring.rs @@ -1,6 +1,6 @@ use super::types::EthAddress; -use crate::chains::ethereum::types::AtomicBridgeCounterpartyMOVE; -use crate::chains::ethereum::types::AtomicBridgeInitiatorMOVE; +use crate::chains::ethereum::types::NativeBridgeCounterpartyMOVE; +use crate::chains::ethereum::types::NativeBridgeInitiatorMOVE; use alloy::eips::BlockNumberOrTag; use alloy::primitives::Address; use alloy::providers::Provider; @@ -52,11 +52,11 @@ impl EthMonitoring { tokio::spawn({ let config = config.clone(); async move { - let initiator_contract = AtomicBridgeInitiatorMOVE::new( + let initiator_contract = NativeBridgeInitiatorMOVE::new( config.eth_initiator_contract.parse().unwrap(), //If unwrap start fail. Config must be updated. rpc_provider.clone(), ); - let counterpart_contract = AtomicBridgeCounterpartyMOVE::new( + let counterpart_contract = NativeBridgeCounterpartyMOVE::new( config.eth_counterparty_contract.parse().unwrap(), //If unwrap start fail. Config must be updated. rpc_provider.clone(), ); diff --git a/protocol-units/bridge/service/src/chains/ethereum/types.rs b/protocol-units/bridge/service/src/chains/ethereum/types.rs index f171f2094..a4d7c1702 100644 --- a/protocol-units/bridge/service/src/chains/ethereum/types.rs +++ b/protocol-units/bridge/service/src/chains/ethereum/types.rs @@ -23,14 +23,14 @@ pub const ETH_ADDRESS_LEN: usize = 20; alloy::sol!( #[allow(missing_docs)] #[sol(rpc)] - AtomicBridgeInitiatorMOVE, - "abis/AtomicBridgeInitiatorMOVE.json" + NativeBridgeInitiatorMOVE, + "abis/NativeBridgeInitiatorMOVE.json" ); alloy::sol!( #[allow(missing_docs)] #[sol(rpc)] - AtomicBridgeCounterpartyMOVE, - "abis/AtomicBridgeCounterpartyMOVE.json" + NativeBridgeCounterpartyMOVE, + "abis/NativeBridgeCounterpartyMOVE.json" ); alloy::sol!( @@ -108,9 +108,9 @@ pub fn hash_static_string(pre_image: &'static str) -> [u8; 32] { } pub type InitiatorContract = - AtomicBridgeInitiatorMOVE::AtomicBridgeInitiatorMOVEInstance; + NativeBridgeInitiatorMOVE::NativeBridgeInitiatorMOVEInstance; pub type CounterpartyContract = - AtomicBridgeCounterpartyMOVE::AtomicBridgeCounterpartyMOVEInstance; + NativeBridgeCounterpartyMOVE::NativeBridgeCounterpartyMOVEInstance; pub type AlloyProvider = FillProvider< JoinFill< diff --git a/protocol-units/bridge/service/src/chains/movement/client.rs b/protocol-units/bridge/service/src/chains/movement/client.rs index d14f2ac09..dbf6ac2f4 100644 --- a/protocol-units/bridge/service/src/chains/movement/client.rs +++ b/protocol-units/bridge/service/src/chains/movement/client.rs @@ -23,8 +23,8 @@ use std::sync::Arc; use tracing::{debug, info}; use url::Url; -pub const INITIATOR_MODULE_NAME: &str = "atomic_bridge_initiator"; -pub const COUNTERPARTY_MODULE_NAME: &str = "atomic_bridge_counterparty"; +pub const INITIATOR_MODULE_NAME: &str = "native_bridge_initiator"; +pub const COUNTERPARTY_MODULE_NAME: &str = "native_bridge_counterparty"; const DUMMY_ADDRESS: AccountAddress = AccountAddress::new([0; 32]); #[allow(dead_code)] @@ -82,7 +82,7 @@ impl MovementClient { let payload = utils::make_aptos_payload( self.native_address, - "atomic_bridge_initiator", + "native_bridge_initiator", "set_time_lock_duration", Vec::new(), args, @@ -103,7 +103,7 @@ impl MovementClient { let payload = utils::make_aptos_payload( self.native_address, - "atomic_bridge_counterparty", + "native_bridge_counterparty", "set_time_lock_duration", Vec::new(), args, @@ -136,7 +136,7 @@ impl BridgeContract for MovementClient { let payload = utils::make_aptos_payload( self.native_address, - "atomic_bridge_initiator", + "native_bridge_initiator", "initiate_bridge_transfer", Vec::new(), args, @@ -277,7 +277,7 @@ impl BridgeContract for MovementClient { let payload = utils::make_aptos_payload( self.native_address, - "atomic_bridge_initiator", + "native_bridge_initiator", "refund_bridge_transfer", Vec::new(), args, @@ -326,7 +326,7 @@ impl BridgeContract for MovementClient { module: MoveModuleId { address: self.native_address.clone().into(), name: aptos_api_types::IdentifierWrapper( - Identifier::new("atomic_bridge_initiator") + Identifier::new("native_bridge_initiator") .map_err(|_| BridgeContractError::FunctionViewError)?, ), }, @@ -397,7 +397,7 @@ impl BridgeContract for MovementClient { module: MoveModuleId { address: self.native_address.clone().into(), name: aptos_api_types::IdentifierWrapper( - Identifier::new("atomic_bridge_counterparty") + Identifier::new("native_bridge_counterparty") .map_err(|_| BridgeContractError::FunctionViewError)?, ), }, diff --git a/protocol-units/bridge/service/src/chains/movement/client_framework.rs b/protocol-units/bridge/service/src/chains/movement/client_framework.rs index 3fd17fdb3..7234fc20e 100644 --- a/protocol-units/bridge/service/src/chains/movement/client_framework.rs +++ b/protocol-units/bridge/service/src/chains/movement/client_framework.rs @@ -25,8 +25,8 @@ pub const FRAMEWORK_ADDRESS: AccountAddress = AccountAddress::new([ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, ]); -pub const INITIATOR_MODULE_NAME: &str = "atomic_bridge_initiator"; -pub const COUNTERPARTY_MODULE_NAME: &str = "atomic_bridge_counterparty"; +pub const INITIATOR_MODULE_NAME: &str = "native_bridge_initiator"; +pub const COUNTERPARTY_MODULE_NAME: &str = "native_bridge_counterparty"; const DUMMY_ADDRESS: AccountAddress = AccountAddress::new([0; 32]); #[allow(dead_code)] @@ -37,7 +37,7 @@ enum Call { GetDetails, } -/// The Client for making calls to the atomic bridge framework modules +/// The Client for making calls to the native bridge framework modules #[derive(Clone)] pub struct MovementClientFramework { ///Native Address of the @@ -77,7 +77,7 @@ impl MovementClientFramework { let payload = utils::make_aptos_payload( FRAMEWORK_ADDRESS, - "atomic_bridge_configuration", + "native_bridge_configuration", "set_initiator_time_lock_duration", Vec::new(), args, @@ -98,7 +98,7 @@ impl MovementClientFramework { let payload = utils::make_aptos_payload( FRAMEWORK_ADDRESS, - "atomic_bridge_configuration", + "native_bridge_configuration", "set_counterparty_time_lock_duration", Vec::new(), args, @@ -131,7 +131,7 @@ impl BridgeContract for MovementClientFramework { let payload = utils::make_aptos_payload( FRAMEWORK_ADDRESS, - "atomic_bridge_initiator", + "native_bridge_initiator", "initiate_bridge_transfer", Vec::new(), args, @@ -276,7 +276,7 @@ impl BridgeContract for MovementClientFramework { let payload = utils::make_aptos_payload( FRAMEWORK_ADDRESS, - "atomic_bridge_initiator", + "native_bridge_initiator", "refund_bridge_transfer", Vec::new(), args, @@ -325,7 +325,7 @@ impl BridgeContract for MovementClientFramework { module: MoveModuleId { address: FRAMEWORK_ADDRESS.clone().into(), name: aptos_api_types::IdentifierWrapper( - Identifier::new("atomic_bridge_store") + Identifier::new("native_bridge_store") .map_err(|_| BridgeContractError::FunctionViewError)?, ), }, @@ -411,7 +411,7 @@ impl BridgeContract for MovementClientFramework { module: MoveModuleId { address: FRAMEWORK_ADDRESS.clone().into(), name: aptos_api_types::IdentifierWrapper( - Identifier::new("atomic_bridge_store") + Identifier::new("native_bridge_store") .map_err(|_| BridgeContractError::FunctionViewError)?, ), }, @@ -738,8 +738,8 @@ impl MovementClientFramework { _ if line.starts_with("resource_addr = ") => { format!(r#"resource_addr = "{}""#, formatted_resource_address) } - _ if line.starts_with("atomic_bridge = ") => { - format!(r#"atomic_bridge = "{}""#, formatted_resource_address) + _ if line.starts_with("native_bridge = ") => { + format!(r#"native_bridge = "{}""#, formatted_resource_address) } _ if line.starts_with("moveth = ") => { format!(r#"moveth = "{}""#, formatted_resource_address) @@ -819,8 +819,8 @@ impl MovementClientFramework { _ if line.starts_with("resource_addr = ") => { format!(r#"resource_addr = "{}""#, final_formatted_resource_address) } - _ if line.starts_with("atomic_bridge = ") => { - format!(r#"atomic_bridge = "{}""#, final_formatted_resource_address) + _ if line.starts_with("native_bridge = ") => { + format!(r#"native_bridge = "{}""#, final_formatted_resource_address) } _ if line.starts_with("moveth = ") => { format!(r#"moveth = "{}""#, final_formatted_resource_address) diff --git a/protocol-units/bridge/service/src/chains/movement/event_monitoring.rs b/protocol-units/bridge/service/src/chains/movement/event_monitoring.rs index e6d357903..b46bddfe4 100644 --- a/protocol-units/bridge/service/src/chains/movement/event_monitoring.rs +++ b/protocol-units/bridge/service/src/chains/movement/event_monitoring.rs @@ -258,7 +258,7 @@ async fn pool_initiator_contract( timeout_sec: u64, ) -> BridgeContractResult, u64)>> { let struct_tag = format!( - "{}::atomic_bridge_initiator::BridgeInitiatorEvents", + "{}::native_bridge_initiator::BridgeInitiatorEvents", framework_address.to_string() ); // Get initiated events @@ -363,7 +363,7 @@ async fn pool_counterparty_contract( timeout_sec: u64, ) -> BridgeContractResult, u64)>> { let struct_tag = format!( - "{}::atomic_bridge_counterparty::BridgeCounterpartyEvents", + "{}::native_bridge_counterparty::BridgeCounterpartyEvents", FRAMEWORK_ADDRESS.to_string() ); @@ -597,7 +597,7 @@ impl TryFrom for LockDetails { /// "account_address": "0xb07a6a200d595dd4ed39d9b91e3132e6c15735549e9920c585b2beec0ae659b6" /// }, /// "sequence_number": "0", -/// "type": "0xb07a6a200d595dd4ed39d9b91e3132e6c15735549e9920c585b2beec0ae659b6::atomic_bridge_initiator::BridgeTransferInitiatedEvent", +/// "type": "0xb07a6a200d595dd4ed39d9b91e3132e6c15735549e9920c585b2beec0ae659b6::native_bridge_initiator::BridgeTransferInitiatedEvent", /// "data": { /// "amount": "100", /// "bridge_transfer_id": "0xeaefd189df98d57b8f4619584cff1fd67f2787c664ac8e9761ecfd7a6ae1fa2b", diff --git a/protocol-units/bridge/setup/src/deploy.rs b/protocol-units/bridge/setup/src/deploy.rs index a503489cd..2995a52cf 100644 --- a/protocol-units/bridge/setup/src/deploy.rs +++ b/protocol-units/bridge/setup/src/deploy.rs @@ -9,7 +9,7 @@ use bridge_config::{ use bridge_service::{ chains::ethereum::{ types::{ - AtomicBridgeCounterpartyMOVE, AtomicBridgeInitiatorMOVE, EthAddress, MockMOVEToken, + NativeBridgeCounterpartyMOVE, NativeBridgeInitiatorMOVE, EthAddress, MockMOVEToken, }, utils::{send_transaction, send_transaction_rules}, }, @@ -74,9 +74,9 @@ async fn deploy_eth_initiator_contract( .await .expect("Error during provider creation"); - let contract = AtomicBridgeInitiatorMOVE::deploy(rpc_provider.clone()) + let contract = NativeBridgeInitiatorMOVE::deploy(rpc_provider.clone()) .await - .expect("Failed to deploy AtomicBridgeInitiatorMOVE"); + .expect("Failed to deploy NativeBridgeInitiatorMOVE"); tracing::info!("initiator_contract address: {}", contract.address().to_string()); contract.address().to_owned() } @@ -91,9 +91,9 @@ async fn deploy_counterpart_contract( .on_builtin(rpc_url) .await .expect("Error during provider creation"); - let contract = AtomicBridgeCounterpartyMOVE::deploy(rpc_provider.clone()) + let contract = NativeBridgeCounterpartyMOVE::deploy(rpc_provider.clone()) .await - .expect("Failed to deploy AtomicBridgeCounterpartyMOVE"); + .expect("Failed to deploy NativeBridgeCounterpartyMOVE"); tracing::info!("counterparty_contract address: {}", contract.address().to_string()); contract.address().to_owned() } @@ -135,7 +135,7 @@ async fn initialize_initiator_contract( .await .expect("Error during provider creation"); let initiator_contract = - AtomicBridgeInitiatorMOVE::new(initiator_contract_address.parse()?, rpc_provider); + NativeBridgeInitiatorMOVE::new(initiator_contract_address.parse()?, rpc_provider); let call = initiator_contract.initialize(move_token.0, owner.0, U256::from(timelock), U256::from(100)); From 57ff6e5623fda4d9d0524c6c39ec419d79beb725 Mon Sep 17 00:00:00 2001 From: primata Date: Wed, 13 Nov 2024 17:34:05 +0100 Subject: [PATCH 2/6] init --- .../src/INativeBridgeCounterpartyMOVE.sol | 5 +- .../src/INativeBridgeInitiatorMOVE.sol | 4 +- .../src/NativeBridgeCounterpartyMOVE.sol | 82 +++++++------- .../src/NativeBridgeInitiatorMOVE.sol | 102 +++++++++--------- 4 files changed, 95 insertions(+), 98 deletions(-) diff --git a/protocol-units/bridge/contracts/src/INativeBridgeCounterpartyMOVE.sol b/protocol-units/bridge/contracts/src/INativeBridgeCounterpartyMOVE.sol index 0ba2c80c2..509c2105b 100644 --- a/protocol-units/bridge/contracts/src/INativeBridgeCounterpartyMOVE.sol +++ b/protocol-units/bridge/contracts/src/INativeBridgeCounterpartyMOVE.sol @@ -15,6 +15,7 @@ interface INativeBridgeCounterpartyMOVE { error ZeroAmount(); error MOVETransferFailed(); error BridgeTransferInvalid(); + error InvalidBridgeTransferId(); error InvalidSecret(); error BridgeTransferHasBeenCompleted(); error BridgeTransferStateNotInitialized(); @@ -27,7 +28,7 @@ interface INativeBridgeCounterpartyMOVE { /** * @dev Locks the assets for a new native bridge transfer - * @param initiator The address of the initiator of the BridgeTransfer + * @param originator The address of the originator of the BridgeTransfer * @param bridgeTransferId A unique id representing this BridgeTransfer * @param hashLock The hash of the secret (HASH) that will unlock the funds * @param recipient The address to which to transfer the funds @@ -36,7 +37,7 @@ interface INativeBridgeCounterpartyMOVE { * */ function lockBridgeTransfer( - bytes32 initiator, + bytes32 originator, bytes32 bridgeTransferId, bytes32 hashLock, address recipient, diff --git a/protocol-units/bridge/contracts/src/INativeBridgeInitiatorMOVE.sol b/protocol-units/bridge/contracts/src/INativeBridgeInitiatorMOVE.sol index a54ee3fb7..e559b25b8 100644 --- a/protocol-units/bridge/contracts/src/INativeBridgeInitiatorMOVE.sol +++ b/protocol-units/bridge/contracts/src/INativeBridgeInitiatorMOVE.sol @@ -30,13 +30,13 @@ interface INativeBridgeInitiatorMOVE { /** * @dev Creates a new native bridge transfer using native ETH - * @param _wethAmount The amount of WETH to send + * @param _moveAmount The amount of MOVE to send * @param _recipient The address on the other chain to which to transfer the funds * @param _hashLock The hash of the secret (HASH) that will unlock the funds * @return _bridgeTransferId A unique id representing this BridgeTransfer * */ - function initiateBridgeTransfer(uint256 _wethAmount, bytes32 _recipient, bytes32 _hashLock) + function initiateBridgeTransfer(uint256 _moveAmount, bytes32 _recipient, bytes32 _hashLock) external returns (bytes32 _bridgeTransferId); diff --git a/protocol-units/bridge/contracts/src/NativeBridgeCounterpartyMOVE.sol b/protocol-units/bridge/contracts/src/NativeBridgeCounterpartyMOVE.sol index 0cf840cef..6c102cca3 100644 --- a/protocol-units/bridge/contracts/src/NativeBridgeCounterpartyMOVE.sol +++ b/protocol-units/bridge/contracts/src/NativeBridgeCounterpartyMOVE.sol @@ -12,17 +12,8 @@ contract NativeBridgeCounterpartyMOVE is INativeBridgeCounterpartyMOVE, OwnableU REFUNDED } - struct BridgeTransferDetails { - bytes32 originator; - address recipient; - uint256 amount; - bytes32 hashLock; - uint256 timeLock; - MessageState state; - } - NativeBridgeInitiatorMOVE public nativeBridgeInitiatorMOVE; - mapping(bytes32 => BridgeTransferDetails) public bridgeTransfers; + mapping(bytes32 => MessageState) public bridgeTransfers; // Configurable time lock duration uint256 public counterpartyTimeLockDuration; @@ -46,51 +37,60 @@ contract NativeBridgeCounterpartyMOVE is INativeBridgeCounterpartyMOVE, OwnableU } function lockBridgeTransfer( - bytes32 originator, bytes32 bridgeTransferId, - bytes32 hashLock, + bytes32 originator, address recipient, - uint256 amount - ) external onlyOwner returns (bool) { - if (amount == 0) revert ZeroAmount(); - if (nativeBridgeInitiatorMOVE.poolBalance() < amount) revert InsufficientMOVEBalance(); + uint256 amount, + bytes32 hashLock, + uint256 initialTimestamp, + uint256 nonce + ) external onlyOwner { // The time lock is now based on the configurable duration uint256 timeLock = block.timestamp + counterpartyTimeLockDuration; - bridgeTransfers[bridgeTransferId] = BridgeTransferDetails({ - recipient: recipient, - originator: originator, - amount: amount, - hashLock: hashLock, - timeLock: timeLock, - state: MessageState.PENDING - }); - - emit BridgeTransferLocked(bridgeTransferId, recipient, amount, hashLock, counterpartyTimeLockDuration); - return true; + require(bridgeTransferId == keccak256(abi.encodePacked(originator, recipient, amount, hashLock, initialTimestamp, nonce)), InvalidBridgeTransferId()); + + bridgeTransfers[bridgeTransferId] = MessageState.PENDING; + + emit BridgeTransferLocked(bridgeTransferId, originator, recipient, amount, hashLock, block.timestamp, nonce); } - function completeBridgeTransfer(bytes32 bridgeTransferId, bytes32 preImage) external { - BridgeTransferDetails storage details = bridgeTransfers[bridgeTransferId]; - if (details.state != MessageState.PENDING) revert BridgeTransferStateNotPending(); - bytes32 computedHash = keccak256(abi.encodePacked(preImage)); - if (computedHash != details.hashLock) revert InvalidSecret(); - if (block.timestamp > details.timeLock) revert TimeLockExpired(); + function completeBridgeTransfer( + bytes32 bridgeTransferId, + bytes32 originator, + address recipient, + uint256 amount, + bytes32 hashLock, + uint256 initialTimestamp, + uint256 nonce, bytes32 preImage) external { + + require(keccak256(abi.encodePacked(preImage)) == details.hashLock, InvalidSecret()); + require(bridgeTransferId == keccak256(abi.encodePacked(originator, recipient, amount, hashLock, initialTimestamp, nonce)), InvalidBridgeTransferId()); - details.state = MessageState.COMPLETED; + require(bridgeTransfers[bridgeTransferId] == MessageState.PENDING BridgeTransferStateNotPending()); + + if (block.timestamp > timeLock) revert TimeLockExpired(); - nativeBridgeInitiatorMOVE.withdrawMOVE(details.recipient, details.amount); + bridgeTransfers[bridgeTransferId] = MessageState.COMPLETED; - emit BridgeTransferCompleted(bridgeTransferId, preImage); + nativeBridgeInitiatorMOVE.withdrawMOVE(recipient, amount); + + emit BridgeTransferCompleted(bridgeTransferId, originator, recipient, amount, hashLock, initialTimestamp, nonce, preImage); } - function abortBridgeTransfer(bytes32 bridgeTransferId) external onlyOwner { - BridgeTransferDetails storage details = bridgeTransfers[bridgeTransferId]; - if (details.state != MessageState.PENDING) revert BridgeTransferStateNotPending(); - if (block.timestamp <= details.timeLock) revert TimeLockNotExpired(); + function abortBridgeTransfer(bytes32 bridgeTransferId, + bytes32 originator, + address recipient, + uint256 amount, + bytes32 hashLock, + uint256 initialTimestamp, + uint256 nonce) external onlyOwner { + require(bridgeTransferId == keccak256(abi.encodePacked(originator, recipient, amount, hashLock, initialTimestamp, nonce)), InvalidBridgeTransferId()); + require(bridgeTransfers[bridgeTransferId] == MessageState.PENDING BridgeTransferStateNotPending()); + if (block.timestamp <= initialTimestamp + counterpartyTimeLockDuration) revert TimeLockNotExpired(); - details.state = MessageState.REFUNDED; + bridgeTransfers[bridgeTransferId] = MessageState.REFUNDED; emit BridgeTransferAborted(bridgeTransferId); } diff --git a/protocol-units/bridge/contracts/src/NativeBridgeInitiatorMOVE.sol b/protocol-units/bridge/contracts/src/NativeBridgeInitiatorMOVE.sol index 9c6c4f93d..f99265ad3 100644 --- a/protocol-units/bridge/contracts/src/NativeBridgeInitiatorMOVE.sol +++ b/protocol-units/bridge/contracts/src/NativeBridgeInitiatorMOVE.sol @@ -13,20 +13,8 @@ contract NativeBridgeInitiatorMOVE is INativeBridgeInitiatorMOVE, OwnableUpgrade REFUNDED } - struct BridgeTransfer { - uint256 amount; - address originator; - bytes32 recipient; - bytes32 hashLock; - uint256 timeLock; // in seconds (timestamp) - MessageState state; - } - // Mapping of bridge transfer ids to BridgeTransfer structs - mapping(bytes32 => BridgeTransfer) public bridgeTransfers; - - // Total MOVE token pool balance - uint256 public poolBalance; + mapping(bytes32 => MessageState) public bridgeTransfers; address public counterpartyAddress; ERC20Upgradeable public moveToken; @@ -48,9 +36,6 @@ contract NativeBridgeInitiatorMOVE is INativeBridgeInitiatorMOVE, OwnableUpgrade // Set the custom time lock duration initiatorTimeLockDuration = _timeLockDuration; - - // Set the initial pool balance - poolBalance = _initialPoolBalance; } function setCounterpartyAddress(address _counterpartyAddress) external onlyOwner { @@ -58,72 +43,83 @@ contract NativeBridgeInitiatorMOVE is INativeBridgeInitiatorMOVE, OwnableUpgrade counterpartyAddress = _counterpartyAddress; } - function initiateBridgeTransfer(uint256 moveAmount, bytes32 recipient, bytes32 hashLock) + function initiateBridgeTransfer(uint256 amount, bytes32 recipient, bytes32 hashLock) external returns (bytes32 bridgeTransferId) { address originator = msg.sender; // Ensure there is a valid amount - if (moveAmount == 0) { + if (amount == 0) { revert ZeroAmount(); } // Transfer the MOVE tokens from the user to the contract - if (!moveToken.transferFrom(originator, address(this), moveAmount)) { + if (!moveToken.transferFrom(originator, address(this), amount)) { revert MOVETransferFailed(); } - // Update the pool balance - poolBalance += moveAmount; - // Generate a unique nonce to prevent replay attacks, and generate a transfer ID - bridgeTransferId = keccak256( - abi.encodePacked(originator, recipient, hashLock, initiatorTimeLockDuration, block.timestamp, nonce++) - ); + bridgeTransferId = + keccak256(abi.encodePacked(originator, recipient, amount, hashLock, block.timestamp, ++nonce)); - bridgeTransfers[bridgeTransferId] = BridgeTransfer({ - amount: moveAmount, - originator: originator, - recipient: recipient, - hashLock: hashLock, - timeLock: block.timestamp + initiatorTimeLockDuration, - state: MessageState.INITIALIZED - }); - - emit BridgeTransferInitiated( - bridgeTransferId, originator, recipient, moveAmount, hashLock, initiatorTimeLockDuration - ); + bridgeTransfers[bridgeTransferId] = MessageState.INITIALIZED; + + emit BridgeTransferInitiated(bridgeTransferId, originator, recipient, amount, hashLock, block.timestamp, nonce); return bridgeTransferId; } - function completeBridgeTransfer(bytes32 bridgeTransferId, bytes32 preImage) external onlyOwner { - BridgeTransfer storage bridgeTransfer = bridgeTransfers[bridgeTransferId]; - if (bridgeTransfer.state != MessageState.INITIALIZED) revert BridgeTransferHasBeenCompleted(); + function completeBridgeTransfer( + bytes32 bridgeTransferId, + bytes32 originator, + address recipient, + uint256 amount, + bytes32 hashLock, + uint256 initialTimestamp, + uint256 nonce, + bytes32 preImage + ) external onlyOwner { + require(bridgeTransfers[bridgeTransferId] == MessageState.INITIALIZED, BridgeTransferHasBeenCompleted()); + require( + bridgeTransferId + == keccak256(abi.encodePacked(originator, recipient, amount, hashLock, initialTimestamp, nonce)), + InvalidBridgeTransferId() + ); if (keccak256(abi.encodePacked(preImage)) != bridgeTransfer.hashLock) revert InvalidSecret(); - if (block.timestamp > bridgeTransfer.timeLock) revert TimelockExpired(); - bridgeTransfer.state = MessageState.COMPLETED; + if (block.timestamp > initialTimestamp + initiatorTimeLockDuration) revert TimelockExpired(); + bridgeTransfers[bridgeTransferId] = MessageState.COMPLETED; - emit BridgeTransferCompleted(bridgeTransferId, preImage); + emit BridgeTransferCompleted( + bridgeTransferId, originator, recipient, amount, hashLock, initialTimestamp, nonce, preImage + ); } - function refundBridgeTransfer(bytes32 bridgeTransferId) external onlyOwner { - BridgeTransfer storage bridgeTransfer = bridgeTransfers[bridgeTransferId]; - if (bridgeTransfer.state != MessageState.INITIALIZED) revert BridgeTransferStateNotInitialized(); - if (block.timestamp < bridgeTransfer.timeLock) revert TimeLockNotExpired(); - bridgeTransfer.state = MessageState.REFUNDED; + function refundBridgeTransfer( + bytes32 bridgeTransferId, + bytes32 originator, + address recipient, + uint256 amount, + bytes32 hashLock, + uint256 initialTimestamp, + uint256 nonce + ) external onlyOwner { + require( + bridgeTransferId + == keccak256(abi.encodePacked(originator, recipient, amount, hashLock, initialTimestamp, nonce)), + InvalidBridgeTransferId() + ); + + require(bridgeTransfers[bridgeTransferId] == MessageState.INITIALIZED, BridgeTransferHasBeenCompleted()); - // Decrease pool balance and transfer MOVE tokens back to the originator - poolBalance -= bridgeTransfer.amount; - if (!moveToken.transfer(bridgeTransfer.originator, bridgeTransfer.amount)) revert MOVETransferFailed(); + if (block.timestamp < initialTimestamp + initiatorTimeLockDuration) revert TimeLockNotExpired(); + bridgeTransfers[bridgeTransferId] = MessageState.REFUNDED; + if (!moveToken.transfer(originator, amount)) revert MOVETransferFailed(); emit BridgeTransferRefunded(bridgeTransferId); } function withdrawMOVE(address recipient, uint256 amount) external { if (msg.sender != counterpartyAddress) revert Unauthorized(); - if (poolBalance < amount) revert InsufficientMOVEBalance(); - poolBalance -= amount; if (!moveToken.transfer(recipient, amount)) revert MOVETransferFailed(); } } From 3cb8dbe05b3d96404f14336a6d07c74a08d71b6a Mon Sep 17 00:00:00 2001 From: primata Date: Thu, 14 Nov 2024 14:19:36 +0100 Subject: [PATCH 3/6] implementation of no struct --- protocol-units/bridge/contracts/foundry.toml | 2 +- .../src/INativeBridgeCounterpartyMOVE.sol | 101 +++--- .../src/INativeBridgeInitiatorMOVE.sol | 100 +++--- .../src/NativeBridgeCounterpartyMOVE.sol | 10 +- .../src/NativeBridgeInitiatorMOVE.sol | 20 +- .../test/NativeBridgeCounterpartyMOVE.t.sol | 270 +++++++------- .../test/NativeBridgeInitiatorMOVE.t.sol | 328 +++++++++--------- 7 files changed, 434 insertions(+), 397 deletions(-) diff --git a/protocol-units/bridge/contracts/foundry.toml b/protocol-units/bridge/contracts/foundry.toml index 081338885..1f445f4c6 100644 --- a/protocol-units/bridge/contracts/foundry.toml +++ b/protocol-units/bridge/contracts/foundry.toml @@ -3,7 +3,7 @@ src = "src" out = "out" libs = ["lib"] -solc = "0.8.26" +solc = "0.8.27" evm_version = "cancun" # See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options diff --git a/protocol-units/bridge/contracts/src/INativeBridgeCounterpartyMOVE.sol b/protocol-units/bridge/contracts/src/INativeBridgeCounterpartyMOVE.sol index 509c2105b..15bd653c8 100644 --- a/protocol-units/bridge/contracts/src/INativeBridgeCounterpartyMOVE.sol +++ b/protocol-units/bridge/contracts/src/INativeBridgeCounterpartyMOVE.sol @@ -1,61 +1,70 @@ +// SPDX-License-Identifier: MIT pragma solidity ^0.8.22; interface INativeBridgeCounterpartyMOVE { - // Event emitted when a new native bridge transfer is locked + + function initialize(address _nativeBridgeInitiator, address owner, uint256 _timeLockDuration) external; + function setNativeBridgeInitiator(address _nativeBridgeInitiator) external; + function setTimeLockDuration(uint256 _timeLockDuration) external; + + function lockBridgeTransfer( + bytes32 bridgeTransferId, + bytes32 originator, + address recipient, + uint256 amount, + bytes32 hashLock, + uint256 initialTimestamp, + uint256 nonce + ) external; + + function completeBridgeTransfer( + bytes32 bridgeTransferId, + bytes32 originator, + address recipient, + uint256 amount, + bytes32 hashLock, + uint256 initialTimestamp, + uint256 nonce, + bytes32 preImage + ) external; + + function abortBridgeTransfer( + bytes32 bridgeTransferId, + bytes32 originator, + address recipient, + uint256 amount, + bytes32 hashLock, + uint256 initialTimestamp, + uint256 nonce + ) external; + event BridgeTransferLocked( - bytes32 indexed bridgeTransferId, address indexed recipient, uint256 amount, bytes32 hashLock, uint256 timeLock + bytes32 indexed bridgeTransferId, + bytes32 indexed originator, + address indexed recipient, + uint256 amount, + bytes32 hashLock, + uint256 initialTimestamp, + uint256 nonce ); - // Event emitted when a BridgeTransfer is completed - event BridgeTransferCompleted(bytes32 indexed bridgeTransferId, bytes32 pre_image); + event BridgeTransferCompleted( + bytes32 indexed bridgeTransferId, + bytes32 indexed originator, + address indexed recipient, + uint256 amount, + bytes32 hashLock, + uint256 initialTimestamp, + uint256 nonce, + bytes32 preImage + ); - // Event emitted when a BridgeTransfer is aborted event BridgeTransferAborted(bytes32 indexed bridgeTransferId); - error ZeroAmount(); - error MOVETransferFailed(); - error BridgeTransferInvalid(); + error ZeroAddress(); error InvalidBridgeTransferId(); error InvalidSecret(); - error BridgeTransferHasBeenCompleted(); - error BridgeTransferStateNotInitialized(); error BridgeTransferStateNotPending(); - error InsufficientMOVEBalance(); error TimeLockExpired(); error TimeLockNotExpired(); - error ZeroAddress(); - error Unauthorized(); - - /** - * @dev Locks the assets for a new native bridge transfer - * @param originator The address of the originator of the BridgeTransfer - * @param bridgeTransferId A unique id representing this BridgeTransfer - * @param hashLock The hash of the secret (HASH) that will unlock the funds - * @param recipient The address to which to transfer the funds - * @param amount The amount of WETH to lock - * @return bool indicating successful lock - * - */ - function lockBridgeTransfer( - bytes32 originator, - bytes32 bridgeTransferId, - bytes32 hashLock, - address recipient, - uint256 amount - ) external returns (bool); - - /** - * @dev Completes the bridge transfer and withdraws WETH to the recipient - * @param bridgeTransferId Unique identifier for the BridgeTransfer - * @param preImage The secret that unlocks the funds - * - */ - function completeBridgeTransfer(bytes32 bridgeTransferId, bytes32 preImage) external; - - /** - * @dev Cancels the bridge transfer and refunds the initiator if the timelock has expired - * @param bridgeTransferId Unique identifier for the BridgeTransfer - * - */ - function abortBridgeTransfer(bytes32 bridgeTransferId) external; } diff --git a/protocol-units/bridge/contracts/src/INativeBridgeInitiatorMOVE.sol b/protocol-units/bridge/contracts/src/INativeBridgeInitiatorMOVE.sol index e559b25b8..41359a455 100644 --- a/protocol-units/bridge/contracts/src/INativeBridgeInitiatorMOVE.sol +++ b/protocol-units/bridge/contracts/src/INativeBridgeInitiatorMOVE.sol @@ -2,56 +2,70 @@ pragma solidity ^0.8.22; interface INativeBridgeInitiatorMOVE { - // Event emitted when a new native bridge transfer is created + + + function initiatorTimeLockDuration() external view returns (uint256); + + function initialize(address _moveToken, address owner, uint256 _timeLockDuration, uint256 _initialPoolBalance) external; + function setCounterpartyAddress(address _counterpartyAddress) external; + + function initiateBridgeTransfer(bytes32 recipient, uint256 amount, bytes32 hashLock) + external + returns (bytes32 bridgeTransferId); + + function completeBridgeTransfer( + bytes32 bridgeTransferId, + address originator, + bytes32 recipient, + uint256 amount, + bytes32 hashLock, + uint256 initialTimestamp, + uint256 nonce, + bytes32 preImage + ) external; + + function refundBridgeTransfer( + bytes32 bridgeTransferId, + address originator, + bytes32 recipient, + uint256 amount, + bytes32 hashLock, + uint256 initialTimestamp, + uint256 nonce + ) external; + + function withdrawMOVE(address recipient, uint256 amount) external; + event BridgeTransferInitiated( - bytes32 indexed _bridgeTransferId, - address indexed _originator, - bytes32 indexed _recipient, + bytes32 indexed bridgeTransferId, + address indexed originator, + bytes32 indexed recipient, + uint256 amount, + bytes32 hashLock, + uint256 initialTimestamp, + uint256 nonce + ); + + event BridgeTransferCompleted( + bytes32 indexed bridgeTransferId, + address indexed originator, + bytes32 indexed recipient, uint256 amount, - bytes32 _hashLock, - uint256 _timeLock + bytes32 hashLock, + uint256 initialTimestamp, + uint256 nonce, + bytes32 preImage ); - // Event emitted when a BridgeTransfer is completed (withdrawn) - event BridgeTransferCompleted(bytes32 indexed _bridgeTransferId, bytes32 pre_image); - // Event emitted when a BridgeTransfer is refunded - event BridgeTransferRefunded(bytes32 indexed _bridgeTransferId); + event BridgeTransferRefunded(bytes32 indexed bridgeTransferId); + + error ZeroAddress(); error ZeroAmount(); error MOVETransferFailed(); - error BridgeTransferInvalid(); - error InvalidSecret(); error BridgeTransferHasBeenCompleted(); - error BridgeTransferStateNotInitialized(); - error InsufficientMOVEBalance(); - error TimeLockNotExpired(); + error InvalidBridgeTransferId(); + error InvalidSecret(); error TimelockExpired(); - error ZeroAddress(); + error TimeLockNotExpired(); error Unauthorized(); - - /** - * @dev Creates a new native bridge transfer using native ETH - * @param _moveAmount The amount of MOVE to send - * @param _recipient The address on the other chain to which to transfer the funds - * @param _hashLock The hash of the secret (HASH) that will unlock the funds - * @return _bridgeTransferId A unique id representing this BridgeTransfer - * - */ - function initiateBridgeTransfer(uint256 _moveAmount, bytes32 _recipient, bytes32 _hashLock) - external - returns (bytes32 _bridgeTransferId); - - /** - * @dev Completes the bridging Counterparty - * @param _bridgeTransferId Unique identifier for the BridgeTransfer - * @param preImage The secret that unlocks the funds - * - */ - function completeBridgeTransfer(bytes32 _bridgeTransferId, bytes32 preImage) external; - - /** - * @dev Refunds the funds back to the initiator if the timelock has expired - * @param _bridgeTransferId Unique identifier for the BridgeTransfer - * - */ - function refundBridgeTransfer(bytes32 _bridgeTransferId) external; } diff --git a/protocol-units/bridge/contracts/src/NativeBridgeCounterpartyMOVE.sol b/protocol-units/bridge/contracts/src/NativeBridgeCounterpartyMOVE.sol index 6c102cca3..6c9dd3bd8 100644 --- a/protocol-units/bridge/contracts/src/NativeBridgeCounterpartyMOVE.sol +++ b/protocol-units/bridge/contracts/src/NativeBridgeCounterpartyMOVE.sol @@ -6,12 +6,12 @@ import {INativeBridgeCounterpartyMOVE} from "./INativeBridgeCounterpartyMOVE.sol import {NativeBridgeInitiatorMOVE} from "./NativeBridgeInitiatorMOVE.sol"; contract NativeBridgeCounterpartyMOVE is INativeBridgeCounterpartyMOVE, OwnableUpgradeable { + enum MessageState { PENDING, COMPLETED, REFUNDED } - NativeBridgeInitiatorMOVE public nativeBridgeInitiatorMOVE; mapping(bytes32 => MessageState) public bridgeTransfers; @@ -65,12 +65,12 @@ contract NativeBridgeCounterpartyMOVE is INativeBridgeCounterpartyMOVE, OwnableU uint256 initialTimestamp, uint256 nonce, bytes32 preImage) external { - require(keccak256(abi.encodePacked(preImage)) == details.hashLock, InvalidSecret()); require(bridgeTransferId == keccak256(abi.encodePacked(originator, recipient, amount, hashLock, initialTimestamp, nonce)), InvalidBridgeTransferId()); + require(keccak256(abi.encodePacked(preImage)) == hashLock, InvalidSecret()); - require(bridgeTransfers[bridgeTransferId] == MessageState.PENDING BridgeTransferStateNotPending()); + require(bridgeTransfers[bridgeTransferId] == MessageState.PENDING, BridgeTransferStateNotPending()); - if (block.timestamp > timeLock) revert TimeLockExpired(); + if (block.timestamp > initialTimestamp + counterpartyTimeLockDuration) revert TimeLockExpired(); bridgeTransfers[bridgeTransferId] = MessageState.COMPLETED; @@ -87,7 +87,7 @@ contract NativeBridgeCounterpartyMOVE is INativeBridgeCounterpartyMOVE, OwnableU uint256 initialTimestamp, uint256 nonce) external onlyOwner { require(bridgeTransferId == keccak256(abi.encodePacked(originator, recipient, amount, hashLock, initialTimestamp, nonce)), InvalidBridgeTransferId()); - require(bridgeTransfers[bridgeTransferId] == MessageState.PENDING BridgeTransferStateNotPending()); + require(bridgeTransfers[bridgeTransferId] == MessageState.PENDING, BridgeTransferStateNotPending()); if (block.timestamp <= initialTimestamp + counterpartyTimeLockDuration) revert TimeLockNotExpired(); bridgeTransfers[bridgeTransferId] = MessageState.REFUNDED; diff --git a/protocol-units/bridge/contracts/src/NativeBridgeInitiatorMOVE.sol b/protocol-units/bridge/contracts/src/NativeBridgeInitiatorMOVE.sol index f99265ad3..9f36cfc08 100644 --- a/protocol-units/bridge/contracts/src/NativeBridgeInitiatorMOVE.sol +++ b/protocol-units/bridge/contracts/src/NativeBridgeInitiatorMOVE.sol @@ -7,18 +7,18 @@ import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/Own import {ERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; contract NativeBridgeInitiatorMOVE is INativeBridgeInitiatorMOVE, OwnableUpgradeable { + enum MessageState { INITIALIZED, COMPLETED, REFUNDED } - // Mapping of bridge transfer ids to BridgeTransfer structs mapping(bytes32 => MessageState) public bridgeTransfers; address public counterpartyAddress; ERC20Upgradeable public moveToken; - uint256 private nonce; + uint256 private _nonce; // Configurable time lock duration uint256 public initiatorTimeLockDuration; @@ -43,7 +43,7 @@ contract NativeBridgeInitiatorMOVE is INativeBridgeInitiatorMOVE, OwnableUpgrade counterpartyAddress = _counterpartyAddress; } - function initiateBridgeTransfer(uint256 amount, bytes32 recipient, bytes32 hashLock) + function initiateBridgeTransfer(bytes32 recipient, uint256 amount, bytes32 hashLock) external returns (bytes32 bridgeTransferId) { @@ -61,18 +61,18 @@ contract NativeBridgeInitiatorMOVE is INativeBridgeInitiatorMOVE, OwnableUpgrade // Generate a unique nonce to prevent replay attacks, and generate a transfer ID bridgeTransferId = - keccak256(abi.encodePacked(originator, recipient, amount, hashLock, block.timestamp, ++nonce)); + keccak256(abi.encodePacked(originator, recipient, amount, hashLock, block.timestamp, ++_nonce)); bridgeTransfers[bridgeTransferId] = MessageState.INITIALIZED; - emit BridgeTransferInitiated(bridgeTransferId, originator, recipient, amount, hashLock, block.timestamp, nonce); + emit BridgeTransferInitiated(bridgeTransferId, originator, recipient, amount, hashLock, block.timestamp, _nonce); return bridgeTransferId; } function completeBridgeTransfer( bytes32 bridgeTransferId, - bytes32 originator, - address recipient, + address originator, + bytes32 recipient, uint256 amount, bytes32 hashLock, uint256 initialTimestamp, @@ -85,7 +85,7 @@ contract NativeBridgeInitiatorMOVE is INativeBridgeInitiatorMOVE, OwnableUpgrade == keccak256(abi.encodePacked(originator, recipient, amount, hashLock, initialTimestamp, nonce)), InvalidBridgeTransferId() ); - if (keccak256(abi.encodePacked(preImage)) != bridgeTransfer.hashLock) revert InvalidSecret(); + if (keccak256(abi.encodePacked(preImage)) != hashLock) revert InvalidSecret(); if (block.timestamp > initialTimestamp + initiatorTimeLockDuration) revert TimelockExpired(); bridgeTransfers[bridgeTransferId] = MessageState.COMPLETED; @@ -96,8 +96,8 @@ contract NativeBridgeInitiatorMOVE is INativeBridgeInitiatorMOVE, OwnableUpgrade function refundBridgeTransfer( bytes32 bridgeTransferId, - bytes32 originator, - address recipient, + address originator, + bytes32 recipient, uint256 amount, bytes32 hashLock, uint256 initialTimestamp, diff --git a/protocol-units/bridge/contracts/test/NativeBridgeCounterpartyMOVE.t.sol b/protocol-units/bridge/contracts/test/NativeBridgeCounterpartyMOVE.t.sol index 670d91815..dbb2c9a23 100644 --- a/protocol-units/bridge/contracts/test/NativeBridgeCounterpartyMOVE.t.sol +++ b/protocol-units/bridge/contracts/test/NativeBridgeCounterpartyMOVE.t.sol @@ -3,8 +3,8 @@ pragma solidity ^0.8.22; pragma abicoder v2; import {Test, console} from "forge-std/Test.sol"; -import {NativeBridgeCounterpartyMOVE} from "../src/NativeBridgeCounterpartyMOVE.sol"; -import {NativeBridgeInitiatorMOVE} from "../src/NativeBridgeInitiatorMOVE.sol"; +import {NativeBridgeCounterpartyMOVE, INativeBridgeCounterpartyMOVE} from "../src/NativeBridgeCounterpartyMOVE.sol"; +import {NativeBridgeInitiatorMOVE, INativeBridgeInitiatorMOVE} from "../src/NativeBridgeInitiatorMOVE.sol"; import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; import {TransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; import {MockMOVEToken} from "../src/MockMOVEToken.sol"; @@ -16,36 +16,29 @@ contract NativeBridgeCounterpartyMOVETest is Test { NativeBridgeInitiatorMOVE public nativeBridgeInitiatorMOVE; MockMOVEToken public moveToken; ProxyAdmin public proxyAdmin; - TransparentUpgradeableProxy public proxy; - - address public deployer = address(0x1); - address public originator = address(1); + TransparentUpgradeableProxy public proxyInitiator; + TransparentUpgradeableProxy public proxyCounterparty; + + address public deployer = address(0x1337); + address public ethAddress = address(0x1); address public recipient = address(0x2); address public otherUser = address(0x3); - bytes32 public hashLock = keccak256(abi.encodePacked("secret")); - uint256 public amount = 100 * 10 ** 8; // 100 MOVEToken (assuming 8 decimals) - uint256 public timeLock = 100; - bytes32 public initiator = keccak256(abi.encodePacked(deployer)); - bytes32 public bridgeTransferId = - keccak256(abi.encodePacked(block.timestamp, initiator, recipient, amount, hashLock, timeLock)); + uint256 public _amount = 100 * 10 ** 8; // 100 MOVEToken (assuming 8 decimals) + uint256 public timeLock = 1 days; + bytes32 public moveAddress = keccak256(abi.encodePacked(ethAddress)); uint256 public constant COUNTERPARTY_TIME_LOCK_DURATION = 24 * 60 * 60; // 24 hours function setUp() public { - // Deploy the MOVEToken contract and mint some tokens to the deployer moveToken = new MockMOVEToken(); - moveToken.initialize(address(this)); // Contract will hold initial MOVE tokens + moveToken.initialize(address(this)); - // Time lock durations uint256 initiatorTimeLockDuration = 48 * 60 * 60; // 48 hours for the initiator uint256 counterpartyTimeLockDuration = 24 * 60 * 60; // 24 hours for the counterparty - originator = vm.addr(uint256(keccak256(abi.encodePacked(block.timestamp, block.prevrandao)))); - - // Deploy the NativeBridgeInitiator contract with a 48-hour time lock nativeBridgeInitiatorMOVEImplementation = new NativeBridgeInitiatorMOVE(); proxyAdmin = new ProxyAdmin(deployer); - proxy = new TransparentUpgradeableProxy( + proxyInitiator = new TransparentUpgradeableProxy( address(nativeBridgeInitiatorMOVEImplementation), address(proxyAdmin), abi.encodeWithSignature( @@ -53,14 +46,13 @@ contract NativeBridgeCounterpartyMOVETest is Test { address(moveToken), deployer, initiatorTimeLockDuration, - 0 ether // Initial pool balance + 0 ether ) ); - nativeBridgeInitiatorMOVE = NativeBridgeInitiatorMOVE(address(proxy)); + nativeBridgeInitiatorMOVE = NativeBridgeInitiatorMOVE(address(proxyInitiator)); - // Deploy the NativeBridgeCounterparty contract with a 24-hour time lock nativeBridgeCounterpartyMOVEImplementation = new NativeBridgeCounterpartyMOVE(); - proxy = new TransparentUpgradeableProxy( + proxyCounterparty = new TransparentUpgradeableProxy( address(nativeBridgeCounterpartyMOVEImplementation), address(proxyAdmin), abi.encodeWithSignature( @@ -70,140 +62,162 @@ contract NativeBridgeCounterpartyMOVETest is Test { counterpartyTimeLockDuration ) ); - nativeBridgeCounterpartyMOVE = NativeBridgeCounterpartyMOVE(address(proxy)); + nativeBridgeCounterpartyMOVE = NativeBridgeCounterpartyMOVE(address(proxyCounterparty)); - // Set the counterparty contract in the NativeBridgeInitiator contract vm.startPrank(deployer); nativeBridgeInitiatorMOVE.setCounterpartyAddress(address(nativeBridgeCounterpartyMOVE)); vm.stopPrank(); } - function testLockBridgeTransfer() public { - uint256 moveAmount = 100 * 10 ** 8; - moveToken.transfer(originator, moveAmount); - vm.startPrank(originator); - - // Approve the NativeBridgeInitiatorMOVE contract to spend MOVEToken - moveToken.approve(address(nativeBridgeInitiatorMOVE), amount); - - // Initiate the bridge transfer - nativeBridgeInitiatorMOVE.initiateBridgeTransfer(amount, initiator, hashLock); - - vm.stopPrank(); - - vm.startPrank(deployer); // Only the owner (deployer) can call lockBridgeTransfer - bool result = - nativeBridgeCounterpartyMOVE.lockBridgeTransfer(initiator, bridgeTransferId, hashLock, recipient, amount); + function testInitiateBridgeTransfer() + public + returns (bytes32 hashLock, uint256 initialTimestamp, uint256 nonce, bytes32 preImage) + { + preImage = "secret"; + hashLock = keccak256(abi.encodePacked(preImage)); + nonce; + moveToken.transfer(ethAddress, _amount); + vm.startPrank(ethAddress); + + moveToken.approve(address(nativeBridgeInitiatorMOVE), _amount); + bytes32 bridgeTransferId = nativeBridgeInitiatorMOVE.initiateBridgeTransfer(moveAddress, _amount, hashLock); + nonce++; + initialTimestamp = block.timestamp; vm.stopPrank(); - - ( - bytes32 pendingInitiator, - address pendingRecipient, - uint256 pendingAmount, - bytes32 pendingHashLock, - uint256 pendingTimelock, - NativeBridgeCounterpartyMOVE.MessageState pendingState - ) = nativeBridgeCounterpartyMOVE.bridgeTransfers(bridgeTransferId); - - assert(result); - assertEq(pendingInitiator, initiator); - assertEq(pendingRecipient, recipient); - assertEq(pendingAmount, amount); - assertEq(pendingHashLock, hashLock); - assertGt(pendingTimelock, block.timestamp); - assertEq(uint8(pendingState), uint8(NativeBridgeCounterpartyMOVE.MessageState.PENDING)); } - function testCompleteBridgeTransfer() public { - bytes32 preImage = "secret"; - bytes32 testHashLock = keccak256(abi.encodePacked(preImage)); - - uint256 moveAmount = 100 * 10 ** 8; - moveToken.transfer(originator, moveAmount); - vm.startPrank(originator); + function testLockBridgeTransfer() + public + returns ( + bytes32 bridgeTransferId, + bytes32 originator, + address recipient, + uint256 amount, + bytes32 hashLock, + uint256 initialTimestamp, + uint256 parallelNonce, + bytes32 preImage + ) + { + moveToken.transfer(address(nativeBridgeInitiatorMOVE), _amount); + + parallelNonce = 1; + originator = moveAddress; + recipient = ethAddress; + amount = _amount; + preImage = keccak256(abi.encodePacked("secret")); + hashLock = keccak256(abi.encodePacked(preImage)); + initialTimestamp = block.timestamp; + bridgeTransferId = + keccak256(abi.encodePacked(originator, recipient, amount, hashLock, initialTimestamp, parallelNonce)); - // Approve the NativeBridgeInitiatorMOVE contract to spend MOVEToken - moveToken.approve(address(nativeBridgeInitiatorMOVE), amount); + vm.startPrank(deployer); - // Initiate the bridge transfer - nativeBridgeInitiatorMOVE.initiateBridgeTransfer(amount, initiator, testHashLock); + console.log("Testing with wrong originator"); + vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); + nativeBridgeCounterpartyMOVE.lockBridgeTransfer( + bridgeTransferId, keccak256(abi.encodePacked(otherUser)), recipient, amount, hashLock, block.timestamp, parallelNonce - 1 + ); - vm.stopPrank(); + console.log("Testing with wrong recipient"); + vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); + nativeBridgeCounterpartyMOVE.lockBridgeTransfer( + bridgeTransferId, + originator, + otherUser, + amount, + hashLock, + block.timestamp, + parallelNonce - 1 + ); - vm.startPrank(deployer); // Only the owner (deployer) can call lockBridgeTransfer - nativeBridgeCounterpartyMOVE.lockBridgeTransfer(initiator, bridgeTransferId, testHashLock, recipient, amount); - vm.stopPrank(); + console.log("Testing with wrong amount"); + vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); + nativeBridgeCounterpartyMOVE.lockBridgeTransfer( + bridgeTransferId, originator, recipient, amount - 1, hashLock, block.timestamp, parallelNonce + ); - vm.startPrank(otherUser); + console.log("Testing with wrong timestamp"); + vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); + nativeBridgeCounterpartyMOVE.lockBridgeTransfer( + bridgeTransferId, originator, recipient, amount - 1, hashLock, block.timestamp + 1, parallelNonce + ); - nativeBridgeCounterpartyMOVE.completeBridgeTransfer(bridgeTransferId, preImage); + console.log("Testing with wrong hashLock"); + vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); + nativeBridgeCounterpartyMOVE.lockBridgeTransfer( + bridgeTransferId, + originator, + recipient, + amount - 1, + keccak256(abi.encodePacked(hashLock)), + block.timestamp, + parallelNonce + ); - ( - bytes32 completedInitiator, - address completedRecipient, - uint256 completedAmount, - bytes32 completedHashLock, - uint256 completedTimeLock, - NativeBridgeCounterpartyMOVE.MessageState completedState - ) = nativeBridgeCounterpartyMOVE.bridgeTransfers(bridgeTransferId); - - assertEq(completedInitiator, initiator); - assertEq(completedRecipient, recipient); - assertEq(completedAmount, amount); - assertEq(completedHashLock, testHashLock); - assertGt(completedTimeLock, block.timestamp); - assertEq(uint8(completedState), uint8(NativeBridgeCounterpartyMOVE.MessageState.COMPLETED)); + console.log("Testing with wrong nonce"); + vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); + nativeBridgeCounterpartyMOVE.lockBridgeTransfer( + bridgeTransferId, originator, recipient, amount, hashLock, block.timestamp, parallelNonce - 1 + ); + nativeBridgeCounterpartyMOVE.lockBridgeTransfer( + bridgeTransferId, originator, recipient, amount, hashLock, block.timestamp, parallelNonce + ); vm.stopPrank(); - } - function testAbortBridgeTransfer() public { - uint256 moveAmount = 100 * 10 ** 8; - moveToken.transfer(originator, moveAmount); - vm.startPrank(originator); + NativeBridgeCounterpartyMOVE.MessageState state = nativeBridgeCounterpartyMOVE.bridgeTransfers(bridgeTransferId); - // Approve the NativeBridgeInitiatorMOVE contract to spend MOVEToken - moveToken.approve(address(nativeBridgeInitiatorMOVE), amount); + assertEq(uint8(state), uint8(NativeBridgeCounterpartyMOVE.MessageState.PENDING)); + } - // Initiate the bridge transfer - nativeBridgeInitiatorMOVE.initiateBridgeTransfer(amount, initiator, hashLock); + function testCompleteCounterpartyBridgeTransfer() public { + ( + bytes32 bridgeTransferId, + bytes32 originator, + address recipient, + uint256 amount, + bytes32 hashLock, + uint256 initialTimestamp, + uint256 parallelNonce, + bytes32 preImage + ) = testLockBridgeTransfer(); - vm.stopPrank(); + vm.startPrank(otherUser); - vm.startPrank(deployer); + console.log("Testing with wrong originator"); + vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); + nativeBridgeCounterpartyMOVE.completeBridgeTransfer(bridgeTransferId, keccak256(abi.encodePacked(originator)), recipient, amount, hashLock, initialTimestamp, parallelNonce, preImage); - nativeBridgeCounterpartyMOVE.lockBridgeTransfer(initiator, bridgeTransferId, hashLock, recipient, amount); + console.log("Testing with wrong recipient"); + vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); + nativeBridgeCounterpartyMOVE.completeBridgeTransfer(bridgeTransferId, originator, otherUser, amount, hashLock, initialTimestamp, parallelNonce, preImage); - vm.stopPrank(); + console.log("Testing with wrong amount"); + vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); + nativeBridgeCounterpartyMOVE.completeBridgeTransfer(bridgeTransferId, originator, recipient, amount + 1, hashLock, initialTimestamp, parallelNonce, preImage); - // Advance the block number to beyond the timelock period - vm.warp(block.timestamp + COUNTERPARTY_TIME_LOCK_DURATION + 1); + console.log("Testing with wrong hashLock"); + vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); + nativeBridgeCounterpartyMOVE.completeBridgeTransfer(bridgeTransferId, originator, recipient, amount, keccak256(abi.encodePacked(hashLock)), initialTimestamp, parallelNonce, preImage); + + console.log("Testing with wrong initialTimestamp"); + vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); + nativeBridgeCounterpartyMOVE.completeBridgeTransfer(bridgeTransferId, originator, recipient, amount, hashLock, initialTimestamp + 1, parallelNonce, preImage); - // Try to abort as a malicious user (this should fail) - //vm.startPrank(otherUser); - //vm.expectRevert("Ownable: caller is not the owner"); - //nativeBridgeCounterpartyMOVE.abortBridgeTransfer(bridgeTransferId); - //vm.stopPrank(); + console.log("Testing with wrong nonce"); + vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); + nativeBridgeCounterpartyMOVE.completeBridgeTransfer(bridgeTransferId, originator, recipient, amount, hashLock, initialTimestamp, parallelNonce + 1, preImage); - // Abort as the owner (this should pass) - vm.startPrank(deployer); // The deployer is the owner - nativeBridgeCounterpartyMOVE.abortBridgeTransfer(bridgeTransferId); + console.log("Testing with wrong preImage"); + vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidSecret.selector); + nativeBridgeCounterpartyMOVE.completeBridgeTransfer(bridgeTransferId, originator, recipient, amount, hashLock, initialTimestamp, parallelNonce, keccak256(abi.encodePacked(preImage))); + + nativeBridgeCounterpartyMOVE.completeBridgeTransfer(bridgeTransferId, originator, recipient, amount, hashLock, initialTimestamp, parallelNonce, preImage); - ( - bytes32 abortedInitiator, - address abortedRecipient, - uint256 abortedAmount, - bytes32 abortedHashLock, - uint256 abortedTimeLock, - NativeBridgeCounterpartyMOVE.MessageState abortedState - ) = nativeBridgeCounterpartyMOVE.bridgeTransfers(bridgeTransferId); - - assertEq(abortedInitiator, initiator); - assertEq(abortedRecipient, recipient); - assertEq(abortedAmount, amount); - assertEq(abortedHashLock, hashLock); - assertLe(abortedTimeLock, block.timestamp, "Timelock is not less than or equal to current timestamp"); - assertEq(uint8(abortedState), uint8(NativeBridgeCounterpartyMOVE.MessageState.REFUNDED)); + NativeBridgeCounterpartyMOVE.MessageState state = nativeBridgeCounterpartyMOVE.bridgeTransfers(bridgeTransferId); + + assertEq(uint8(state), uint8(NativeBridgeCounterpartyMOVE.MessageState.COMPLETED)); vm.stopPrank(); } diff --git a/protocol-units/bridge/contracts/test/NativeBridgeInitiatorMOVE.t.sol b/protocol-units/bridge/contracts/test/NativeBridgeInitiatorMOVE.t.sol index c385b1253..c478e1b11 100644 --- a/protocol-units/bridge/contracts/test/NativeBridgeInitiatorMOVE.t.sol +++ b/protocol-units/bridge/contracts/test/NativeBridgeInitiatorMOVE.t.sol @@ -1,164 +1,164 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.22; -pragma abicoder v2; - -import {Test, console} from "forge-std/Test.sol"; -import { - NativeBridgeInitiatorMOVE, - INativeBridgeInitiatorMOVE, - OwnableUpgradeable -} from "../src/NativeBridgeInitiatorMOVE.sol"; -import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; -import {TransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; -import {MockMOVEToken} from "../src/MockMOVEToken.sol"; -import {console} from "forge-std/console.sol"; - -contract NativeBridgeInitiatorMOVETest is Test { - NativeBridgeInitiatorMOVE public nativeBridgeInitiatorImplementation; - MockMOVEToken public moveToken; - ProxyAdmin public proxyAdmin; - TransparentUpgradeableProxy public proxy; - NativeBridgeInitiatorMOVE public nativeBridgeInitiatorMOVE; - - address public originator = address(1); - bytes32 public recipient = keccak256(abi.encodePacked(address(2))); - bytes32 public hashLock = keccak256(abi.encodePacked("secret")); - uint256 public amount = 1 ether; - uint256 public constant timeLockDuration = 48 * 60 * 60; // 48 hours in seconds - - function setUp() public { - // Deploy the MOVEToken contract and mint some tokens to the deployer - moveToken = new MockMOVEToken(); - moveToken.initialize(address(this)); // Contract will hold initial MOVE tokens - - originator = vm.addr(uint256(keccak256(abi.encodePacked(block.timestamp, block.prevrandao)))); - - // Deploy the NativeBridgeInitiatorMOVE contract - nativeBridgeInitiatorImplementation = new NativeBridgeInitiatorMOVE(); - proxyAdmin = new ProxyAdmin(msg.sender); - proxy = new TransparentUpgradeableProxy( - address(nativeBridgeInitiatorImplementation), - address(proxyAdmin), - abi.encodeWithSignature( - "initialize(address,address,uint256,uint256)", - address(moveToken), - address(this), - timeLockDuration, - 0 ether - ) - ); - - nativeBridgeInitiatorMOVE = NativeBridgeInitiatorMOVE(address(proxy)); - } - - function testInitiateBridgeTransferWithMove() public { - uint256 moveAmount = 100 * 10 ** 8; - - // Transfer moveAmount tokens to the originator and check initial balance - moveToken.transfer(originator, moveAmount); - uint256 initialBalance = moveToken.balanceOf(originator); - - vm.startPrank(originator); - moveToken.approve(address(nativeBridgeInitiatorMOVE), moveAmount); - - // Initiate the bridge transfer - bytes32 bridgeTransferId = nativeBridgeInitiatorMOVE.initiateBridgeTransfer(moveAmount, recipient, hashLock); - - // Verify the bridge transfer details - ( - uint256 transferAmount, - address transferOriginator, - bytes32 transferRecipient, - bytes32 transferHashLock, - uint256 transferTimeLock, - NativeBridgeInitiatorMOVE.MessageState transferState - ) = nativeBridgeInitiatorMOVE.bridgeTransfers(bridgeTransferId); - - assertEq(transferAmount, moveAmount); - assertEq(transferOriginator, originator); - assertEq(transferRecipient, recipient); - assertEq(transferHashLock, hashLock); - assertGt(transferTimeLock, block.timestamp); - assertEq(uint8(transferState), uint8(NativeBridgeInitiatorMOVE.MessageState.INITIALIZED)); - - // Check the originator's MOVE balance after initiating the transfer - uint256 finalBalance = moveToken.balanceOf(originator); - assertEq(finalBalance, initialBalance - moveAmount); - - vm.stopPrank(); - } - - function testCompleteBridgeTransfer() public { - bytes32 secret = "secret"; - bytes32 testHashLock = keccak256(abi.encodePacked(secret)); - uint256 moveAmount = 100 * 10 ** 8; // 100 MOVEToken - - // Transfer moveAmount tokens to the originator and check initial balance - moveToken.transfer(originator, moveAmount); - uint256 initialBalance = moveToken.balanceOf(originator); - - vm.startPrank(originator); - moveToken.approve(address(nativeBridgeInitiatorMOVE), moveAmount); - - // Initiate the bridge transfer - bytes32 bridgeTransferId = nativeBridgeInitiatorMOVE.initiateBridgeTransfer(moveAmount, recipient, testHashLock); - - vm.stopPrank(); - - nativeBridgeInitiatorMOVE.completeBridgeTransfer(bridgeTransferId, secret); - - // Verify the bridge transfer details after completion - ( - uint256 completedAmount, - address completedOriginator, - bytes32 completedRecipient, - bytes32 completedHashLock, - uint256 completedTimeLock, - NativeBridgeInitiatorMOVE.MessageState completedState - ) = nativeBridgeInitiatorMOVE.bridgeTransfers(bridgeTransferId); - - assertEq(completedAmount, moveAmount); - assertEq(completedOriginator, originator); - assertEq(completedRecipient, recipient); - assertEq(completedHashLock, testHashLock); - assertGt(completedTimeLock, block.timestamp); - assertEq(uint8(completedState), uint8(NativeBridgeInitiatorMOVE.MessageState.COMPLETED)); - - // Ensure no changes to the originator's balance after the transfer is completed - uint256 finalBalance = moveToken.balanceOf(originator); - assertEq(finalBalance, initialBalance - moveAmount); - } - - function testRefundBridgeTransfer() public { - uint256 moveAmount = 100 * 10 ** 8; // 100 MOVEToken - - // Transfer moveAmount tokens to the originator and check initial balance - moveToken.transfer(originator, moveAmount); - uint256 initialBalance = moveToken.balanceOf(originator); - - vm.startPrank(originator); - moveToken.approve(address(nativeBridgeInitiatorMOVE), moveAmount); - - // Initiate the bridge transfer - bytes32 bridgeTransferId = nativeBridgeInitiatorMOVE.initiateBridgeTransfer(moveAmount, recipient, hashLock); - vm.stopPrank(); - - // Advance time and block height to ensure the time lock has expired - vm.warp(block.timestamp + timeLockDuration + 1); - - // Test that a non-owner cannot call refund - vm.startPrank(originator); - vm.expectRevert(abi.encodeWithSelector(OwnableUpgradeable.OwnableUnauthorizedAccount.selector, originator)); - nativeBridgeInitiatorMOVE.refundBridgeTransfer(bridgeTransferId); - vm.stopPrank(); - - // Owner refunds the transfer - vm.expectEmit(); - emit INativeBridgeInitiatorMOVE.BridgeTransferRefunded(bridgeTransferId); - nativeBridgeInitiatorMOVE.refundBridgeTransfer(bridgeTransferId); - - // Verify that the originator receives the refund and the balance is restored - uint256 finalBalance = moveToken.balanceOf(originator); - assertEq(finalBalance, initialBalance, "MOVE balance mismatch"); - } -} +// // SPDX-License-Identifier: UNLICENSED +// pragma solidity ^0.8.22; +// pragma abicoder v2; + +// import {Test, console} from "forge-std/Test.sol"; +// import { +// NativeBridgeInitiatorMOVE, +// INativeBridgeInitiatorMOVE, +// OwnableUpgradeable +// } from "../src/NativeBridgeInitiatorMOVE.sol"; +// import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; +// import {TransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; +// import {MockMOVEToken} from "../src/MockMOVEToken.sol"; +// import {console} from "forge-std/console.sol"; + +// contract NativeBridgeInitiatorMOVETest is Test { +// NativeBridgeInitiatorMOVE public nativeBridgeInitiatorImplementation; +// MockMOVEToken public moveToken; +// ProxyAdmin public proxyAdmin; +// TransparentUpgradeableProxy public proxy; +// NativeBridgeInitiatorMOVE public nativeBridgeInitiatorMOVE; + +// address public originator = address(1); +// bytes32 public recipient = keccak256(abi.encodePacked(address(2))); +// bytes32 public hashLock = keccak256(abi.encodePacked("secret")); +// uint256 public amount = 1 ether; +// uint256 public constant timeLockDuration = 48 * 60 * 60; // 48 hours in seconds + +// function setUp() public { +// // Deploy the MOVEToken contract and mint some tokens to the deployer +// moveToken = new MockMOVEToken(); +// moveToken.initialize(address(this)); // Contract will hold initial MOVE tokens + +// originator = vm.addr(uint256(keccak256(abi.encodePacked(block.timestamp, block.prevrandao)))); + +// // Deploy the NativeBridgeInitiatorMOVE contract +// nativeBridgeInitiatorImplementation = new NativeBridgeInitiatorMOVE(); +// proxyAdmin = new ProxyAdmin(msg.sender); +// proxy = new TransparentUpgradeableProxy( +// address(nativeBridgeInitiatorImplementation), +// address(proxyAdmin), +// abi.encodeWithSignature( +// "initialize(address,address,uint256,uint256)", +// address(moveToken), +// address(this), +// timeLockDuration, +// 0 ether +// ) +// ); + +// nativeBridgeInitiatorMOVE = NativeBridgeInitiatorMOVE(address(proxy)); +// } + +// function testInitiateBridgeTransferWithMove() public { +// uint256 moveAmount = 100 * 10 ** 8; + +// // Transfer moveAmount tokens to the originator and check initial balance +// moveToken.transfer(originator, moveAmount); +// uint256 initialBalance = moveToken.balanceOf(originator); + +// vm.startPrank(originator); +// moveToken.approve(address(nativeBridgeInitiatorMOVE), moveAmount); + +// // Initiate the bridge transfer +// bytes32 bridgeTransferId = nativeBridgeInitiatorMOVE.initiateBridgeTransfer(moveAmount, recipient, hashLock); + +// // Verify the bridge transfer details +// ( +// uint256 transferAmount, +// address transferOriginator, +// bytes32 transferRecipient, +// bytes32 transferHashLock, +// uint256 transferTimeLock, +// NativeBridgeInitiatorMOVE.MessageState transferState +// ) = nativeBridgeInitiatorMOVE.bridgeTransfers(bridgeTransferId); + +// assertEq(transferAmount, moveAmount); +// assertEq(transferOriginator, originator); +// assertEq(transferRecipient, recipient); +// assertEq(transferHashLock, hashLock); +// assertGt(transferTimeLock, block.timestamp); +// assertEq(uint8(transferState), uint8(NativeBridgeInitiatorMOVE.MessageState.INITIALIZED)); + +// // Check the originator's MOVE balance after initiating the transfer +// uint256 finalBalance = moveToken.balanceOf(originator); +// assertEq(finalBalance, initialBalance - moveAmount); + +// vm.stopPrank(); +// } + +// function testCompleteBridgeTransfer() public { +// bytes32 secret = "secret"; +// bytes32 testHashLock = keccak256(abi.encodePacked(secret)); +// uint256 moveAmount = 100 * 10 ** 8; // 100 MOVEToken + +// // Transfer moveAmount tokens to the originator and check initial balance +// moveToken.transfer(originator, moveAmount); +// uint256 initialBalance = moveToken.balanceOf(originator); + +// vm.startPrank(originator); +// moveToken.approve(address(nativeBridgeInitiatorMOVE), moveAmount); + +// // Initiate the bridge transfer +// bytes32 bridgeTransferId = nativeBridgeInitiatorMOVE.initiateBridgeTransfer(moveAmount, recipient, testHashLock); + +// vm.stopPrank(); + +// nativeBridgeInitiatorMOVE.completeBridgeTransfer(bridgeTransferId, secret); + +// // Verify the bridge transfer details after completion +// ( +// uint256 completedAmount, +// address completedOriginator, +// bytes32 completedRecipient, +// bytes32 completedHashLock, +// uint256 completedTimeLock, +// NativeBridgeInitiatorMOVE.MessageState completedState +// ) = nativeBridgeInitiatorMOVE.bridgeTransfers(bridgeTransferId); + +// assertEq(completedAmount, moveAmount); +// assertEq(completedOriginator, originator); +// assertEq(completedRecipient, recipient); +// assertEq(completedHashLock, testHashLock); +// assertGt(completedTimeLock, block.timestamp); +// assertEq(uint8(completedState), uint8(NativeBridgeInitiatorMOVE.MessageState.COMPLETED)); + +// // Ensure no changes to the originator's balance after the transfer is completed +// uint256 finalBalance = moveToken.balanceOf(originator); +// assertEq(finalBalance, initialBalance - moveAmount); +// } + +// function testRefundBridgeTransfer() public { +// uint256 moveAmount = 100 * 10 ** 8; // 100 MOVEToken + +// // Transfer moveAmount tokens to the originator and check initial balance +// moveToken.transfer(originator, moveAmount); +// uint256 initialBalance = moveToken.balanceOf(originator); + +// vm.startPrank(originator); +// moveToken.approve(address(nativeBridgeInitiatorMOVE), moveAmount); + +// // Initiate the bridge transfer +// bytes32 bridgeTransferId = nativeBridgeInitiatorMOVE.initiateBridgeTransfer(moveAmount, recipient, hashLock); +// vm.stopPrank(); + +// // Advance time and block height to ensure the time lock has expired +// vm.warp(block.timestamp + timeLockDuration + 1); + +// // Test that a non-owner cannot call refund +// vm.startPrank(originator); +// vm.expectRevert(abi.encodeWithSelector(OwnableUpgradeable.OwnableUnauthorizedAccount.selector, originator)); +// nativeBridgeInitiatorMOVE.refundBridgeTransfer(bridgeTransferId); +// vm.stopPrank(); + +// // Owner refunds the transfer +// vm.expectEmit(); +// emit INativeBridgeInitiatorMOVE.BridgeTransferRefunded(bridgeTransferId); +// nativeBridgeInitiatorMOVE.refundBridgeTransfer(bridgeTransferId); + +// // Verify that the originator receives the refund and the balance is restored +// uint256 finalBalance = moveToken.balanceOf(originator); +// assertEq(finalBalance, initialBalance, "MOVE balance mismatch"); +// } +// } From da2d6d6ced6854fbe76a2a2b0c3e8c961c7f803e Mon Sep 17 00:00:00 2001 From: primata Date: Thu, 14 Nov 2024 16:12:50 +0100 Subject: [PATCH 4/6] test of new implementation --- .../src/NativeBridgeInitiatorMOVE.sol | 2 +- .../test/NativeBridgeCounterpartyMOVE.t.sol | 224 ---------- .../test/NativeBridgeInitiatorMOVE.t.sol | 164 -------- .../contracts/test/NativeBridgeMOVE.t.sol | 391 ++++++++++++++++++ 4 files changed, 392 insertions(+), 389 deletions(-) delete mode 100644 protocol-units/bridge/contracts/test/NativeBridgeCounterpartyMOVE.t.sol delete mode 100644 protocol-units/bridge/contracts/test/NativeBridgeInitiatorMOVE.t.sol create mode 100644 protocol-units/bridge/contracts/test/NativeBridgeMOVE.t.sol diff --git a/protocol-units/bridge/contracts/src/NativeBridgeInitiatorMOVE.sol b/protocol-units/bridge/contracts/src/NativeBridgeInitiatorMOVE.sol index 9f36cfc08..7a7bc8567 100644 --- a/protocol-units/bridge/contracts/src/NativeBridgeInitiatorMOVE.sol +++ b/protocol-units/bridge/contracts/src/NativeBridgeInitiatorMOVE.sol @@ -78,7 +78,7 @@ contract NativeBridgeInitiatorMOVE is INativeBridgeInitiatorMOVE, OwnableUpgrade uint256 initialTimestamp, uint256 nonce, bytes32 preImage - ) external onlyOwner { + ) external { require(bridgeTransfers[bridgeTransferId] == MessageState.INITIALIZED, BridgeTransferHasBeenCompleted()); require( bridgeTransferId diff --git a/protocol-units/bridge/contracts/test/NativeBridgeCounterpartyMOVE.t.sol b/protocol-units/bridge/contracts/test/NativeBridgeCounterpartyMOVE.t.sol deleted file mode 100644 index dbb2c9a23..000000000 --- a/protocol-units/bridge/contracts/test/NativeBridgeCounterpartyMOVE.t.sol +++ /dev/null @@ -1,224 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.22; -pragma abicoder v2; - -import {Test, console} from "forge-std/Test.sol"; -import {NativeBridgeCounterpartyMOVE, INativeBridgeCounterpartyMOVE} from "../src/NativeBridgeCounterpartyMOVE.sol"; -import {NativeBridgeInitiatorMOVE, INativeBridgeInitiatorMOVE} from "../src/NativeBridgeInitiatorMOVE.sol"; -import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; -import {TransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; -import {MockMOVEToken} from "../src/MockMOVEToken.sol"; - -contract NativeBridgeCounterpartyMOVETest is Test { - NativeBridgeCounterpartyMOVE public nativeBridgeCounterpartyMOVEImplementation; - NativeBridgeCounterpartyMOVE public nativeBridgeCounterpartyMOVE; - NativeBridgeInitiatorMOVE public nativeBridgeInitiatorMOVEImplementation; - NativeBridgeInitiatorMOVE public nativeBridgeInitiatorMOVE; - MockMOVEToken public moveToken; - ProxyAdmin public proxyAdmin; - TransparentUpgradeableProxy public proxyInitiator; - TransparentUpgradeableProxy public proxyCounterparty; - - address public deployer = address(0x1337); - address public ethAddress = address(0x1); - address public recipient = address(0x2); - address public otherUser = address(0x3); - uint256 public _amount = 100 * 10 ** 8; // 100 MOVEToken (assuming 8 decimals) - uint256 public timeLock = 1 days; - - bytes32 public moveAddress = keccak256(abi.encodePacked(ethAddress)); - uint256 public constant COUNTERPARTY_TIME_LOCK_DURATION = 24 * 60 * 60; // 24 hours - - function setUp() public { - moveToken = new MockMOVEToken(); - moveToken.initialize(address(this)); - - uint256 initiatorTimeLockDuration = 48 * 60 * 60; // 48 hours for the initiator - uint256 counterpartyTimeLockDuration = 24 * 60 * 60; // 24 hours for the counterparty - - nativeBridgeInitiatorMOVEImplementation = new NativeBridgeInitiatorMOVE(); - proxyAdmin = new ProxyAdmin(deployer); - proxyInitiator = new TransparentUpgradeableProxy( - address(nativeBridgeInitiatorMOVEImplementation), - address(proxyAdmin), - abi.encodeWithSignature( - "initialize(address,address,uint256,uint256)", - address(moveToken), - deployer, - initiatorTimeLockDuration, - 0 ether - ) - ); - nativeBridgeInitiatorMOVE = NativeBridgeInitiatorMOVE(address(proxyInitiator)); - - nativeBridgeCounterpartyMOVEImplementation = new NativeBridgeCounterpartyMOVE(); - proxyCounterparty = new TransparentUpgradeableProxy( - address(nativeBridgeCounterpartyMOVEImplementation), - address(proxyAdmin), - abi.encodeWithSignature( - "initialize(address,address,uint256)", - address(nativeBridgeInitiatorMOVE), - deployer, - counterpartyTimeLockDuration - ) - ); - nativeBridgeCounterpartyMOVE = NativeBridgeCounterpartyMOVE(address(proxyCounterparty)); - - vm.startPrank(deployer); - nativeBridgeInitiatorMOVE.setCounterpartyAddress(address(nativeBridgeCounterpartyMOVE)); - vm.stopPrank(); - } - - function testInitiateBridgeTransfer() - public - returns (bytes32 hashLock, uint256 initialTimestamp, uint256 nonce, bytes32 preImage) - { - preImage = "secret"; - hashLock = keccak256(abi.encodePacked(preImage)); - nonce; - moveToken.transfer(ethAddress, _amount); - vm.startPrank(ethAddress); - - moveToken.approve(address(nativeBridgeInitiatorMOVE), _amount); - bytes32 bridgeTransferId = nativeBridgeInitiatorMOVE.initiateBridgeTransfer(moveAddress, _amount, hashLock); - nonce++; - initialTimestamp = block.timestamp; - vm.stopPrank(); - } - - function testLockBridgeTransfer() - public - returns ( - bytes32 bridgeTransferId, - bytes32 originator, - address recipient, - uint256 amount, - bytes32 hashLock, - uint256 initialTimestamp, - uint256 parallelNonce, - bytes32 preImage - ) - { - moveToken.transfer(address(nativeBridgeInitiatorMOVE), _amount); - - parallelNonce = 1; - originator = moveAddress; - recipient = ethAddress; - amount = _amount; - preImage = keccak256(abi.encodePacked("secret")); - hashLock = keccak256(abi.encodePacked(preImage)); - initialTimestamp = block.timestamp; - bridgeTransferId = - keccak256(abi.encodePacked(originator, recipient, amount, hashLock, initialTimestamp, parallelNonce)); - - vm.startPrank(deployer); - - console.log("Testing with wrong originator"); - vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); - nativeBridgeCounterpartyMOVE.lockBridgeTransfer( - bridgeTransferId, keccak256(abi.encodePacked(otherUser)), recipient, amount, hashLock, block.timestamp, parallelNonce - 1 - ); - - console.log("Testing with wrong recipient"); - vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); - nativeBridgeCounterpartyMOVE.lockBridgeTransfer( - bridgeTransferId, - originator, - otherUser, - amount, - hashLock, - block.timestamp, - parallelNonce - 1 - ); - - console.log("Testing with wrong amount"); - vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); - nativeBridgeCounterpartyMOVE.lockBridgeTransfer( - bridgeTransferId, originator, recipient, amount - 1, hashLock, block.timestamp, parallelNonce - ); - - console.log("Testing with wrong timestamp"); - vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); - nativeBridgeCounterpartyMOVE.lockBridgeTransfer( - bridgeTransferId, originator, recipient, amount - 1, hashLock, block.timestamp + 1, parallelNonce - ); - - console.log("Testing with wrong hashLock"); - vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); - nativeBridgeCounterpartyMOVE.lockBridgeTransfer( - bridgeTransferId, - originator, - recipient, - amount - 1, - keccak256(abi.encodePacked(hashLock)), - block.timestamp, - parallelNonce - ); - - console.log("Testing with wrong nonce"); - vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); - nativeBridgeCounterpartyMOVE.lockBridgeTransfer( - bridgeTransferId, originator, recipient, amount, hashLock, block.timestamp, parallelNonce - 1 - ); - - nativeBridgeCounterpartyMOVE.lockBridgeTransfer( - bridgeTransferId, originator, recipient, amount, hashLock, block.timestamp, parallelNonce - ); - vm.stopPrank(); - - NativeBridgeCounterpartyMOVE.MessageState state = nativeBridgeCounterpartyMOVE.bridgeTransfers(bridgeTransferId); - - assertEq(uint8(state), uint8(NativeBridgeCounterpartyMOVE.MessageState.PENDING)); - } - - function testCompleteCounterpartyBridgeTransfer() public { - ( - bytes32 bridgeTransferId, - bytes32 originator, - address recipient, - uint256 amount, - bytes32 hashLock, - uint256 initialTimestamp, - uint256 parallelNonce, - bytes32 preImage - ) = testLockBridgeTransfer(); - - vm.startPrank(otherUser); - - console.log("Testing with wrong originator"); - vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); - nativeBridgeCounterpartyMOVE.completeBridgeTransfer(bridgeTransferId, keccak256(abi.encodePacked(originator)), recipient, amount, hashLock, initialTimestamp, parallelNonce, preImage); - - console.log("Testing with wrong recipient"); - vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); - nativeBridgeCounterpartyMOVE.completeBridgeTransfer(bridgeTransferId, originator, otherUser, amount, hashLock, initialTimestamp, parallelNonce, preImage); - - console.log("Testing with wrong amount"); - vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); - nativeBridgeCounterpartyMOVE.completeBridgeTransfer(bridgeTransferId, originator, recipient, amount + 1, hashLock, initialTimestamp, parallelNonce, preImage); - - console.log("Testing with wrong hashLock"); - vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); - nativeBridgeCounterpartyMOVE.completeBridgeTransfer(bridgeTransferId, originator, recipient, amount, keccak256(abi.encodePacked(hashLock)), initialTimestamp, parallelNonce, preImage); - - console.log("Testing with wrong initialTimestamp"); - vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); - nativeBridgeCounterpartyMOVE.completeBridgeTransfer(bridgeTransferId, originator, recipient, amount, hashLock, initialTimestamp + 1, parallelNonce, preImage); - - console.log("Testing with wrong nonce"); - vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); - nativeBridgeCounterpartyMOVE.completeBridgeTransfer(bridgeTransferId, originator, recipient, amount, hashLock, initialTimestamp, parallelNonce + 1, preImage); - - console.log("Testing with wrong preImage"); - vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidSecret.selector); - nativeBridgeCounterpartyMOVE.completeBridgeTransfer(bridgeTransferId, originator, recipient, amount, hashLock, initialTimestamp, parallelNonce, keccak256(abi.encodePacked(preImage))); - - nativeBridgeCounterpartyMOVE.completeBridgeTransfer(bridgeTransferId, originator, recipient, amount, hashLock, initialTimestamp, parallelNonce, preImage); - - NativeBridgeCounterpartyMOVE.MessageState state = nativeBridgeCounterpartyMOVE.bridgeTransfers(bridgeTransferId); - - assertEq(uint8(state), uint8(NativeBridgeCounterpartyMOVE.MessageState.COMPLETED)); - - vm.stopPrank(); - } -} diff --git a/protocol-units/bridge/contracts/test/NativeBridgeInitiatorMOVE.t.sol b/protocol-units/bridge/contracts/test/NativeBridgeInitiatorMOVE.t.sol deleted file mode 100644 index c478e1b11..000000000 --- a/protocol-units/bridge/contracts/test/NativeBridgeInitiatorMOVE.t.sol +++ /dev/null @@ -1,164 +0,0 @@ -// // SPDX-License-Identifier: UNLICENSED -// pragma solidity ^0.8.22; -// pragma abicoder v2; - -// import {Test, console} from "forge-std/Test.sol"; -// import { -// NativeBridgeInitiatorMOVE, -// INativeBridgeInitiatorMOVE, -// OwnableUpgradeable -// } from "../src/NativeBridgeInitiatorMOVE.sol"; -// import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; -// import {TransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; -// import {MockMOVEToken} from "../src/MockMOVEToken.sol"; -// import {console} from "forge-std/console.sol"; - -// contract NativeBridgeInitiatorMOVETest is Test { -// NativeBridgeInitiatorMOVE public nativeBridgeInitiatorImplementation; -// MockMOVEToken public moveToken; -// ProxyAdmin public proxyAdmin; -// TransparentUpgradeableProxy public proxy; -// NativeBridgeInitiatorMOVE public nativeBridgeInitiatorMOVE; - -// address public originator = address(1); -// bytes32 public recipient = keccak256(abi.encodePacked(address(2))); -// bytes32 public hashLock = keccak256(abi.encodePacked("secret")); -// uint256 public amount = 1 ether; -// uint256 public constant timeLockDuration = 48 * 60 * 60; // 48 hours in seconds - -// function setUp() public { -// // Deploy the MOVEToken contract and mint some tokens to the deployer -// moveToken = new MockMOVEToken(); -// moveToken.initialize(address(this)); // Contract will hold initial MOVE tokens - -// originator = vm.addr(uint256(keccak256(abi.encodePacked(block.timestamp, block.prevrandao)))); - -// // Deploy the NativeBridgeInitiatorMOVE contract -// nativeBridgeInitiatorImplementation = new NativeBridgeInitiatorMOVE(); -// proxyAdmin = new ProxyAdmin(msg.sender); -// proxy = new TransparentUpgradeableProxy( -// address(nativeBridgeInitiatorImplementation), -// address(proxyAdmin), -// abi.encodeWithSignature( -// "initialize(address,address,uint256,uint256)", -// address(moveToken), -// address(this), -// timeLockDuration, -// 0 ether -// ) -// ); - -// nativeBridgeInitiatorMOVE = NativeBridgeInitiatorMOVE(address(proxy)); -// } - -// function testInitiateBridgeTransferWithMove() public { -// uint256 moveAmount = 100 * 10 ** 8; - -// // Transfer moveAmount tokens to the originator and check initial balance -// moveToken.transfer(originator, moveAmount); -// uint256 initialBalance = moveToken.balanceOf(originator); - -// vm.startPrank(originator); -// moveToken.approve(address(nativeBridgeInitiatorMOVE), moveAmount); - -// // Initiate the bridge transfer -// bytes32 bridgeTransferId = nativeBridgeInitiatorMOVE.initiateBridgeTransfer(moveAmount, recipient, hashLock); - -// // Verify the bridge transfer details -// ( -// uint256 transferAmount, -// address transferOriginator, -// bytes32 transferRecipient, -// bytes32 transferHashLock, -// uint256 transferTimeLock, -// NativeBridgeInitiatorMOVE.MessageState transferState -// ) = nativeBridgeInitiatorMOVE.bridgeTransfers(bridgeTransferId); - -// assertEq(transferAmount, moveAmount); -// assertEq(transferOriginator, originator); -// assertEq(transferRecipient, recipient); -// assertEq(transferHashLock, hashLock); -// assertGt(transferTimeLock, block.timestamp); -// assertEq(uint8(transferState), uint8(NativeBridgeInitiatorMOVE.MessageState.INITIALIZED)); - -// // Check the originator's MOVE balance after initiating the transfer -// uint256 finalBalance = moveToken.balanceOf(originator); -// assertEq(finalBalance, initialBalance - moveAmount); - -// vm.stopPrank(); -// } - -// function testCompleteBridgeTransfer() public { -// bytes32 secret = "secret"; -// bytes32 testHashLock = keccak256(abi.encodePacked(secret)); -// uint256 moveAmount = 100 * 10 ** 8; // 100 MOVEToken - -// // Transfer moveAmount tokens to the originator and check initial balance -// moveToken.transfer(originator, moveAmount); -// uint256 initialBalance = moveToken.balanceOf(originator); - -// vm.startPrank(originator); -// moveToken.approve(address(nativeBridgeInitiatorMOVE), moveAmount); - -// // Initiate the bridge transfer -// bytes32 bridgeTransferId = nativeBridgeInitiatorMOVE.initiateBridgeTransfer(moveAmount, recipient, testHashLock); - -// vm.stopPrank(); - -// nativeBridgeInitiatorMOVE.completeBridgeTransfer(bridgeTransferId, secret); - -// // Verify the bridge transfer details after completion -// ( -// uint256 completedAmount, -// address completedOriginator, -// bytes32 completedRecipient, -// bytes32 completedHashLock, -// uint256 completedTimeLock, -// NativeBridgeInitiatorMOVE.MessageState completedState -// ) = nativeBridgeInitiatorMOVE.bridgeTransfers(bridgeTransferId); - -// assertEq(completedAmount, moveAmount); -// assertEq(completedOriginator, originator); -// assertEq(completedRecipient, recipient); -// assertEq(completedHashLock, testHashLock); -// assertGt(completedTimeLock, block.timestamp); -// assertEq(uint8(completedState), uint8(NativeBridgeInitiatorMOVE.MessageState.COMPLETED)); - -// // Ensure no changes to the originator's balance after the transfer is completed -// uint256 finalBalance = moveToken.balanceOf(originator); -// assertEq(finalBalance, initialBalance - moveAmount); -// } - -// function testRefundBridgeTransfer() public { -// uint256 moveAmount = 100 * 10 ** 8; // 100 MOVEToken - -// // Transfer moveAmount tokens to the originator and check initial balance -// moveToken.transfer(originator, moveAmount); -// uint256 initialBalance = moveToken.balanceOf(originator); - -// vm.startPrank(originator); -// moveToken.approve(address(nativeBridgeInitiatorMOVE), moveAmount); - -// // Initiate the bridge transfer -// bytes32 bridgeTransferId = nativeBridgeInitiatorMOVE.initiateBridgeTransfer(moveAmount, recipient, hashLock); -// vm.stopPrank(); - -// // Advance time and block height to ensure the time lock has expired -// vm.warp(block.timestamp + timeLockDuration + 1); - -// // Test that a non-owner cannot call refund -// vm.startPrank(originator); -// vm.expectRevert(abi.encodeWithSelector(OwnableUpgradeable.OwnableUnauthorizedAccount.selector, originator)); -// nativeBridgeInitiatorMOVE.refundBridgeTransfer(bridgeTransferId); -// vm.stopPrank(); - -// // Owner refunds the transfer -// vm.expectEmit(); -// emit INativeBridgeInitiatorMOVE.BridgeTransferRefunded(bridgeTransferId); -// nativeBridgeInitiatorMOVE.refundBridgeTransfer(bridgeTransferId); - -// // Verify that the originator receives the refund and the balance is restored -// uint256 finalBalance = moveToken.balanceOf(originator); -// assertEq(finalBalance, initialBalance, "MOVE balance mismatch"); -// } -// } diff --git a/protocol-units/bridge/contracts/test/NativeBridgeMOVE.t.sol b/protocol-units/bridge/contracts/test/NativeBridgeMOVE.t.sol new file mode 100644 index 000000000..c79c221cb --- /dev/null +++ b/protocol-units/bridge/contracts/test/NativeBridgeMOVE.t.sol @@ -0,0 +1,391 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.22; +pragma abicoder v2; + +import {Test, console} from "forge-std/Test.sol"; +import {NativeBridgeCounterpartyMOVE, OwnableUpgradeable, INativeBridgeCounterpartyMOVE} from "../src/NativeBridgeCounterpartyMOVE.sol"; +import {NativeBridgeInitiatorMOVE, INativeBridgeInitiatorMOVE} from "../src/NativeBridgeInitiatorMOVE.sol"; +import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; +import {TransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; +import {MockMOVEToken} from "../src/MockMOVEToken.sol"; + +contract NativeBridgeCounterpartyMOVETest is Test { + NativeBridgeCounterpartyMOVE public nativeBridgeCounterpartyMOVEImplementation; + NativeBridgeCounterpartyMOVE public nativeBridgeCounterpartyMOVE; + NativeBridgeInitiatorMOVE public nativeBridgeInitiatorMOVEImplementation; + NativeBridgeInitiatorMOVE public nativeBridgeInitiatorMOVE; + MockMOVEToken public moveToken; + ProxyAdmin public proxyAdmin; + TransparentUpgradeableProxy public proxyInitiator; + TransparentUpgradeableProxy public proxyCounterparty; + + address public deployer = address(0x1337); + address public ethAddress = address(0x1); + address public recipient = address(0x2); + address public otherUser = address(0x3); + uint256 public _amount = 100 * 10 ** 8; // 100 MOVEToken (assuming 8 decimals) + uint256 public timeLock = 1 days; + + bytes32 public moveAddress = keccak256(abi.encodePacked(ethAddress)); + uint256 public constant COUNTERPARTY_TIME_LOCK_DURATION = 24 * 60 * 60; // 24 hours + + function setUp() public { + moveToken = new MockMOVEToken(); + moveToken.initialize(address(this)); + + uint256 initiatorTimeLockDuration = 48 * 60 * 60; // 48 hours for the initiator + uint256 counterpartyTimeLockDuration = 24 * 60 * 60; // 24 hours for the counterparty + + nativeBridgeInitiatorMOVEImplementation = new NativeBridgeInitiatorMOVE(); + proxyAdmin = new ProxyAdmin(deployer); + proxyInitiator = new TransparentUpgradeableProxy( + address(nativeBridgeInitiatorMOVEImplementation), + address(proxyAdmin), + abi.encodeWithSignature( + "initialize(address,address,uint256,uint256)", + address(moveToken), + deployer, + initiatorTimeLockDuration, + 0 ether + ) + ); + nativeBridgeInitiatorMOVE = NativeBridgeInitiatorMOVE(address(proxyInitiator)); + + nativeBridgeCounterpartyMOVEImplementation = new NativeBridgeCounterpartyMOVE(); + proxyCounterparty = new TransparentUpgradeableProxy( + address(nativeBridgeCounterpartyMOVEImplementation), + address(proxyAdmin), + abi.encodeWithSignature( + "initialize(address,address,uint256)", + address(nativeBridgeInitiatorMOVE), + deployer, + counterpartyTimeLockDuration + ) + ); + nativeBridgeCounterpartyMOVE = NativeBridgeCounterpartyMOVE(address(proxyCounterparty)); + + vm.startPrank(deployer); + nativeBridgeInitiatorMOVE.setCounterpartyAddress(address(nativeBridgeCounterpartyMOVE)); + vm.stopPrank(); + } + + function testInitiateBridgeTransfer() + public + returns (bytes32 bridgeTransferId, address originator, bytes32 recipient, uint256 amount, bytes32 hashLock, uint256 initialTimestamp, uint256 nonce, bytes32 preImage) + { + + preImage = "secret"; + hashLock = keccak256(abi.encodePacked(preImage)); + nonce; + originator = ethAddress; + recipient = moveAddress; + amount = _amount; + moveToken.transfer(ethAddress, amount); + vm.startPrank(ethAddress); + + moveToken.approve(address(nativeBridgeInitiatorMOVE), amount); + bridgeTransferId = nativeBridgeInitiatorMOVE.initiateBridgeTransfer(recipient, amount, hashLock); + nonce++; + initialTimestamp = block.timestamp; + vm.stopPrank(); + } + + function testCompleteInitiatorBridgeTransfer() public { + ( + bytes32 bridgeTransferId, + address originator, + bytes32 recipient, + uint256 amount, + bytes32 hashLock, + uint256 initialTimestamp, + uint256 parallelNonce, + bytes32 preImage + ) = testInitiateBridgeTransfer(); + + vm.startPrank(otherUser); + + console.log("Testing with wrong originator"); + vm.expectRevert(INativeBridgeInitiatorMOVE.InvalidBridgeTransferId.selector); + nativeBridgeInitiatorMOVE.completeBridgeTransfer(bridgeTransferId, otherUser, recipient, amount, hashLock, initialTimestamp, parallelNonce, preImage); + + console.log("Testing with wrong recipient"); + vm.expectRevert(INativeBridgeInitiatorMOVE.InvalidBridgeTransferId.selector); + nativeBridgeInitiatorMOVE.completeBridgeTransfer(bridgeTransferId, originator, keccak256(abi.encodePacked(otherUser)), amount, hashLock, initialTimestamp, parallelNonce, preImage); + + console.log("Testing with wrong amount"); + vm.expectRevert(INativeBridgeInitiatorMOVE.InvalidBridgeTransferId.selector); + nativeBridgeInitiatorMOVE.completeBridgeTransfer(bridgeTransferId, originator, recipient, amount + 1, hashLock, initialTimestamp, parallelNonce, preImage); + + console.log("Testing with wrong hashLock"); + vm.expectRevert(INativeBridgeInitiatorMOVE.InvalidBridgeTransferId.selector); + nativeBridgeInitiatorMOVE.completeBridgeTransfer(bridgeTransferId, originator, recipient, amount, keccak256(abi.encodePacked(hashLock)), initialTimestamp, parallelNonce, preImage); + + console.log("Testing with wrong initialTimestamp"); + vm.expectRevert(INativeBridgeInitiatorMOVE.InvalidBridgeTransferId.selector); + nativeBridgeInitiatorMOVE.completeBridgeTransfer(bridgeTransferId, originator, recipient, amount, hashLock, initialTimestamp + 1, parallelNonce, preImage); + + console.log("Testing with wrong nonce"); + vm.expectRevert(INativeBridgeInitiatorMOVE.InvalidBridgeTransferId.selector); + nativeBridgeInitiatorMOVE.completeBridgeTransfer(bridgeTransferId, originator, recipient, amount, hashLock, initialTimestamp, parallelNonce + 1, preImage); + + console.log("Testing with wrong preImage"); + vm.expectRevert(INativeBridgeInitiatorMOVE.InvalidSecret.selector); + nativeBridgeInitiatorMOVE.completeBridgeTransfer(bridgeTransferId, originator, recipient, amount, hashLock, initialTimestamp, parallelNonce, keccak256(abi.encodePacked(preImage))); + + nativeBridgeInitiatorMOVE.completeBridgeTransfer(bridgeTransferId, originator, recipient, amount, hashLock, initialTimestamp, parallelNonce, preImage); + + NativeBridgeInitiatorMOVE.MessageState state = nativeBridgeInitiatorMOVE.bridgeTransfers(bridgeTransferId); + + assertEq(uint8(state), uint8(NativeBridgeInitiatorMOVE.MessageState.COMPLETED)); + + vm.stopPrank(); + } + + function testRefundInitiatorBridgeTransfer() public { + ( + bytes32 bridgeTransferId, + address originator, + bytes32 recipient, + uint256 amount, + bytes32 hashLock, + uint256 initialTimestamp, + uint256 parallelNonce, + bytes32 preImage + ) = testInitiateBridgeTransfer(); + + vm.startPrank(otherUser); + vm.expectRevert(abi.encodeWithSelector(OwnableUpgradeable.OwnableUnauthorizedAccount.selector, otherUser)); + nativeBridgeInitiatorMOVE.refundBridgeTransfer(bridgeTransferId, originator, recipient, amount, hashLock, initialTimestamp, parallelNonce); + vm.stopPrank(); + + vm.startPrank(deployer); + console.log("Testing with wrong originator"); + vm.expectRevert(INativeBridgeInitiatorMOVE.InvalidBridgeTransferId.selector); + nativeBridgeInitiatorMOVE.refundBridgeTransfer(bridgeTransferId, otherUser, recipient, amount, hashLock, initialTimestamp, parallelNonce); + + console.log("Testing with wrong recipient"); + vm.expectRevert(INativeBridgeInitiatorMOVE.InvalidBridgeTransferId.selector); + nativeBridgeInitiatorMOVE.refundBridgeTransfer(bridgeTransferId, originator, keccak256(abi.encodePacked(recipient)), amount, hashLock, initialTimestamp, parallelNonce); + + console.log("Testing with wrong amount"); + vm.expectRevert(INativeBridgeInitiatorMOVE.InvalidBridgeTransferId.selector); + nativeBridgeInitiatorMOVE.refundBridgeTransfer(bridgeTransferId, originator, recipient, amount + 1, hashLock, initialTimestamp, parallelNonce); + + console.log("Testing with wrong hashLock"); + vm.expectRevert(INativeBridgeInitiatorMOVE.InvalidBridgeTransferId.selector); + nativeBridgeInitiatorMOVE.refundBridgeTransfer(bridgeTransferId, originator, recipient, amount, keccak256(abi.encodePacked(hashLock)), initialTimestamp, parallelNonce); + + console.log("Testing with wrong initialTimestamp"); + vm.expectRevert(INativeBridgeInitiatorMOVE.InvalidBridgeTransferId.selector); + nativeBridgeInitiatorMOVE.refundBridgeTransfer(bridgeTransferId, originator, recipient, amount, hashLock, initialTimestamp + 1, parallelNonce); + + console.log("Testing with wrong nonce"); + vm.expectRevert(INativeBridgeInitiatorMOVE.InvalidBridgeTransferId.selector); + nativeBridgeInitiatorMOVE.refundBridgeTransfer(bridgeTransferId, originator, recipient, amount, hashLock, initialTimestamp, parallelNonce + 1); + + console.log("Not enough time has passed"); + vm.expectRevert(INativeBridgeInitiatorMOVE.TimeLockNotExpired.selector); + nativeBridgeInitiatorMOVE.refundBridgeTransfer(bridgeTransferId, originator, recipient, amount, hashLock, initialTimestamp, parallelNonce); + + vm.warp(2 days + 1); + nativeBridgeInitiatorMOVE.refundBridgeTransfer(bridgeTransferId, originator, recipient, amount, hashLock, initialTimestamp, parallelNonce); + + NativeBridgeInitiatorMOVE.MessageState state = nativeBridgeInitiatorMOVE.bridgeTransfers(bridgeTransferId); + + assertEq(uint8(state), uint8(NativeBridgeInitiatorMOVE.MessageState.REFUNDED)); + + vm.stopPrank(); + } + + function testLockBridgeTransfer() + public + returns ( + bytes32 bridgeTransferId, + bytes32 originator, + address recipient, + uint256 amount, + bytes32 hashLock, + uint256 initialTimestamp, + uint256 parallelNonce, + bytes32 preImage + ) + { + moveToken.transfer(address(nativeBridgeInitiatorMOVE), _amount); + + parallelNonce = 1; + originator = moveAddress; + recipient = ethAddress; + amount = _amount; + preImage = keccak256(abi.encodePacked("secret")); + hashLock = keccak256(abi.encodePacked(preImage)); + initialTimestamp = block.timestamp; + bridgeTransferId = + keccak256(abi.encodePacked(originator, recipient, amount, hashLock, initialTimestamp, parallelNonce)); + + vm.startPrank(deployer); + + console.log("Testing with wrong originator"); + vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); + nativeBridgeCounterpartyMOVE.lockBridgeTransfer( + bridgeTransferId, keccak256(abi.encodePacked(otherUser)), recipient, amount, hashLock, block.timestamp, parallelNonce - 1 + ); + + console.log("Testing with wrong recipient"); + vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); + nativeBridgeCounterpartyMOVE.lockBridgeTransfer( + bridgeTransferId, + originator, + otherUser, + amount, + hashLock, + block.timestamp, + parallelNonce - 1 + ); + + console.log("Testing with wrong amount"); + vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); + nativeBridgeCounterpartyMOVE.lockBridgeTransfer( + bridgeTransferId, originator, recipient, amount - 1, hashLock, block.timestamp, parallelNonce + ); + + console.log("Testing with wrong timestamp"); + vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); + nativeBridgeCounterpartyMOVE.lockBridgeTransfer( + bridgeTransferId, originator, recipient, amount - 1, hashLock, block.timestamp + 1, parallelNonce + ); + + console.log("Testing with wrong hashLock"); + vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); + nativeBridgeCounterpartyMOVE.lockBridgeTransfer( + bridgeTransferId, + originator, + recipient, + amount - 1, + keccak256(abi.encodePacked(hashLock)), + block.timestamp, + parallelNonce + ); + + console.log("Testing with wrong nonce"); + vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); + nativeBridgeCounterpartyMOVE.lockBridgeTransfer( + bridgeTransferId, originator, recipient, amount, hashLock, block.timestamp, parallelNonce - 1 + ); + + nativeBridgeCounterpartyMOVE.lockBridgeTransfer( + bridgeTransferId, originator, recipient, amount, hashLock, block.timestamp, parallelNonce + ); + vm.stopPrank(); + + NativeBridgeCounterpartyMOVE.MessageState state = nativeBridgeCounterpartyMOVE.bridgeTransfers(bridgeTransferId); + + assertEq(uint8(state), uint8(NativeBridgeCounterpartyMOVE.MessageState.PENDING)); + } + + function testCompleteCounterpartyBridgeTransfer() public { + ( + bytes32 bridgeTransferId, + bytes32 originator, + address recipient, + uint256 amount, + bytes32 hashLock, + uint256 initialTimestamp, + uint256 parallelNonce, + bytes32 preImage + ) = testLockBridgeTransfer(); + + vm.startPrank(otherUser); + + console.log("Testing with wrong originator"); + vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); + nativeBridgeCounterpartyMOVE.completeBridgeTransfer(bridgeTransferId, keccak256(abi.encodePacked(originator)), recipient, amount, hashLock, initialTimestamp, parallelNonce, preImage); + + console.log("Testing with wrong recipient"); + vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); + nativeBridgeCounterpartyMOVE.completeBridgeTransfer(bridgeTransferId, originator, otherUser, amount, hashLock, initialTimestamp, parallelNonce, preImage); + + console.log("Testing with wrong amount"); + vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); + nativeBridgeCounterpartyMOVE.completeBridgeTransfer(bridgeTransferId, originator, recipient, amount + 1, hashLock, initialTimestamp, parallelNonce, preImage); + + console.log("Testing with wrong hashLock"); + vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); + nativeBridgeCounterpartyMOVE.completeBridgeTransfer(bridgeTransferId, originator, recipient, amount, keccak256(abi.encodePacked(hashLock)), initialTimestamp, parallelNonce, preImage); + + console.log("Testing with wrong initialTimestamp"); + vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); + nativeBridgeCounterpartyMOVE.completeBridgeTransfer(bridgeTransferId, originator, recipient, amount, hashLock, initialTimestamp + 1, parallelNonce, preImage); + + console.log("Testing with wrong nonce"); + vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); + nativeBridgeCounterpartyMOVE.completeBridgeTransfer(bridgeTransferId, originator, recipient, amount, hashLock, initialTimestamp, parallelNonce + 1, preImage); + + console.log("Testing with wrong preImage"); + vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidSecret.selector); + nativeBridgeCounterpartyMOVE.completeBridgeTransfer(bridgeTransferId, originator, recipient, amount, hashLock, initialTimestamp, parallelNonce, keccak256(abi.encodePacked(preImage))); + + nativeBridgeCounterpartyMOVE.completeBridgeTransfer(bridgeTransferId, originator, recipient, amount, hashLock, initialTimestamp, parallelNonce, preImage); + + NativeBridgeCounterpartyMOVE.MessageState state = nativeBridgeCounterpartyMOVE.bridgeTransfers(bridgeTransferId); + + assertEq(uint8(state), uint8(NativeBridgeCounterpartyMOVE.MessageState.COMPLETED)); + + vm.stopPrank(); + } + + function testAbortCounterpartyBridgeTransfer() public { + ( + bytes32 bridgeTransferId, + bytes32 originator, + address recipient, + uint256 amount, + bytes32 hashLock, + uint256 initialTimestamp, + uint256 parallelNonce, + bytes32 preImage + ) = testLockBridgeTransfer(); + + vm.startPrank(otherUser); + vm.expectRevert(abi.encodeWithSelector(OwnableUpgradeable.OwnableUnauthorizedAccount.selector, otherUser)); + nativeBridgeCounterpartyMOVE.abortBridgeTransfer(bridgeTransferId, originator, recipient, amount, hashLock, initialTimestamp, parallelNonce); + vm.stopPrank(); + + vm.startPrank(deployer); + console.log("Testing with wrong originator"); + vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); + nativeBridgeCounterpartyMOVE.abortBridgeTransfer(bridgeTransferId, keccak256(abi.encodePacked(originator)), recipient, amount, hashLock, initialTimestamp, parallelNonce); + + console.log("Testing with wrong recipient"); + vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); + nativeBridgeCounterpartyMOVE.abortBridgeTransfer(bridgeTransferId, originator, otherUser, amount, hashLock, initialTimestamp, parallelNonce); + + console.log("Testing with wrong amount"); + vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); + nativeBridgeCounterpartyMOVE.abortBridgeTransfer(bridgeTransferId, originator, recipient, amount + 1, hashLock, initialTimestamp, parallelNonce); + + console.log("Testing with wrong hashLock"); + vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); + nativeBridgeCounterpartyMOVE.abortBridgeTransfer(bridgeTransferId, originator, recipient, amount, keccak256(abi.encodePacked(hashLock)), initialTimestamp, parallelNonce); + + console.log("Testing with wrong initialTimestamp"); + vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); + nativeBridgeCounterpartyMOVE.abortBridgeTransfer(bridgeTransferId, originator, recipient, amount, hashLock, initialTimestamp + 1, parallelNonce); + + console.log("Testing with wrong nonce"); + vm.expectRevert(INativeBridgeCounterpartyMOVE.InvalidBridgeTransferId.selector); + nativeBridgeCounterpartyMOVE.abortBridgeTransfer(bridgeTransferId, originator, recipient, amount, hashLock, initialTimestamp, parallelNonce + 1); + + console.log("Not enough time has passed"); + vm.expectRevert(INativeBridgeCounterpartyMOVE.TimeLockNotExpired.selector); + nativeBridgeCounterpartyMOVE.abortBridgeTransfer(bridgeTransferId, originator, recipient, amount, hashLock, initialTimestamp, parallelNonce); + + vm.warp(2 days + 1); + nativeBridgeCounterpartyMOVE.abortBridgeTransfer(bridgeTransferId, originator, recipient, amount, hashLock, initialTimestamp, parallelNonce); + + NativeBridgeCounterpartyMOVE.MessageState state = nativeBridgeCounterpartyMOVE.bridgeTransfers(bridgeTransferId); + + assertEq(uint8(state), uint8(NativeBridgeCounterpartyMOVE.MessageState.REFUNDED)); + + vm.stopPrank(); + } +} From 8de815d7875dbd6c7d8b993ee06a962d143dbb38 Mon Sep 17 00:00:00 2001 From: primata Date: Thu, 14 Nov 2024 17:17:19 +0100 Subject: [PATCH 5/6] rename test --- protocol-units/bridge/contracts/test/NativeBridgeMOVE.t.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol-units/bridge/contracts/test/NativeBridgeMOVE.t.sol b/protocol-units/bridge/contracts/test/NativeBridgeMOVE.t.sol index c79c221cb..43f75d87b 100644 --- a/protocol-units/bridge/contracts/test/NativeBridgeMOVE.t.sol +++ b/protocol-units/bridge/contracts/test/NativeBridgeMOVE.t.sol @@ -9,7 +9,7 @@ import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.s import {TransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; import {MockMOVEToken} from "../src/MockMOVEToken.sol"; -contract NativeBridgeCounterpartyMOVETest is Test { +contract NativeBridgeMOVETest is Test { NativeBridgeCounterpartyMOVE public nativeBridgeCounterpartyMOVEImplementation; NativeBridgeCounterpartyMOVE public nativeBridgeCounterpartyMOVE; NativeBridgeInitiatorMOVE public nativeBridgeInitiatorMOVEImplementation; From d2d206b03d645f75c816bd1c6aa7ff75af4fba13 Mon Sep 17 00:00:00 2001 From: primata Date: Fri, 15 Nov 2024 18:40:19 +0100 Subject: [PATCH 6/6] complete tests --- .../src/INativeBridgeInitiatorMOVE.sol | 4 +- .../src/NativeBridgeCounterpartyMOVE.sol | 40 ++++++------ .../src/NativeBridgeInitiatorMOVE.sol | 61 +++++++++---------- .../contracts/test/NativeBridgeMOVE.t.sol | 43 ++++++++++++- 4 files changed, 94 insertions(+), 54 deletions(-) diff --git a/protocol-units/bridge/contracts/src/INativeBridgeInitiatorMOVE.sol b/protocol-units/bridge/contracts/src/INativeBridgeInitiatorMOVE.sol index 41359a455..62e9d4a9c 100644 --- a/protocol-units/bridge/contracts/src/INativeBridgeInitiatorMOVE.sol +++ b/protocol-units/bridge/contracts/src/INativeBridgeInitiatorMOVE.sol @@ -6,7 +6,7 @@ interface INativeBridgeInitiatorMOVE { function initiatorTimeLockDuration() external view returns (uint256); - function initialize(address _moveToken, address owner, uint256 _timeLockDuration, uint256 _initialPoolBalance) external; + function initialize(address _moveToken, address owner, uint256 _timeLockDuration) external; function setCounterpartyAddress(address _counterpartyAddress) external; function initiateBridgeTransfer(bytes32 recipient, uint256 amount, bytes32 hashLock) @@ -62,7 +62,7 @@ interface INativeBridgeInitiatorMOVE { error ZeroAddress(); error ZeroAmount(); error MOVETransferFailed(); - error BridgeTransferHasBeenCompleted(); + error BridgeTransferNotInitialized(); error InvalidBridgeTransferId(); error InvalidSecret(); error TimelockExpired(); diff --git a/protocol-units/bridge/contracts/src/NativeBridgeCounterpartyMOVE.sol b/protocol-units/bridge/contracts/src/NativeBridgeCounterpartyMOVE.sol index 6c9dd3bd8..1c775fdf1 100644 --- a/protocol-units/bridge/contracts/src/NativeBridgeCounterpartyMOVE.sol +++ b/protocol-units/bridge/contracts/src/NativeBridgeCounterpartyMOVE.sol @@ -4,10 +4,12 @@ pragma solidity ^0.8.22; import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import {INativeBridgeCounterpartyMOVE} from "./INativeBridgeCounterpartyMOVE.sol"; import {NativeBridgeInitiatorMOVE} from "./NativeBridgeInitiatorMOVE.sol"; +import {console} from "forge-std/Console.sol"; contract NativeBridgeCounterpartyMOVE is INativeBridgeCounterpartyMOVE, OwnableUpgradeable { enum MessageState { + NOT_INITIALIZED, PENDING, COMPLETED, REFUNDED @@ -45,14 +47,8 @@ contract NativeBridgeCounterpartyMOVE is INativeBridgeCounterpartyMOVE, OwnableU uint256 initialTimestamp, uint256 nonce ) external onlyOwner { - - // The time lock is now based on the configurable duration - uint256 timeLock = block.timestamp + counterpartyTimeLockDuration; - - require(bridgeTransferId == keccak256(abi.encodePacked(originator, recipient, amount, hashLock, initialTimestamp, nonce)), InvalidBridgeTransferId()); - + _verifyHash(bridgeTransferId, originator, recipient, amount, hashLock, initialTimestamp, nonce); bridgeTransfers[bridgeTransferId] = MessageState.PENDING; - emit BridgeTransferLocked(bridgeTransferId, originator, recipient, amount, hashLock, block.timestamp, nonce); } @@ -63,14 +59,12 @@ contract NativeBridgeCounterpartyMOVE is INativeBridgeCounterpartyMOVE, OwnableU uint256 amount, bytes32 hashLock, uint256 initialTimestamp, - uint256 nonce, bytes32 preImage) external { - - require(bridgeTransferId == keccak256(abi.encodePacked(originator, recipient, amount, hashLock, initialTimestamp, nonce)), InvalidBridgeTransferId()); + uint256 nonce, + bytes32 preImage) external { + _verifyHash(bridgeTransferId, originator, recipient, amount, hashLock, initialTimestamp, nonce); require(keccak256(abi.encodePacked(preImage)) == hashLock, InvalidSecret()); - require(bridgeTransfers[bridgeTransferId] == MessageState.PENDING, BridgeTransferStateNotPending()); - - if (block.timestamp > initialTimestamp + counterpartyTimeLockDuration) revert TimeLockExpired(); + require(block.timestamp < initialTimestamp + counterpartyTimeLockDuration, TimeLockExpired()); bridgeTransfers[bridgeTransferId] = MessageState.COMPLETED; @@ -79,19 +73,31 @@ contract NativeBridgeCounterpartyMOVE is INativeBridgeCounterpartyMOVE, OwnableU emit BridgeTransferCompleted(bridgeTransferId, originator, recipient, amount, hashLock, initialTimestamp, nonce, preImage); } - function abortBridgeTransfer(bytes32 bridgeTransferId, - bytes32 originator, + function abortBridgeTransfer( + bytes32 bridgeTransferId, + bytes32 originator, address recipient, uint256 amount, bytes32 hashLock, uint256 initialTimestamp, uint256 nonce) external onlyOwner { - require(bridgeTransferId == keccak256(abi.encodePacked(originator, recipient, amount, hashLock, initialTimestamp, nonce)), InvalidBridgeTransferId()); + _verifyHash(bridgeTransferId, originator, recipient, amount, hashLock, initialTimestamp, nonce); require(bridgeTransfers[bridgeTransferId] == MessageState.PENDING, BridgeTransferStateNotPending()); - if (block.timestamp <= initialTimestamp + counterpartyTimeLockDuration) revert TimeLockNotExpired(); + require(block.timestamp > initialTimestamp + counterpartyTimeLockDuration, TimeLockNotExpired()); bridgeTransfers[bridgeTransferId] = MessageState.REFUNDED; emit BridgeTransferAborted(bridgeTransferId); } + + function _verifyHash(bytes32 bridgeTransferId, + bytes32 originator, + address recipient, + uint256 amount, + bytes32 hashLock, + uint256 initialTimestamp, + uint256 nonce) internal { + console.logBytes32(keccak256(abi.encodePacked(originator, recipient, amount, hashLock, initialTimestamp, nonce))); + require(bridgeTransferId == keccak256(abi.encodePacked(originator, recipient, amount, hashLock, initialTimestamp, nonce)), InvalidBridgeTransferId()); + } } diff --git a/protocol-units/bridge/contracts/src/NativeBridgeInitiatorMOVE.sol b/protocol-units/bridge/contracts/src/NativeBridgeInitiatorMOVE.sol index 7a7bc8567..47b1e56fa 100644 --- a/protocol-units/bridge/contracts/src/NativeBridgeInitiatorMOVE.sol +++ b/protocol-units/bridge/contracts/src/NativeBridgeInitiatorMOVE.sol @@ -5,10 +5,12 @@ import {INativeBridgeInitiatorMOVE} from "./INativeBridgeInitiatorMOVE.sol"; import {MockMOVEToken} from "./MockMOVEToken.sol"; import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import {ERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; +import {console} from "forge-std/Console.sol"; contract NativeBridgeInitiatorMOVE is INativeBridgeInitiatorMOVE, OwnableUpgradeable { enum MessageState { + NOT_INITIALIZED, INITIALIZED, COMPLETED, REFUNDED @@ -24,22 +26,20 @@ contract NativeBridgeInitiatorMOVE is INativeBridgeInitiatorMOVE, OwnableUpgrade uint256 public initiatorTimeLockDuration; // Initialize the contract with MOVE token address, owner, custom time lock duration, and initial pool balance - function initialize(address _moveToken, address owner, uint256 _timeLockDuration, uint256 _initialPoolBalance) + function initialize(address _moveToken, address _owner, uint256 _timeLockDuration) public initializer { - if (_moveToken == address(0)) { - revert ZeroAddress(); - } + require(_moveToken != address(0) && _owner != address(0), ZeroAddress()); moveToken = ERC20Upgradeable(_moveToken); - __Ownable_init(owner); + __Ownable_init(_owner); // Set the custom time lock duration initiatorTimeLockDuration = _timeLockDuration; } function setCounterpartyAddress(address _counterpartyAddress) external onlyOwner { - if (_counterpartyAddress == address(0)) revert ZeroAddress(); + require(_counterpartyAddress != address(0), ZeroAddress()); counterpartyAddress = _counterpartyAddress; } @@ -50,14 +50,10 @@ contract NativeBridgeInitiatorMOVE is INativeBridgeInitiatorMOVE, OwnableUpgrade address originator = msg.sender; // Ensure there is a valid amount - if (amount == 0) { - revert ZeroAmount(); - } + require(amount != 0, ZeroAmount()); // Transfer the MOVE tokens from the user to the contract - if (!moveToken.transferFrom(originator, address(this), amount)) { - revert MOVETransferFailed(); - } + require(moveToken.transferFrom(originator, address(this), amount),MOVETransferFailed()); // Generate a unique nonce to prevent replay attacks, and generate a transfer ID bridgeTransferId = @@ -79,14 +75,10 @@ contract NativeBridgeInitiatorMOVE is INativeBridgeInitiatorMOVE, OwnableUpgrade uint256 nonce, bytes32 preImage ) external { - require(bridgeTransfers[bridgeTransferId] == MessageState.INITIALIZED, BridgeTransferHasBeenCompleted()); - require( - bridgeTransferId - == keccak256(abi.encodePacked(originator, recipient, amount, hashLock, initialTimestamp, nonce)), - InvalidBridgeTransferId() - ); - if (keccak256(abi.encodePacked(preImage)) != hashLock) revert InvalidSecret(); - if (block.timestamp > initialTimestamp + initiatorTimeLockDuration) revert TimelockExpired(); + _verifyHash(bridgeTransferId, originator, recipient, amount, hashLock, initialTimestamp, nonce); + require(bridgeTransfers[bridgeTransferId] == MessageState.INITIALIZED, BridgeTransferNotInitialized()); + require(keccak256(abi.encodePacked(preImage)) == hashLock,InvalidSecret()); + require(block.timestamp < initialTimestamp + initiatorTimeLockDuration, TimelockExpired()); bridgeTransfers[bridgeTransferId] = MessageState.COMPLETED; emit BridgeTransferCompleted( @@ -103,23 +95,28 @@ contract NativeBridgeInitiatorMOVE is INativeBridgeInitiatorMOVE, OwnableUpgrade uint256 initialTimestamp, uint256 nonce ) external onlyOwner { - require( - bridgeTransferId - == keccak256(abi.encodePacked(originator, recipient, amount, hashLock, initialTimestamp, nonce)), - InvalidBridgeTransferId() - ); - - require(bridgeTransfers[bridgeTransferId] == MessageState.INITIALIZED, BridgeTransferHasBeenCompleted()); - - if (block.timestamp < initialTimestamp + initiatorTimeLockDuration) revert TimeLockNotExpired(); + _verifyHash(bridgeTransferId, originator, recipient, amount, hashLock, initialTimestamp, nonce); + require(bridgeTransfers[bridgeTransferId] == MessageState.INITIALIZED, BridgeTransferNotInitialized()); + require(block.timestamp > initialTimestamp + initiatorTimeLockDuration, TimeLockNotExpired()); bridgeTransfers[bridgeTransferId] = MessageState.REFUNDED; - if (!moveToken.transfer(originator, amount)) revert MOVETransferFailed(); + require(moveToken.transfer(originator, amount), MOVETransferFailed()); emit BridgeTransferRefunded(bridgeTransferId); } function withdrawMOVE(address recipient, uint256 amount) external { - if (msg.sender != counterpartyAddress) revert Unauthorized(); - if (!moveToken.transfer(recipient, amount)) revert MOVETransferFailed(); + require(msg.sender == counterpartyAddress, Unauthorized()); + require(moveToken.transfer(recipient, amount), MOVETransferFailed()); + } + + function _verifyHash(bytes32 bridgeTransferId, + address originator, + bytes32 recipient, + uint256 amount, + bytes32 hashLock, + uint256 initialTimestamp, + uint256 nonce) internal { + console.logBytes32(keccak256(abi.encodePacked(originator, recipient, amount, hashLock, initialTimestamp, nonce))); + require(bridgeTransferId == keccak256(abi.encodePacked(originator, recipient, amount, hashLock, initialTimestamp, nonce)), InvalidBridgeTransferId()); } } diff --git a/protocol-units/bridge/contracts/test/NativeBridgeMOVE.t.sol b/protocol-units/bridge/contracts/test/NativeBridgeMOVE.t.sol index 43f75d87b..5b5e92ae9 100644 --- a/protocol-units/bridge/contracts/test/NativeBridgeMOVE.t.sol +++ b/protocol-units/bridge/contracts/test/NativeBridgeMOVE.t.sol @@ -42,11 +42,10 @@ contract NativeBridgeMOVETest is Test { address(nativeBridgeInitiatorMOVEImplementation), address(proxyAdmin), abi.encodeWithSignature( - "initialize(address,address,uint256,uint256)", + "initialize(address,address,uint256)", address(moveToken), deployer, - initiatorTimeLockDuration, - 0 ether + initiatorTimeLockDuration ) ); nativeBridgeInitiatorMOVE = NativeBridgeInitiatorMOVE(address(proxyInitiator)); @@ -91,6 +90,11 @@ contract NativeBridgeMOVETest is Test { } function testCompleteInitiatorBridgeTransfer() public { + uint256 _initialTimestamp = block.timestamp; + bytes32 _bridgeTransferId = keccak256(abi.encodePacked(ethAddress, moveAddress, _amount, keccak256(abi.encodePacked(keccak256(abi.encodePacked("secret")))), _initialTimestamp, uint256(0), keccak256(abi.encodePacked("secret")))); + console.log("attempting to complete inexistent transaction"); + vm.expectRevert(INativeBridgeInitiatorMOVE.BridgeTransferNotInitialized.selector); + nativeBridgeInitiatorMOVE.completeBridgeTransfer(_bridgeTransferId, ethAddress, moveAddress, _amount, keccak256(abi.encodePacked(keccak256(abi.encodePacked("secret")))), _initialTimestamp, uint256(0), keccak256(abi.encodePacked("secret"))); ( bytes32 bridgeTransferId, address originator, @@ -142,6 +146,18 @@ contract NativeBridgeMOVETest is Test { } function testRefundInitiatorBridgeTransfer() public { + // testing non initialized states + uint256 snapshot = vm.snapshot(); + moveToken.transfer(address(nativeBridgeInitiatorMOVE), _amount); + vm.startPrank(deployer); + uint256 _initialTimestamp = block.timestamp; + vm.warp(2 days + 1); + bytes32 _bridgeTransferId = keccak256(abi.encodePacked(ethAddress, moveAddress, _amount, keccak256(abi.encodePacked(keccak256(abi.encodePacked("secret")))), _initialTimestamp, uint256(0))); + console.log("attempting to refund inexistent transaction"); + vm.expectRevert(INativeBridgeInitiatorMOVE.BridgeTransferNotInitialized.selector); + nativeBridgeInitiatorMOVE.refundBridgeTransfer(_bridgeTransferId, ethAddress, moveAddress, _amount, keccak256(abi.encodePacked(keccak256(abi.encodePacked("secret")))), _initialTimestamp, uint256(0)); + vm.revertTo(snapshot); + vm.stopPrank(); ( bytes32 bridgeTransferId, address originator, @@ -283,6 +299,16 @@ contract NativeBridgeMOVETest is Test { } function testCompleteCounterpartyBridgeTransfer() public { + uint256 snapshot = vm.snapshot(); + vm.startPrank(deployer); + uint256 _initialTimestamp = block.timestamp; + vm.warp(2 days + 1); + bytes32 _bridgeTransferId = keccak256(abi.encodePacked(moveAddress, ethAddress, _amount, keccak256(abi.encodePacked(keccak256(abi.encodePacked("secret")))), _initialTimestamp, uint256(0))); + console.log("attempting to complete inexistent transaction"); + vm.expectRevert(INativeBridgeCounterpartyMOVE.BridgeTransferStateNotPending.selector); + nativeBridgeCounterpartyMOVE.completeBridgeTransfer(_bridgeTransferId, moveAddress, ethAddress, _amount, keccak256(abi.encodePacked(keccak256(abi.encodePacked("secret")))), _initialTimestamp, uint256(0), keccak256(abi.encodePacked("secret"))); + vm.revertTo(snapshot); + vm.stopPrank(); ( bytes32 bridgeTransferId, bytes32 originator, @@ -334,6 +360,17 @@ contract NativeBridgeMOVETest is Test { } function testAbortCounterpartyBridgeTransfer() public { + uint256 _initialTimestamp = block.timestamp; + bytes32 _bridgeTransferId = keccak256(abi.encodePacked(moveAddress, ethAddress, _amount, keccak256(abi.encodePacked(keccak256(abi.encodePacked("secret")))), _initialTimestamp, uint256(0))); + + uint256 snapshot = vm.snapshot(); + vm.warp(2 days + 1); + console.log("attempting to abort inexistent transaction"); + vm.startPrank(deployer); + vm.expectRevert(INativeBridgeCounterpartyMOVE.BridgeTransferStateNotPending.selector); + nativeBridgeCounterpartyMOVE.abortBridgeTransfer(_bridgeTransferId, moveAddress, ethAddress, _amount, keccak256(abi.encodePacked(keccak256(abi.encodePacked("secret")))), _initialTimestamp, uint256(0)); + vm.stopPrank(); + vm.revertTo(snapshot); ( bytes32 bridgeTransferId, bytes32 originator,