From 799c2896dff902c4d7fab69cf2d689ef3bf3f255 Mon Sep 17 00:00:00 2001 From: minghinmatthewlam Date: Thu, 21 Sep 2023 08:53:36 -0700 Subject: [PATCH 001/183] fix comment and commented code (#30) --- contracts/src/Teleporter/TeleporterMessenger.sol | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/contracts/src/Teleporter/TeleporterMessenger.sol b/contracts/src/Teleporter/TeleporterMessenger.sol index 9b524c4cf..4e5d04fb9 100644 --- a/contracts/src/Teleporter/TeleporterMessenger.sol +++ b/contracts/src/Teleporter/TeleporterMessenger.sol @@ -168,7 +168,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { message ); - // Resubmit the message to the warp message precompile know that we know the exact message was + // Resubmit the message to the warp message precompile now that we know the exact message was // already submitted in the past. WARP_MESSENGER.sendWarpMessage( destinationChainID, @@ -221,8 +221,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { if ( sentMessageInfo[destinationChainID][messageID] .feeInfo - .contractAddress != - feeContractAddress + .contractAddress != feeContractAddress ) { revert InvalidFeeAssetContractAddress(); } @@ -233,8 +232,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { additionalFeeAmount ); - // Calculate and store the update fee amount, and emit it as an event. - // currentMessageInfo.feeInfo.amount += adjustedAmount; + // Store the updated fee amount, and emit it as an event. sentMessageInfo[destinationChainID][messageID] .feeInfo .amount += adjustedAmount; From a393c5baa830038172cf1e874d253bde49474583 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Thu, 14 Sep 2023 11:54:48 -0400 Subject: [PATCH 002/183] Working copied test --- .vscode/settings.json | 4 +- .../ERC20Bridge/ERC20Bridge.sol | 2 +- .../NativeTokenBridge/AllowList.sol | 74 +++++++ .../NativeTokenBridge/IAllowList.sol | 16 ++ .../NativeTokenBridge/INativeMinter.sol | 8 + .../NativeTokenBridge/INativeTokenMinter.sol | 44 ++++ .../INativeTokenReceiver.sol | 42 ++++ .../NativeTokenBridge/NativeTokenMinter.sol | 151 ++++++++++++++ .../NativeTokenBridge/NativeTokenReceiver.sol | 144 +++++++++++++ docker/defaultChainConfig.json | 8 +- docker/defaultNodeConfig.json | 8 +- .../erc20_bridge_multihop.sh | 4 +- scripts/local/native/docker-compose-run.yml | 32 +++ scripts/local/native/docker-compose-test.yml | 50 +++++ scripts/local/native/native.sh | 189 ++++++++++++++++++ .../local/native/relayerConfigTemplate.json | 59 ++++++ scripts/local/native/run_relayer.sh | 50 +++++ scripts/local/native/run_setup.sh | 148 ++++++++++++++ scripts/local/native/run_stop.sh | 29 +++ scripts/local/native/run_tests.sh | 42 ++++ scripts/local/native/test.sh | 81 ++++++++ scripts/local/run_stop.sh | 5 - 22 files changed, 1179 insertions(+), 11 deletions(-) create mode 100644 contracts/src/CrossChainApplications/NativeTokenBridge/AllowList.sol create mode 100644 contracts/src/CrossChainApplications/NativeTokenBridge/IAllowList.sol create mode 100644 contracts/src/CrossChainApplications/NativeTokenBridge/INativeMinter.sol create mode 100644 contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenMinter.sol create mode 100644 contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenReceiver.sol create mode 100644 contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenMinter.sol create mode 100644 contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenReceiver.sol create mode 100644 scripts/local/native/docker-compose-run.yml create mode 100644 scripts/local/native/docker-compose-test.yml create mode 100755 scripts/local/native/native.sh create mode 100644 scripts/local/native/relayerConfigTemplate.json create mode 100755 scripts/local/native/run_relayer.sh create mode 100755 scripts/local/native/run_setup.sh create mode 100755 scripts/local/native/run_stop.sh create mode 100755 scripts/local/native/run_tests.sh create mode 100755 scripts/local/native/test.sh diff --git a/.vscode/settings.json b/.vscode/settings.json index 99f58cab9..8b66fda7d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -21,5 +21,7 @@ } ] }, - "files.trimTrailingWhitespace": true + "files.trimTrailingWhitespace": true, + "solidity.compileUsingRemoteVersion": "v0.8.18+commit.87f61d96", + "solidity.defaultCompiler": "remote" } \ No newline at end of file diff --git a/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol b/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol index ec3ede225..e70fb5d5f 100644 --- a/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol +++ b/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol @@ -44,7 +44,7 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { 0x0200000000000000000000000000000000000005; bytes32 public immutable currentChainID; - // Used for sending an receiving Teleporter messages. + // Used for sending and receiving Teleporter messages. ITeleporterMessenger public immutable teleporterMessenger; // Tracks which bridge tokens have been submitted to be created other bridge instances. diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/AllowList.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/AllowList.sol new file mode 100644 index 000000000..924601422 --- /dev/null +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/AllowList.sol @@ -0,0 +1,74 @@ +//SPDX-License-Identifier: MIT +pragma solidity 0.8.18; + +import "./IAllowList.sol"; +import "@openzeppelin/contracts/access/Ownable.sol"; + +// AllowList is a base contract to use AllowList precompile capabilities. +contract AllowList is Ownable { + enum Role { + None, + Enabled, + Admin + } + + // Precompiled Allow List Contract Address + IAllowList private _allowList; + + uint256 public constant STATUS_NONE = 0; + uint256 public constant STATUS_ENABLED = 1; + uint256 public constant STATUS_ADMIN = 2; + + error NotEnabled(); + error CannotRevokeOwnRule(); + + modifier onlyEnabled() { + if (!isEnabled(msg.sender)) { + revert NotEnabled(); + } + _; + } + + constructor(address precompileAddr) Ownable() { + _allowList = IAllowList(precompileAddr); + } + + function setAdmin(address addr) public virtual onlyOwner { + _setAdmin(addr); + } + + function setEnabled(address addr) public virtual onlyOwner { + _setEnabled(addr); + } + + function revoke(address addr) public virtual onlyOwner { + _revoke(addr); + } + + function isAdmin(address addr) public view returns (bool) { + uint256 result = _allowList.readAllowList(addr); + return result == STATUS_ADMIN; + } + + function isEnabled(address addr) public view returns (bool) { + uint256 result = _allowList.readAllowList(addr); + // if address is ENABLED or ADMIN it can deploy + // in other words, if it's not NONE it can deploy. + return result != STATUS_NONE; + } + + function _setAdmin(address addr) private { + _allowList.setAdmin(addr); + } + + function _setEnabled(address addr) private { + _allowList.setEnabled(addr); + } + + function _revoke(address addr) private { + if (msg.sender == addr) { + revert CannotRevokeOwnRule(); + } + _allowList.setNone(addr); + } +} diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/IAllowList.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/IAllowList.sol new file mode 100644 index 000000000..691b4065a --- /dev/null +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/IAllowList.sol @@ -0,0 +1,16 @@ +//SPDX-License-Identifier: MIT +pragma solidity 0.8.18; + +interface IAllowList { + // Set [addr] to have the admin role over the precompile contract. + function setAdmin(address addr) external; + + // Set [addr] to be enabled on the precompile contract. + function setEnabled(address addr) external; + + // Set [addr] to have no role for the precompile contract. + function setNone(address addr) external; + + // Read the status of [addr]. + function readAllowList(address addr) external view returns (uint256 role); +} diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeMinter.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeMinter.sol new file mode 100644 index 000000000..7d869eba0 --- /dev/null +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeMinter.sol @@ -0,0 +1,8 @@ +//SPDX-License-Identifier: MIT +pragma solidity 0.8.18; +import "./IAllowList.sol"; + +interface INativeMinter is IAllowList { + // Mint [amount] number of native coins and send to [addr] + function mintNativeCoin(address addr, uint256 amount) external; +} diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenMinter.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenMinter.sol new file mode 100644 index 000000000..c58b365db --- /dev/null +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenMinter.sol @@ -0,0 +1,44 @@ +// (c) 2023, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +// SPDX-License-Identifier: Ecosystem + +pragma solidity 0.8.18; + +/** + * @dev Interface that describes functionalities for a cross-chain ERC20 bridge. + */ +interface INativeTokenMinter { + + /** + * @dev Emitted when tokens are locked in this bridge contract to be bridged to another chain. + */ + event BridgeTokens( + address indexed tokenContractAddress, + uint256 indexed teleporterMessageID, + bytes32 destinationChainID, + address destinationBridgeAddress, + address recipient, + uint256 transferAmount, + uint256 feeAmount + ); + + /** + * @dev Emitted when minting bridge tokens. + */ + event MintNativeTokens( + address recipient, + uint256 amount + ); + + /** + * @dev Transfers ERC20 tokens to another chain. + * + * This can be wrapping, unwrapping, and transferring a wrapped token between two non-native chains. + */ + function bridgeTokens( + address recipient, + address feeTokenContractAddress, + uint256 feeAmount + ) external payable; +} diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenReceiver.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenReceiver.sol new file mode 100644 index 000000000..fdc28e740 --- /dev/null +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenReceiver.sol @@ -0,0 +1,42 @@ +// (c) 2023, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +// SPDX-License-Identifier: Ecosystem + +pragma solidity 0.8.18; + +/** + * @dev Interface that describes functionalities for a cross-chain ERC20 bridge. + */ +interface INativeTokenReceiver { + + /** + * @dev Emitted when tokens are locked in this bridge contract to be bridged to another chain. + */ + event BridgeTokens( + address indexed tokenContractAddress, + uint256 indexed teleporterMessageID, + bytes32 destinationChainID, + address destinationBridgeAddress, + address recipient, + uint256 transferAmount, + uint256 feeAmount + ); + + /** + * @dev Emitted when tokens are unlocked on this chain. + */ + event UnlockTokens( + address recipient, + uint256 amount + ); + + /** + * @dev Transfers native tokens to another chain as that chain's native token. + */ + function bridgeTokens( + address recipient, + address feeTokenContractAddress, + uint256 feeAmount + ) external payable; +} diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenMinter.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenMinter.sol new file mode 100644 index 000000000..025e2a5c8 --- /dev/null +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenMinter.sol @@ -0,0 +1,151 @@ +//SPDX-License-Identifier: MIT +pragma solidity 0.8.18; + +import "@subnet-evm-contracts/interfaces/IWarpMessenger.sol"; +import "./INativeMinter.sol"; +import "./AllowList.sol"; +import "./INativeTokenMinter.sol"; +import "../../Teleporter/ITeleporterMessenger.sol"; +import "../../Teleporter/ITeleporterReceiver.sol"; +import "../../Teleporter/SafeERC20TransferFrom.sol"; +import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; + +// Precompiled Native Minter Contract Address +address constant MINTER_ADDRESS = 0x0200000000000000000000000000000000000001; +// Designated Blackhole Address +address constant BLACKHOLE_ADDRESS = 0x0100000000000000000000000000000000000000; + +contract NativeTokenMinter is ITeleporterReceiver, INativeTokenMinter, AllowList, ReentrancyGuard { + INativeMinter private _nativeMinter = INativeMinter(MINTER_ADDRESS); + + address public constant WARP_PRECOMPILE_ADDRESS = + 0x0200000000000000000000000000000000000005; + + uint256 public constant TRANSFER_NATIVE_TOKENS_REQUIRED_GAS = 300_000; + bytes32 public immutable currentChainID; + bytes32 public immutable partnerChainID; + address public immutable partnerContractAddress; + + // Used for sending an receiving Teleporter messages. + ITeleporterMessenger public immutable teleporterMessenger; + + error InvalidTeleporterMessengerAddress(); + error InvalidRecipientAddress(); + error InvalidSourceChain(); + error InvalidPartnerContractAddress(); + error CannotBridgeTokenWithinSameChain(); + error Unauthorized(); + error InsufficientPayment(); + error InsufficientAdjustedAmount(uint256 adjustedAmount, uint256 feeAmount); + + constructor(address teleporterMessengerAddress, bytes32 partnerChainID_, address partnerContractAddress_) AllowList(MINTER_ADDRESS) { + if (teleporterMessengerAddress == address(0)) { + revert InvalidTeleporterMessengerAddress(); + } + teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); + currentChainID = WarpMessenger(WARP_PRECOMPILE_ADDRESS) + .getBlockchainID(); + + if (partnerContractAddress_ == address(0)) { + revert InvalidTeleporterMessengerAddress(); + } + partnerContractAddress = partnerContractAddress_; + + if (partnerChainID_ == currentChainID) { + revert CannotBridgeTokenWithinSameChain(); + } + partnerChainID = partnerChainID_; + } + + /** + * @dev See {ITeleporterReceiver-receiveTeleporterMessage}. + * + * Receives a Teleporter message and routes to the appropriate internal function call. + */ + function receiveTeleporterMessage( + bytes32 nativeChainID, + address nativeBridgeAddress, + bytes calldata message + ) external nonReentrant() { + + // Only allow the Teleporter messenger to deliver messages. + if (msg.sender != address(teleporterMessenger)) { + revert Unauthorized(); + } + // Only allow messages from the partner chain. + if (nativeChainID != partnerChainID) { + revert InvalidSourceChain(); + } + // Only allow the partner contract to send messages. + if (nativeBridgeAddress != partnerContractAddress) { + revert InvalidPartnerContractAddress(); + } + + (address recipient, uint256 amount) = abi.decode(message, (address, uint256)); + + // Calls NativeMinter precompile through INativeMinter interface. + _nativeMinter.mintNativeCoin(recipient, amount); + emit MintNativeTokens(recipient, amount); + } + + /** + * @dev See {INativeTokenMinter-bridgeTokens}. + * + * Requirements: + * + * - `msg.value` must be greater than the fee amount. + */ + function bridgeTokens( + address recipient, + address feeTokenContractAddress, + uint256 feeAmount + ) external payable nonReentrant { + // The recipient cannot be the zero address. + if (recipient == address(0)) { + revert InvalidRecipientAddress(); + } + + // Lock tokens in this bridge instance. Supports "fee/burn on transfer" ERC20 token + // implementations by only bridging the actual balance increase reflected by the call + // to transferFrom. + uint256 adjustedAmount = SafeERC20TransferFrom.safeTransferFrom( + IERC20(feeTokenContractAddress), + feeAmount + ); + + // Ensure that the adjusted amount is greater than the fee to be paid. + if (adjustedAmount <= feeAmount) { + revert InsufficientAdjustedAmount(adjustedAmount, feeAmount); + } + + // Burn native token by sending to BLACKHOLE_ADDRESS + payable(BLACKHOLE_ADDRESS).transfer(msg.value); + + // Send Teleporter message. + bytes memory messageData = abi.encode(recipient, msg.value); + + uint256 messageID = teleporterMessenger.sendCrossChainMessage( + TeleporterMessageInput({ + destinationChainID: partnerChainID, + destinationAddress: partnerContractAddress, + feeInfo: TeleporterFeeInfo({ + contractAddress: feeTokenContractAddress, + amount: feeAmount + }), + requiredGasLimit: TRANSFER_NATIVE_TOKENS_REQUIRED_GAS, + allowedRelayerAddresses: new address[](0), + message: messageData + }) + ); + + emit BridgeTokens({ + tokenContractAddress: feeTokenContractAddress, + teleporterMessageID: messageID, + destinationChainID: partnerChainID, + destinationBridgeAddress: partnerContractAddress, + recipient: recipient, + transferAmount: msg.value, + feeAmount: feeAmount + }); + } +} diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenReceiver.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenReceiver.sol new file mode 100644 index 000000000..2b8796ca3 --- /dev/null +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenReceiver.sol @@ -0,0 +1,144 @@ +//SPDX-License-Identifier: MIT +pragma solidity 0.8.18; + +import "@subnet-evm-contracts/interfaces/IWarpMessenger.sol"; +import "./INativeTokenReceiver.sol"; +import "../../Teleporter/ITeleporterMessenger.sol"; +import "../../Teleporter/ITeleporterReceiver.sol"; +import "../../Teleporter/SafeERC20TransferFrom.sol"; +import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; + +contract NativeTokenMinter is ITeleporterReceiver, INativeTokenReceiver, ReentrancyGuard { + address public constant WARP_PRECOMPILE_ADDRESS = + 0x0200000000000000000000000000000000000005; + + uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 200_000; + bytes32 public immutable currentChainID; + bytes32 public immutable partnerChainID; + address public immutable partnerContractAddress; + + // Used for sending an receiving Teleporter messages. + ITeleporterMessenger public immutable teleporterMessenger; + + error InvalidTeleporterMessengerAddress(); + error InvalidRecipientAddress(); + error InvalidSourceChain(); + error InvalidPartnerContractAddress(); + error CannotBridgeTokenWithinSameChain(); + error Unauthorized(); + error InsufficientPayment(); + error InsufficientAdjustedAmount(uint256 adjustedAmount, uint256 feeAmount); + + constructor(address teleporterMessengerAddress, bytes32 partnerChainID_, address partnerContractAddress_) { + if (teleporterMessengerAddress == address(0)) { + revert InvalidTeleporterMessengerAddress(); + } + teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); + currentChainID = WarpMessenger(WARP_PRECOMPILE_ADDRESS) + .getBlockchainID(); + + if (partnerContractAddress_ == address(0)) { + revert InvalidTeleporterMessengerAddress(); + } + partnerContractAddress = partnerContractAddress_; + + if (partnerChainID_ == currentChainID) { + revert CannotBridgeTokenWithinSameChain(); + } + partnerChainID = partnerChainID_; + } + + /** + * @dev See {ITeleporterReceiver-receiveTeleporterMessage}. + * + * Receives a Teleporter message and routes to the appropriate internal function call. + */ + function receiveTeleporterMessage( + bytes32 nativeChainID, + address nativeBridgeAddress, + bytes calldata message + ) external nonReentrant() { + + // Only allow the Teleporter messenger to deliver messages. + if (msg.sender != address(teleporterMessenger)) { + revert Unauthorized(); + } + // Only allow messages from the partner chain. + if (nativeChainID != partnerChainID) { + revert InvalidSourceChain(); + } + // Only allow the partner contract to send messages. + if (nativeBridgeAddress != partnerContractAddress) { + revert InvalidPartnerContractAddress(); + } + + (address recipient, uint256 amount) = abi.decode(message, (address, uint256)); + + // TODO set up starting threshold. + + // Send to recipient + payable(recipient).transfer(amount); + + emit UnlockTokens(recipient, amount); + } + + /** + * @dev See {IERC20Bridge-bridgeTokens}. + * + * Requirements: + * + * - `msg.value` must be greater than the fee amount. + */ + function bridgeTokens( + address recipient, + address feeTokenContractAddress, + uint256 feeAmount + ) external payable nonReentrant { + // The recipient cannot be the zero address. + if (recipient == address(0)) { + revert InvalidRecipientAddress(); + } + + // Lock tokens in this bridge instance. Supports "fee/burn on transfer" ERC20 token + // implementations by only bridging the actual balance increase reflected by the call + // to transferFrom. + uint256 adjustedAmount = SafeERC20TransferFrom.safeTransferFrom( + IERC20(feeTokenContractAddress), + feeAmount + ); + + // Ensure that the adjusted amount is greater than the fee to be paid. + // The secondary fee amount is not used in this case (and can assumed to be 0) since bridging + // a native token to another chain only ever involves a single cross-chain message. + if (adjustedAmount <= feeAmount) { + revert InsufficientAdjustedAmount(adjustedAmount, feeAmount); + } + + // Send Teleporter message. + bytes memory messageData = abi.encode(recipient, msg.value); + + uint256 messageID = teleporterMessenger.sendCrossChainMessage( + TeleporterMessageInput({ + destinationChainID: partnerChainID, + destinationAddress: partnerContractAddress, + feeInfo: TeleporterFeeInfo({ + contractAddress: feeTokenContractAddress, + amount: feeAmount + }), + requiredGasLimit: MINT_NATIVE_TOKENS_REQUIRED_GAS, + allowedRelayerAddresses: new address[](0), + message: messageData + }) + ); + + emit BridgeTokens({ + tokenContractAddress: feeTokenContractAddress, + teleporterMessageID: messageID, + destinationChainID: partnerChainID, + destinationBridgeAddress: partnerContractAddress, + recipient: recipient, + transferAmount: msg.value, + feeAmount: feeAmount + }); + } +} diff --git a/docker/defaultChainConfig.json b/docker/defaultChainConfig.json index 1eb85c60f..f21a3c906 100644 --- a/docker/defaultChainConfig.json +++ b/docker/defaultChainConfig.json @@ -1,3 +1,9 @@ { - "log-level": "info" + "log-level": "info", + "contractNativeMinterConfig": { + "blockTimestamp": 0, + "adminAddresses": [ + "0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC" + ] + } } \ No newline at end of file diff --git a/docker/defaultNodeConfig.json b/docker/defaultNodeConfig.json index 1eb85c60f..f21a3c906 100644 --- a/docker/defaultNodeConfig.json +++ b/docker/defaultNodeConfig.json @@ -1,3 +1,9 @@ { - "log-level": "info" + "log-level": "info", + "contractNativeMinterConfig": { + "blockTimestamp": 0, + "adminAddresses": [ + "0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC" + ] + } } \ No newline at end of file diff --git a/scripts/local/integration-tests/erc20_bridge_multihop.sh b/scripts/local/integration-tests/erc20_bridge_multihop.sh index 7ba9760db..bf0bc7206 100755 --- a/scripts/local/integration-tests/erc20_bridge_multihop.sh +++ b/scripts/local/integration-tests/erc20_bridge_multihop.sh @@ -39,7 +39,7 @@ native_erc20_deploy_result=$(forge create --private-key $user_private_key src/Mo native_erc20_contract_address=$(parseContractAddress "$native_erc20_deploy_result") echo "Test ERC20 contract deployed to $native_erc20_contract_address on Subnet A" -# Deploy the ERC20 bridge contract to both chains. +# Deploy the ERC20 bridge contract to all chains. bridge_a_deploy_result=$(forge create --private-key $user_private_key --constructor-args $teleporter_contract_address \ --rpc-url $subnet_a_url src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol:ERC20Bridge) bridge_a_address=$(parseContractAddress "$bridge_a_deploy_result") @@ -79,7 +79,7 @@ cast send $bridge_a_address "submitCreateBridgeToken(bytes32,address,address,add $native_erc20_contract_address \ $create_bridge_token_message_fee \ --private-key $user_private_key --rpc-url $subnet_a_url -echo "Sent a transaction on Subnet A to add support for the the ERC20 token to the bridge." +echo "Sent a transaction on Subnet A to add support for the the ERC20 token to the bridge on Subnet B." cast send $bridge_a_address "submitCreateBridgeToken(bytes32,address,address,address,uint256)" \ $subnet_c_chain_id_hex \ $bridge_c_address \ diff --git a/scripts/local/native/docker-compose-run.yml b/scripts/local/native/docker-compose-run.yml new file mode 100644 index 000000000..1c4c1f3e2 --- /dev/null +++ b/scripts/local/native/docker-compose-run.yml @@ -0,0 +1,32 @@ +# Copyright (C) 2023, Ava Labs, Inc. All rights reserved. +# See the file LICENSE for licensing terms. + +version: "3.9" +services: + local_network: + build: + context: ./ + dockerfile: ./docker/Dockerfile + args: + ARCH: ${ARCH} # set by run.sh + container_name: local_network_run + init: true + working_dir: /code + entrypoint: [ "/code/docker/run_setup.sh" ] + network_mode: "host" + volumes: + - type: bind + source: ./ + target: /code/ + relayer: + image: avaplatform/awm-relayer:v0.2.0 + container_name: relayer_run + init: true + working_dir: /code + entrypoint: /code/docker/run_relayer.sh + network_mode: "host" + user: "root" + volumes: + - type: bind + source: ./ + target: /code/ diff --git a/scripts/local/native/docker-compose-test.yml b/scripts/local/native/docker-compose-test.yml new file mode 100644 index 000000000..725b7d5ab --- /dev/null +++ b/scripts/local/native/docker-compose-test.yml @@ -0,0 +1,50 @@ +# Copyright (C) 2023, Ava Labs, Inc. All rights reserved. +# See the file LICENSE for licensing terms. + +version: "3.9" +services: + local_network: + image: local-network-image + build: + context: ./ + dockerfile: ./docker/Dockerfile + args: + ARCH: ${ARCH} # set by test.sh + container_name: local_network_test + init: true + working_dir: /code + entrypoint: [ "/code/scripts/local/native/run_setup.sh" ] + network_mode: "host" + volumes: + - type: bind + source: ./ + target: /code/ + relayer: + image: avaplatform/awm-relayer:v0.2.0 + init: true + working_dir: /code + entrypoint: /code/scripts/local/native/run_relayer.sh + network_mode: "host" + user: "root" + volumes: + - type: bind + source: ./ + target: /code/ + test_runner: + image: test-runner-image + build: + context: ./ + dockerfile: ./docker/Dockerfile + args: + ARCH: ${ARCH} # set by test.sh + container_name: test_runner + init: true + working_dir: /code + entrypoint: /code/scripts/local/native/run_tests.sh + network_mode: "host" + volumes: + - type: bind + source: ./ + target: /code/ + environment: + - TEST_TARGET="scripts/local/native/native.sh" diff --git a/scripts/local/native/native.sh b/scripts/local/native/native.sh new file mode 100755 index 000000000..259b9253d --- /dev/null +++ b/scripts/local/native/native.sh @@ -0,0 +1,189 @@ +#!/usr/bin/env bash +# Copyright (C) 2023, Ava Labs, Inc. All rights reserved. +# See the file LICENSE for licensing terms. + +set -e # Stop on first error + +# Variables provided by run_test.sh: +# c_chain_url +# user_private_key +# user_address_bytes +# user_address +# relayer_address +# subnet_a_chain_id +# subnet_a_subnet_id +# subnet_a_url +# subnet_a_chain_id_hex +# subnet_a_subnet_id_hex +# teleporter_contract_address + +# Test covers: +# - Creating bridged tokens on subnets different from the original subnet with the native token asset. +# - Bridging directly from token native subnet to a subnet with its bridged token +# - Bridging a wrapped token of one subnet to another subnet's bridged token of the same native token asset, through unwrapping then wrapping. +# - Unwrap bridged token back to origin subnet with native token asset. + +# Deploy the ERC20 bridge contract to both chains. +bridge_a_deploy_result=$(forge create --private-key $user_private_key --constructor-args $teleporter_contract_address \ + --rpc-url $subnet_a_url src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol:ERC20Bridge) +ntm_a_address=$(parseContractAddress "$bridge_a_deploy_result") +echo "Native token minting contract deployed to subnet A at $ntm_a_address." + +c_chain_deploy_result=$(forge create --private-key $user_private_key --constructor-args $teleporter_contract_address \ + --rpc-url $c_chain_url src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol:ERC20Bridge) +c_chain_ntr_address=$(parseContractAddress "$c_chain_deploy_result") +echo ""Native token bridge contract deployed to C Chain at $c_chain_ntr_address." + +cd .. + +# Send a transaction that initiates the ERC20 token being added to be bridged to subnet B +# Function signature for submitCreateBridgeToken includes an ERC20 type parameter, but we can pass in address +# since the contract solidity type gets mapped to address abi type https://docs.soliditylang.org/en/latest/abi-spec.html#mapping-solidity-to-abi-types. +create_bridge_token_message_fee=1000000000000000000 +cast send $bridge_a_address "submitCreateBridgeToken(bytes32,address,address,address,uint256)" \ + $subnet_b_chain_id_hex \ + $ntm_b_address \ + $native_erc20_contract_address \ + $native_erc20_contract_address \ + $create_bridge_token_message_fee \ + --private-key $user_private_key --rpc-url $subnet_a_url +echo "Sent a transaction on Subnet A to add support for the the ERC20 token to the bridge on Subnet B." + + +# Wait for the cross chain message to be delivered by a relayer. +sleep 10 + +# Check that the bridge token was added on Subnet B +bridge_token_subnet_b_contract_address=$(cast call $ntm_b_address "nativeToWrappedTokens(bytes32,address,address)(address)" \ + $subnet_a_chain_id_hex \ + $bridge_a_address \ + $native_erc20_contract_address \ + --rpc-url $subnet_b_url) +echo "The bridge token contract address on Subnet B is $bridge_token_subnet_b_contract_address" +if [[ "$bridge_token_subnet_b_contract_address" == "0x0000000000000000000000000000000000000000" ]]; then + echo "Bridge token contract was not created on Subnet B." + exit 1 +fi + +# Now that the bridge token has been added, send a bridge transfer for the newly added token from subnet A to subnet B. +total_amount=13000000000000000000 +primary_fee_amount=1000000000000000000 +secondary_fee_amount=0 +cast send $bridge_a_address "bridgeTokens(bytes32,address,address,address,uint256,uint256,uint256)" \ + $subnet_b_chain_id_hex \ + $bridge_b_address \ + $native_erc20_contract_address \ + $user_address \ + $total_amount \ + $primary_fee_amount \ + $secondary_fee_amount \ + --private-key $user_private_key --rpc-url $subnet_a_url +echo "Sent a transaction to bridgeTokens from Subnet A to Subnet B." + +# Wait for the cross chain message to be processed by a relayer. +sleep 10 + +# Check that all the settings of the new bridge token are correct. +actual_native_chain_id=$(cast call $bridge_token_subnet_b_contract_address "nativeChainID()(bytes32)" --rpc-url $subnet_b_url) +echo "Bridge token native chain ID: $actual_native_chain_id" +actual_native_bridge=$(cast call $bridge_token_subnet_b_contract_address "nativeBridge()(address)" --rpc-url $subnet_b_url) +echo "Bridge token native bridge address: $actual_native_bridge" +actual_native_asset=$(cast call $bridge_token_subnet_b_contract_address "nativeAsset()(address)" --rpc-url $subnet_b_url) +echo "Bridge token native asset: $actual_native_asset" +actual_name=$(cast call $bridge_token_subnet_b_contract_address "name()(string)" --rpc-url $subnet_b_url) +echo "Bridge token name: $actual_name" +actual_symbol=$(cast call $bridge_token_subnet_b_contract_address "symbol()(string)" --rpc-url $subnet_b_url) +echo "Bridge token symbol: $actual_symbol" +actual_decimals=$(cast call $bridge_token_subnet_b_contract_address "decimals()(uint8)" --rpc-url $subnet_b_url) +echo "Bridge token decimals: $actual_decimals" +if [[ "$actual_native_chain_id" != "0x$subnet_a_chain_id_hex" || + "$actual_native_bridge" != "$bridge_a_address" || + "$actual_native_asset" != "$native_erc20_contract_address" || + "$actual_name" != "Mock Token" || + "$actual_symbol" != "EXMP" || + "$actual_decimals" != "18" ]]; then + echo "Bridge token contract was not created or did not have expected values." + echo "Actual native chain ID: $actual_native_chain_id, Expected: $subnet_a_chain_id_hex" + echo "Actual native bridge: $actual_native_bridge, Expected: $bridge_a_address" + echo "Actual native asset: $actual_native_asset, Expected: $native_erc20_contract_address" + echo "Actual name: $actual_name, Expected: Mock Token" + echo "Actual symbol: $actual_symbol, Expected: EXMP" + echo "Actual decimals: $actual_decimals, Expected: 18" + exit 1 +fi + +# Check the recipient balance of the new bridge token. +actual_bridge_token_balance=$(cast call $bridge_token_subnet_b_contract_address "balanceOf(address)(uint256)" $user_address --rpc-url $subnet_b_url) +echo "Bridge token balance is $actual_bridge_token_balance" + +if [[ "$actual_bridge_token_balance" != "12000000000000000000" ]]; then + echo "Bridge token balance for $user_address did not match expected." + echo "Actual balance: $actual_bridge_token_balance, Expected: 12000000000000000000" + exit 1 +fi +echo "Bridge token balance matches expected." + +# Approve the bridge contract on subnet B to spent the wrapped tokens in the user account. +cast send $bridge_token_subnet_b_contract_address "approve(address,uint256)(bool)" $bridge_b_address 000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFF --private-key $user_private_key --rpc-url $subnet_b_url +result=$(cast call $bridge_token_subnet_b_contract_address "allowance(address,address)(uint256)" $user_address $bridge_b_address --rpc-url $subnet_b_url) +if [[ $result != 309485009821345068724781055 ]]; then # FFFFFFFFFFFFFFFFFFFFFF in decimal form is 309485009821345068724781055 + echo $result + echo "Error approving bridge contract on subnet B to spend bridged ERC20 from user account." + exit 1 +fi +echo "Approved the subnet B bridge contract to spend the bridged ERC20 token from the user account." + +# Unwrap bridged tokens back to subnet A. +total_amount=11000000000000000000 +primary_fee_amount=1000000000000000000 +secondary_fee_amount=1000000000000000000 +cast send $bridge_b_address "bridgeTokens(bytes32,address,address,address,uint256,uint256,uint256)" \ + $subnet_a_chain_id_hex \ + $bridge_a_address \ + $bridge_token_subnet_b_contract_address \ + $user_address \ + $total_amount \ + $primary_fee_amount \ + $secondary_fee_amount \ + --private-key $user_private_key --rpc-url $subnet_b_url +echo "Sent a transaction to bridge tokens from Subnet B to Subnet A." + +# Wait for the cross chain message to be delivered by a relayer. +sleep 10 + +# Check the redeemable reward balance of the relayer if the relayer address was set. +if [ ! -z "$relayer_address" ]; then + actual_relayer_redeemable_balance=$(cast call $teleporter_contract_address "checkRelayerRewardAmount(address,address)(uint256)" $relayer_address $native_erc20_contract_address --rpc-url $subnet_a_url) + echo "Native ERC20 token balance for relayer account is $actual_relayer_redeemable_balance" + if [[ "$actual_relayer_redeemable_balance" != "2000000000000000000" ]]; then + echo "Redeemable rewards for relayer account ($relayer_address) did not match expected." + echo "Actual balance: $actual_relayer_redeemable_balance, Expected: 2000000000000000000" + exit 1 + fi + echo "Redeemable rewards balance matches expected for relayer on Subnet A." +fi + +# Check the balance of the native token after the unwrap +actual_native_token_default_account_balance=$(cast call $native_erc20_contract_address "balanceOf(address)(uint256)" $user_address --rpc-url $subnet_a_url) +echo "Native ERC20 token balance for user account is $actual_native_token_default_account_balance" +if [[ "$actual_native_token_default_account_balance" != "9999999996000000000000000000" ]]; then + echo "Native token balance for $user_address did not match expected." + echo "Actual balance: $actual_native_token_default_account_balance, Expected: 9999999996000000000000000000" + exit 1 +fi +echo "Native token balance matches expected for user account." + +# Check the balance of the native token for the relayer, which should have received the fee rewards +if [ ! -z "$relayer_address" ]; then + actual_relayer_redeemable_balance=$(cast call $teleporter_contract_address "checkRelayerRewardAmount(address,address)(uint256)" $relayer_address $native_erc20_contract_address --rpc-url $subnet_a_url) + echo "Redeemable ERC20 token reward balance for relayer account is $actual_relayer_redeemable_balance" + if [[ "$actual_relayer_redeemable_balance" != "2000000000000000000" ]]; then + echo "Redeemable reward balance for relayer account ($relayer_address) did not match expected." + echo "Actual balance: $actual_relayer_redeemable_balance, Expected: 2000000000000000000" + exit 1 + fi + echo "Redeemable rewards balance matches expected for relayer on Subnet A." +fi + + +exit 0 \ No newline at end of file diff --git a/scripts/local/native/relayerConfigTemplate.json b/scripts/local/native/relayerConfigTemplate.json new file mode 100644 index 000000000..95cd0341c --- /dev/null +++ b/scripts/local/native/relayerConfigTemplate.json @@ -0,0 +1,59 @@ +{ + "network-id": 1337, + "p-chain-api-url": "http://127.0.0.1:9650", + "encrypt-connection": false, + "source-subnets": [ + { + "subnet-id": "11111111111111111111111111111111LpoYY", + "chain-id": "", + "vm": "evm", + "api-node-host": "127.0.0.1", + "api-node-port": 9650, + "encrypt-connection": false, + "message-contracts": { + "": { + "message-format": "teleporter", + "settings": { + "reward-address": "" + } + } + } + }, + { + "subnet-id": "", + "chain-id": "", + "vm": "evm", + "api-node-host": "127.0.0.1", + "api-node-port": 9650, + "encrypt-connection": false, + "message-contracts": { + "": { + "message-format": "teleporter", + "settings": { + "reward-address": "" + } + } + } + } + ], + "destination-subnets": [ + { + "subnet-id": "11111111111111111111111111111111LpoYY", + "chain-id": "", + "vm": "evm", + "api-node-host": "127.0.0.1", + "api-node-port": 9650, + "encrypt-connection": false, + "account-private-key": "" + }, + { + "subnet-id": "", + "chain-id": "", + "vm": "evm", + "api-node-host": "127.0.0.1", + "api-node-port": 9650, + "encrypt-connection": false, + "account-private-key": "" + } + ] +} \ No newline at end of file diff --git a/scripts/local/native/run_relayer.sh b/scripts/local/native/run_relayer.sh new file mode 100755 index 000000000..34c3c46fd --- /dev/null +++ b/scripts/local/native/run_relayer.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +# Copyright (C) 2023, Ava Labs, Inc. All rights reserved. +# See the file LICENSE for licensing terms. + + +set -e # Stop on first error + +# Needed for submodules +git config --global --add safe.directory '*' +if [[ $# -eq 1 ]] && [[ "$1" == "--local-tests-only" ]]; then + dir_prefix=. +else + dir_prefix=/code +fi + +rm -f $dir_prefix/NETWORK_READY + +until cat $dir_prefix/NETWORK_READY &> /dev/null +do + if [[ retry_count -ge 600 ]]; then + echo "Subnets didn't start up quickly enough." + exit 1 + fi + echo "Waiting for subnets to start up. Retry count: $retry_count" + retry_count=$((retry_count+1)) + sleep 1 +done + +# Source all variables set in run_setup.sh +set -a +source $dir_prefix/vars.sh || true # ignore readonly variable errors +set +a + +# Relayer constants +reward_address=0xA100fF48a37cab9f87c8b5Da933DA46ea1a5fb80 +account_private_key=C2CE4E001B7585F543982A01FBC537CFF261A672FA8BD1FAFC08A207098FE2DE + +# Populate the relayer configuration +relayerConfigFile=./relayerConfig.json +rm -f $relayerConfigFile + +# Avoid using sed -i due to Docker + MacOS M1 issues +sed "s//$subnet_a_chain_id/g + s//$subnet_a_subnet_id/g + s//$teleporter_contract_address/g + s//$c_chain_chain_id/g + s//$reward_address/g + s//$account_private_key/g" ./scripts/local/native/relayerConfigTemplate.json > $relayerConfigFile + +/usr/bin/awm-relayer --config-file $relayerConfigFile diff --git a/scripts/local/native/run_setup.sh b/scripts/local/native/run_setup.sh new file mode 100755 index 000000000..c10fae594 --- /dev/null +++ b/scripts/local/native/run_setup.sh @@ -0,0 +1,148 @@ +#!/usr/bin/env bash +# Copyright (C) 2023, Ava Labs, Inc. All rights reserved. +# See the file LICENSE for licensing terms. + + +set -e # Stop on first error + +# Needed for submodules +git config --global --add safe.directory '*' +if [[ $# -eq 1 ]] && [[ "$1" == "--local-tests-only" ]]; then + dir_prefix=. +else + dir_prefix=/code +fi + +source $dir_prefix/scripts/utils.sh + +# Signifies container is ready +rm -f $dir_prefix/NETWORK_READY + +# Set up the network if this is the first time the container is starting +if [ ! -e $dir_prefix/NETWORK_RUNNING ]; then + rm -f $dir_prefix/vars.sh + + cd subnet-evm + + # Source $AVALANCHEGO_VERSION from versions.sh + source ./scripts/versions.sh + + # Build the subnet-evm + export VM_BUILD_PATH=$"/tmp/subnet-evm-runner" + ./scripts/build.sh $VM_BUILD_PATH/srEXiWaHuhNyGwPUi444Tu47ZEDwxTWrbQiuD7FmgSAQ6X7Dy + cd .. + + echo "Avalanche cli version: $(avalanche --version --skip-update-check)" + + # Start the local Avalanche network + avalanche network clean --skip-update-check + + # Configure the subnet genesis files for the three subnets to be created. + # Avoid using sed -i due to docker + macos m1 issues + rm -f ./subnetGenesis_*.json + sed "s/\"\"/68430/g" ./docker/genesisTemplate.json > subnetGenesis_A.json + + # Deploy a test subnets to the local network. + echo "Creating new subnet A..." + avalanche subnet create subneta --force --custom --genesis ./subnetGenesis_A.json --config ./docker/defaultNodeConfig.json --vm $VM_BUILD_PATH/srEXiWaHuhNyGwPUi444Tu47ZEDwxTWrbQiuD7FmgSAQ6X7Dy --log-level info --skip-update-check + avalanche subnet configure subneta --config ./docker/defaultNodeConfig.json --chain-config ./docker/defaultChainConfig.json --skip-update-check + avalanche subnet deploy subneta --local --avalanchego-version $AVALANCHEGO_VERSION --config ./docker/defaultNodeConfig.json --log-level info --skip-update-check + + # Find the proper Avalanche CLI log directory + function getJsonVal () { + python3 -c "import json,sys;sys.stdout.write(json.dumps(json.load(sys.stdin)$1).strip('\"'))"; + } + + subnet_a_chain_id=$(cat $HOME/.avalanche-cli/subnets/subneta/sidecar.json | getJsonVal "['Networks']['Local Network']['BlockchainID']") + subnet_a_subnet_id=$(cat $HOME/.avalanche-cli/subnets/subneta/sidecar.json | getJsonVal "['Networks']['Local Network']['SubnetID']") + c_chain_subnet_id=11111111111111111111111111111111LpoYY # hardcoded primary subnet ID + c_chain_chain_id=$(curl -X POST --data '{"jsonrpc": "2.0","method": "platform.getBlockchains","params": {},"id": 1}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P | getJsonVal "['result']['blockchains']" | python3 docker/getBlockChainId.py C-Chain) + + echo "Subnet A chain ID: $subnet_a_chain_id" + echo "C-Chain chain ID: $c_chain_chain_id" + + user_private_key=0x56289e99c94b6912bfc12adc093c9b51124f0dc54ac7a766b2bc5ccf558d8027 + user_address_bytes=8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC + user_address=0x$user_address_bytes # Address corresponding to the user_private_key + + export PATH="$PATH:$HOME/.foundry/bin" + + subnet_a_url="http://127.0.0.1:9650/ext/bc/$subnet_a_chain_id/rpc" + c_chain_url="http://127.0.0.1:9650/ext/bc/C/rpc" + + # Deploy TeleporterMessenger contract to each chain. + cd contracts + forge build + cd .. + go run contract-deployment/contractDeploymentTools.go constructKeylessTx contracts/out/TeleporterMessenger.sol/TeleporterMessenger.json + teleporter_deploy_address=$(cat UniversalTeleporterDeployerAddress.txt) + teleporter_deploy_tx=$(cat UniversalTeleporterDeployerTransaction.txt) + teleporter_contract_address=$(cat UniversalTeleporterMessengerContractAddress.txt) + echo $teleporter_deploy_address $teleporter_contract_address + echo "Finished reading universal deploy address and transaction" + + cast send --private-key $user_private_key --value 50ether $teleporter_deploy_address --rpc-url $subnet_a_url + cast send --private-key $user_private_key --value 50ether $teleporter_deploy_address --rpc-url $c_chain_url + echo "Sent ether to teleporter deployer on each subnet." + + # Verify that the transaction status was successful for the deployments + status=$(cast publish --rpc-url $subnet_a_url $teleporter_deploy_tx | getJsonVal "['status']") + if [[ $status != "0x1" ]]; then + echo "Error deploying Teleporter Messenger transaction on subnet A." + exit 1 + fi + echo "Deployed TeleporterMessenger to Subnet A" + status=$(cast publish --rpc-url $c_chain_url $teleporter_deploy_tx | getJsonVal "['status']") + if [[ $status != "0x1" ]]; then + echo "Error deploying Teleporter Messenger transaction on C Chain." + exit 1 + fi + echo "Deployed TeleporterMessenger to C Chain" + + # Send tokens to cover gas costs for the relayers. + relayer_private_key=C2CE4E001B7585F543982A01FBC537CFF261A672FA8BD1FAFC08A207098FE2DE + relayer_address=0xA100fF48a37cab9f87c8b5Da933DA46ea1a5fb80 + + cast send --private-key $user_private_key --value 500ether $relayer_address --rpc-url $subnet_a_url + cast send --private-key $user_private_key --value 500ether $relayer_address --rpc-url $c_chain_url + echo "Sent ether to relayer account on each subnet." + + subnet_a_chain_id_hex=$(getBlockChainIDHex $subnet_a_chain_id) + subnet_a_subnet_id_hex=$(getBlockChainIDHex $subnet_a_subnet_id) + c_chain_chain_id_hex=$(getBlockChainIDHex $c_chain_chain_id) + c_chain_subnet_id_hex=$(getBlockChainIDHex $c_chain_subnet_id) + warp_messenger_precompile_addr=0x0200000000000000000000000000000000000005 + + # Write all vars to file so that they can be imported from another container + set > $dir_prefix/vars.sh + + # Indicate for future runs that we started up successfully + touch $dir_prefix/NETWORK_RUNNING +else + echo "Resuming network from previous run" + source $dir_prefix/vars.sh || true + avalanche network start --skip-update-check + restart="restart" +fi + +# Signal other containers this container is ready +touch $dir_prefix/NETWORK_READY + +function cleanup() +{ + echo "Stopping the network..." + avalanche network stop --skip-update-check + echo "Gracefully shut down the network." +} + +trap cleanup EXIT + +# Stream the subnet logs +network_runner_dir=$(python3 docker/findCliLogDirectory.py $restart) +subnet_a_log_file=$HOME/.avalanche-cli/runs/$network_runner_dir/node1/logs/$subnet_a_chain_id.log + +echo "Streaming subnet A log file at $subnet_a_log_file" + +tail -f $subnet_a_log_file & + +wait $! diff --git a/scripts/local/native/run_stop.sh b/scripts/local/native/run_stop.sh new file mode 100755 index 000000000..bee5c5fb2 --- /dev/null +++ b/scripts/local/native/run_stop.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +# Copyright (C) 2023, Ava Labs, Inc. All rights reserved. +# See the file LICENSE for licensing terms. + +set -e # Stop on first error +source ./scripts/utils.sh + +if [[ $# -gt 1 ]]; then + echo "Invalid number of arguments. Usage:" + echo " ./scripts/local/run_stop.sh # stop the running containers and preserve the network for subsequent runs" + echo " ./scripts/local/run_stop.sh -c # stop the running containers and clean the network" + exit 1 +fi + +clean=false +while getopts c flag +do + case "${flag}" in + c ) clean=true;; + esac +done + +# If clean flag is set we remove network running file to start the network from scratch +if $clean +then + rm -f NETWORK_RUNNING +fi + +docker compose -f scripts/local/native/docker-compose-run.yml --project-directory ./ stop \ No newline at end of file diff --git a/scripts/local/native/run_tests.sh b/scripts/local/native/run_tests.sh new file mode 100755 index 000000000..a08a480d3 --- /dev/null +++ b/scripts/local/native/run_tests.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +# Copyright (C) 2023, Ava Labs, Inc. All rights reserved. +# See the file LICENSE for licensing terms. + +set -e # Stop on first error + +# Needed for submodules +git config --global --add safe.directory '*' +if [[ $# -eq 1 ]] && [[ "$1" == "--local-tests-only" ]]; then + dir_prefix=. +else + dir_prefix=/code +fi + +rm -f $dir_prefix/NETWORK_READY + +until cat $dir_prefix/NETWORK_READY &> /dev/null +do + if [[ retry_count -ge 60 ]]; then + echo "Subnets didn't start up quickly enough." + exit 1 + fi + echo "Waiting for subnets to start up. Retry count: $retry_count" + retry_count=$((retry_count+1)) + sleep 10 +done + +# Wait for relayers to start and subscribe +sleep 3 + +# Source all variables set in run_setup.sh +set -a +source $dir_prefix/vars.sh || true # ignore readonly variable errors +source $dir_prefix/scripts/utils.sh +set +a + +echo "Running test ./scripts/local/native/native.sh" +./scripts/local/native/native.sh +echo "Done running test ./scripts/local/native/native.sh" +echo "" + +exit 0 diff --git a/scripts/local/native/test.sh b/scripts/local/native/test.sh new file mode 100755 index 000000000..c823fdaa0 --- /dev/null +++ b/scripts/local/native/test.sh @@ -0,0 +1,81 @@ +#!/usr/bin/env bash +# Copyright (C) 2023, Ava Labs, Inc. All rights reserved. +# See the file LICENSE for licensing terms. + +set -e # Stop on first error +source ./scripts/utils.sh + +TEST_TARGET= +LOCAL_RELAYER_IMAGE= +TESTNET= +HELP= +while [ $# -gt 0 ]; do + case "$1" in + -t | --test) export TEST_TARGET=$2 ;; + -l | --local-relayer-image) LOCAL_RELAYER_IMAGE=$2 ;; + -h | --help) HELP=true ;; + esac + shift +done + +if [ "$HELP" = true ]; then + echo "Usage: ./scripts/local/test.sh [OPTIONS]" + echo "Run integration tests for Teleporter." + echo "" + echo "Options:" + echo " -t, --test Run a specific test. If empty, runs all tests in the ./scripts/local/integration-tests/" + echo " -t, --test "test1 test2" Run multiple tests. Test names must be space delimited and enclosed in quotes" + echo " -l, --local-relayer-image Use a local AWM Relayer image instead of pulling from dockerhub" + echo " -h, --help Print this help message" + exit 0 +fi + +function cleanup { + echo "Shutting down network before exiting..." + ./scripts/local/run_stop.sh + echo "Network stopped" +} + +# Set up the trap to catch the SIGINT signal (CTRL+C) +# Note that the output of the cleanup function defined in run_setup.sh does not appear if CTRL+C is used to kill this script, +# but the function does in fact run as expected. +trap cleanup SIGTERM +trap cleanup SIGINT + +# Set ARCH env so as a container executes without issues in a portable way +# Should be amd64 for linux/macos x86 hosts, and arm64 for macos M1 +# It is referenced in the docker composer yaml, and then passed as a Dockerfile ARG +setARCH + +if [ -z "$LOCAL_RELAYER_IMAGE" ]; then + echo "Using published awm-relayer image" + docker compose -f scripts/local/native/docker-compose-test.yml --project-directory ./ up --exit-code-from test_runner --build & +else + echo "Using local awm-relayer image: $LOCAL_RELAYER_IMAGE" + if [[ "$(docker images -q awm-relayer:$LOCAL_RELAYER_IMAGE 2> /dev/null)" == "" ]]; then + echo "awm-relayer:$LOCAL_RELAYER_IMAGE does not exist locally. Exiting." + exit 1 + fi + rm -f docker/docker-compose-test-local.yml + sed "s//$LOCAL_RELAYER_IMAGE/g" docker/docker-compose-test-local-template.yml > docker/docker-compose-test-local.yml + docker compose -f docker/docker-compose-test-local.yml --project-directory ./ up --build & +fi + +# Wait for the containers to start up +until [ "$( docker container inspect --format '{{.State.Running}}' test_runner )" == "true" ] +do + echo "Waiting for containers to start..." + sleep 1 +done +echo "Containers started." + +# Wait for the test runner to exit, then grab the exit code +until [ "$( docker container inspect --format '{{.State.Running}}' test_runner )" == "false" ] +do + sleep 10 +done + +# Stop the containers gracefully +./scripts/local/native/run_stop.sh +code=$(docker inspect --format='{{.State.ExitCode}}' test_runner) +exit $code diff --git a/scripts/local/run_stop.sh b/scripts/local/run_stop.sh index dbd76d8ff..a162052a7 100755 --- a/scripts/local/run_stop.sh +++ b/scripts/local/run_stop.sh @@ -5,11 +5,6 @@ set -e # Stop on first error source ./scripts/utils.sh -# Set ARCH env so as a container executes without issues in a portable way -# Should be amd64 for linux/macos x86 hosts, and arm64 for macos M1 -# It is referenced in the docker composer yaml, and then passed as a Dockerfile ARG -setARCH - if [[ $# -gt 1 ]]; then echo "Invalid number of arguments. Usage:" echo " ./scripts/local/run_stop.sh # stop the running containers and preserve the network for subsequent runs" From 275c9c99d372d141edcf38daf26e0291ab50f9e4 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 25 Sep 2023 11:09:04 -0400 Subject: [PATCH 003/183] Fix constructor --- .../NativeTokenBridge/NativeTokenMinter.sol | 17 ++++++----------- .../NativeTokenBridge/NativeTokenReceiver.sol | 16 +++++----------- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenMinter.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenMinter.sol index 025e2a5c8..69d6563fa 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenMinter.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenMinter.sol @@ -21,10 +21,9 @@ contract NativeTokenMinter is ITeleporterReceiver, INativeTokenMinter, AllowList address public constant WARP_PRECOMPILE_ADDRESS = 0x0200000000000000000000000000000000000005; - uint256 public constant TRANSFER_NATIVE_TOKENS_REQUIRED_GAS = 300_000; + uint256 public constant TRANSFER_NATIVE_TOKENS_REQUIRED_GAS = 300_000; // TODO this is a placeholder bytes32 public immutable currentChainID; bytes32 public immutable partnerChainID; - address public immutable partnerContractAddress; // Used for sending an receiving Teleporter messages. ITeleporterMessenger public immutable teleporterMessenger; @@ -38,7 +37,8 @@ contract NativeTokenMinter is ITeleporterReceiver, INativeTokenMinter, AllowList error InsufficientPayment(); error InsufficientAdjustedAmount(uint256 adjustedAmount, uint256 feeAmount); - constructor(address teleporterMessengerAddress, bytes32 partnerChainID_, address partnerContractAddress_) AllowList(MINTER_ADDRESS) { + // TODO we probably want to add the original token supply from this chain to the constructor. + constructor(address teleporterMessengerAddress, bytes32 partnerChainID_) AllowList(MINTER_ADDRESS) { if (teleporterMessengerAddress == address(0)) { revert InvalidTeleporterMessengerAddress(); } @@ -46,11 +46,6 @@ contract NativeTokenMinter is ITeleporterReceiver, INativeTokenMinter, AllowList currentChainID = WarpMessenger(WARP_PRECOMPILE_ADDRESS) .getBlockchainID(); - if (partnerContractAddress_ == address(0)) { - revert InvalidTeleporterMessengerAddress(); - } - partnerContractAddress = partnerContractAddress_; - if (partnerChainID_ == currentChainID) { revert CannotBridgeTokenWithinSameChain(); } @@ -77,7 +72,7 @@ contract NativeTokenMinter is ITeleporterReceiver, INativeTokenMinter, AllowList revert InvalidSourceChain(); } // Only allow the partner contract to send messages. - if (nativeBridgeAddress != partnerContractAddress) { + if (nativeBridgeAddress != address(this)) { revert InvalidPartnerContractAddress(); } @@ -127,7 +122,7 @@ contract NativeTokenMinter is ITeleporterReceiver, INativeTokenMinter, AllowList uint256 messageID = teleporterMessenger.sendCrossChainMessage( TeleporterMessageInput({ destinationChainID: partnerChainID, - destinationAddress: partnerContractAddress, + destinationAddress: address(this), feeInfo: TeleporterFeeInfo({ contractAddress: feeTokenContractAddress, amount: feeAmount @@ -142,7 +137,7 @@ contract NativeTokenMinter is ITeleporterReceiver, INativeTokenMinter, AllowList tokenContractAddress: feeTokenContractAddress, teleporterMessageID: messageID, destinationChainID: partnerChainID, - destinationBridgeAddress: partnerContractAddress, + destinationBridgeAddress: address(this), recipient: recipient, transferAmount: msg.value, feeAmount: feeAmount diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenReceiver.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenReceiver.sol index 2b8796ca3..40ab7f7fc 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenReceiver.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenReceiver.sol @@ -12,10 +12,9 @@ contract NativeTokenMinter is ITeleporterReceiver, INativeTokenReceiver, Reentra address public constant WARP_PRECOMPILE_ADDRESS = 0x0200000000000000000000000000000000000005; - uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 200_000; + uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 200_000; // TODO this is a placeholder bytes32 public immutable currentChainID; bytes32 public immutable partnerChainID; - address public immutable partnerContractAddress; // Used for sending an receiving Teleporter messages. ITeleporterMessenger public immutable teleporterMessenger; @@ -29,7 +28,7 @@ contract NativeTokenMinter is ITeleporterReceiver, INativeTokenReceiver, Reentra error InsufficientPayment(); error InsufficientAdjustedAmount(uint256 adjustedAmount, uint256 feeAmount); - constructor(address teleporterMessengerAddress, bytes32 partnerChainID_, address partnerContractAddress_) { + constructor(address teleporterMessengerAddress, bytes32 partnerChainID_) { if (teleporterMessengerAddress == address(0)) { revert InvalidTeleporterMessengerAddress(); } @@ -37,11 +36,6 @@ contract NativeTokenMinter is ITeleporterReceiver, INativeTokenReceiver, Reentra currentChainID = WarpMessenger(WARP_PRECOMPILE_ADDRESS) .getBlockchainID(); - if (partnerContractAddress_ == address(0)) { - revert InvalidTeleporterMessengerAddress(); - } - partnerContractAddress = partnerContractAddress_; - if (partnerChainID_ == currentChainID) { revert CannotBridgeTokenWithinSameChain(); } @@ -68,7 +62,7 @@ contract NativeTokenMinter is ITeleporterReceiver, INativeTokenReceiver, Reentra revert InvalidSourceChain(); } // Only allow the partner contract to send messages. - if (nativeBridgeAddress != partnerContractAddress) { + if (nativeBridgeAddress != address(this)) { revert InvalidPartnerContractAddress(); } @@ -120,7 +114,7 @@ contract NativeTokenMinter is ITeleporterReceiver, INativeTokenReceiver, Reentra uint256 messageID = teleporterMessenger.sendCrossChainMessage( TeleporterMessageInput({ destinationChainID: partnerChainID, - destinationAddress: partnerContractAddress, + destinationAddress: address(this), feeInfo: TeleporterFeeInfo({ contractAddress: feeTokenContractAddress, amount: feeAmount @@ -135,7 +129,7 @@ contract NativeTokenMinter is ITeleporterReceiver, INativeTokenReceiver, Reentra tokenContractAddress: feeTokenContractAddress, teleporterMessageID: messageID, destinationChainID: partnerChainID, - destinationBridgeAddress: partnerContractAddress, + destinationBridgeAddress: address(this), recipient: recipient, transferAmount: msg.value, feeAmount: feeAmount From 97d4cf149434ad13eef07f0f5d29d2eba9871001 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 25 Sep 2023 11:09:33 -0400 Subject: [PATCH 004/183] Add minter to network genesis --- tests/warp-genesis.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/warp-genesis.json b/tests/warp-genesis.json index 2560bba0a..5c10d832f 100644 --- a/tests/warp-genesis.json +++ b/tests/warp-genesis.json @@ -24,6 +24,12 @@ }, "warpConfig": { "blockTimestamp": 0 + }, + "contractNativeMinterConfig": { + "blockTimestamp": 0, + "adminAddresses": [ + "0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC" + ] } }, "alloc": { From 99df7eee512de33eb06e7579a0934cc2487ff471 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 25 Sep 2023 18:15:57 -0400 Subject: [PATCH 005/183] Working test --- .github/workflows/e2e.yml | 3 +++ .vscode/settings.json | 4 +--- tests/e2e_test.go | 42 +++++++++++++++++++++++++++++++++++++++ tests/warp-genesis.json | 2 +- 4 files changed, 47 insertions(+), 4 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index a71c4909b..a01ef5fce 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -5,11 +5,14 @@ name: E2E Tests on: push: +<<<<<<< HEAD branches: - main pull_request: branches: - "*" +======= +>>>>>>> 3863c9b... Test on push env: GO_VERSION: "1.20.7" diff --git a/.vscode/settings.json b/.vscode/settings.json index 8b66fda7d..99f58cab9 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -21,7 +21,5 @@ } ] }, - "files.trimTrailingWhitespace": true, - "solidity.compileUsingRemoteVersion": "v0.8.18+commit.87f61d96", - "solidity.defaultCompiler": "remote" + "files.trimTrailingWhitespace": true } \ No newline at end of file diff --git a/tests/e2e_test.go b/tests/e2e_test.go index d5dc0ca61..2c039dd02 100644 --- a/tests/e2e_test.go +++ b/tests/e2e_test.go @@ -9,6 +9,7 @@ import ( "fmt" "math/big" "os" + "os/exec" "testing" "time" @@ -40,6 +41,7 @@ import ( const ( fundedKeyStr = "56289e99c94b6912bfc12adc093c9b51124f0dc54ac7a766b2bc5ccf558d8027" + bridgeDeployerKeyStr = "aad7440febfc8f9d73a58c3cb1f1754779a566978f9ebffcd4f4698e9b043985" warpGenesisFile = "./tests/warp-genesis.json" teleporterByteCodeFile = "./contracts/out/TeleporterMessenger.sol/TeleporterMessenger.json" ) @@ -59,6 +61,9 @@ var ( Receipts: []teleporter.TeleporterMessageReceipt{}, Message: []byte{1, 2, 3, 4}, } + nativeTokenBridgeContractAddress common.Address + nativeTokenBridgeDeployer = common.HexToAddress("0x1337cfd2dCff6270615B90938aCB1efE79801704") + nativeTokenBridgeDeployerPK *ecdsa.PrivateKey storageLocation = fmt.Sprintf("%s/.awm-relayer-storage", os.TempDir()) subnetIDs []ids.ID subnetA, subnetB ids.ID @@ -295,6 +300,43 @@ var _ = ginkgo.BeforeSuite(func() { } log.Info("Finished deploying Teleporter contracts") + // Deploy Native Token bridge on the two subnets + { + nativeTokenBridgeDeployerPK, err = crypto.HexToECDSA(bridgeDeployerKeyStr) + Expect(err).Should(BeNil()) + + cmd := exec.Command( + "forge", + "create", + "src/CrossChainApplications/NativeTokenBridge/NativeTokenMinter.sol:NativeTokenMinter", + "--rpc-url", chainARPCURI, + "--private-key", hexutil.Encode(nativeTokenBridgeDeployerPK.D.Bytes()), + "--constructor-args", teleporterContractAddress.Hex(), hexutil.Encode(chainBIDInt.Bytes())) + + cmd.Dir = "./contracts" + fmt.Println(cmd.Args) + // time.Sleep(10000 * time.Second) + output, err := cmd.Output() + fmt.Println(output) + Expect(err).Should(BeNil()) + } + { + cmd := exec.Command( + "forge", + "create", + "src/CrossChainApplications/NativeTokenBridge/NativeTokenMinter.sol:NativeTokenMinter", + "--rpc-url", chainBRPCURI, + "--private-key", hexutil.Encode(nativeTokenBridgeDeployerPK.D.Bytes()), + "--constructor-args", teleporterContractAddress.Hex(), hexutil.Encode(chainAIDInt.Bytes())) + + + cmd.Dir = "./contracts" + output, err := cmd.Output() + fmt.Println(output) + Expect(err).Should(BeNil()) + } + log.Info("Finished deploying Bridge contracts") + log.Info("Set up ginkgo before suite") }) diff --git a/tests/warp-genesis.json b/tests/warp-genesis.json index 5c10d832f..71aa30fcb 100644 --- a/tests/warp-genesis.json +++ b/tests/warp-genesis.json @@ -36,7 +36,7 @@ "0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC": { "balance": "0x52B7D2DCC80CD2E4000000" }, - "0x0Fa8EA536Be85F32724D57A37758761B86416123": { + "0x1337cfd2dCff6270615B90938aCB1efE79801704": { "balance": "0x52B7D2DCC80CD2E4000000" }, "0x1dD31B5351e76d51F4B152ce64fE5cf594694De5": { From 31120c7ae005bec0cf663e23cbd01cc429967b20 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 26 Sep 2023 12:45:53 -0400 Subject: [PATCH 006/183] Remove unnecessary files --- scripts/local/native/docker-compose-run.yml | 32 ---- scripts/local/native/docker-compose-test.yml | 50 ------ .../local/native/relayerConfigTemplate.json | 59 ------- scripts/local/native/run_relayer.sh | 50 ------ scripts/local/native/run_setup.sh | 148 ------------------ scripts/local/native/run_stop.sh | 29 ---- scripts/local/native/run_tests.sh | 42 ----- scripts/local/native/test.sh | 81 ---------- 8 files changed, 491 deletions(-) delete mode 100644 scripts/local/native/docker-compose-run.yml delete mode 100644 scripts/local/native/docker-compose-test.yml delete mode 100644 scripts/local/native/relayerConfigTemplate.json delete mode 100755 scripts/local/native/run_relayer.sh delete mode 100755 scripts/local/native/run_setup.sh delete mode 100755 scripts/local/native/run_stop.sh delete mode 100755 scripts/local/native/run_tests.sh delete mode 100755 scripts/local/native/test.sh diff --git a/scripts/local/native/docker-compose-run.yml b/scripts/local/native/docker-compose-run.yml deleted file mode 100644 index 1c4c1f3e2..000000000 --- a/scripts/local/native/docker-compose-run.yml +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright (C) 2023, Ava Labs, Inc. All rights reserved. -# See the file LICENSE for licensing terms. - -version: "3.9" -services: - local_network: - build: - context: ./ - dockerfile: ./docker/Dockerfile - args: - ARCH: ${ARCH} # set by run.sh - container_name: local_network_run - init: true - working_dir: /code - entrypoint: [ "/code/docker/run_setup.sh" ] - network_mode: "host" - volumes: - - type: bind - source: ./ - target: /code/ - relayer: - image: avaplatform/awm-relayer:v0.2.0 - container_name: relayer_run - init: true - working_dir: /code - entrypoint: /code/docker/run_relayer.sh - network_mode: "host" - user: "root" - volumes: - - type: bind - source: ./ - target: /code/ diff --git a/scripts/local/native/docker-compose-test.yml b/scripts/local/native/docker-compose-test.yml deleted file mode 100644 index 725b7d5ab..000000000 --- a/scripts/local/native/docker-compose-test.yml +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright (C) 2023, Ava Labs, Inc. All rights reserved. -# See the file LICENSE for licensing terms. - -version: "3.9" -services: - local_network: - image: local-network-image - build: - context: ./ - dockerfile: ./docker/Dockerfile - args: - ARCH: ${ARCH} # set by test.sh - container_name: local_network_test - init: true - working_dir: /code - entrypoint: [ "/code/scripts/local/native/run_setup.sh" ] - network_mode: "host" - volumes: - - type: bind - source: ./ - target: /code/ - relayer: - image: avaplatform/awm-relayer:v0.2.0 - init: true - working_dir: /code - entrypoint: /code/scripts/local/native/run_relayer.sh - network_mode: "host" - user: "root" - volumes: - - type: bind - source: ./ - target: /code/ - test_runner: - image: test-runner-image - build: - context: ./ - dockerfile: ./docker/Dockerfile - args: - ARCH: ${ARCH} # set by test.sh - container_name: test_runner - init: true - working_dir: /code - entrypoint: /code/scripts/local/native/run_tests.sh - network_mode: "host" - volumes: - - type: bind - source: ./ - target: /code/ - environment: - - TEST_TARGET="scripts/local/native/native.sh" diff --git a/scripts/local/native/relayerConfigTemplate.json b/scripts/local/native/relayerConfigTemplate.json deleted file mode 100644 index 95cd0341c..000000000 --- a/scripts/local/native/relayerConfigTemplate.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "network-id": 1337, - "p-chain-api-url": "http://127.0.0.1:9650", - "encrypt-connection": false, - "source-subnets": [ - { - "subnet-id": "11111111111111111111111111111111LpoYY", - "chain-id": "", - "vm": "evm", - "api-node-host": "127.0.0.1", - "api-node-port": 9650, - "encrypt-connection": false, - "message-contracts": { - "": { - "message-format": "teleporter", - "settings": { - "reward-address": "" - } - } - } - }, - { - "subnet-id": "", - "chain-id": "", - "vm": "evm", - "api-node-host": "127.0.0.1", - "api-node-port": 9650, - "encrypt-connection": false, - "message-contracts": { - "": { - "message-format": "teleporter", - "settings": { - "reward-address": "" - } - } - } - } - ], - "destination-subnets": [ - { - "subnet-id": "11111111111111111111111111111111LpoYY", - "chain-id": "", - "vm": "evm", - "api-node-host": "127.0.0.1", - "api-node-port": 9650, - "encrypt-connection": false, - "account-private-key": "" - }, - { - "subnet-id": "", - "chain-id": "", - "vm": "evm", - "api-node-host": "127.0.0.1", - "api-node-port": 9650, - "encrypt-connection": false, - "account-private-key": "" - } - ] -} \ No newline at end of file diff --git a/scripts/local/native/run_relayer.sh b/scripts/local/native/run_relayer.sh deleted file mode 100755 index 34c3c46fd..000000000 --- a/scripts/local/native/run_relayer.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env bash -# Copyright (C) 2023, Ava Labs, Inc. All rights reserved. -# See the file LICENSE for licensing terms. - - -set -e # Stop on first error - -# Needed for submodules -git config --global --add safe.directory '*' -if [[ $# -eq 1 ]] && [[ "$1" == "--local-tests-only" ]]; then - dir_prefix=. -else - dir_prefix=/code -fi - -rm -f $dir_prefix/NETWORK_READY - -until cat $dir_prefix/NETWORK_READY &> /dev/null -do - if [[ retry_count -ge 600 ]]; then - echo "Subnets didn't start up quickly enough." - exit 1 - fi - echo "Waiting for subnets to start up. Retry count: $retry_count" - retry_count=$((retry_count+1)) - sleep 1 -done - -# Source all variables set in run_setup.sh -set -a -source $dir_prefix/vars.sh || true # ignore readonly variable errors -set +a - -# Relayer constants -reward_address=0xA100fF48a37cab9f87c8b5Da933DA46ea1a5fb80 -account_private_key=C2CE4E001B7585F543982A01FBC537CFF261A672FA8BD1FAFC08A207098FE2DE - -# Populate the relayer configuration -relayerConfigFile=./relayerConfig.json -rm -f $relayerConfigFile - -# Avoid using sed -i due to Docker + MacOS M1 issues -sed "s//$subnet_a_chain_id/g - s//$subnet_a_subnet_id/g - s//$teleporter_contract_address/g - s//$c_chain_chain_id/g - s//$reward_address/g - s//$account_private_key/g" ./scripts/local/native/relayerConfigTemplate.json > $relayerConfigFile - -/usr/bin/awm-relayer --config-file $relayerConfigFile diff --git a/scripts/local/native/run_setup.sh b/scripts/local/native/run_setup.sh deleted file mode 100755 index c10fae594..000000000 --- a/scripts/local/native/run_setup.sh +++ /dev/null @@ -1,148 +0,0 @@ -#!/usr/bin/env bash -# Copyright (C) 2023, Ava Labs, Inc. All rights reserved. -# See the file LICENSE for licensing terms. - - -set -e # Stop on first error - -# Needed for submodules -git config --global --add safe.directory '*' -if [[ $# -eq 1 ]] && [[ "$1" == "--local-tests-only" ]]; then - dir_prefix=. -else - dir_prefix=/code -fi - -source $dir_prefix/scripts/utils.sh - -# Signifies container is ready -rm -f $dir_prefix/NETWORK_READY - -# Set up the network if this is the first time the container is starting -if [ ! -e $dir_prefix/NETWORK_RUNNING ]; then - rm -f $dir_prefix/vars.sh - - cd subnet-evm - - # Source $AVALANCHEGO_VERSION from versions.sh - source ./scripts/versions.sh - - # Build the subnet-evm - export VM_BUILD_PATH=$"/tmp/subnet-evm-runner" - ./scripts/build.sh $VM_BUILD_PATH/srEXiWaHuhNyGwPUi444Tu47ZEDwxTWrbQiuD7FmgSAQ6X7Dy - cd .. - - echo "Avalanche cli version: $(avalanche --version --skip-update-check)" - - # Start the local Avalanche network - avalanche network clean --skip-update-check - - # Configure the subnet genesis files for the three subnets to be created. - # Avoid using sed -i due to docker + macos m1 issues - rm -f ./subnetGenesis_*.json - sed "s/\"\"/68430/g" ./docker/genesisTemplate.json > subnetGenesis_A.json - - # Deploy a test subnets to the local network. - echo "Creating new subnet A..." - avalanche subnet create subneta --force --custom --genesis ./subnetGenesis_A.json --config ./docker/defaultNodeConfig.json --vm $VM_BUILD_PATH/srEXiWaHuhNyGwPUi444Tu47ZEDwxTWrbQiuD7FmgSAQ6X7Dy --log-level info --skip-update-check - avalanche subnet configure subneta --config ./docker/defaultNodeConfig.json --chain-config ./docker/defaultChainConfig.json --skip-update-check - avalanche subnet deploy subneta --local --avalanchego-version $AVALANCHEGO_VERSION --config ./docker/defaultNodeConfig.json --log-level info --skip-update-check - - # Find the proper Avalanche CLI log directory - function getJsonVal () { - python3 -c "import json,sys;sys.stdout.write(json.dumps(json.load(sys.stdin)$1).strip('\"'))"; - } - - subnet_a_chain_id=$(cat $HOME/.avalanche-cli/subnets/subneta/sidecar.json | getJsonVal "['Networks']['Local Network']['BlockchainID']") - subnet_a_subnet_id=$(cat $HOME/.avalanche-cli/subnets/subneta/sidecar.json | getJsonVal "['Networks']['Local Network']['SubnetID']") - c_chain_subnet_id=11111111111111111111111111111111LpoYY # hardcoded primary subnet ID - c_chain_chain_id=$(curl -X POST --data '{"jsonrpc": "2.0","method": "platform.getBlockchains","params": {},"id": 1}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P | getJsonVal "['result']['blockchains']" | python3 docker/getBlockChainId.py C-Chain) - - echo "Subnet A chain ID: $subnet_a_chain_id" - echo "C-Chain chain ID: $c_chain_chain_id" - - user_private_key=0x56289e99c94b6912bfc12adc093c9b51124f0dc54ac7a766b2bc5ccf558d8027 - user_address_bytes=8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC - user_address=0x$user_address_bytes # Address corresponding to the user_private_key - - export PATH="$PATH:$HOME/.foundry/bin" - - subnet_a_url="http://127.0.0.1:9650/ext/bc/$subnet_a_chain_id/rpc" - c_chain_url="http://127.0.0.1:9650/ext/bc/C/rpc" - - # Deploy TeleporterMessenger contract to each chain. - cd contracts - forge build - cd .. - go run contract-deployment/contractDeploymentTools.go constructKeylessTx contracts/out/TeleporterMessenger.sol/TeleporterMessenger.json - teleporter_deploy_address=$(cat UniversalTeleporterDeployerAddress.txt) - teleporter_deploy_tx=$(cat UniversalTeleporterDeployerTransaction.txt) - teleporter_contract_address=$(cat UniversalTeleporterMessengerContractAddress.txt) - echo $teleporter_deploy_address $teleporter_contract_address - echo "Finished reading universal deploy address and transaction" - - cast send --private-key $user_private_key --value 50ether $teleporter_deploy_address --rpc-url $subnet_a_url - cast send --private-key $user_private_key --value 50ether $teleporter_deploy_address --rpc-url $c_chain_url - echo "Sent ether to teleporter deployer on each subnet." - - # Verify that the transaction status was successful for the deployments - status=$(cast publish --rpc-url $subnet_a_url $teleporter_deploy_tx | getJsonVal "['status']") - if [[ $status != "0x1" ]]; then - echo "Error deploying Teleporter Messenger transaction on subnet A." - exit 1 - fi - echo "Deployed TeleporterMessenger to Subnet A" - status=$(cast publish --rpc-url $c_chain_url $teleporter_deploy_tx | getJsonVal "['status']") - if [[ $status != "0x1" ]]; then - echo "Error deploying Teleporter Messenger transaction on C Chain." - exit 1 - fi - echo "Deployed TeleporterMessenger to C Chain" - - # Send tokens to cover gas costs for the relayers. - relayer_private_key=C2CE4E001B7585F543982A01FBC537CFF261A672FA8BD1FAFC08A207098FE2DE - relayer_address=0xA100fF48a37cab9f87c8b5Da933DA46ea1a5fb80 - - cast send --private-key $user_private_key --value 500ether $relayer_address --rpc-url $subnet_a_url - cast send --private-key $user_private_key --value 500ether $relayer_address --rpc-url $c_chain_url - echo "Sent ether to relayer account on each subnet." - - subnet_a_chain_id_hex=$(getBlockChainIDHex $subnet_a_chain_id) - subnet_a_subnet_id_hex=$(getBlockChainIDHex $subnet_a_subnet_id) - c_chain_chain_id_hex=$(getBlockChainIDHex $c_chain_chain_id) - c_chain_subnet_id_hex=$(getBlockChainIDHex $c_chain_subnet_id) - warp_messenger_precompile_addr=0x0200000000000000000000000000000000000005 - - # Write all vars to file so that they can be imported from another container - set > $dir_prefix/vars.sh - - # Indicate for future runs that we started up successfully - touch $dir_prefix/NETWORK_RUNNING -else - echo "Resuming network from previous run" - source $dir_prefix/vars.sh || true - avalanche network start --skip-update-check - restart="restart" -fi - -# Signal other containers this container is ready -touch $dir_prefix/NETWORK_READY - -function cleanup() -{ - echo "Stopping the network..." - avalanche network stop --skip-update-check - echo "Gracefully shut down the network." -} - -trap cleanup EXIT - -# Stream the subnet logs -network_runner_dir=$(python3 docker/findCliLogDirectory.py $restart) -subnet_a_log_file=$HOME/.avalanche-cli/runs/$network_runner_dir/node1/logs/$subnet_a_chain_id.log - -echo "Streaming subnet A log file at $subnet_a_log_file" - -tail -f $subnet_a_log_file & - -wait $! diff --git a/scripts/local/native/run_stop.sh b/scripts/local/native/run_stop.sh deleted file mode 100755 index bee5c5fb2..000000000 --- a/scripts/local/native/run_stop.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash -# Copyright (C) 2023, Ava Labs, Inc. All rights reserved. -# See the file LICENSE for licensing terms. - -set -e # Stop on first error -source ./scripts/utils.sh - -if [[ $# -gt 1 ]]; then - echo "Invalid number of arguments. Usage:" - echo " ./scripts/local/run_stop.sh # stop the running containers and preserve the network for subsequent runs" - echo " ./scripts/local/run_stop.sh -c # stop the running containers and clean the network" - exit 1 -fi - -clean=false -while getopts c flag -do - case "${flag}" in - c ) clean=true;; - esac -done - -# If clean flag is set we remove network running file to start the network from scratch -if $clean -then - rm -f NETWORK_RUNNING -fi - -docker compose -f scripts/local/native/docker-compose-run.yml --project-directory ./ stop \ No newline at end of file diff --git a/scripts/local/native/run_tests.sh b/scripts/local/native/run_tests.sh deleted file mode 100755 index a08a480d3..000000000 --- a/scripts/local/native/run_tests.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env bash -# Copyright (C) 2023, Ava Labs, Inc. All rights reserved. -# See the file LICENSE for licensing terms. - -set -e # Stop on first error - -# Needed for submodules -git config --global --add safe.directory '*' -if [[ $# -eq 1 ]] && [[ "$1" == "--local-tests-only" ]]; then - dir_prefix=. -else - dir_prefix=/code -fi - -rm -f $dir_prefix/NETWORK_READY - -until cat $dir_prefix/NETWORK_READY &> /dev/null -do - if [[ retry_count -ge 60 ]]; then - echo "Subnets didn't start up quickly enough." - exit 1 - fi - echo "Waiting for subnets to start up. Retry count: $retry_count" - retry_count=$((retry_count+1)) - sleep 10 -done - -# Wait for relayers to start and subscribe -sleep 3 - -# Source all variables set in run_setup.sh -set -a -source $dir_prefix/vars.sh || true # ignore readonly variable errors -source $dir_prefix/scripts/utils.sh -set +a - -echo "Running test ./scripts/local/native/native.sh" -./scripts/local/native/native.sh -echo "Done running test ./scripts/local/native/native.sh" -echo "" - -exit 0 diff --git a/scripts/local/native/test.sh b/scripts/local/native/test.sh deleted file mode 100755 index c823fdaa0..000000000 --- a/scripts/local/native/test.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/env bash -# Copyright (C) 2023, Ava Labs, Inc. All rights reserved. -# See the file LICENSE for licensing terms. - -set -e # Stop on first error -source ./scripts/utils.sh - -TEST_TARGET= -LOCAL_RELAYER_IMAGE= -TESTNET= -HELP= -while [ $# -gt 0 ]; do - case "$1" in - -t | --test) export TEST_TARGET=$2 ;; - -l | --local-relayer-image) LOCAL_RELAYER_IMAGE=$2 ;; - -h | --help) HELP=true ;; - esac - shift -done - -if [ "$HELP" = true ]; then - echo "Usage: ./scripts/local/test.sh [OPTIONS]" - echo "Run integration tests for Teleporter." - echo "" - echo "Options:" - echo " -t, --test Run a specific test. If empty, runs all tests in the ./scripts/local/integration-tests/" - echo " -t, --test "test1 test2" Run multiple tests. Test names must be space delimited and enclosed in quotes" - echo " -l, --local-relayer-image Use a local AWM Relayer image instead of pulling from dockerhub" - echo " -h, --help Print this help message" - exit 0 -fi - -function cleanup { - echo "Shutting down network before exiting..." - ./scripts/local/run_stop.sh - echo "Network stopped" -} - -# Set up the trap to catch the SIGINT signal (CTRL+C) -# Note that the output of the cleanup function defined in run_setup.sh does not appear if CTRL+C is used to kill this script, -# but the function does in fact run as expected. -trap cleanup SIGTERM -trap cleanup SIGINT - -# Set ARCH env so as a container executes without issues in a portable way -# Should be amd64 for linux/macos x86 hosts, and arm64 for macos M1 -# It is referenced in the docker composer yaml, and then passed as a Dockerfile ARG -setARCH - -if [ -z "$LOCAL_RELAYER_IMAGE" ]; then - echo "Using published awm-relayer image" - docker compose -f scripts/local/native/docker-compose-test.yml --project-directory ./ up --exit-code-from test_runner --build & -else - echo "Using local awm-relayer image: $LOCAL_RELAYER_IMAGE" - if [[ "$(docker images -q awm-relayer:$LOCAL_RELAYER_IMAGE 2> /dev/null)" == "" ]]; then - echo "awm-relayer:$LOCAL_RELAYER_IMAGE does not exist locally. Exiting." - exit 1 - fi - rm -f docker/docker-compose-test-local.yml - sed "s//$LOCAL_RELAYER_IMAGE/g" docker/docker-compose-test-local-template.yml > docker/docker-compose-test-local.yml - docker compose -f docker/docker-compose-test-local.yml --project-directory ./ up --build & -fi - -# Wait for the containers to start up -until [ "$( docker container inspect --format '{{.State.Running}}' test_runner )" == "true" ] -do - echo "Waiting for containers to start..." - sleep 1 -done -echo "Containers started." - -# Wait for the test runner to exit, then grab the exit code -until [ "$( docker container inspect --format '{{.State.Running}}' test_runner )" == "false" ] -do - sleep 10 -done - -# Stop the containers gracefully -./scripts/local/native/run_stop.sh -code=$(docker inspect --format='{{.State.ExitCode}}' test_runner) -exit $code From 36465eda32b44250a363cc76fad8113cde941302 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 26 Sep 2023 12:53:47 -0400 Subject: [PATCH 007/183] Remove Imported contracts --- .../NativeTokenBridge/AllowList.sol | 74 ------------------- .../NativeTokenBridge/IAllowList.sol | 16 ---- .../NativeTokenBridge/INativeMinter.sol | 8 -- .../NativeTokenBridge/NativeTokenMinter.sol | 10 +-- .../NativeTokenBridge/NativeTokenReceiver.sol | 2 +- 5 files changed, 6 insertions(+), 104 deletions(-) delete mode 100644 contracts/src/CrossChainApplications/NativeTokenBridge/AllowList.sol delete mode 100644 contracts/src/CrossChainApplications/NativeTokenBridge/IAllowList.sol delete mode 100644 contracts/src/CrossChainApplications/NativeTokenBridge/INativeMinter.sol diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/AllowList.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/AllowList.sol deleted file mode 100644 index 924601422..000000000 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/AllowList.sol +++ /dev/null @@ -1,74 +0,0 @@ -//SPDX-License-Identifier: MIT -pragma solidity 0.8.18; - -import "./IAllowList.sol"; -import "@openzeppelin/contracts/access/Ownable.sol"; - -// AllowList is a base contract to use AllowList precompile capabilities. -contract AllowList is Ownable { - enum Role { - None, - Enabled, - Admin - } - - // Precompiled Allow List Contract Address - IAllowList private _allowList; - - uint256 public constant STATUS_NONE = 0; - uint256 public constant STATUS_ENABLED = 1; - uint256 public constant STATUS_ADMIN = 2; - - error NotEnabled(); - error CannotRevokeOwnRule(); - - modifier onlyEnabled() { - if (!isEnabled(msg.sender)) { - revert NotEnabled(); - } - _; - } - - constructor(address precompileAddr) Ownable() { - _allowList = IAllowList(precompileAddr); - } - - function setAdmin(address addr) public virtual onlyOwner { - _setAdmin(addr); - } - - function setEnabled(address addr) public virtual onlyOwner { - _setEnabled(addr); - } - - function revoke(address addr) public virtual onlyOwner { - _revoke(addr); - } - - function isAdmin(address addr) public view returns (bool) { - uint256 result = _allowList.readAllowList(addr); - return result == STATUS_ADMIN; - } - - function isEnabled(address addr) public view returns (bool) { - uint256 result = _allowList.readAllowList(addr); - // if address is ENABLED or ADMIN it can deploy - // in other words, if it's not NONE it can deploy. - return result != STATUS_NONE; - } - - function _setAdmin(address addr) private { - _allowList.setAdmin(addr); - } - - function _setEnabled(address addr) private { - _allowList.setEnabled(addr); - } - - function _revoke(address addr) private { - if (msg.sender == addr) { - revert CannotRevokeOwnRule(); - } - _allowList.setNone(addr); - } -} diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/IAllowList.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/IAllowList.sol deleted file mode 100644 index 691b4065a..000000000 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/IAllowList.sol +++ /dev/null @@ -1,16 +0,0 @@ -//SPDX-License-Identifier: MIT -pragma solidity 0.8.18; - -interface IAllowList { - // Set [addr] to have the admin role over the precompile contract. - function setAdmin(address addr) external; - - // Set [addr] to be enabled on the precompile contract. - function setEnabled(address addr) external; - - // Set [addr] to have no role for the precompile contract. - function setNone(address addr) external; - - // Read the status of [addr]. - function readAllowList(address addr) external view returns (uint256 role); -} diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeMinter.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeMinter.sol deleted file mode 100644 index 7d869eba0..000000000 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeMinter.sol +++ /dev/null @@ -1,8 +0,0 @@ -//SPDX-License-Identifier: MIT -pragma solidity 0.8.18; -import "./IAllowList.sol"; - -interface INativeMinter is IAllowList { - // Mint [amount] number of native coins and send to [addr] - function mintNativeCoin(address addr, uint256 amount) external; -} diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenMinter.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenMinter.sol index 69d6563fa..8dd49eca9 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenMinter.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenMinter.sol @@ -1,21 +1,21 @@ //SPDX-License-Identifier: MIT pragma solidity 0.8.18; +import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@subnet-evm-contracts/interfaces/IWarpMessenger.sol"; -import "./INativeMinter.sol"; -import "./AllowList.sol"; +import "@subnet-evm-contracts/interfaces/IAllowList.sol"; +import "@subnet-evm-contracts/interfaces/INativeMinter.sol"; import "./INativeTokenMinter.sol"; import "../../Teleporter/ITeleporterMessenger.sol"; import "../../Teleporter/ITeleporterReceiver.sol"; import "../../Teleporter/SafeERC20TransferFrom.sol"; -import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; // Precompiled Native Minter Contract Address address constant MINTER_ADDRESS = 0x0200000000000000000000000000000000000001; // Designated Blackhole Address address constant BLACKHOLE_ADDRESS = 0x0100000000000000000000000000000000000000; -contract NativeTokenMinter is ITeleporterReceiver, INativeTokenMinter, AllowList, ReentrancyGuard { +contract NativeTokenMinter is ITeleporterReceiver, INativeTokenMinter, ReentrancyGuard { INativeMinter private _nativeMinter = INativeMinter(MINTER_ADDRESS); address public constant WARP_PRECOMPILE_ADDRESS = @@ -38,7 +38,7 @@ contract NativeTokenMinter is ITeleporterReceiver, INativeTokenMinter, AllowList error InsufficientAdjustedAmount(uint256 adjustedAmount, uint256 feeAmount); // TODO we probably want to add the original token supply from this chain to the constructor. - constructor(address teleporterMessengerAddress, bytes32 partnerChainID_) AllowList(MINTER_ADDRESS) { + constructor(address teleporterMessengerAddress, bytes32 partnerChainID_) { if (teleporterMessengerAddress == address(0)) { revert InvalidTeleporterMessengerAddress(); } diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenReceiver.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenReceiver.sol index 40ab7f7fc..14a3b4405 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenReceiver.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenReceiver.sol @@ -1,12 +1,12 @@ //SPDX-License-Identifier: MIT pragma solidity 0.8.18; +import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@subnet-evm-contracts/interfaces/IWarpMessenger.sol"; import "./INativeTokenReceiver.sol"; import "../../Teleporter/ITeleporterMessenger.sol"; import "../../Teleporter/ITeleporterReceiver.sol"; import "../../Teleporter/SafeERC20TransferFrom.sol"; -import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; contract NativeTokenMinter is ITeleporterReceiver, INativeTokenReceiver, ReentrancyGuard { address public constant WARP_PRECOMPILE_ADDRESS = From f7ee05a3bcfe332ad85769b99a9725c9f90e601e Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 26 Sep 2023 12:39:09 -0400 Subject: [PATCH 008/183] wip --- .github/workflows/e2e.yml | 3 - contracts/remappings.txt | 3 +- .../NativeTokenBridge/NativeTokenMinter.sol | 18 +- .../src/Teleporter/TeleporterMessenger.sol | 1 + tests/e2e_test.go | 233 +++++++++++++++++- tests/warp-genesis.json | 3 +- 6 files changed, 241 insertions(+), 20 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index a01ef5fce..a71c4909b 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -5,14 +5,11 @@ name: E2E Tests on: push: -<<<<<<< HEAD branches: - main pull_request: branches: - "*" -======= ->>>>>>> 3863c9b... Test on push env: GO_VERSION: "1.20.7" diff --git a/contracts/remappings.txt b/contracts/remappings.txt index f2384d685..1982d40b1 100644 --- a/contracts/remappings.txt +++ b/contracts/remappings.txt @@ -1,2 +1,3 @@ @subnet-evm-contracts=../subnet-evm/contracts/contracts -@openzeppelin/=lib/openzeppelin-contracts/ \ No newline at end of file +@openzeppelin/=lib/openzeppelin-contracts/ +@ds-test/=lib/forge-std/lib/ds-test/src/ \ No newline at end of file diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenMinter.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenMinter.sol index 8dd49eca9..085a0aeec 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenMinter.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenMinter.sol @@ -103,14 +103,16 @@ contract NativeTokenMinter is ITeleporterReceiver, INativeTokenMinter, Reentranc // Lock tokens in this bridge instance. Supports "fee/burn on transfer" ERC20 token // implementations by only bridging the actual balance increase reflected by the call // to transferFrom. - uint256 adjustedAmount = SafeERC20TransferFrom.safeTransferFrom( - IERC20(feeTokenContractAddress), - feeAmount - ); - - // Ensure that the adjusted amount is greater than the fee to be paid. - if (adjustedAmount <= feeAmount) { - revert InsufficientAdjustedAmount(adjustedAmount, feeAmount); + if (feeAmount > 0) { + uint256 adjustedAmount = SafeERC20TransferFrom.safeTransferFrom( + IERC20(feeTokenContractAddress), + feeAmount + ); + + // Ensure that the adjusted amount is greater than the fee to be paid. + if (adjustedAmount <= feeAmount) { + revert InsufficientAdjustedAmount(adjustedAmount, feeAmount); + } } // Burn native token by sending to BLACKHOLE_ADDRESS diff --git a/contracts/src/Teleporter/TeleporterMessenger.sol b/contracts/src/Teleporter/TeleporterMessenger.sol index 4e5d04fb9..2094c9812 100644 --- a/contracts/src/Teleporter/TeleporterMessenger.sol +++ b/contracts/src/Teleporter/TeleporterMessenger.sol @@ -233,6 +233,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { ); // Store the updated fee amount, and emit it as an event. + // currentMessageInfo.feeInfo.amount += adjustedAmount; sentMessageInfo[destinationChainID][messageID] .feeInfo .amount += adjustedAmount; diff --git a/tests/e2e_test.go b/tests/e2e_test.go index 2c039dd02..b59c6edbd 100644 --- a/tests/e2e_test.go +++ b/tests/e2e_test.go @@ -314,10 +314,7 @@ var _ = ginkgo.BeforeSuite(func() { "--constructor-args", teleporterContractAddress.Hex(), hexutil.Encode(chainBIDInt.Bytes())) cmd.Dir = "./contracts" - fmt.Println(cmd.Args) - // time.Sleep(10000 * time.Second) - output, err := cmd.Output() - fmt.Println(output) + err := cmd.Run() Expect(err).Should(BeNil()) } { @@ -329,10 +326,9 @@ var _ = ginkgo.BeforeSuite(func() { "--private-key", hexutil.Encode(nativeTokenBridgeDeployerPK.D.Bytes()), "--constructor-args", teleporterContractAddress.Hex(), hexutil.Encode(chainAIDInt.Bytes())) - + cmd.Dir = "./contracts" - output, err := cmd.Output() - fmt.Println(output) + err := cmd.Run() Expect(err).Should(BeNil()) } log.Info("Finished deploying Bridge contracts") @@ -605,3 +601,226 @@ var _ = ginkgo.Describe("[Teleporter one way send]", ginkgo.Ordered, func() { }) }) + +// Ginkgo describe node that acts as a container for the teleporter e2e tests. This test suite +// will run through the following steps in order: +// 1. +var _ = ginkgo.Describe("[Native Token Bridge one way send]", ginkgo.Ordered, func() { + // Send a transaction to Subnet A to issue a Warp Message from the Teleporter contract to Subnet B + ginkgo.It("Send Message from A to B", ginkgo.Label("NativeTokenBridge", "SendNativeTokenBridge"), func() { + ctx := context.Background() + + cmd := exec.CommandContext( + ctx, + "cast", + "send", + nativeTokenBridgeContractAddress.Hex(), + "bridgeTokens(address,address,uint256)", + fundedAddress.Hex(), + fundedAddress.Hex(), // TODO use different address + "0x00", + "--rpc-url", chainARPCURI, + "--private-key", hexutil.Encode(nativeTokenBridgeDeployerPK.D.Bytes())) + + err := cmd.Run() + Expect(err).Should(BeNil()) + + // Sleep to ensure the new block is published to the subscriber + time.Sleep(5 * time.Second) + + }) + + // ginkgo.It("Relay message to destination", ginkgo.Label("Teleporter", "RelayMessage"), func() { + // ctx := context.Background() + + // // Get the latest block from Subnet A, and retrieve the warp message from the logs + // log.Info("Waiting for new block confirmation") + // newHeadA := <-newHeadsA + // blockHashA := newHeadA.Hash() + + // log.Info("Fetching relevant warp logs from the newly produced block") + // logs, err := chainARPCClient.FilterLogs(ctx, interfaces.FilterQuery{ + // BlockHash: &blockHashA, + // Addresses: []common.Address{warp.Module.Address}, + // }) + // Expect(err).Should(BeNil()) + // Expect(len(logs)).Should(Equal(1)) + + // // Check for relevant warp log from subscription and ensure that it matches + // // the log extracted from the last block. + // txLog := logs[0] + // log.Info("Parsing logData as unsigned warp message") + // unsignedMsg, err := avalancheWarp.ParseUnsignedMessage(txLog.Data) + // Expect(err).Should(BeNil()) + + // // Set local variables for the duration of the test + // unsignedWarpMessageID := unsignedMsg.ID() + // unsignedWarpMsg := unsignedMsg + // log.Info("Parsed unsignedWarpMsg", "unsignedWarpMessageID", unsignedWarpMessageID, "unsignedWarpMessage", unsignedWarpMsg) + + // // Loop over each client on chain A to ensure they all have time to accept the block. + // // Note: if we did not confirm this here, the next stage could be racy since it assumes every node + // // has accepted the block. + // for i, uri := range chainANodeURIs { + // chainAWSURI := httpToWebsocketURI(uri, blockchainIDA.String()) + // log.Info("Creating ethclient for blockchainA", "wsURI", chainAWSURI) + // client, err := ethclient.Dial(chainAWSURI) + // Expect(err).Should(BeNil()) + + // // Loop until each node has advanced to >= the height of the block that emitted the warp log + // for { + // block, err := client.BlockByNumber(ctx, nil) + // Expect(err).Should(BeNil()) + // if block.NumberU64() >= newHeadA.Number.Uint64() { + // log.Info("client accepted the block containing SendWarpMessage", "client", i, "height", block.NumberU64()) + // break + // } + // } + // } + + // // Get the aggregate signature for the Warp message + // log.Info("Fetching aggregate signature from the source chain validators") + // warpClient, err := warpBackend.NewWarpClient(chainANodeURIs[0], blockchainIDA.String()) + // Expect(err).Should(BeNil()) + // signedWarpMessageBytes, err := warpClient.GetAggregateSignature(ctx, unsignedWarpMessageID, params.WarpQuorumDenominator) + // Expect(err).Should(BeNil()) + + // // Construct the transaction to send the Warp message to the destination chain + // log.Info("Constructing transaction for the destination chain") + // signedMessage, err := avalancheWarp.ParseMessage(signedWarpMessageBytes) + // Expect(err).Should(BeNil()) + + // numSigners, err := signedMessage.Signature.NumSigners() + // Expect(err).Should(BeNil()) + + // gasLimit, err := teleporter.CalculateReceiveMessageGasLimit(numSigners, teleporterMessage.RequiredGasLimit) + // Expect(err).Should(BeNil()) + + // callData, err := teleporter.EVMTeleporterContractABI.Pack("receiveCrossChainMessage", fundedAddress) + // Expect(err).Should(BeNil()) + + // baseFee, err := chainBRPCClient.EstimateBaseFee(ctx) + // Expect(err).Should(BeNil()) + + // gasTipCap, err := chainBRPCClient.SuggestGasTipCap(ctx) + // Expect(err).Should(BeNil()) + + // nonce, err := chainBRPCClient.NonceAt(ctx, fundedAddress, nil) + // Expect(err).Should(BeNil()) + + // gasFeeCap := baseFee.Mul(baseFee, big.NewInt(2)) + // gasFeeCap.Add(gasFeeCap, big.NewInt(2500000000)) + // destinationTx := predicateutils.NewPredicateTx( + // chainBIDInt, + // nonce, + // &teleporterContractAddress, + // gasLimit, + // gasFeeCap, + // gasTipCap, + // big.NewInt(0), + // callData, + // types.AccessList{}, + // warp.ContractAddress, + // signedMessage.Bytes(), + // ) + + // // Sign and send the transaction on the destination chain + // signer := types.LatestSignerForChainID(chainBIDInt) + // signedTxB, err := types.SignTx(destinationTx, signer, fundedKey) + // Expect(err).Should(BeNil()) + + // log.Info("Subscribing to new heads on destination chain") + // subB, err := chainBWSClient.SubscribeNewHead(ctx, newHeadsB) + // Expect(err).Should(BeNil()) + // defer subB.Unsubscribe() + + // log.Info("Sending transaction to destination chain") + // err = chainBRPCClient.SendTransaction(context.Background(), signedTxB) + // Expect(err).Should(BeNil()) + + // // Sleep to ensure the new block is published to the subscriber + // time.Sleep(5 * time.Second) + // receipt, err := chainBRPCClient.TransactionReceipt(ctx, signedTxB.Hash()) + // Expect(err).Should(BeNil()) + // Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + // }) + + // ginkgo.It("Receive message on Subnet B", ginkgo.Label("Teleporter", "ReceiveTeleporter"), func() { + // ctx := context.Background() + + // // Get the latest block from Subnet B + // log.Info("Waiting for new block confirmation") + // newHeadB := <-newHeadsB + // log.Info("Received new head", "height", newHeadB.Number.Uint64()) + // blockHashB := newHeadB.Hash() + // block, err := chainBRPCClient.BlockByHash(ctx, blockHashB) + // Expect(err).Should(BeNil()) + // log.Info( + // "Got block", + // "blockHash", blockHashB, + // "blockNumber", block.NumberU64(), + // "transactions", block.Transactions(), + // "numTransactions", len(block.Transactions()), + // "block", block, + // ) + // accessLists := block.Transactions()[0].AccessList() + // Expect(len(accessLists)).Should(Equal(1)) + // Expect(accessLists[0].Address).Should(Equal(warp.Module.Address)) + + // // Check the transaction storage key has warp message we're expecting + // storageKeyHashes := accessLists[0].StorageKeys + // packedPredicate := predicateutils.HashSliceToBytes(storageKeyHashes) + // predicateBytes, err := predicateutils.UnpackPredicate(packedPredicate) + // Expect(err).Should(BeNil()) + // receivedWarpMessage, err = avalancheWarp.ParseMessage(predicateBytes) + // Expect(err).Should(BeNil()) + + // // Check that the transaction has successful receipt status + // txHash := block.Transactions()[0].Hash() + // receipt, err := chainBRPCClient.TransactionReceipt(ctx, txHash) + // Expect(err).Should(BeNil()) + // Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + + // log.Info("Finished sending warp message, closing down output channel") + + // }) + + // ginkgo.It("Validate Received Warp Message Values", ginkgo.Label("Teleporter", "VerifyWarp"), func() { + // Expect(receivedWarpMessage.SourceChainID).Should(Equal(blockchainIDA)) + // addressedPayload, err := warpPayload.ParseAddressedPayload(receivedWarpMessage.Payload) + // Expect(err).Should(BeNil()) + + // receivedDestinationID, err := ids.ToID(addressedPayload.DestinationChainID.Bytes()) + // Expect(err).Should(BeNil()) + // Expect(receivedDestinationID).Should(Equal(blockchainIDB)) + // Expect(addressedPayload.DestinationAddress).Should(Equal(teleporterContractAddress)) + // Expect(addressedPayload.Payload).Should(Equal(payload)) + + // // Check that the teleporter message is correct + // receivedTeleporterMessage, err := teleporter.UnpackTeleporterMessage(addressedPayload.Payload) + // Expect(err).Should(BeNil()) + // Expect(*receivedTeleporterMessage).Should(Equal(teleporterMessage)) + + // teleporterMessageID = receivedTeleporterMessage.MessageID + // }) + + // ginkgo.It("Check Teleporter Message Received", ginkgo.Label("Teleporter", "TeleporterMessageReceived"), func() { + // data, err := teleporter.PackMessageReceivedMessage(teleporter.MessageReceivedInput{ + // OriginChainID: blockchainIDA, + // MessageID: teleporterMessageID, + // }) + // Expect(err).Should(BeNil()) + // callMessage := interfaces.CallMsg{ + // To: &teleporterContractAddress, + // Data: data, + // } + // result, err := chainBRPCClient.CallContract(context.Background(), callMessage, nil) + // Expect(err).Should(BeNil()) + + // // check the contract call result + // delivered, err := teleporter.UnpackMessageReceivedResult(result) + // Expect(err).Should(BeNil()) + // Expect(delivered).Should(BeTrue()) + // }) + +}) diff --git a/tests/warp-genesis.json b/tests/warp-genesis.json index 71aa30fcb..c5653c7b8 100644 --- a/tests/warp-genesis.json +++ b/tests/warp-genesis.json @@ -28,7 +28,8 @@ "contractNativeMinterConfig": { "blockTimestamp": 0, "adminAddresses": [ - "0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC" + "0x1337cfd2dCff6270615B90938aCB1efE79801704", + "0xAcB633F5B00099c7ec187eB00156c5cd9D854b5B" ] } }, From 91b83aed3298d556a532f58598ca8ee0edc6d8fa Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 26 Sep 2023 13:27:05 -0400 Subject: [PATCH 009/183] remove unneeded change --- contracts/remappings.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/contracts/remappings.txt b/contracts/remappings.txt index 1982d40b1..f2384d685 100644 --- a/contracts/remappings.txt +++ b/contracts/remappings.txt @@ -1,3 +1,2 @@ @subnet-evm-contracts=../subnet-evm/contracts/contracts -@openzeppelin/=lib/openzeppelin-contracts/ -@ds-test/=lib/forge-std/lib/ds-test/src/ \ No newline at end of file +@openzeppelin/=lib/openzeppelin-contracts/ \ No newline at end of file From 6d271c563addc13dbf294310a442fed648c32588 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 26 Sep 2023 13:47:52 -0400 Subject: [PATCH 010/183] Update Geth --- go.mod | 45 ++++++----- go.sum | 54 +++++++++++++ go.work.sum | 225 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 305 insertions(+), 19 deletions(-) diff --git a/go.mod b/go.mod index cea306b14..8efedb04c 100644 --- a/go.mod +++ b/go.mod @@ -3,40 +3,45 @@ module github.com/ava-labs/teleporter go 1.18 require ( - github.com/ava-labs/avalanchego v1.10.9 + github.com/ava-labs/avalanchego v1.10.4 github.com/supranational/blst v0.3.11 // indirect ) require ( - github.com/ava-labs/avalanche-network-runner v1.7.2-0.20230825150237-723bc7b31724 - github.com/ava-labs/awm-relayer v0.2.1-0.20230920145222-b8571020bdaa - github.com/ava-labs/coreth v0.12.5-rc.3 - github.com/ava-labs/subnet-evm v0.5.4 - github.com/ethereum/go-ethereum v1.12.0 + github.com/ava-labs/avalanche-network-runner v1.7.0 + github.com/ava-labs/awm-relayer v0.1.1 + github.com/ava-labs/coreth v0.12.4-rc.3 + github.com/ava-labs/subnet-evm v0.5.3-coreth-sync-rc + github.com/ethereum/go-ethereum v1.13.1 github.com/onsi/ginkgo/v2 v2.12.0 github.com/onsi/gomega v1.27.10 ) require ( github.com/DataDog/zstd v1.5.2 // indirect - github.com/Microsoft/go-winio v0.5.2 // indirect + github.com/Microsoft/go-winio v0.6.1 // indirect github.com/NYTimes/gziphandler v1.1.1 // indirect github.com/VictoriaMetrics/fastcache v1.10.0 // indirect github.com/beorn7/perks v1.0.1 // indirect + github.com/bits-and-blooms/bitset v1.9.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect github.com/btcsuite/btcd/btcutil v1.1.3 // indirect github.com/cenkalti/backoff/v4 v4.1.3 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/cockroachdb/errors v1.9.1 // indirect github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect - github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811 // indirect + github.com/cockroachdb/pebble v0.0.0-20230906160148-46873a6a7a06 // indirect github.com/cockroachdb/redact v1.1.3 // indirect + github.com/consensys/bavard v0.1.13 // indirect + github.com/consensys/gnark-crypto v0.11.2 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect + github.com/crate-crypto/go-kzg-4844 v0.4.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/deckarep/golang-set/v2 v2.1.0 // indirect - github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect github.com/dlclark/regexp2 v1.7.0 // indirect - github.com/dop251/goja v0.0.0-20230605162241-28ee0ee714f3 // indirect + github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127 // indirect + github.com/ethereum/c-kzg-4844 v0.3.1 // indirect github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 // indirect @@ -66,7 +71,7 @@ require ( github.com/holiman/big v0.0.0-20221017200358-a027dc42d04e // indirect github.com/holiman/bloomfilter/v2 v2.0.3 // indirect github.com/holiman/uint256 v1.2.3 // indirect - github.com/huin/goupnp v1.0.3 // indirect + github.com/huin/goupnp v1.3.0 // indirect github.com/jackpal/gateway v1.0.6 // indirect github.com/jackpal/go-nat-pmp v1.0.2 // indirect github.com/klauspost/compress v1.15.15 // indirect @@ -79,6 +84,7 @@ require ( github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/pointerstructure v1.2.0 // indirect + github.com/mmcloughlin/addchain v0.4.0 // indirect github.com/mr-tron/base58 v1.2.0 // indirect github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect @@ -105,10 +111,10 @@ require ( github.com/stretchr/testify v1.8.4 // indirect github.com/subosito/gotenv v1.4.2 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a // indirect - github.com/tklauser/go-sysconf v0.3.5 // indirect - github.com/tklauser/numcpus v0.2.2 // indirect + github.com/tklauser/go-sysconf v0.3.12 // indirect + github.com/tklauser/numcpus v0.6.1 // indirect github.com/tyler-smith/go-bip39 v1.1.0 // indirect - github.com/urfave/cli/v2 v2.17.2-0.20221006022127-8f469abc00aa // indirect + github.com/urfave/cli/v2 v2.25.7 // indirect github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect github.com/yusufpapurcu/wmi v1.2.2 // indirect go.opentelemetry.io/otel v1.11.0 // indirect @@ -122,14 +128,14 @@ require ( go.uber.org/mock v0.2.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.25.0 // indirect - golang.org/x/crypto v0.12.0 // indirect - golang.org/x/exp v0.0.0-20230206171751-46f607a40771 // indirect + golang.org/x/crypto v0.13.0 // indirect + golang.org/x/exp v0.0.0-20230810033253-352e893a4cad // indirect golang.org/x/mod v0.12.0 // indirect golang.org/x/net v0.14.0 // indirect golang.org/x/sync v0.3.0 // indirect - golang.org/x/sys v0.11.0 // indirect - golang.org/x/term v0.11.0 // indirect - golang.org/x/text v0.12.0 // indirect + golang.org/x/sys v0.12.0 // indirect + golang.org/x/term v0.12.0 // indirect + golang.org/x/text v0.13.0 // indirect golang.org/x/time v0.3.0 // indirect gonum.org/v1/gonum v0.11.0 // indirect google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect @@ -138,4 +144,5 @@ require ( gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect + rsc.io/tmplfunc v0.0.3 // indirect ) diff --git a/go.sum b/go.sum index 0698b7526..284ad0c1b 100644 --- a/go.sum +++ b/go.sum @@ -47,6 +47,8 @@ github.com/DataDog/zstd v1.5.2/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwS github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY= github.com/Microsoft/go-winio v0.5.2 h1:a9IhgEQBCUEk6QCdml9CiJGhAws+YwffDHEMp1VMrpA= github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= +github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I= github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= @@ -59,10 +61,16 @@ github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/ava-labs/avalanche-network-runner v1.7.0 h1:SkNN9m0w8NEYjQelGlBRWDGOUiVELE5XT9LBBByBy2I= +github.com/ava-labs/avalanche-network-runner v1.7.0/go.mod h1:x9S9gDlmiGnruqXbecX9BIh1I1Ky+jqGmYdOpFeVM+0= github.com/ava-labs/avalanche-network-runner v1.7.2-0.20230825150237-723bc7b31724 h1:ptqFgQtJ5DyLb2lvuvawLJNlvo1A1qv+JXYTneNeg14= github.com/ava-labs/avalanche-network-runner v1.7.2-0.20230825150237-723bc7b31724/go.mod h1:euKHwZ77sGvGfhVj4v9WPM4jD2b5N80ldE2XHqO7lwA= +github.com/ava-labs/avalanchego v1.10.4 h1:wGldIq/zn7DTE8TvsBKq6UjyICXb9HY5joNOX73ovEU= +github.com/ava-labs/avalanchego v1.10.4/go.mod h1:lQNBWn4f27MWJGH9Jj1zOX1GlJDeHofMG/TBRaqSNSg= github.com/ava-labs/avalanchego v1.10.9 h1:qxhp3YoD2Wm/iIKP6Wb1isbkUPWmIrJxWgivDoL0obM= github.com/ava-labs/avalanchego v1.10.9/go.mod h1:C8R5uiltpc8MQ62ixxgODR+15mesWF0aAw3H+Qrl9Iw= +github.com/ava-labs/awm-relayer v0.1.1 h1:eOCdHfjT1tHl6dWlAljmzt8UFLZZiBg3ghOWixNi87g= +github.com/ava-labs/awm-relayer v0.1.1/go.mod h1:eztx3shJfCEa+seHb8rtRh+wMpY4nkhMXqPHV90D7C0= github.com/ava-labs/awm-relayer v0.2.0 h1:cj5roMKyfCsm32ot54TmtE85cbPlbvRjFq57D19q9S8= github.com/ava-labs/awm-relayer v0.2.0/go.mod h1:0fS2iFDiqigt/G6rxuiIz6fEN0Frpne99AVdzDoj2IE= github.com/ava-labs/awm-relayer v0.2.1-0.20230915205322-c997e81650b1 h1:ecjd0Tdro0uRxL345HdqVqiOnj5P1ZoJwRUmT/4tCtI= @@ -77,14 +85,20 @@ github.com/ava-labs/awm-relayer v0.2.1-0.20230920144803-34fb8976d19e h1:BDT2HOIF github.com/ava-labs/awm-relayer v0.2.1-0.20230920144803-34fb8976d19e/go.mod h1:p1zOyznNK7WxW8qQdjIyoYUroPB0cPJMiDwbNC+bkwE= github.com/ava-labs/awm-relayer v0.2.1-0.20230920145222-b8571020bdaa h1:hOMFyhAEbEprP6Qxuc6jSPRrGVpBwfPpcGqROOJCslI= github.com/ava-labs/awm-relayer v0.2.1-0.20230920145222-b8571020bdaa/go.mod h1:p1zOyznNK7WxW8qQdjIyoYUroPB0cPJMiDwbNC+bkwE= +github.com/ava-labs/coreth v0.12.4-rc.3 h1:mcY/RRRMFgxEORzbVxqBSc1gp5JAKi+U7gKxPGV0Xfs= +github.com/ava-labs/coreth v0.12.4-rc.3/go.mod h1:f08KU6tbwR8TSx/7Bh1ZV3lfmbr7XDwbNcuvbW7gDts= github.com/ava-labs/coreth v0.12.5-rc.3 h1:cpmC+fSZMsO4gaFWqXHzAHrJACf05u5HPAYmwh7nmkU= github.com/ava-labs/coreth v0.12.5-rc.3/go.mod h1:HI+jTIflnDFBd0bledgkgid1Uurwr8q1h7zb3LsFsSo= +github.com/ava-labs/subnet-evm v0.5.3-coreth-sync-rc h1:RWQ2go/o939xA3V6ANJCrtrCIr0X+1vMpnwNTjw1u0s= +github.com/ava-labs/subnet-evm v0.5.3-coreth-sync-rc/go.mod h1:pIlB9JxE+1ai+quGjuEQknY1ipbuAb4yEL+BELRoddk= github.com/ava-labs/subnet-evm v0.5.4 h1:4+UHva8rhGlvH4gDYpI0Lt6/J5ie1DqQa6kEmbebArI= github.com/ava-labs/subnet-evm v0.5.4/go.mod h1:PAyhfYnECzA17N62i7OAdKazjfSsN2l8KR5nOspg39I= github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bits-and-blooms/bitset v1.9.0 h1:g1YivPG8jOtrN013Fe8OBXubkiTwvm7/vG2vXz03ANU= +github.com/bits-and-blooms/bitset v1.9.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M= github.com/btcsuite/btcd v0.23.0 h1:V2/ZgjfDFIygAX3ZapeigkVBoVUtOJKSwrhZdlpSvaA= @@ -135,6 +149,7 @@ github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/datadriven v1.0.2 h1:H9MtNqVoVhvd9nCBwOyDjUEdZCREqbIdCJD93PBm/jA= github.com/cockroachdb/datadriven v1.0.2/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= +github.com/cockroachdb/datadriven v1.0.3-0.20230801171734-e384cf455877 h1:1MLK4YpFtIEo3ZtMA5C795Wtv5VuUnrXX7mQG+aHg6o= github.com/cockroachdb/errors v1.9.1 h1:yFVvsI0VxmRShfawbt/laCIDy/mtTqqnvoNgiy5bEV8= github.com/cockroachdb/errors v1.9.1/go.mod h1:2sxOtL2WIc096WSZqZ5h8fa17rdDq9HZOZLBCor4mBk= github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= @@ -142,15 +157,23 @@ github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZe github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811 h1:ytcWPaNPhNoGMWEhDvS3zToKcDpRsLuRolQJBVGdozk= github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811/go.mod h1:Nb5lgvnQ2+oGlE/EyZy4+2/CxRh9KfvCXnag1vtpxVM= +github.com/cockroachdb/pebble v0.0.0-20230906160148-46873a6a7a06 h1:T+Np/xtzIjYM/P5NAw0e2Rf1FGvzDau1h54MKvx8G7w= +github.com/cockroachdb/pebble v0.0.0-20230906160148-46873a6a7a06/go.mod h1:bynZ3gvVyhlvjLI7PT6dmZ7g76xzJ7HpxfjgkzCGz6s= github.com/cockroachdb/redact v1.1.3 h1:AKZds10rFSIj7qADf0g46UixK8NNLwWTNdCIGS5wfSQ= github.com/cockroachdb/redact v1.1.3/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM= +github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ= +github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= +github.com/consensys/gnark-crypto v0.11.2 h1:GJjjtWJ+db1xGao7vTsOgAOGgjfPe7eRGPL+xxMX0qE= +github.com/consensys/gnark-crypto v0.11.2/go.mod h1:v2Gy7L/4ZRosZ7Ivs+9SfUDr0f5UlG+EM5t7MPHiLuY= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/crate-crypto/go-kzg-4844 v0.4.0 h1:Lecbci8nd4rnlawQa2r2QPZrDVd6ZA/sOjBn3W1XkEY= +github.com/crate-crypto/go-kzg-4844 v0.4.0/go.mod h1:SBP7ikXEgDnUPONgm33HtuDZEDtWa3L4QtN1ocJSEQ4= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -160,9 +183,12 @@ github.com/deckarep/golang-set/v2 v2.1.0 h1:g47V4Or+DUdzbs8FxCCmgb6VYd+ptPAngjM6 github.com/deckarep/golang-set/v2 v2.1.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= +github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= @@ -172,6 +198,8 @@ github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnm github.com/dop251/goja v0.0.0-20211022113120-dc8c55024d06/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= github.com/dop251/goja v0.0.0-20230605162241-28ee0ee714f3 h1:+3HCtB74++ClLy8GgjUQYeC8R4ILzVcIe8+5edAJJnE= github.com/dop251/goja v0.0.0-20230605162241-28ee0ee714f3/go.mod h1:QMWlm50DNe14hD7t24KEqZuUdC9sOTy8W6XbCU1mlw4= +github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127 h1:qwcF+vdFrvPSEUDSX5RVoRccG8a5DhOdWdQ4zN62zzo= +github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127/go.mod h1:QMWlm50DNe14hD7t24KEqZuUdC9sOTy8W6XbCU1mlw4= github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= github.com/dop251/goja_nodejs v0.0.0-20211022123610-8dd9abb0616d/go.mod h1:DngW8aVqWbuLRMHItjPUyqdj+HWPvnQe8V8y1nDpIbM= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= @@ -186,8 +214,12 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= +github.com/ethereum/c-kzg-4844 v0.3.1 h1:sR65+68+WdnMKxseNWxSJuAv2tsUrihTpVBTfM/U5Zg= +github.com/ethereum/c-kzg-4844 v0.3.1/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= github.com/ethereum/go-ethereum v1.12.0 h1:bdnhLPtqETd4m3mS8BGMNvBTf36bO5bx/hxE2zljOa0= github.com/ethereum/go-ethereum v1.12.0/go.mod h1:/oo2X/dZLJjf2mJ6YT9wcWxa4nNJDBKDBU6sFIpx1Gs= +github.com/ethereum/go-ethereum v1.13.1 h1:UF2FaUKPIy5jeZk3X06ait3y2Q4wI+vJ1l7+UARp+60= +github.com/ethereum/go-ethereum v1.13.1/go.mod h1:xHQKzwkHSl0gnSjZK1mWa06XEdm9685AHqhRknOzqGQ= github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= @@ -315,6 +347,7 @@ github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20230207041349-798e818bf904 h1:4/hN5RUoecvl+RmJRE2YxKWtnnQls6rQjjW5oV7qg2U= github.com/google/pprof v0.0.0-20230207041349-798e818bf904/go.mod h1:uglQLonpP8qtYCYyzA+8c/9qtqgA3qsXGYqCPKARAFg= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -353,6 +386,8 @@ github.com/holiman/uint256 v1.2.3/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZm github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huin/goupnp v1.0.3 h1:N8No57ls+MnjlB+JPiCVSOyy/ot7MJTqlo7rn+NYSqQ= github.com/huin/goupnp v1.0.3/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y= +github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= +github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= github.com/hydrogen18/memlistener v0.0.0-20200120041712-dcc25e7acd91/go.mod h1:qEIFzExnS6016fRpRfxrExeVn2gbClQA99gQhnIcdhE= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= @@ -434,6 +469,9 @@ github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyua github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= +github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY= +github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU= +github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= @@ -566,8 +604,12 @@ github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a/go.mod h1:RRCYJ github.com/thepudds/fzgen v0.4.2 h1:HlEHl5hk2/cqEomf2uK5SA/FeJc12s/vIHmOG+FbACw= github.com/tklauser/go-sysconf v0.3.5 h1:uu3Xl4nkLzQfXNsWn15rPc/HQCJKObbt1dKJeWp3vU4= github.com/tklauser/go-sysconf v0.3.5/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI= +github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= +github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= github.com/tklauser/numcpus v0.2.2 h1:oyhllyrScuYI6g+h/zUvNXNp1wy7x8qQy3t/piefldA= github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZFu0T9wgjM= +github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= +github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= @@ -576,6 +618,8 @@ github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljT github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/urfave/cli/v2 v2.17.2-0.20221006022127-8f469abc00aa h1:5SqCsI/2Qya2bCzK15ozrqo2sZxkh0FHynJZOTVoV6Q= github.com/urfave/cli/v2 v2.17.2-0.20221006022127-8f469abc00aa/go.mod h1:1CNUng3PtjQMtRzJO4FMXBQvkGtuYRxxiR9xMa7jMwI= +github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs= +github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasthttp v1.6.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBnvPM1Su9w= @@ -646,6 +690,8 @@ golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= +golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= +golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -658,6 +704,7 @@ golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EH golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20230206171751-46f607a40771 h1:xP7rWLUr1e1n2xkK5YB4LI0hPEy3LJC6Wk+D4pGlOJg= golang.org/x/exp v0.0.0-20230206171751-46f607a40771/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= +golang.org/x/exp v0.0.0-20230810033253-352e893a4cad/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -825,14 +872,18 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= +golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -846,6 +897,7 @@ golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1060,3 +1112,5 @@ honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= +rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU= +rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= diff --git a/go.work.sum b/go.work.sum index 571ce3165..aa153513e 100644 --- a/go.work.sum +++ b/go.work.sum @@ -1,3 +1,4 @@ +cloud.google.com/go v0.0.0-20170206221025-ce650573d812/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= @@ -707,6 +708,7 @@ cloud.google.com/go/workflows v1.10.0 h1:FfGp9w0cYnaKZJhUOMqCOJCYT/WlvYBfTQhFWV3 cloud.google.com/go/workflows v1.10.0/go.mod h1:fZ8LmRmZQWacon9UCX1r/g/DfAXx5VcPALq2CxzdePw= collectd.org v0.3.0 h1:iNBHGw1VvPJxH2B6RiFWFZ+vsjo1lCdRszBeOuwGi00= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9 h1:VpgP7xuJadIUuKccphEpTJnWhS2jkQyMt6Y7pJCD7fY= +gioui.org v0.0.0-20210308172011-57750fc8a0a6/go.mod h1:RSH6KIUZ0p2xy5zHDxgAM4zumjgTw83q2ge/PI+yyw8= git.sr.ht/~sbinet/gg v0.3.1 h1:LNhjNn8DerC8f9DHLz6lS0YYul/b602DUxDgGkd/Aik= github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9 h1:HD8gA2tkByhMAwYaFAX9w2l7vxvBQ5NMoxDrkhqhtn4= github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1 h1:qoVeMsc9/fh/yhxVaA0obYjVH/oI/ihrOoMwsLS9KSA= @@ -715,23 +717,38 @@ github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3 h1:E+m3SkZCN0Bf5q7YdTs5lSm github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0 h1:Px2UA+2RvSSvv+RvJNuUB6n7rs5Wsel4dXLe90Um2n4= github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0/go.mod h1:tPaiy8S5bQ+S5sOiDlINkp7+Ef339+Nz5L5XO+cnOHo= +github.com/BurntSushi/toml v1.2.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802 h1:1BDTz0u9nC3//pOCMdNH+CiXJVYJh5UQNCOBG7jbELc= +github.com/CloudyKit/fastprinter v0.0.0-20170127035650-74b38d55f37a/go.mod h1:EFZQ978U7x8IRnstaskI3IysnWY5Ao3QgZUKOXlsAdw= github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53 h1:sR+/8Yb4slttB4vD+b9btVEnWgL3Q00OBTzVT8B9C0c= +github.com/CloudyKit/jet v2.1.3-0.20180809161101-62edd43e4f88+incompatible/go.mod h1:HPYO+50pSWkPoj9Q/eq0aRGByCL6ScRlUmiEX5Zgm+w= github.com/CloudyKit/jet/v3 v3.0.0 h1:1PwO5w5VCtlUUl+KTOBsTGZlhjWkcybsGaAau52tOy8= github.com/CloudyKit/jet/v6 v6.1.0 h1:hvO96X345XagdH1fAoBjpBYG4a1ghhL/QzalkduPuXk= +github.com/CloudyKit/jet/v6 v6.1.0/go.mod h1:d3ypHeIRNo2+XyqnGA8s+aphtcVpjP5hPwP/Lzo7Ro4= github.com/DATA-DOG/go-sqlmock v1.3.3 h1:CWUqKXe0s8A2z6qCgkP4Kru7wC11YoAnoupUKFDnH08= github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/FactomProject/btcutilecc v0.0.0-20130527213604-d3a63a5752ec h1:1Qb69mGp/UtRPn422BH4/Y4Q3SLUrD9KHuDkm8iodFc= +github.com/GoogleCloudPlatform/cloudsql-proxy v0.0.0-20190129172621-c8b1d7a94ddf/go.mod h1:aJ4qN3TfrelA6NZ6AXsXRfmEVaYin3EDbSPJrKS8OXo= github.com/HdrHistogram/hdrhistogram-go v1.1.2 h1:5IcZpTvzydCQeHzK4Ef/D5rrSqwxob0t8PQPMybUNFM= +github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= github.com/Joker/hpp v1.0.0 h1:65+iuJYdRXv/XyN62C1uEmmOx3432rNG/rKlX6V7Kkc= +github.com/Joker/jade v1.0.1-0.20190614124447-d475f43051e7/go.mod h1:6E6s8o2AE4KhCrqr6GRJjdC/gNfTdxkIXvuGZZda2VM= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/Shopify/goreferrer v0.0.0-20220729165902-8cddb4f5de06 h1:KkH3I3sJuOLP3TjA/dfr4NAY8bghDwnXiU7cTKxQqo0= +github.com/Shopify/goreferrer v0.0.0-20220729165902-8cddb4f5de06/go.mod h1:7erjKLwalezA0k99cWs5L11HWOAPNjdUZ6RxH1BXbbM= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIOA6tDi6QXUemppXK3P9BI7mr2hd6gx8= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= +github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= +github.com/aclements/go-gg v0.0.0-20170118225347-6dbb4e4fefb0/go.mod h1:55qNq4vcpkIuHowELi5C8e+1yUHtoLoOUR9QU5j7Tes= +github.com/aclements/go-moremath v0.0.0-20210112150236-f10218a38794/go.mod h1:7e+I0LQFUI9AXWxOfsQROs9xPhoJtbsyWcjJqDd4KPY= github.com/aead/siphash v1.0.1 h1:FwHfE/T45KPKYuuSAKyyvE+oPWcaQ+CUmFW0bPlM+kg= github.com/ajg/form v1.5.1 h1:t9c7v8JUKu/XxOGBU0yjNpaMloxGEJhUkqFRq0ibGeU= +github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= +github.com/ajstarks/svgo v0.0.0-20210923152817-c3b6e2f0c527/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b h1:slYM766cy2nI3BwyRiyQj/Ud48djTMtMebDqepE95rw= github.com/alecthomas/kingpin/v2 v2.3.1 h1:ANLJcKmQm4nIaog7xdr/id6FM6zm5hHnfZrvtKPxqGg= github.com/alecthomas/kingpin/v2 v2.3.1/go.mod h1:oYL5vtsvEHZGHxU7DMp32Dvx+qL+ptGn6lWaot2vCNE= @@ -741,11 +758,13 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuy github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d h1:UQZhZ2O0vMHr2cI+DC1Mbh0TJxzA3RcLoMsFw+aXw7E= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 h1:s6gZFSlWYmbqAuRjVTiNNhvNRfY2Wxp9nhfyel4rklc= github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= github.com/alexliesenfeld/health v0.7.0 h1:U3mSZ3ussRbGx+/rXBjNVxjLX5cKaNh8Ly9Hx3q+yfY= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ= github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY= +github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg= github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db h1:nxAtV4VajJDhKysp2kdcJZsq8Ss1xSA0vZTkVHHJd0E= github.com/apache/arrow/go/v11 v11.0.0 h1:hqauxvFQxww+0mEU/2XHG6LT7eZternCZq+A5Yly2uM= @@ -769,6 +788,7 @@ github.com/ava-labs/avalanchego v1.9.1-rc.3/go.mod h1:qQJugll8yY/YKiy/Eutjwjn/vS github.com/ava-labs/avalanchego v1.10.5-rc.1/go.mod h1:azK88lcF5jwcPSp//RKUh2VncmrZZUrKu998C7no4Ys= github.com/ava-labs/avalanchego v1.10.6-rc.4/go.mod h1:e8LdGy0xM+QejpMoEK6wOFu2O5HMlAHPJiBPjhoTG78= github.com/ava-labs/avalanchego v1.10.8 h1:fUudA4J37y8wyNG3iiX0kpoZXunsWpCgvsGDgIsi0NY= +github.com/ava-labs/avalanchego v1.10.9-rc.4/go.mod h1:vTBLl1zK36olfLRA7IUfdbvphWqlkuarIoXxvZTHZVw= github.com/ava-labs/coreth v0.11.5-rc.0 h1:EQ4MVWFrG+gtqtTFgquL4yoZnCNA+kbMVGWAnsTMeBE= github.com/ava-labs/coreth v0.11.7-rc.0/go.mod h1:e7SuEq6g3+YWyNPiznJF6KnnAuc0HCXxiSshMNj52Sw= github.com/ava-labs/coreth v0.11.7-rc.3 h1:+GaXmcqzBDd6jFJcPrAQ/RKEFJlqCVcdTF/Q5T6woy4= @@ -798,6 +818,7 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.1.1/go.mod h1:Wi0EBZwiz/K44YliU0EKxq github.com/aws/smithy-go v1.1.0 h1:D6CSsM3gdxaGaqXnPgOBCeL6Mophqzu7KJOu7zW78sU= github.com/aws/smithy-go v1.1.0/go.mod h1:EzMw8dbp/YJL4A5/sbhGddag+NPT7q084agLbB9LgIw= github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk= +github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible h1:Ppm0npCCsmuR9oQaBtRuZcmILVE74aXE+AmrJj8L2ns= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= @@ -805,8 +826,11 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24 github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bits-and-blooms/bitset v1.5.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40 h1:y4B3+GPxKlrigF1ha5FFErxK+sr6sWxQovRMzwMhejo= github.com/boltdb/bolt v1.3.1 h1:JQmyP4ZBrce+ZQu0dY660FMfatumYDLun9hBCUVIkF4= +github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= +github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= github.com/btcsuite/btcd/btcutil v1.1.1 h1:hDcDaXiP0uEzR8Biqo2weECKqEw0uHDZ9ixIWevVQqY= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo= @@ -822,6 +846,7 @@ github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA github.com/census-instrumentation/opencensus-proto v0.4.1 h1:iKLQ0xPNFxR/2hzXZMrBo8f1j86j5WHzznCCQxV/b8g= github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= +github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927/go.mod h1:h/aW8ynjgkuj+NQRlZcDbAbM1ORAbXjXX77sX7T289U= github.com/chzyer/logex v1.1.10 h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE= github.com/chzyer/logex v1.2.0 h1:+eqR0HfOetur4tgnC8ftU5imRnhi4te+BadWS95c5AM= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8= @@ -842,7 +867,14 @@ github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1 h1:zH8ljVhhq7yC0MIeUL/IviMtY8hx2mK8cN9wEYb8ggw= github.com/cncf/xds/go v0.0.0-20230310173818-32f1caf87195 h1:58f1tJ1ra+zFINPlwLWvQsR9CzAKt2e+EWV2yX9oXQ4= github.com/cncf/xds/go v0.0.0-20230310173818-32f1caf87195/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cockroachdb/datadriven v1.0.0/go.mod h1:5Ib8Meh+jk1RlHIXej6Pzevx/NLlNvQB9pmSBZErGA4= +github.com/cockroachdb/datadriven v1.0.3-0.20230801171734-e384cf455877/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= +github.com/cockroachdb/errors v1.6.1/go.mod h1:tm6FTP5G81vwJ5lC0SizQo374JNCOPrHyXGitRJoDqM= +github.com/cockroachdb/errors v1.8.1/go.mod h1:qGwQn6JmZ+oMjuLwjWzUNqblqk0xl4CVV3SQbGwK7Ac= +github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI= +github.com/cockroachdb/redact v1.0.8/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2 h1:IKgmqgMQlVJIZj19CdocBeSfSaiCbEBZGKODaixqtHM= +github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2/go.mod h1:8BT+cPK6xvFOcRlk0R8eg+OTkcqI6baNH4xAkpiYVvQ= github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0 h1:sDMmm+q/3+BukdIpxwO365v/Rbspp2Nt5XntgQRXq8Q= github.com/consensys/gnark-crypto v0.4.1-0.20210426202927-39ac3d4b3f1f h1:C43yEtQ6NIf4ftFXD/V55gnGFgPbMQobd//YlnLjUJ8= github.com/consensys/gnark-crypto v0.9.1-0.20230105202408-1a7a29904a7c/go.mod h1:CkbdF9hbRidRJYMRzmfX8TMOr95I2pYXRHF18MzRrvA= @@ -860,10 +892,14 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:ma github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/crate-crypto/go-ipa v0.0.0-20220523130400-f11357ae11c7 h1:6IrxszG5G+O7zhtkWxq6+unVvnrm1fqV2Pe+T95DUzw= github.com/crate-crypto/go-ipa v0.0.0-20220523130400-f11357ae11c7/go.mod h1:gFnFS95y8HstDP6P9pPwzrxOOC5TRDkwbM+ao15ChAI= +github.com/crate-crypto/go-ipa v0.0.0-20230601170251-1830d0757c80/go.mod h1:gzbVz57IDJgQ9rLQwfSk696JGWof8ftznEL9GoAv3NI= +github.com/crate-crypto/go-kzg-4844 v0.3.0/go.mod h1:SBP7ikXEgDnUPONgm33HtuDZEDtWa3L4QtN1ocJSEQ4= github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c h1:/ovYnF02fwL0kvspmy9AuyKg1JhdTRUgPw4nUxd9oZM= github.com/dave/jennifer v1.2.0 h1:S15ZkFMRoJ36mGAQgWL1tnr0NQJh9rZ8qatseX/VbBc= github.com/davecgh/go-spew v0.0.0-20161028175848-04cdfd42973b/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4= +github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= github.com/decred/dcrd/lru v1.0.0 h1:Kbsb1SFDsIlaupWPwsPp+dkxiBY1frcS07PCPgotKz8= github.com/dgraph-io/badger v1.6.0 h1:DshxFxZWXUcO0xX476VJC07Xsr6ZCBVRHKZ93Oh7Evo= github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= @@ -871,8 +907,11 @@ github.com/dgryski/go-bitstream v0.0.0-20180413035011-3522498ce2c8 h1:akOQj8IVgo github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954 h1:RMLoZVzv4GliuWafOuPuQDKSm1SJph7uCRnnS61JAn4= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/djherbis/atime v1.1.0/go.mod h1:28OF6Y8s3NQWwacXc5eZTsEsiMzp7LF8MbXE+XJPdBE= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/docker/docker v24.0.5+incompatible h1:WmgcE4fxyI6EEXxBRxsHnZXrO1pQ3smi0k/jho4HLeY= +github.com/docker/docker v24.0.5+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/dop251/goja v0.0.0-20230122112309-96b1610dd4f7/go.mod h1:yRkwfj0CBpOGre+TwBsqPV0IH0Pk73e4PXJOeNDboGs= github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7 h1:tYwu/z8Y0NkkzGEh3z21mSWggMg4LwLRFucLS7TjARg= github.com/dop251/goja_nodejs v0.0.0-20211022123610-8dd9abb0616d h1:W1n4DvpzZGOISgp7wWNtraLcHtnmnTwBlJidqtMIuwQ= @@ -897,8 +936,12 @@ github.com/fjl/gencodec v0.0.0-20220412091415-8bb9e558978c h1:CndMRAH4JIwxbW8KYq github.com/fjl/gencodec v0.0.0-20220412091415-8bb9e558978c/go.mod h1:AzA8Lj6YtixmJWL+wkKoBGsLWy9gFrAzi4g+5bCKwpY= github.com/fjl/gencodec v0.0.0-20230517082657-f9840df7b83e h1:bBLctRc7kr01YGvaDfgLbTwjFNW5jdp5y5rj8XXBHfY= github.com/fjl/gencodec v0.0.0-20230517082657-f9840df7b83e/go.mod h1:AzA8Lj6YtixmJWL+wkKoBGsLWy9gFrAzi4g+5bCKwpY= +github.com/flosch/pongo2 v0.0.0-20190707114632-bbf5a6c351f4/go.mod h1:T9YF2M40nIgbVgp3rreNmTged+9HrbNTIQf1PsaIiTA= github.com/flosch/pongo2/v4 v4.0.2 h1:gv+5Pe3vaSVmiJvh/BZa82b7/00YUGm0PIyVVLop0Hw= +github.com/flosch/pongo2/v4 v4.0.2/go.mod h1:B5ObFANs/36VwxxlgKpdchIJHMvHB562PW+BWPhwZD8= github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90 h1:WXb3TSNmHp2vHoCroCIB1foO/yQ36swABL8aOVeDpgg= +github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= +github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61 h1:IZqZOB2fydHte3kUgxrzK5E1fW7RQGeDwE8F/ZZnUYc= github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61/go.mod h1:Q0X6pkwTILDlzrGEckF6HKjXe48EgsY/l7K7vhY4MW8= @@ -906,36 +949,58 @@ github.com/gavv/httpexpect v2.0.0+incompatible h1:1X9kcRshkSKEjNJJxX9Y9mQ5BRfbxU github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/gballet/go-verkle v0.0.0-20220902153445-097bd83b7732 h1:AB7YjNrzlVHsYz06zCULVV2zYCEft82P86dSmtwxKL0= github.com/gballet/go-verkle v0.0.0-20220902153445-097bd83b7732/go.mod h1:o/XfIXWi4/GqbQirfRm5uTbXMG5NpqxkxblnbZ+QM9I= +github.com/gballet/go-verkle v0.0.0-20230607174250-df487255f46b/go.mod h1:CDncRYVRSDqwakm282WEkjfaAj1hxU/v5RXxk5nXOiI= github.com/getkin/kin-openapi v0.61.0 h1:6awGqF5nG5zkVpMsAih1QH4VgzS8phTxECUWIFo7zko= github.com/ghemawat/stream v0.0.0-20171120220530-696b145b53b9 h1:r5GgOLGbza2wVHRzK7aAj6lWZjfbAwiu/RDCVOKjRyM= +github.com/ghemawat/stream v0.0.0-20171120220530-696b145b53b9/go.mod h1:106OIgooyS7OzLDOpUGgm9fA3bQENb/cFSyyBmMoJDs= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= +github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8= +github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk= github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd h1:r04MMPyLHj/QwZuMJ5+7tJcBr1AQjpiAK/rZWRrQT7o= github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31 h1:gclg6gY70GLy3PbkQ1AERPfmLMMagS60DKF78eWwLn8= github.com/go-check/check v0.0.0-20180628173108-788fd7840127 h1:0gkP6mzaMqkmpcJYCFOLkIBwI7xFExG03bbkOkCvUPI= github.com/go-chi/chi/v5 v5.0.0 h1:DBPx88FjZJH3FsICfDAfIfnb7XxKIYVGG6lOPlhENAg= +github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= +github.com/go-fonts/dejavu v0.1.0/go.mod h1:4Wt4I4OU2Nq9asgDCteaAaWZOV24E+0/Pwo0gppep4g= +github.com/go-fonts/latin-modern v0.2.0/go.mod h1:rQVLdDMK+mK1xscDwsqM5J8U2jrRa3T0ecnM9pNujks= +github.com/go-fonts/liberation v0.1.1/go.mod h1:K6qoJYypsmfVjWg8KOVDQhLc8UDgIK2HYqyqAO9z7GY= github.com/go-fonts/liberation v0.2.0 h1:jAkAWJP4S+OsrPLZM4/eC9iW7CtHy+HBXrEwZXWo5VM= +github.com/go-fonts/liberation v0.2.0/go.mod h1:K6qoJYypsmfVjWg8KOVDQhLc8UDgIK2HYqyqAO9z7GY= +github.com/go-fonts/stix v0.1.0/go.mod h1:w/c1f0ldAUlJmLBvlbkvVXLAD+tAMqobIIQpmnUIzUY= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1 h1:QbL/5oDUmRBzO9/Z7Seo6zf912W/a6Sr4Eu0G/3Jho0= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4 h1:WtGNWLvXpe6ZudgnXrq0barxBImvnnJoMEhXAzcbM0I= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0 h1:wDJmvq38kDhkVxi50ni9ykkdUr1PKgqKOoi01fa0Mdk= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= +github.com/go-latex/latex v0.0.0-20210118124228-b3d85cf34e07/go.mod h1:CO1AlKB2CSIqUrmQPqA0gdRIlnLEY0gK5JGjh37zN5U= github.com/go-latex/latex v0.0.0-20210823091927-c0d11ff05a81 h1:6zl3BbBhdnMkpSj2YY30qV3gDcVBGtFgVsV3+/i+mKQ= +github.com/go-latex/latex v0.0.0-20210823091927-c0d11ff05a81/go.mod h1:SX0U8uGpxhq9o2S/CELCSUxEWWAuoCUcVCQWv7G2OCk= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= +github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab h1:xveKWz2iaueeTaUgdetzel+U7exyigDYBryyVfV/rZk= github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= +github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= github.com/go-openapi/swag v0.19.5 h1:lTz6Ys4CmqqCQmZPBlbQENR1/GucA2bzYTE12Pw4tFY= +github.com/go-pdf/fpdf v0.5.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhOh5M= github.com/go-pdf/fpdf v0.6.0 h1:MlgtGIfsdMEEQJr2le6b/HNr1ZlQwxyWr77r2aj2U/8= +github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= +github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= +github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJWXmqUsHwfTRRkQ= +github.com/go-playground/validator/v10 v10.11.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= +github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= @@ -943,14 +1008,17 @@ github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= github.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo= github.com/goccy/go-json v0.9.11 h1:/pAaQDLHEoCq/5FFmSKBswWmK6H0e8g4159Kc/X/nqk= +github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/godbus/dbus/v5 v5.0.4 h1:9349emZab16e7zQvpmsbtjc18ykshndd8y2PG3sgJbA= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/status v1.1.0 h1:+eIkrewn5q6b30y+g/BJINVVdi2xH7je5MPJ3ZPK3JA= github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= +github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= @@ -958,6 +1026,11 @@ github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4er github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219 h1:utua3L2IbQJmauC5IXdEA547bcoU5dozgQAfc8Onsg4= github.com/gomodule/redigo v1.7.1-0.20190724094224-574c33c3df38 h1:y0Wmhvml7cGnzPa9nocn/fMraMH/lMDdeG+rkx4VgYY= +github.com/gonum/blas v0.0.0-20181208220705-f22b278b28ac/go.mod h1:P32wAyui1PQ58Oce/KYkOqQv8cVw1zAapXOl+dRFGbc= +github.com/gonum/floats v0.0.0-20181209220543-c233463c7e82/go.mod h1:PxC8OnwL11+aosOB5+iEPoV3picfs8tUpkVd0pDo+Kg= +github.com/gonum/internal v0.0.0-20181124074243-f884aa714029/go.mod h1:Pu4dmpkhSyOzRwuXkOgAvijx4o+4YMUJJo9OvPYMkks= +github.com/gonum/lapack v0.0.0-20181123203213-e4cdc5a0bff9/go.mod h1:XA3DeT6rxh2EAE789SSiSJNqxPaC0aE9J8NTOI0Jo/A= +github.com/gonum/matrix v0.0.0-20181209220409-c518dec07be9/go.mod h1:0EXg4mc1CNP0HCqCz+K4ts155PXIlUywf0wqN+GfPZw= github.com/google/flatbuffers v2.0.8+incompatible h1:ivUb1cGomAB101ZM1T0nOiWz9pSrTMoa9+EiY7igmkM= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= @@ -971,10 +1044,12 @@ github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3 github.com/google/renameio v0.1.0 h1:GOZbcHa3HfsPKPlmyPyN2KEohoMXOhdMbHrvbpl2QaA= github.com/google/s2a-go v0.1.3 h1:FAgZmpLl/SXurPEZyCMPBIiiYeTbqfjlbdnCNTAkbGE= github.com/google/s2a-go v0.1.3/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= +github.com/google/safehtml v0.0.2/go.mod h1:L4KWwDsUJdECRAEpZoBn3O64bQaywRscowZjJAzjHnU= github.com/google/subcommands v1.2.0 h1:vWQspBTo2nEqTUFita5/KeEWlUL8kQObDFbub/EN9oE= github.com/googleapis/enterprise-certificate-proxy v0.2.1/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= github.com/googleapis/enterprise-certificate-proxy v0.2.3 h1:yk9/cqRKtT9wXZSsRH9aurXEpJX+U6FLtpYTdC3R06k= github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= +github.com/googleapis/gax-go v0.0.0-20161107002406-da06d194a00e/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY= github.com/googleapis/gax-go/v2 v2.7.0/go.mod h1:TEop28CZZQ2y+c0VxMUmu1lV+fQx57QpBWsYpwqHJx8= github.com/googleapis/gax-go/v2 v2.7.1/go.mod h1:4orTrqY6hXxxaUL4LHIPl6lGo8vAE38/qKbhSAKP6QI= github.com/googleapis/gax-go/v2 v2.8.0 h1:UBtEZqx1bjXtOQ5BVTkuYghXrr3N4V123VKJK67vJZc= @@ -982,11 +1057,15 @@ github.com/googleapis/gax-go/v2 v2.8.0/go.mod h1:4orTrqY6hXxxaUL4LHIPl6lGo8vAE38 github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8 h1:tlyzajkF3030q6M8SvmJSemC9DTHL/xaMa18b65+JM4= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY= +github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway/v2 v2.12.0/go.mod h1:ummNFgdgLhhX7aIiy35vVmQNS0rWXknfPE0qe6fmFXg= +github.com/guptarohit/asciigraph v0.5.5/go.mod h1:dYl5wwK4gNsnFf9Zp+l06rFiDZ5YtXM6x7SRWZ3KGag= github.com/hashicorp/consul/api v1.20.0 h1:9IHTjNVSZ7MIwjlW3N3a7iGiykCMDpxZu8jsxFJh0yc= github.com/hashicorp/consul/api v1.20.0/go.mod h1:nR64eD44KQ59Of/ECwt2vUmIK2DKsDzAwTmwmLl8Wpo= github.com/hashicorp/consul/sdk v0.13.1 h1:EygWVWWMczTzXGpO93awkHFzfUka6hLYJ0qhETd+6lY= @@ -1026,8 +1105,11 @@ github.com/hashicorp/memberlist v0.5.0 h1:EtYPN8DpAURiapus508I4n9CzHs2W+8NZGbmmR github.com/hashicorp/memberlist v0.5.0/go.mod h1:yvyXLpo0QaGE59Y7hDTsTzDD25JYBZ4mHgHUZ8lrOI0= github.com/hashicorp/serf v0.10.1 h1:Z1H2J60yRKvfDYAOZLd2MU0ND4AH/WDz7xYHDWQsIPY= github.com/hashicorp/serf v0.10.1/go.mod h1:yL2t6BqATOLGc5HF7qbFkTfXoPIY0WZdWHfEvMqbG+4= +github.com/holiman/billy v0.0.0-20230718173358-1c7e68d277a7 h1:3JQNjnMRil1yD0IfZKHF9GxxWKDJGj8I0IqOUol//sw= +github.com/holiman/billy v0.0.0-20230718173358-1c7e68d277a7/go.mod h1:5GuXa7vkL8u9FkFuWdVvfR5ix8hRB7DbOAaYULamFpc= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150 h1:vlNjIqmUZ9CMAWsbURYl3a6wZbw7q5RHVvlXTNS/Bs8= +github.com/hydrogen18/memlistener v0.0.0-20141126152155-54553eb933fb/go.mod h1:qEIFzExnS6016fRpRfxrExeVn2gbClQA99gQhnIcdhE= github.com/hydrogen18/memlistener v0.0.0-20200120041712-dcc25e7acd91 h1:KyZDvZ/GGn+r+Y3DKZ7UOQ/TP4xV6HNkrwiVMB1GnNY= github.com/iancoleman/strcase v0.2.0 h1:05I4QRnGpI0m37iZQRuskXh+w77mr6Z41lwQzuHLwW0= github.com/ianlancetaylor/demangle v0.0.0-20220319035150-800ac71e25c2 h1:rcanfLhLDA8nozr/K289V1zcntHr3V+SHlXwzz1ZI2g= @@ -1036,56 +1118,94 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2 github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/iris-contrib/blackfriday v2.0.0+incompatible h1:o5sHQHHm0ToHUlAJSTjW9UWicjJSDDauOOQ2AHuIVp4= github.com/iris-contrib/go.uuid v2.0.0+incompatible h1:XZubAYg61/JwnJNbZilGjf3b3pB80+OQg2qf6c8BfWE= +github.com/iris-contrib/i18n v0.0.0-20171121225848-987a633949d0/go.mod h1:pMCz62A0xJL6I+umB2YTlFRwWXaDFA0jy+5HzGiJjqI= github.com/iris-contrib/jade v1.1.4 h1:WoYdfyJFfZIUgqNAeOyRfTNQZOksSlZ6+FnXR3AEpX0= +github.com/iris-contrib/jade v1.1.4/go.mod h1:EDqR+ur9piDl6DUgs6qRrlfzmlx/D5UybogqrXvJTBE= github.com/iris-contrib/pongo2 v0.0.1 h1:zGP7pW51oi5eQZMIlGA3I+FHY9/HOQWDB+572yin0to= github.com/iris-contrib/schema v0.0.6 h1:CPSBLyx2e91H2yJzPuhGuifVRnZBBJ3pCOMbOvPZaTw= +github.com/iris-contrib/schema v0.0.6/go.mod h1:iYszG0IOsuIsfzjymw1kMzTL8YQcCWlm65f3wX8J5iA= github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e h1:UvSe12bq+Uj2hWd8aOlwPmoZ+CITRFrdit+sDGfAg8U= github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e/go.mod h1:G1CVv03EnqU1wYL2dFwXxW2An0az9JTl/ZsqXQeBlkU= +github.com/jedisct1/go-minisign v0.0.0-20230811132847-661be99b8267/go.mod h1:h1nSAbGFqGVzn6Jyl1R/iCcBUHN4g+gW1u9CoBTrb9E= github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/jrick/logrotate v1.0.0 h1:lQ1bL/n9mBNeIXoTUoYRlK4dHuNJVofX9oWqBtPnSzI= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.9.1 h1:6QPYqodiu3GuPL+7mfx+NwDdp2eTkp9IfEUpgAwUN0o= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= +github.com/juju/errors v0.0.0-20181118221551-089d3ea4e4d5/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q= +github.com/juju/loggo v0.0.0-20180524022052-584905176618/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U= +github.com/juju/testing v0.0.0-20180920084828-472a3e8b2073/go.mod h1:63prj8cnj0tU0S9OHjGJn+b1h0ZghCndfnbQolrYTwA= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/jung-kurt/gofpdf v1.0.0/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= +github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 h1:uC1QfSlInpQF+M0ao65imhwqKnz3Q2z/d8PWZRMQvDM= github.com/karalabe/usb v0.0.2 h1:M6QQBNxF+CQ8OFvxrT90BA0qBOXymndZnk5q235mFc4= github.com/karalabe/usb v0.0.2/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= +github.com/karalabe/usb v0.0.3-0.20230711191512-61db3e06439c/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= github.com/kataras/blocks v0.0.7 h1:cF3RDY/vxnSRezc7vLFlQFTYXG/yAr1o7WImJuZbzC4= +github.com/kataras/blocks v0.0.7/go.mod h1:UJIU97CluDo0f+zEjbnbkeMRlvYORtmc1304EeyXf4I= +github.com/kataras/golog v0.0.9/go.mod h1:12HJgwBIZFNGL0EJnMRhmvGA0PQGx8VFwrZtM4CqbAk= github.com/kataras/golog v0.1.7 h1:0TY5tHn5L5DlRIikepcaRR/6oInIr9AiWsxzt0vvlBE= +github.com/kataras/golog v0.1.7/go.mod h1:jOSQ+C5fUqsNSwurB/oAHq1IFSb0KI3l6GMa7xB6dZA= +github.com/kataras/iris/v12 v12.0.1/go.mod h1:udK4vLQKkdDqMGJJVd/msuMtN6hpYJhg/lSzuxjhO+U= github.com/kataras/iris/v12 v12.2.0-beta5 h1:grB/oCf5baZhmYIeDMfgN3LYrtEcmK8pbxlRvEZ2pgw= +github.com/kataras/iris/v12 v12.2.0-beta5/go.mod h1:q26aoWJ0Knx/00iPKg5iizDK7oQQSPjbD8np0XDh6dc= +github.com/kataras/neffos v0.0.10/go.mod h1:ZYmJC07hQPW67eKuzlfY7SO3bC0mw83A3j6im82hfqw= github.com/kataras/neffos v0.0.14 h1:pdJaTvUG3NQfeMbbVCI8JT2T5goPldyyfUB2PJfh1Bs= +github.com/kataras/pio v0.0.0-20190103105442-ea782b38602d/go.mod h1:NV88laa9UiiDuX9AhMbDPkGYSPugBOV6yTZB1l2K9Z0= +github.com/kataras/pio v0.0.10/go.mod h1:gS3ui9xSD+lAUpbYnjOGiQyY7sUMJO+EHpiRzhtZ5no= github.com/kataras/pio v0.0.11 h1:kqreJ5KOEXGMwHAWHDwIl+mjfNCPhAwZPa8gK7MKlyw= +github.com/kataras/pio v0.0.11/go.mod h1:38hH6SWH6m4DKSYmRhlrCJ5WItwWgCVrTNU62XZyUvI= github.com/kataras/sitemap v0.0.6 h1:w71CRMMKYMJh6LR2wTgnk5hSgjVNB9KL60n5e2KHvLY= +github.com/kataras/sitemap v0.0.6/go.mod h1:dW4dOCNs896OR1HmG+dMLdT7JjDk7mYBzoIRwuj5jA4= github.com/kataras/tunnel v0.0.4 h1:sCAqWuJV7nPzGrlb0os3j49lk2JhILT0rID38NHNLpA= +github.com/kataras/tunnel v0.0.4/go.mod h1:9FkU4LaeifdMWqZu7o20ojmW4B7hdhv2CMLwfnHGpYw= github.com/kilic/bls12-381 v0.1.0 h1:encrdjqKMEvabVQ7qYOKu1OvhqpK4s47wDYtNiPtlp4= github.com/kilic/bls12-381 v0.1.0/go.mod h1:vDTTHJONJ6G+P2R74EhnyotQDTliQDnFEwhdmfzw1ig= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0 h1:e8esj/e4R+SAOwFwN+n3zr0nYeCyeweozKfO23MvHzY= github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23 h1:FOOIBWrEkLgmlgGfMuZT83xIwfPDxEI2OHu6xUmJMFE= github.com/klauspost/asmfmt v1.3.2 h1:4Ri7ox3EwapiOjCki+hw14RyKk201CN4rzyCJRFLpK4= +github.com/klauspost/compress v1.9.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= +github.com/klauspost/compress v1.15.0/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= github.com/klauspost/cpuid v1.2.1 h1:vJi+O/nMdFt0vqm8NZBI6wzALWdA2X+egi0ogNyrC/w= github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4= github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.1.0 h1:Jskdu9ieNAYnjxsi0LbQp1ulIKZV1LAFgK1tWhpZgl8= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pty v1.1.1 h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw= +github.com/labstack/echo/v4 v4.1.11/go.mod h1:i541M3Fj6f76NZtHSj7TXnyM8n2gaodfvfxNnFqi74g= github.com/labstack/echo/v4 v4.9.0 h1:wPOF1CE6gvt/kmbMR4dGzWvHMPT+sAEUJOwOTtvITVY= +github.com/labstack/echo/v4 v4.9.0/go.mod h1:xkCDAdFCIf8jsFQ5NnbK7oqaF/yU1A1X20Ltm0OvSks= github.com/labstack/gommon v0.3.1 h1:OomWaJXm7xR6L1HmEtGyQf26TEn7V6X88mktX9kee9o= +github.com/labstack/gommon v0.3.1/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM= github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= +github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= github.com/lyft/protoc-gen-star/v2 v2.0.1 h1:keaAo8hRuAT0O3DfJ/wM3rufbAjGeJ1lAtWZHDjKGB0= github.com/mailgun/raymond/v2 v2.0.46 h1:aOYHhvTpF5USySJ0o7cpPno/Uh2I5qg2115K25A+Ft4= +github.com/mailgun/raymond/v2 v2.0.46/go.mod h1:lsgvL50kgt1ylcFJYZiULi5fjPBkkhNfj4KA0W54Z18= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd h1:HvFwW+cm9bCbZ/+vuGNq7CRWXql8c0y8nGeYpqmpvmk= +github.com/matryer/try v0.0.0-20161228173917-9ac251b645a2/go.mod h1:0KeJpeMD6o+O4hW7qJOT7vyQPKrWmj26uf5wMc/IiIs= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= @@ -1094,10 +1214,15 @@ github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= +github.com/mattn/go-sqlite3 v1.14.5/go.mod h1:WVKg1VTActs4Qso6iwGbiFih2UIHo0ENGwNd0Lj+XmI= github.com/mattn/goveralls v0.0.2 h1:7eJB6EqsPhRVxvwEXGnqdO2sJI0PTsrWoTMXEk9/OQc= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/mediocregopher/mediocre-go-lib v0.0.0-20181029021733-cb65787f37ed/go.mod h1:dSsfyI2zABAdhcbvkXqgxOxrCsbYeHCPgrZkku60dSg= +github.com/mediocregopher/radix/v3 v3.3.0/go.mod h1:EmfVyvspXz1uZEyPBMyGK+kjWiKQGvsUt6O3Pj+LDCQ= github.com/mediocregopher/radix/v3 v3.4.2 h1:galbPBjIwmyREgwGCfQEN4X8lxbJnKBYurgz+VfcStA= github.com/microcosm-cc/bluemonday v1.0.21 h1:dNH3e4PSyE4vNX+KlRGHT5KrSvjeUkoNPwEORjffHJg= +github.com/microcosm-cc/bluemonday v1.0.21/go.mod h1:ytNkv4RrDrLJ2pqlsSI46O6IVXmZOBBD4SaJyDwwTkM= github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= github.com/miekg/dns v1.1.41 h1:WMszZWJG0XmzbK9FEmzH2TVcqYzFesusSIB41b8KHxY= github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= @@ -1115,15 +1240,20 @@ github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3P github.com/moul/http2curl v1.0.0 h1:dRMWoAtb+ePxMlLkrCbAqh4TlPHXvoGUSQ323/9Zahs= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/naoina/go-stringutil v0.1.0 h1:rCUeRUHjBjGTSHl0VC00jUPLz8/F9dDzYI70Hzifhks= github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416 h1:shk/vn9oCoOTmwcouEdwIeOtOGA/ELRUw/GwvxwfT+0= github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= github.com/nats-io/jwt v0.3.0 h1:xdnzwFETV++jNc4W1mw//qFyJGb2ABOombmZJQS4+Qo= +github.com/nats-io/nats.go v1.8.1/go.mod h1:BrFz9vVn0fU3AcH9Vn4Kd7W0NpJ651tD5omQ3M8LwxM= github.com/nats-io/nats.go v1.9.1 h1:ik3HbLhZ0YABLto7iX80pZLPw/6dx3T+++MZJwLnMrQ= +github.com/nats-io/nkeys v0.0.2/go.mod h1:dab7URMsZm6Z/jp9Z5UGa87Uutgc2mVpXLC4B7TDb/4= github.com/nats-io/nkeys v0.1.0 h1:qMd4+pRHgdr1nAClu+2h/2a5F2TmKcCzjCDazVgRoX4= github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/onsi/ginkgo v1.13.0/go.mod h1:+REjRxOmWfHCjfv9TTWB1jD1Frx4XydAD3zm1lskyM0= github.com/onsi/ginkgo/v2 v2.4.0/go.mod h1:iHkDK1fKGcBoEHT5W7YBq4RFWaQulw+caOMkAt4OrFo= github.com/onsi/ginkgo/v2 v2.7.0/go.mod h1:yjiuMwPokqY1XauOgju45q3sJt6VzQ/Fict1LFVcsAo= github.com/onsi/ginkgo/v2 v2.11.0/go.mod h1:ZhrRA5XmEE3x3rhlzamx/JJvujdZoJ2uvgI7kR0iZvM= @@ -1133,6 +1263,9 @@ github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/phpdave11/gofpdf v1.4.2/go.mod h1:zpO6xFn9yxo3YLyMvW8HcKWVdbNqgIfOOp2dXMnm1mY= +github.com/phpdave11/gofpdi v1.0.12/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI= +github.com/phpdave11/gofpdi v1.0.13/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI= github.com/pierrec/lz4/v4 v4.1.15 h1:MO0/ucJhngq7299dKLwIMtgTfbkoSPF6AoMYDd8Q4q0= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e h1:aoZm08cpOy4WuID//EZDgcC4zIxODThtZNPirFr42+A= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -1145,44 +1278,65 @@ github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_golang v1.12.0/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.1-0.20210607210712-147c58e9608a/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= github.com/prometheus/common v0.39.0/go.mod h1:6XBZ7lYdLCbkAVhwRsWTZn+IN5AB9F/NXd5w0BbEX0Y= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/protolambda/bls12-381-util v0.0.0-20220416220906-d8552aa452c7 h1:cZC+usqsYgHtlBaGulVnZ1hfKAi8iWtujBnRLQE698c= github.com/protolambda/bls12-381-util v0.0.0-20220416220906-d8552aa452c7/go.mod h1:IToEjHuttnUzwZI5KBSM/LOOW3qLbbrHOEfp3SbECGY= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0 h1:Ppwyp6VYCF1nvBTXL3trRso7mXMlRrw9ooo375wvi2s= +github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfFZQK844Gfx8o5WFuvpxWRwnSoipWe/p622j1v06w= +github.com/ruudk/golang-pdf417 v0.0.0-20201230142125-a7e3863a1245/go.mod h1:pQAZKsJ8yyVxGRWYNEm9oFB8ieLgKFnamEyDmSA0BRk= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/ryanuber/columnize v2.1.0+incompatible h1:j1Wcmh8OrK4Q7GXY+V7SVSY8nUWQxHW5TkBe7YUl+2s= github.com/sagikazarmark/crypt v0.10.0 h1:96E1qrToLBU6fGzo+PRRz7KGOc9FkYFiPnR3/zf8Smg= github.com/sagikazarmark/crypt v0.10.0/go.mod h1:gwTNHQVoOS3xp9Xvz5LLR+1AauC5M6880z5NWzdhOyQ= github.com/sanity-io/litter v1.5.1/go.mod h1:5Z71SvaYy5kcGtyglXOC9rrUi3c1E8CamFWjQsazTh0= github.com/schollz/closestmatch v2.1.0+incompatible h1:Uel2GXEpJqOWBrlyI+oY9LTiyyjYS17cCYRqP13/SHk= +github.com/sclevine/agouti v3.0.0+incompatible/go.mod h1:b4WX9W9L1sfQKXeJf1mUTLZKJ48R1S7H23Ji7oFO5Bw= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= +github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= +github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= +github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM= github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= @@ -1191,24 +1345,34 @@ github.com/stretchr/testify v0.0.0-20161117074351-18a02ba4a312/go.mod h1:a8OnRci github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.5/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/supranational/blst v0.3.8-0.20220526154634-513d2456b344/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= github.com/supranational/blst v0.3.11-0.20230406105308-e9dfc5ee724b/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= github.com/tdewolff/minify/v2 v2.12.4 h1:kejsHQMM17n6/gwdw53qsi6lg0TGddZADVyQOz1KMdE= +github.com/tdewolff/minify/v2 v2.12.4/go.mod h1:h+SRvSIX3kwgwTFOpSckvSxgax3uy8kZTSF1Ojrr3bk= github.com/tdewolff/parse/v2 v2.6.4 h1:KCkDvNUMof10e3QExio9OPZJT8SbdKojLBumw8YZycQ= +github.com/tdewolff/parse/v2 v2.6.4/go.mod h1:woz0cgbLwFdtbjJu8PIKxhW05KplTFQkOdX78o+Jgrs= +github.com/tdewolff/test v1.0.7/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE= github.com/thepudds/fzgen v0.4.2/go.mod h1:kHCWdsv5tdnt32NIHYDdgq083m6bMtaY0M+ipiO9xWE= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926 h1:G3dpKMzFDjgEh2q1Z7zUUtKa8ViPtH+ocF0bE0g00O8= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= +github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M= github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= +github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= github.com/urfave/negroni v1.0.0 h1:kIimOitoypq34K7TG7DUaJ9kq/N4Ofuwi1sjz0KipXc= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/fasthttp v1.40.0 h1:CRq/00MfruPGFLTQKY8b+8SfdK60TxNztjRMnH0t1Yc= +github.com/valyala/fasthttp v1.40.0/go.mod h1:t/G+3rLek+CyY9bnIE+YlMRddxVAAGjhxndDB4i4C0I= github.com/valyala/fasttemplate v1.2.1 h1:TVEnxayobAdVkhQfrfes2IzOB6o+z4roRkPF52WA1u4= github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a h1:0R4NLDRDZX6JcmhJgXi5E4b8Wg84ihbmUKp/GvSPEzc= +github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9znI5mJU= +github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= +github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= @@ -1218,6 +1382,7 @@ github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77 h1:ESFSdwYZvkeru3RtdrYueztKhOBCSAAzS4Gf+k0tEow= github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0 h1:6fRhSjgLCkTD3JnJxvaJ4Sj+TYblw757bqYgZaOq5ZY= github.com/yosssi/ace v0.0.5 h1:tUkIP/BLdKqrlrPwcmH0shwEEhTRHoGnc1wFIWmaBUA= +github.com/yosssi/ace v0.0.5/go.mod h1:ALfIzm2vT7t5ZE7uoIZqF3TQ7SAOyupFZnkrF5id+K0= github.com/yudai/gojsondiff v1.0.0 h1:27cbfqXLVEJ1o8I6v3y9lg8Ydm53EKqHXAOMxEGlCOA= github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 h1:BHyfKlQyqbsFN5p3IfnEUduWvb9is428/nNb5L3U01M= github.com/yudai/pp v2.0.1+incompatible h1:Q4//iY4pNF6yPLZIigmvcl7k/bPgrcTPIFIcmawg5bI= @@ -1241,6 +1406,7 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/automaxprocs v1.5.2/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0= go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo= go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4= @@ -1253,14 +1419,35 @@ go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190909091759-094676da4a83/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= +golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220926161630-eccd6366d1be/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I= golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= +golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20191002040644-a1355ae1e2c3/go.mod h1:NOZ3BPKG0ec/BKJQgnvsSFpcKLM5xXVWnvZS97DWHgE= +golang.org/x/exp v0.0.0-20200513190911-00229845015e/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= +golang.org/x/exp v0.0.0-20230810033253-352e893a4cad h1:g0bG7Z4uG+OgH2QDODnjp6ggkk1bJDsINcuWmJN1iJU= +golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= +golang.org/x/image v0.0.0-20190910094157-69e4b8554b2a/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20200119044424-58c23975cae1/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20200430140353-33d19683fad8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20200618115811-c13761719519/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20201208152932-35266b937fa6/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20210216034530-4410531fe030/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20210607152325-775e3b0c77b9/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= +golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= golang.org/x/image v0.0.0-20220302094943-723b81ca9867 h1:TcHcE0vrmgzNH1v3ppjcMGbhG5+9fMuvOmUYwNEF4q4= golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028 h1:4+4C/Iv2U4fMZBiMCc98MG1In4gJY5YRhtpDNeDeHWs= golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= @@ -1270,8 +1457,11 @@ golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8= +golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20221002022538-bcab6841153b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= @@ -1281,11 +1471,14 @@ golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= +golang.org/x/oauth2 v0.0.0-20170207211851-4464e7848382/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.5.0/go.mod h1:9/XBHVqLaWO3/BRHs5jbpYCnOZVjj5V0ndyaAM7KB4I= golang.org/x/oauth2 v0.6.0/go.mod h1:ycmewcwgD4Rpr3eZJLSB4Kyyljb3qDh40vJ8STE5HKw= golang.org/x/oauth2 v0.7.0 h1:qe6s0zUXlPX80/dITx3440hWZ7GwMwgDDyrSGTPJG/g= golang.org/x/oauth2 v0.7.0/go.mod h1:hPLQkd9LyjfXTiRohC/41GhcFqxisoUQ99sCUOHO9x4= +golang.org/x/perf v0.0.0-20230113213139-801c7ef9e5c5/go.mod h1:UBKtEnL8aqnd+0JHqZ+2qoMDwtuy6cYhhKNoHLBiTQc= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1295,12 +1488,24 @@ golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201101102859-da207088b7d1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210304124612-50617c2ba197/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211020174200-9d6173849985/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1310,25 +1515,40 @@ golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0= +golang.org/x/term v0.12.0 h1:/ZfYdc3zq+q02Rv9vGqTeSItdzZTSNDmfTi0mBAuidU= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/time v0.0.0-20220922220347-f3bd1da661af/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190927191325-030b2cf1153e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4= golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= +golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= golang.org/x/tools v0.9.3/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= golang.org/x/tools v0.12.0/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= +gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= +gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0= +gonum.org/v1/gonum v0.9.3/go.mod h1:TZumC3NeyVQskjXqmyWt4S3bINhy7B4eYwW69EbyX+0= +gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= +gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= +gonum.org/v1/plot v0.9.0/go.mod h1:3Pcqqmp6RHvJI72kgb8fThyUnav364FOsdDo2aGW5lY= +gonum.org/v1/plot v0.10.0/go.mod h1:JWIHJ7U20drSQb/aDpTetJzfC1KlAPldJLpkSy88dvQ= gonum.org/v1/plot v0.10.1 h1:dnifSs43YJuNMDzB7v8wV64O4ABBHReuAVAoBxqBqS4= +google.golang.org/api v0.0.0-20170206182103-3d017632ea10/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.106.0/go.mod h1:2Ts0XTHNVWxypznxWOYUeI4g3WdP9Pk2Qk58+a/O9MY= google.golang.org/api v0.108.0/go.mod h1:2Ts0XTHNVWxypznxWOYUeI4g3WdP9Pk2Qk58+a/O9MY= google.golang.org/api v0.110.0/go.mod h1:7FC4Vvx1Mooxh8C5HWjzZHcavuS2f6pmJpZx60ca7iI= @@ -1345,6 +1565,7 @@ google.golang.org/genproto v0.0.0-20230222225845-10f96fb3dbec/go.mod h1:3Dl5ZL0q google.golang.org/genproto v0.0.0-20230223222841-637eb2293923/go.mod h1:3Dl5ZL0q0isWJt+FVcfpQyirqemEuLAK/iFvg1UP1Hw= google.golang.org/genproto v0.0.0-20230303212802-e74f57abe488/go.mod h1:TvhZT5f700eVlTNwND1xoEZQeWTB2RY/65kplwl/bFA= google.golang.org/genproto v0.0.0-20230320184635-7606e756e683/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= +google.golang.org/grpc v0.0.0-20170208002647-2a6bf6142e96/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= @@ -1359,6 +1580,8 @@ google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqw google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0 h1:0vLT13EuvQ0hNvakwLuFZ/jYrLp5F3kcWHXdRggjCE8= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM= @@ -1368,9 +1591,11 @@ gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gotest.tools/v3 v3.5.0/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= honnef.co/go/tools v0.0.1-2020.1.4 h1:UoveltGrhghAA7ePc+e+QYDHXrBps2PqFZiHkGR/xK8= rsc.io/binaryregexp v0.2.0 h1:HfqmD5MEmC0zvwBuF187nq9mdnXjXsSivRiXN7SmRkE= rsc.io/pdf v0.1.1 h1:k1MczvYDUvJBe93bYd7wrZLLUEcLZAuF824/I4e5Xr4= +rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0 h1:9JKUTTIUgS6kzR9mK1YuGKv6Nl+DijDNIc0ghT58FaY= rsc.io/sampler v1.3.0 h1:7uVkIFmeBqHfdjD+gZwtXXI+RODJ2Wc4O7MPEh/QiW4= sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q= From 93805ffeb4ca3855c9b530c9639605b46aa634ae Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 26 Sep 2023 15:55:00 -0400 Subject: [PATCH 011/183] generate abi files --- contracts/abi/NativeTokenMinter.go | 671 ++++++++++++++++++ contracts/abi/NativeTokenReceiver.go | 671 ++++++++++++++++++ .../NativeTokenBridge/NativeTokenReceiver.sol | 2 +- 3 files changed, 1343 insertions(+), 1 deletion(-) create mode 100644 contracts/abi/NativeTokenMinter.go create mode 100644 contracts/abi/NativeTokenReceiver.go diff --git a/contracts/abi/NativeTokenMinter.go b/contracts/abi/NativeTokenMinter.go new file mode 100644 index 000000000..9cb74a28f --- /dev/null +++ b/contracts/abi/NativeTokenMinter.go @@ -0,0 +1,671 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package abi + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// NativeTokenMinterMetaData contains all meta data concerning the NativeTokenMinter contract. +var NativeTokenMinterMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"partnerChainID_\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CannotBridgeTokenWithinSameChain\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"adjustedAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"InsufficientAdjustedAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientPayment\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidPartnerContractAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidRecipientAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSourceChain\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTeleporterMessengerAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Unauthorized\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"tokenContractAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destinationBridgeAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"transferAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"BridgeTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"MintNativeTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WARP_PRECOMPILE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeTokenContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"bridgeTokens\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentChainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"partnerChainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"nativeChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeBridgeAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", +} + +// NativeTokenMinterABI is the input ABI used to generate the binding from. +// Deprecated: Use NativeTokenMinterMetaData.ABI instead. +var NativeTokenMinterABI = NativeTokenMinterMetaData.ABI + +// NativeTokenMinter is an auto generated Go binding around an Ethereum contract. +type NativeTokenMinter struct { + NativeTokenMinterCaller // Read-only binding to the contract + NativeTokenMinterTransactor // Write-only binding to the contract + NativeTokenMinterFilterer // Log filterer for contract events +} + +// NativeTokenMinterCaller is an auto generated read-only Go binding around an Ethereum contract. +type NativeTokenMinterCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// NativeTokenMinterTransactor is an auto generated write-only Go binding around an Ethereum contract. +type NativeTokenMinterTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// NativeTokenMinterFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type NativeTokenMinterFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// NativeTokenMinterSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type NativeTokenMinterSession struct { + Contract *NativeTokenMinter // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// NativeTokenMinterCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type NativeTokenMinterCallerSession struct { + Contract *NativeTokenMinterCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// NativeTokenMinterTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type NativeTokenMinterTransactorSession struct { + Contract *NativeTokenMinterTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// NativeTokenMinterRaw is an auto generated low-level Go binding around an Ethereum contract. +type NativeTokenMinterRaw struct { + Contract *NativeTokenMinter // Generic contract binding to access the raw methods on +} + +// NativeTokenMinterCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type NativeTokenMinterCallerRaw struct { + Contract *NativeTokenMinterCaller // Generic read-only contract binding to access the raw methods on +} + +// NativeTokenMinterTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type NativeTokenMinterTransactorRaw struct { + Contract *NativeTokenMinterTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewNativeTokenMinter creates a new instance of NativeTokenMinter, bound to a specific deployed contract. +func NewNativeTokenMinter(address common.Address, backend bind.ContractBackend) (*NativeTokenMinter, error) { + contract, err := bindNativeTokenMinter(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &NativeTokenMinter{NativeTokenMinterCaller: NativeTokenMinterCaller{contract: contract}, NativeTokenMinterTransactor: NativeTokenMinterTransactor{contract: contract}, NativeTokenMinterFilterer: NativeTokenMinterFilterer{contract: contract}}, nil +} + +// NewNativeTokenMinterCaller creates a new read-only instance of NativeTokenMinter, bound to a specific deployed contract. +func NewNativeTokenMinterCaller(address common.Address, caller bind.ContractCaller) (*NativeTokenMinterCaller, error) { + contract, err := bindNativeTokenMinter(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &NativeTokenMinterCaller{contract: contract}, nil +} + +// NewNativeTokenMinterTransactor creates a new write-only instance of NativeTokenMinter, bound to a specific deployed contract. +func NewNativeTokenMinterTransactor(address common.Address, transactor bind.ContractTransactor) (*NativeTokenMinterTransactor, error) { + contract, err := bindNativeTokenMinter(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &NativeTokenMinterTransactor{contract: contract}, nil +} + +// NewNativeTokenMinterFilterer creates a new log filterer instance of NativeTokenMinter, bound to a specific deployed contract. +func NewNativeTokenMinterFilterer(address common.Address, filterer bind.ContractFilterer) (*NativeTokenMinterFilterer, error) { + contract, err := bindNativeTokenMinter(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &NativeTokenMinterFilterer{contract: contract}, nil +} + +// bindNativeTokenMinter binds a generic wrapper to an already deployed contract. +func bindNativeTokenMinter(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := NativeTokenMinterMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_NativeTokenMinter *NativeTokenMinterRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _NativeTokenMinter.Contract.NativeTokenMinterCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_NativeTokenMinter *NativeTokenMinterRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _NativeTokenMinter.Contract.NativeTokenMinterTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_NativeTokenMinter *NativeTokenMinterRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _NativeTokenMinter.Contract.NativeTokenMinterTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_NativeTokenMinter *NativeTokenMinterCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _NativeTokenMinter.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_NativeTokenMinter *NativeTokenMinterTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _NativeTokenMinter.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_NativeTokenMinter *NativeTokenMinterTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _NativeTokenMinter.Contract.contract.Transact(opts, method, params...) +} + +// TRANSFERNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xab285230. +// +// Solidity: function TRANSFER_NATIVE_TOKENS_REQUIRED_GAS() view returns(uint256) +func (_NativeTokenMinter *NativeTokenMinterCaller) TRANSFERNATIVETOKENSREQUIREDGAS(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _NativeTokenMinter.contract.Call(opts, &out, "TRANSFER_NATIVE_TOKENS_REQUIRED_GAS") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TRANSFERNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xab285230. +// +// Solidity: function TRANSFER_NATIVE_TOKENS_REQUIRED_GAS() view returns(uint256) +func (_NativeTokenMinter *NativeTokenMinterSession) TRANSFERNATIVETOKENSREQUIREDGAS() (*big.Int, error) { + return _NativeTokenMinter.Contract.TRANSFERNATIVETOKENSREQUIREDGAS(&_NativeTokenMinter.CallOpts) +} + +// TRANSFERNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xab285230. +// +// Solidity: function TRANSFER_NATIVE_TOKENS_REQUIRED_GAS() view returns(uint256) +func (_NativeTokenMinter *NativeTokenMinterCallerSession) TRANSFERNATIVETOKENSREQUIREDGAS() (*big.Int, error) { + return _NativeTokenMinter.Contract.TRANSFERNATIVETOKENSREQUIREDGAS(&_NativeTokenMinter.CallOpts) +} + +// WARPPRECOMPILEADDRESS is a free data retrieval call binding the contract method 0x74971856. +// +// Solidity: function WARP_PRECOMPILE_ADDRESS() view returns(address) +func (_NativeTokenMinter *NativeTokenMinterCaller) WARPPRECOMPILEADDRESS(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _NativeTokenMinter.contract.Call(opts, &out, "WARP_PRECOMPILE_ADDRESS") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// WARPPRECOMPILEADDRESS is a free data retrieval call binding the contract method 0x74971856. +// +// Solidity: function WARP_PRECOMPILE_ADDRESS() view returns(address) +func (_NativeTokenMinter *NativeTokenMinterSession) WARPPRECOMPILEADDRESS() (common.Address, error) { + return _NativeTokenMinter.Contract.WARPPRECOMPILEADDRESS(&_NativeTokenMinter.CallOpts) +} + +// WARPPRECOMPILEADDRESS is a free data retrieval call binding the contract method 0x74971856. +// +// Solidity: function WARP_PRECOMPILE_ADDRESS() view returns(address) +func (_NativeTokenMinter *NativeTokenMinterCallerSession) WARPPRECOMPILEADDRESS() (common.Address, error) { + return _NativeTokenMinter.Contract.WARPPRECOMPILEADDRESS(&_NativeTokenMinter.CallOpts) +} + +// CurrentChainID is a free data retrieval call binding the contract method 0xb179e1e7. +// +// Solidity: function currentChainID() view returns(bytes32) +func (_NativeTokenMinter *NativeTokenMinterCaller) CurrentChainID(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _NativeTokenMinter.contract.Call(opts, &out, "currentChainID") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// CurrentChainID is a free data retrieval call binding the contract method 0xb179e1e7. +// +// Solidity: function currentChainID() view returns(bytes32) +func (_NativeTokenMinter *NativeTokenMinterSession) CurrentChainID() ([32]byte, error) { + return _NativeTokenMinter.Contract.CurrentChainID(&_NativeTokenMinter.CallOpts) +} + +// CurrentChainID is a free data retrieval call binding the contract method 0xb179e1e7. +// +// Solidity: function currentChainID() view returns(bytes32) +func (_NativeTokenMinter *NativeTokenMinterCallerSession) CurrentChainID() ([32]byte, error) { + return _NativeTokenMinter.Contract.CurrentChainID(&_NativeTokenMinter.CallOpts) +} + +// PartnerChainID is a free data retrieval call binding the contract method 0x9c224734. +// +// Solidity: function partnerChainID() view returns(bytes32) +func (_NativeTokenMinter *NativeTokenMinterCaller) PartnerChainID(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _NativeTokenMinter.contract.Call(opts, &out, "partnerChainID") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// PartnerChainID is a free data retrieval call binding the contract method 0x9c224734. +// +// Solidity: function partnerChainID() view returns(bytes32) +func (_NativeTokenMinter *NativeTokenMinterSession) PartnerChainID() ([32]byte, error) { + return _NativeTokenMinter.Contract.PartnerChainID(&_NativeTokenMinter.CallOpts) +} + +// PartnerChainID is a free data retrieval call binding the contract method 0x9c224734. +// +// Solidity: function partnerChainID() view returns(bytes32) +func (_NativeTokenMinter *NativeTokenMinterCallerSession) PartnerChainID() ([32]byte, error) { + return _NativeTokenMinter.Contract.PartnerChainID(&_NativeTokenMinter.CallOpts) +} + +// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// +// Solidity: function teleporterMessenger() view returns(address) +func (_NativeTokenMinter *NativeTokenMinterCaller) TeleporterMessenger(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _NativeTokenMinter.contract.Call(opts, &out, "teleporterMessenger") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// +// Solidity: function teleporterMessenger() view returns(address) +func (_NativeTokenMinter *NativeTokenMinterSession) TeleporterMessenger() (common.Address, error) { + return _NativeTokenMinter.Contract.TeleporterMessenger(&_NativeTokenMinter.CallOpts) +} + +// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// +// Solidity: function teleporterMessenger() view returns(address) +func (_NativeTokenMinter *NativeTokenMinterCallerSession) TeleporterMessenger() (common.Address, error) { + return _NativeTokenMinter.Contract.TeleporterMessenger(&_NativeTokenMinter.CallOpts) +} + +// BridgeTokens is a paid mutator transaction binding the contract method 0xf9fe683e. +// +// Solidity: function bridgeTokens(address recipient, address feeTokenContractAddress, uint256 feeAmount) payable returns() +func (_NativeTokenMinter *NativeTokenMinterTransactor) BridgeTokens(opts *bind.TransactOpts, recipient common.Address, feeTokenContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { + return _NativeTokenMinter.contract.Transact(opts, "bridgeTokens", recipient, feeTokenContractAddress, feeAmount) +} + +// BridgeTokens is a paid mutator transaction binding the contract method 0xf9fe683e. +// +// Solidity: function bridgeTokens(address recipient, address feeTokenContractAddress, uint256 feeAmount) payable returns() +func (_NativeTokenMinter *NativeTokenMinterSession) BridgeTokens(recipient common.Address, feeTokenContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { + return _NativeTokenMinter.Contract.BridgeTokens(&_NativeTokenMinter.TransactOpts, recipient, feeTokenContractAddress, feeAmount) +} + +// BridgeTokens is a paid mutator transaction binding the contract method 0xf9fe683e. +// +// Solidity: function bridgeTokens(address recipient, address feeTokenContractAddress, uint256 feeAmount) payable returns() +func (_NativeTokenMinter *NativeTokenMinterTransactorSession) BridgeTokens(recipient common.Address, feeTokenContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { + return _NativeTokenMinter.Contract.BridgeTokens(&_NativeTokenMinter.TransactOpts, recipient, feeTokenContractAddress, feeAmount) +} + +// ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. +// +// Solidity: function receiveTeleporterMessage(bytes32 nativeChainID, address nativeBridgeAddress, bytes message) returns() +func (_NativeTokenMinter *NativeTokenMinterTransactor) ReceiveTeleporterMessage(opts *bind.TransactOpts, nativeChainID [32]byte, nativeBridgeAddress common.Address, message []byte) (*types.Transaction, error) { + return _NativeTokenMinter.contract.Transact(opts, "receiveTeleporterMessage", nativeChainID, nativeBridgeAddress, message) +} + +// ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. +// +// Solidity: function receiveTeleporterMessage(bytes32 nativeChainID, address nativeBridgeAddress, bytes message) returns() +func (_NativeTokenMinter *NativeTokenMinterSession) ReceiveTeleporterMessage(nativeChainID [32]byte, nativeBridgeAddress common.Address, message []byte) (*types.Transaction, error) { + return _NativeTokenMinter.Contract.ReceiveTeleporterMessage(&_NativeTokenMinter.TransactOpts, nativeChainID, nativeBridgeAddress, message) +} + +// ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. +// +// Solidity: function receiveTeleporterMessage(bytes32 nativeChainID, address nativeBridgeAddress, bytes message) returns() +func (_NativeTokenMinter *NativeTokenMinterTransactorSession) ReceiveTeleporterMessage(nativeChainID [32]byte, nativeBridgeAddress common.Address, message []byte) (*types.Transaction, error) { + return _NativeTokenMinter.Contract.ReceiveTeleporterMessage(&_NativeTokenMinter.TransactOpts, nativeChainID, nativeBridgeAddress, message) +} + +// NativeTokenMinterBridgeTokensIterator is returned from FilterBridgeTokens and is used to iterate over the raw logs and unpacked data for BridgeTokens events raised by the NativeTokenMinter contract. +type NativeTokenMinterBridgeTokensIterator struct { + Event *NativeTokenMinterBridgeTokens // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *NativeTokenMinterBridgeTokensIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(NativeTokenMinterBridgeTokens) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(NativeTokenMinterBridgeTokens) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *NativeTokenMinterBridgeTokensIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *NativeTokenMinterBridgeTokensIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// NativeTokenMinterBridgeTokens represents a BridgeTokens event raised by the NativeTokenMinter contract. +type NativeTokenMinterBridgeTokens struct { + TokenContractAddress common.Address + TeleporterMessageID *big.Int + DestinationChainID [32]byte + DestinationBridgeAddress common.Address + Recipient common.Address + TransferAmount *big.Int + FeeAmount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBridgeTokens is a free log retrieval operation binding the contract event 0xfd68c031379d96b674b8ff93f8bba98792a892b18f15c19e26dc84485f4f33e2. +// +// Solidity: event BridgeTokens(address indexed tokenContractAddress, uint256 indexed teleporterMessageID, bytes32 destinationChainID, address destinationBridgeAddress, address recipient, uint256 transferAmount, uint256 feeAmount) +func (_NativeTokenMinter *NativeTokenMinterFilterer) FilterBridgeTokens(opts *bind.FilterOpts, tokenContractAddress []common.Address, teleporterMessageID []*big.Int) (*NativeTokenMinterBridgeTokensIterator, error) { + + var tokenContractAddressRule []interface{} + for _, tokenContractAddressItem := range tokenContractAddress { + tokenContractAddressRule = append(tokenContractAddressRule, tokenContractAddressItem) + } + var teleporterMessageIDRule []interface{} + for _, teleporterMessageIDItem := range teleporterMessageID { + teleporterMessageIDRule = append(teleporterMessageIDRule, teleporterMessageIDItem) + } + + logs, sub, err := _NativeTokenMinter.contract.FilterLogs(opts, "BridgeTokens", tokenContractAddressRule, teleporterMessageIDRule) + if err != nil { + return nil, err + } + return &NativeTokenMinterBridgeTokensIterator{contract: _NativeTokenMinter.contract, event: "BridgeTokens", logs: logs, sub: sub}, nil +} + +// WatchBridgeTokens is a free log subscription operation binding the contract event 0xfd68c031379d96b674b8ff93f8bba98792a892b18f15c19e26dc84485f4f33e2. +// +// Solidity: event BridgeTokens(address indexed tokenContractAddress, uint256 indexed teleporterMessageID, bytes32 destinationChainID, address destinationBridgeAddress, address recipient, uint256 transferAmount, uint256 feeAmount) +func (_NativeTokenMinter *NativeTokenMinterFilterer) WatchBridgeTokens(opts *bind.WatchOpts, sink chan<- *NativeTokenMinterBridgeTokens, tokenContractAddress []common.Address, teleporterMessageID []*big.Int) (event.Subscription, error) { + + var tokenContractAddressRule []interface{} + for _, tokenContractAddressItem := range tokenContractAddress { + tokenContractAddressRule = append(tokenContractAddressRule, tokenContractAddressItem) + } + var teleporterMessageIDRule []interface{} + for _, teleporterMessageIDItem := range teleporterMessageID { + teleporterMessageIDRule = append(teleporterMessageIDRule, teleporterMessageIDItem) + } + + logs, sub, err := _NativeTokenMinter.contract.WatchLogs(opts, "BridgeTokens", tokenContractAddressRule, teleporterMessageIDRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(NativeTokenMinterBridgeTokens) + if err := _NativeTokenMinter.contract.UnpackLog(event, "BridgeTokens", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseBridgeTokens is a log parse operation binding the contract event 0xfd68c031379d96b674b8ff93f8bba98792a892b18f15c19e26dc84485f4f33e2. +// +// Solidity: event BridgeTokens(address indexed tokenContractAddress, uint256 indexed teleporterMessageID, bytes32 destinationChainID, address destinationBridgeAddress, address recipient, uint256 transferAmount, uint256 feeAmount) +func (_NativeTokenMinter *NativeTokenMinterFilterer) ParseBridgeTokens(log types.Log) (*NativeTokenMinterBridgeTokens, error) { + event := new(NativeTokenMinterBridgeTokens) + if err := _NativeTokenMinter.contract.UnpackLog(event, "BridgeTokens", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// NativeTokenMinterMintNativeTokensIterator is returned from FilterMintNativeTokens and is used to iterate over the raw logs and unpacked data for MintNativeTokens events raised by the NativeTokenMinter contract. +type NativeTokenMinterMintNativeTokensIterator struct { + Event *NativeTokenMinterMintNativeTokens // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *NativeTokenMinterMintNativeTokensIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(NativeTokenMinterMintNativeTokens) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(NativeTokenMinterMintNativeTokens) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *NativeTokenMinterMintNativeTokensIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *NativeTokenMinterMintNativeTokensIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// NativeTokenMinterMintNativeTokens represents a MintNativeTokens event raised by the NativeTokenMinter contract. +type NativeTokenMinterMintNativeTokens struct { + Recipient common.Address + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterMintNativeTokens is a free log retrieval operation binding the contract event 0xe2899f7ef7618206fa13efbcde0c05cccd83f35ac3b18ef860021181d61fa680. +// +// Solidity: event MintNativeTokens(address recipient, uint256 amount) +func (_NativeTokenMinter *NativeTokenMinterFilterer) FilterMintNativeTokens(opts *bind.FilterOpts) (*NativeTokenMinterMintNativeTokensIterator, error) { + + logs, sub, err := _NativeTokenMinter.contract.FilterLogs(opts, "MintNativeTokens") + if err != nil { + return nil, err + } + return &NativeTokenMinterMintNativeTokensIterator{contract: _NativeTokenMinter.contract, event: "MintNativeTokens", logs: logs, sub: sub}, nil +} + +// WatchMintNativeTokens is a free log subscription operation binding the contract event 0xe2899f7ef7618206fa13efbcde0c05cccd83f35ac3b18ef860021181d61fa680. +// +// Solidity: event MintNativeTokens(address recipient, uint256 amount) +func (_NativeTokenMinter *NativeTokenMinterFilterer) WatchMintNativeTokens(opts *bind.WatchOpts, sink chan<- *NativeTokenMinterMintNativeTokens) (event.Subscription, error) { + + logs, sub, err := _NativeTokenMinter.contract.WatchLogs(opts, "MintNativeTokens") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(NativeTokenMinterMintNativeTokens) + if err := _NativeTokenMinter.contract.UnpackLog(event, "MintNativeTokens", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseMintNativeTokens is a log parse operation binding the contract event 0xe2899f7ef7618206fa13efbcde0c05cccd83f35ac3b18ef860021181d61fa680. +// +// Solidity: event MintNativeTokens(address recipient, uint256 amount) +func (_NativeTokenMinter *NativeTokenMinterFilterer) ParseMintNativeTokens(log types.Log) (*NativeTokenMinterMintNativeTokens, error) { + event := new(NativeTokenMinterMintNativeTokens) + if err := _NativeTokenMinter.contract.UnpackLog(event, "MintNativeTokens", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/contracts/abi/NativeTokenReceiver.go b/contracts/abi/NativeTokenReceiver.go new file mode 100644 index 000000000..b2b27e40b --- /dev/null +++ b/contracts/abi/NativeTokenReceiver.go @@ -0,0 +1,671 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package abi + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// NativeTokenReceiverMetaData contains all meta data concerning the NativeTokenReceiver contract. +var NativeTokenReceiverMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"partnerChainID_\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CannotBridgeTokenWithinSameChain\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"adjustedAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"InsufficientAdjustedAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientPayment\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidPartnerContractAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidRecipientAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSourceChain\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTeleporterMessengerAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Unauthorized\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"tokenContractAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destinationBridgeAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"transferAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"BridgeTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WARP_PRECOMPILE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeTokenContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"bridgeTokens\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentChainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"partnerChainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"nativeChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeBridgeAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", +} + +// NativeTokenReceiverABI is the input ABI used to generate the binding from. +// Deprecated: Use NativeTokenReceiverMetaData.ABI instead. +var NativeTokenReceiverABI = NativeTokenReceiverMetaData.ABI + +// NativeTokenReceiver is an auto generated Go binding around an Ethereum contract. +type NativeTokenReceiver struct { + NativeTokenReceiverCaller // Read-only binding to the contract + NativeTokenReceiverTransactor // Write-only binding to the contract + NativeTokenReceiverFilterer // Log filterer for contract events +} + +// NativeTokenReceiverCaller is an auto generated read-only Go binding around an Ethereum contract. +type NativeTokenReceiverCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// NativeTokenReceiverTransactor is an auto generated write-only Go binding around an Ethereum contract. +type NativeTokenReceiverTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// NativeTokenReceiverFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type NativeTokenReceiverFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// NativeTokenReceiverSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type NativeTokenReceiverSession struct { + Contract *NativeTokenReceiver // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// NativeTokenReceiverCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type NativeTokenReceiverCallerSession struct { + Contract *NativeTokenReceiverCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// NativeTokenReceiverTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type NativeTokenReceiverTransactorSession struct { + Contract *NativeTokenReceiverTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// NativeTokenReceiverRaw is an auto generated low-level Go binding around an Ethereum contract. +type NativeTokenReceiverRaw struct { + Contract *NativeTokenReceiver // Generic contract binding to access the raw methods on +} + +// NativeTokenReceiverCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type NativeTokenReceiverCallerRaw struct { + Contract *NativeTokenReceiverCaller // Generic read-only contract binding to access the raw methods on +} + +// NativeTokenReceiverTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type NativeTokenReceiverTransactorRaw struct { + Contract *NativeTokenReceiverTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewNativeTokenReceiver creates a new instance of NativeTokenReceiver, bound to a specific deployed contract. +func NewNativeTokenReceiver(address common.Address, backend bind.ContractBackend) (*NativeTokenReceiver, error) { + contract, err := bindNativeTokenReceiver(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &NativeTokenReceiver{NativeTokenReceiverCaller: NativeTokenReceiverCaller{contract: contract}, NativeTokenReceiverTransactor: NativeTokenReceiverTransactor{contract: contract}, NativeTokenReceiverFilterer: NativeTokenReceiverFilterer{contract: contract}}, nil +} + +// NewNativeTokenReceiverCaller creates a new read-only instance of NativeTokenReceiver, bound to a specific deployed contract. +func NewNativeTokenReceiverCaller(address common.Address, caller bind.ContractCaller) (*NativeTokenReceiverCaller, error) { + contract, err := bindNativeTokenReceiver(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &NativeTokenReceiverCaller{contract: contract}, nil +} + +// NewNativeTokenReceiverTransactor creates a new write-only instance of NativeTokenReceiver, bound to a specific deployed contract. +func NewNativeTokenReceiverTransactor(address common.Address, transactor bind.ContractTransactor) (*NativeTokenReceiverTransactor, error) { + contract, err := bindNativeTokenReceiver(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &NativeTokenReceiverTransactor{contract: contract}, nil +} + +// NewNativeTokenReceiverFilterer creates a new log filterer instance of NativeTokenReceiver, bound to a specific deployed contract. +func NewNativeTokenReceiverFilterer(address common.Address, filterer bind.ContractFilterer) (*NativeTokenReceiverFilterer, error) { + contract, err := bindNativeTokenReceiver(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &NativeTokenReceiverFilterer{contract: contract}, nil +} + +// bindNativeTokenReceiver binds a generic wrapper to an already deployed contract. +func bindNativeTokenReceiver(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := NativeTokenReceiverMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_NativeTokenReceiver *NativeTokenReceiverRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _NativeTokenReceiver.Contract.NativeTokenReceiverCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_NativeTokenReceiver *NativeTokenReceiverRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _NativeTokenReceiver.Contract.NativeTokenReceiverTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_NativeTokenReceiver *NativeTokenReceiverRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _NativeTokenReceiver.Contract.NativeTokenReceiverTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_NativeTokenReceiver *NativeTokenReceiverCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _NativeTokenReceiver.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_NativeTokenReceiver *NativeTokenReceiverTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _NativeTokenReceiver.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_NativeTokenReceiver *NativeTokenReceiverTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _NativeTokenReceiver.Contract.contract.Transact(opts, method, params...) +} + +// MINTNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xb6171f73. +// +// Solidity: function MINT_NATIVE_TOKENS_REQUIRED_GAS() view returns(uint256) +func (_NativeTokenReceiver *NativeTokenReceiverCaller) MINTNATIVETOKENSREQUIREDGAS(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _NativeTokenReceiver.contract.Call(opts, &out, "MINT_NATIVE_TOKENS_REQUIRED_GAS") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// MINTNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xb6171f73. +// +// Solidity: function MINT_NATIVE_TOKENS_REQUIRED_GAS() view returns(uint256) +func (_NativeTokenReceiver *NativeTokenReceiverSession) MINTNATIVETOKENSREQUIREDGAS() (*big.Int, error) { + return _NativeTokenReceiver.Contract.MINTNATIVETOKENSREQUIREDGAS(&_NativeTokenReceiver.CallOpts) +} + +// MINTNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xb6171f73. +// +// Solidity: function MINT_NATIVE_TOKENS_REQUIRED_GAS() view returns(uint256) +func (_NativeTokenReceiver *NativeTokenReceiverCallerSession) MINTNATIVETOKENSREQUIREDGAS() (*big.Int, error) { + return _NativeTokenReceiver.Contract.MINTNATIVETOKENSREQUIREDGAS(&_NativeTokenReceiver.CallOpts) +} + +// WARPPRECOMPILEADDRESS is a free data retrieval call binding the contract method 0x74971856. +// +// Solidity: function WARP_PRECOMPILE_ADDRESS() view returns(address) +func (_NativeTokenReceiver *NativeTokenReceiverCaller) WARPPRECOMPILEADDRESS(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _NativeTokenReceiver.contract.Call(opts, &out, "WARP_PRECOMPILE_ADDRESS") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// WARPPRECOMPILEADDRESS is a free data retrieval call binding the contract method 0x74971856. +// +// Solidity: function WARP_PRECOMPILE_ADDRESS() view returns(address) +func (_NativeTokenReceiver *NativeTokenReceiverSession) WARPPRECOMPILEADDRESS() (common.Address, error) { + return _NativeTokenReceiver.Contract.WARPPRECOMPILEADDRESS(&_NativeTokenReceiver.CallOpts) +} + +// WARPPRECOMPILEADDRESS is a free data retrieval call binding the contract method 0x74971856. +// +// Solidity: function WARP_PRECOMPILE_ADDRESS() view returns(address) +func (_NativeTokenReceiver *NativeTokenReceiverCallerSession) WARPPRECOMPILEADDRESS() (common.Address, error) { + return _NativeTokenReceiver.Contract.WARPPRECOMPILEADDRESS(&_NativeTokenReceiver.CallOpts) +} + +// CurrentChainID is a free data retrieval call binding the contract method 0xb179e1e7. +// +// Solidity: function currentChainID() view returns(bytes32) +func (_NativeTokenReceiver *NativeTokenReceiverCaller) CurrentChainID(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _NativeTokenReceiver.contract.Call(opts, &out, "currentChainID") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// CurrentChainID is a free data retrieval call binding the contract method 0xb179e1e7. +// +// Solidity: function currentChainID() view returns(bytes32) +func (_NativeTokenReceiver *NativeTokenReceiverSession) CurrentChainID() ([32]byte, error) { + return _NativeTokenReceiver.Contract.CurrentChainID(&_NativeTokenReceiver.CallOpts) +} + +// CurrentChainID is a free data retrieval call binding the contract method 0xb179e1e7. +// +// Solidity: function currentChainID() view returns(bytes32) +func (_NativeTokenReceiver *NativeTokenReceiverCallerSession) CurrentChainID() ([32]byte, error) { + return _NativeTokenReceiver.Contract.CurrentChainID(&_NativeTokenReceiver.CallOpts) +} + +// PartnerChainID is a free data retrieval call binding the contract method 0x9c224734. +// +// Solidity: function partnerChainID() view returns(bytes32) +func (_NativeTokenReceiver *NativeTokenReceiverCaller) PartnerChainID(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _NativeTokenReceiver.contract.Call(opts, &out, "partnerChainID") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// PartnerChainID is a free data retrieval call binding the contract method 0x9c224734. +// +// Solidity: function partnerChainID() view returns(bytes32) +func (_NativeTokenReceiver *NativeTokenReceiverSession) PartnerChainID() ([32]byte, error) { + return _NativeTokenReceiver.Contract.PartnerChainID(&_NativeTokenReceiver.CallOpts) +} + +// PartnerChainID is a free data retrieval call binding the contract method 0x9c224734. +// +// Solidity: function partnerChainID() view returns(bytes32) +func (_NativeTokenReceiver *NativeTokenReceiverCallerSession) PartnerChainID() ([32]byte, error) { + return _NativeTokenReceiver.Contract.PartnerChainID(&_NativeTokenReceiver.CallOpts) +} + +// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// +// Solidity: function teleporterMessenger() view returns(address) +func (_NativeTokenReceiver *NativeTokenReceiverCaller) TeleporterMessenger(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _NativeTokenReceiver.contract.Call(opts, &out, "teleporterMessenger") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// +// Solidity: function teleporterMessenger() view returns(address) +func (_NativeTokenReceiver *NativeTokenReceiverSession) TeleporterMessenger() (common.Address, error) { + return _NativeTokenReceiver.Contract.TeleporterMessenger(&_NativeTokenReceiver.CallOpts) +} + +// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// +// Solidity: function teleporterMessenger() view returns(address) +func (_NativeTokenReceiver *NativeTokenReceiverCallerSession) TeleporterMessenger() (common.Address, error) { + return _NativeTokenReceiver.Contract.TeleporterMessenger(&_NativeTokenReceiver.CallOpts) +} + +// BridgeTokens is a paid mutator transaction binding the contract method 0xf9fe683e. +// +// Solidity: function bridgeTokens(address recipient, address feeTokenContractAddress, uint256 feeAmount) payable returns() +func (_NativeTokenReceiver *NativeTokenReceiverTransactor) BridgeTokens(opts *bind.TransactOpts, recipient common.Address, feeTokenContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { + return _NativeTokenReceiver.contract.Transact(opts, "bridgeTokens", recipient, feeTokenContractAddress, feeAmount) +} + +// BridgeTokens is a paid mutator transaction binding the contract method 0xf9fe683e. +// +// Solidity: function bridgeTokens(address recipient, address feeTokenContractAddress, uint256 feeAmount) payable returns() +func (_NativeTokenReceiver *NativeTokenReceiverSession) BridgeTokens(recipient common.Address, feeTokenContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { + return _NativeTokenReceiver.Contract.BridgeTokens(&_NativeTokenReceiver.TransactOpts, recipient, feeTokenContractAddress, feeAmount) +} + +// BridgeTokens is a paid mutator transaction binding the contract method 0xf9fe683e. +// +// Solidity: function bridgeTokens(address recipient, address feeTokenContractAddress, uint256 feeAmount) payable returns() +func (_NativeTokenReceiver *NativeTokenReceiverTransactorSession) BridgeTokens(recipient common.Address, feeTokenContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { + return _NativeTokenReceiver.Contract.BridgeTokens(&_NativeTokenReceiver.TransactOpts, recipient, feeTokenContractAddress, feeAmount) +} + +// ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. +// +// Solidity: function receiveTeleporterMessage(bytes32 nativeChainID, address nativeBridgeAddress, bytes message) returns() +func (_NativeTokenReceiver *NativeTokenReceiverTransactor) ReceiveTeleporterMessage(opts *bind.TransactOpts, nativeChainID [32]byte, nativeBridgeAddress common.Address, message []byte) (*types.Transaction, error) { + return _NativeTokenReceiver.contract.Transact(opts, "receiveTeleporterMessage", nativeChainID, nativeBridgeAddress, message) +} + +// ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. +// +// Solidity: function receiveTeleporterMessage(bytes32 nativeChainID, address nativeBridgeAddress, bytes message) returns() +func (_NativeTokenReceiver *NativeTokenReceiverSession) ReceiveTeleporterMessage(nativeChainID [32]byte, nativeBridgeAddress common.Address, message []byte) (*types.Transaction, error) { + return _NativeTokenReceiver.Contract.ReceiveTeleporterMessage(&_NativeTokenReceiver.TransactOpts, nativeChainID, nativeBridgeAddress, message) +} + +// ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. +// +// Solidity: function receiveTeleporterMessage(bytes32 nativeChainID, address nativeBridgeAddress, bytes message) returns() +func (_NativeTokenReceiver *NativeTokenReceiverTransactorSession) ReceiveTeleporterMessage(nativeChainID [32]byte, nativeBridgeAddress common.Address, message []byte) (*types.Transaction, error) { + return _NativeTokenReceiver.Contract.ReceiveTeleporterMessage(&_NativeTokenReceiver.TransactOpts, nativeChainID, nativeBridgeAddress, message) +} + +// NativeTokenReceiverBridgeTokensIterator is returned from FilterBridgeTokens and is used to iterate over the raw logs and unpacked data for BridgeTokens events raised by the NativeTokenReceiver contract. +type NativeTokenReceiverBridgeTokensIterator struct { + Event *NativeTokenReceiverBridgeTokens // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *NativeTokenReceiverBridgeTokensIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(NativeTokenReceiverBridgeTokens) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(NativeTokenReceiverBridgeTokens) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *NativeTokenReceiverBridgeTokensIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *NativeTokenReceiverBridgeTokensIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// NativeTokenReceiverBridgeTokens represents a BridgeTokens event raised by the NativeTokenReceiver contract. +type NativeTokenReceiverBridgeTokens struct { + TokenContractAddress common.Address + TeleporterMessageID *big.Int + DestinationChainID [32]byte + DestinationBridgeAddress common.Address + Recipient common.Address + TransferAmount *big.Int + FeeAmount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBridgeTokens is a free log retrieval operation binding the contract event 0xfd68c031379d96b674b8ff93f8bba98792a892b18f15c19e26dc84485f4f33e2. +// +// Solidity: event BridgeTokens(address indexed tokenContractAddress, uint256 indexed teleporterMessageID, bytes32 destinationChainID, address destinationBridgeAddress, address recipient, uint256 transferAmount, uint256 feeAmount) +func (_NativeTokenReceiver *NativeTokenReceiverFilterer) FilterBridgeTokens(opts *bind.FilterOpts, tokenContractAddress []common.Address, teleporterMessageID []*big.Int) (*NativeTokenReceiverBridgeTokensIterator, error) { + + var tokenContractAddressRule []interface{} + for _, tokenContractAddressItem := range tokenContractAddress { + tokenContractAddressRule = append(tokenContractAddressRule, tokenContractAddressItem) + } + var teleporterMessageIDRule []interface{} + for _, teleporterMessageIDItem := range teleporterMessageID { + teleporterMessageIDRule = append(teleporterMessageIDRule, teleporterMessageIDItem) + } + + logs, sub, err := _NativeTokenReceiver.contract.FilterLogs(opts, "BridgeTokens", tokenContractAddressRule, teleporterMessageIDRule) + if err != nil { + return nil, err + } + return &NativeTokenReceiverBridgeTokensIterator{contract: _NativeTokenReceiver.contract, event: "BridgeTokens", logs: logs, sub: sub}, nil +} + +// WatchBridgeTokens is a free log subscription operation binding the contract event 0xfd68c031379d96b674b8ff93f8bba98792a892b18f15c19e26dc84485f4f33e2. +// +// Solidity: event BridgeTokens(address indexed tokenContractAddress, uint256 indexed teleporterMessageID, bytes32 destinationChainID, address destinationBridgeAddress, address recipient, uint256 transferAmount, uint256 feeAmount) +func (_NativeTokenReceiver *NativeTokenReceiverFilterer) WatchBridgeTokens(opts *bind.WatchOpts, sink chan<- *NativeTokenReceiverBridgeTokens, tokenContractAddress []common.Address, teleporterMessageID []*big.Int) (event.Subscription, error) { + + var tokenContractAddressRule []interface{} + for _, tokenContractAddressItem := range tokenContractAddress { + tokenContractAddressRule = append(tokenContractAddressRule, tokenContractAddressItem) + } + var teleporterMessageIDRule []interface{} + for _, teleporterMessageIDItem := range teleporterMessageID { + teleporterMessageIDRule = append(teleporterMessageIDRule, teleporterMessageIDItem) + } + + logs, sub, err := _NativeTokenReceiver.contract.WatchLogs(opts, "BridgeTokens", tokenContractAddressRule, teleporterMessageIDRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(NativeTokenReceiverBridgeTokens) + if err := _NativeTokenReceiver.contract.UnpackLog(event, "BridgeTokens", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseBridgeTokens is a log parse operation binding the contract event 0xfd68c031379d96b674b8ff93f8bba98792a892b18f15c19e26dc84485f4f33e2. +// +// Solidity: event BridgeTokens(address indexed tokenContractAddress, uint256 indexed teleporterMessageID, bytes32 destinationChainID, address destinationBridgeAddress, address recipient, uint256 transferAmount, uint256 feeAmount) +func (_NativeTokenReceiver *NativeTokenReceiverFilterer) ParseBridgeTokens(log types.Log) (*NativeTokenReceiverBridgeTokens, error) { + event := new(NativeTokenReceiverBridgeTokens) + if err := _NativeTokenReceiver.contract.UnpackLog(event, "BridgeTokens", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// NativeTokenReceiverUnlockTokensIterator is returned from FilterUnlockTokens and is used to iterate over the raw logs and unpacked data for UnlockTokens events raised by the NativeTokenReceiver contract. +type NativeTokenReceiverUnlockTokensIterator struct { + Event *NativeTokenReceiverUnlockTokens // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *NativeTokenReceiverUnlockTokensIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(NativeTokenReceiverUnlockTokens) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(NativeTokenReceiverUnlockTokens) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *NativeTokenReceiverUnlockTokensIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *NativeTokenReceiverUnlockTokensIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// NativeTokenReceiverUnlockTokens represents a UnlockTokens event raised by the NativeTokenReceiver contract. +type NativeTokenReceiverUnlockTokens struct { + Recipient common.Address + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterUnlockTokens is a free log retrieval operation binding the contract event 0x55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407. +// +// Solidity: event UnlockTokens(address recipient, uint256 amount) +func (_NativeTokenReceiver *NativeTokenReceiverFilterer) FilterUnlockTokens(opts *bind.FilterOpts) (*NativeTokenReceiverUnlockTokensIterator, error) { + + logs, sub, err := _NativeTokenReceiver.contract.FilterLogs(opts, "UnlockTokens") + if err != nil { + return nil, err + } + return &NativeTokenReceiverUnlockTokensIterator{contract: _NativeTokenReceiver.contract, event: "UnlockTokens", logs: logs, sub: sub}, nil +} + +// WatchUnlockTokens is a free log subscription operation binding the contract event 0x55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407. +// +// Solidity: event UnlockTokens(address recipient, uint256 amount) +func (_NativeTokenReceiver *NativeTokenReceiverFilterer) WatchUnlockTokens(opts *bind.WatchOpts, sink chan<- *NativeTokenReceiverUnlockTokens) (event.Subscription, error) { + + logs, sub, err := _NativeTokenReceiver.contract.WatchLogs(opts, "UnlockTokens") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(NativeTokenReceiverUnlockTokens) + if err := _NativeTokenReceiver.contract.UnpackLog(event, "UnlockTokens", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseUnlockTokens is a log parse operation binding the contract event 0x55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407. +// +// Solidity: event UnlockTokens(address recipient, uint256 amount) +func (_NativeTokenReceiver *NativeTokenReceiverFilterer) ParseUnlockTokens(log types.Log) (*NativeTokenReceiverUnlockTokens, error) { + event := new(NativeTokenReceiverUnlockTokens) + if err := _NativeTokenReceiver.contract.UnpackLog(event, "UnlockTokens", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenReceiver.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenReceiver.sol index 14a3b4405..8ab185ae5 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenReceiver.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenReceiver.sol @@ -8,7 +8,7 @@ import "../../Teleporter/ITeleporterMessenger.sol"; import "../../Teleporter/ITeleporterReceiver.sol"; import "../../Teleporter/SafeERC20TransferFrom.sol"; -contract NativeTokenMinter is ITeleporterReceiver, INativeTokenReceiver, ReentrancyGuard { +contract NativeTokenReceiver is ITeleporterReceiver, INativeTokenReceiver, ReentrancyGuard { address public constant WARP_PRECOMPILE_ADDRESS = 0x0200000000000000000000000000000000000005; From 5ddae2793d4a2815b494c0e8e90bb65a241c0a7c Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 26 Sep 2023 16:07:38 -0400 Subject: [PATCH 012/183] Slither fixes --- .../NativeTokenBridge/NativeTokenMinter.sol | 2 +- .../NativeTokenBridge/NativeTokenReceiver.sol | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenMinter.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenMinter.sol index 085a0aeec..74e8da121 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenMinter.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenMinter.sol @@ -16,7 +16,7 @@ address constant MINTER_ADDRESS = 0x0200000000000000000000000000000000000001; address constant BLACKHOLE_ADDRESS = 0x0100000000000000000000000000000000000000; contract NativeTokenMinter is ITeleporterReceiver, INativeTokenMinter, ReentrancyGuard { - INativeMinter private _nativeMinter = INativeMinter(MINTER_ADDRESS); + INativeMinter private immutable _nativeMinter = INativeMinter(MINTER_ADDRESS); address public constant WARP_PRECOMPILE_ADDRESS = 0x0200000000000000000000000000000000000005; diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenReceiver.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenReceiver.sol index 8ab185ae5..6b54dab3c 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenReceiver.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenReceiver.sol @@ -22,6 +22,7 @@ contract NativeTokenReceiver is ITeleporterReceiver, INativeTokenReceiver, Reent error InvalidTeleporterMessengerAddress(); error InvalidRecipientAddress(); error InvalidSourceChain(); + error InvalidRecipient(); error InvalidPartnerContractAddress(); error CannotBridgeTokenWithinSameChain(); error Unauthorized(); @@ -51,7 +52,7 @@ contract NativeTokenReceiver is ITeleporterReceiver, INativeTokenReceiver, Reent bytes32 nativeChainID, address nativeBridgeAddress, bytes calldata message - ) external nonReentrant() { + ) external nonReentrant { // Only allow the Teleporter messenger to deliver messages. if (msg.sender != address(teleporterMessenger)) { @@ -67,6 +68,9 @@ contract NativeTokenReceiver is ITeleporterReceiver, INativeTokenReceiver, Reent } (address recipient, uint256 amount) = abi.decode(message, (address, uint256)); + if (address == address(0)) { + revert InvalidRecipient(); + } // TODO set up starting threshold. From 8ceb73ea96076d1d5933bf5c34b0b2c6c766ccab Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 26 Sep 2023 16:17:57 -0400 Subject: [PATCH 013/183] typo --- contracts/src/Teleporter/TeleporterMessenger.sol | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contracts/src/Teleporter/TeleporterMessenger.sol b/contracts/src/Teleporter/TeleporterMessenger.sol index 1b8f20fc5..9b524c4cf 100644 --- a/contracts/src/Teleporter/TeleporterMessenger.sol +++ b/contracts/src/Teleporter/TeleporterMessenger.sol @@ -221,7 +221,8 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { if ( sentMessageInfo[destinationChainID][messageID] .feeInfo - .contractAddress != feeContractAddress + .contractAddress != + feeContractAddress ) { revert InvalidFeeAssetContractAddress(); } From 060be4ed7114d4dd3d927542d1ff5bd30bdad502 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 26 Sep 2023 16:30:34 -0400 Subject: [PATCH 014/183] Fix --- .../NativeTokenBridge/NativeTokenReceiver.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenReceiver.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenReceiver.sol index 6b54dab3c..a31e137d9 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenReceiver.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenReceiver.sol @@ -68,7 +68,7 @@ contract NativeTokenReceiver is ITeleporterReceiver, INativeTokenReceiver, Reent } (address recipient, uint256 amount) = abi.decode(message, (address, uint256)); - if (address == address(0)) { + if (recipient == address(0)) { revert InvalidRecipient(); } From 7b4596419262d0c5ab11f67d5595b885f586befc Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 26 Sep 2023 16:32:20 -0400 Subject: [PATCH 015/183] Undo go mod updates --- go.mod | 45 +++++------ go.sum | 54 ------------- go.work.sum | 225 ---------------------------------------------------- 3 files changed, 19 insertions(+), 305 deletions(-) diff --git a/go.mod b/go.mod index 8efedb04c..cea306b14 100644 --- a/go.mod +++ b/go.mod @@ -3,45 +3,40 @@ module github.com/ava-labs/teleporter go 1.18 require ( - github.com/ava-labs/avalanchego v1.10.4 + github.com/ava-labs/avalanchego v1.10.9 github.com/supranational/blst v0.3.11 // indirect ) require ( - github.com/ava-labs/avalanche-network-runner v1.7.0 - github.com/ava-labs/awm-relayer v0.1.1 - github.com/ava-labs/coreth v0.12.4-rc.3 - github.com/ava-labs/subnet-evm v0.5.3-coreth-sync-rc - github.com/ethereum/go-ethereum v1.13.1 + github.com/ava-labs/avalanche-network-runner v1.7.2-0.20230825150237-723bc7b31724 + github.com/ava-labs/awm-relayer v0.2.1-0.20230920145222-b8571020bdaa + github.com/ava-labs/coreth v0.12.5-rc.3 + github.com/ava-labs/subnet-evm v0.5.4 + github.com/ethereum/go-ethereum v1.12.0 github.com/onsi/ginkgo/v2 v2.12.0 github.com/onsi/gomega v1.27.10 ) require ( github.com/DataDog/zstd v1.5.2 // indirect - github.com/Microsoft/go-winio v0.6.1 // indirect + github.com/Microsoft/go-winio v0.5.2 // indirect github.com/NYTimes/gziphandler v1.1.1 // indirect github.com/VictoriaMetrics/fastcache v1.10.0 // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/bits-and-blooms/bitset v1.9.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect github.com/btcsuite/btcd/btcutil v1.1.3 // indirect github.com/cenkalti/backoff/v4 v4.1.3 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/cockroachdb/errors v1.9.1 // indirect github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect - github.com/cockroachdb/pebble v0.0.0-20230906160148-46873a6a7a06 // indirect + github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811 // indirect github.com/cockroachdb/redact v1.1.3 // indirect - github.com/consensys/bavard v0.1.13 // indirect - github.com/consensys/gnark-crypto v0.11.2 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect - github.com/crate-crypto/go-kzg-4844 v0.4.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/deckarep/golang-set/v2 v2.1.0 // indirect - github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect github.com/dlclark/regexp2 v1.7.0 // indirect - github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127 // indirect - github.com/ethereum/c-kzg-4844 v0.3.1 // indirect + github.com/dop251/goja v0.0.0-20230605162241-28ee0ee714f3 // indirect github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 // indirect @@ -71,7 +66,7 @@ require ( github.com/holiman/big v0.0.0-20221017200358-a027dc42d04e // indirect github.com/holiman/bloomfilter/v2 v2.0.3 // indirect github.com/holiman/uint256 v1.2.3 // indirect - github.com/huin/goupnp v1.3.0 // indirect + github.com/huin/goupnp v1.0.3 // indirect github.com/jackpal/gateway v1.0.6 // indirect github.com/jackpal/go-nat-pmp v1.0.2 // indirect github.com/klauspost/compress v1.15.15 // indirect @@ -84,7 +79,6 @@ require ( github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/pointerstructure v1.2.0 // indirect - github.com/mmcloughlin/addchain v0.4.0 // indirect github.com/mr-tron/base58 v1.2.0 // indirect github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect @@ -111,10 +105,10 @@ require ( github.com/stretchr/testify v1.8.4 // indirect github.com/subosito/gotenv v1.4.2 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a // indirect - github.com/tklauser/go-sysconf v0.3.12 // indirect - github.com/tklauser/numcpus v0.6.1 // indirect + github.com/tklauser/go-sysconf v0.3.5 // indirect + github.com/tklauser/numcpus v0.2.2 // indirect github.com/tyler-smith/go-bip39 v1.1.0 // indirect - github.com/urfave/cli/v2 v2.25.7 // indirect + github.com/urfave/cli/v2 v2.17.2-0.20221006022127-8f469abc00aa // indirect github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect github.com/yusufpapurcu/wmi v1.2.2 // indirect go.opentelemetry.io/otel v1.11.0 // indirect @@ -128,14 +122,14 @@ require ( go.uber.org/mock v0.2.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.25.0 // indirect - golang.org/x/crypto v0.13.0 // indirect - golang.org/x/exp v0.0.0-20230810033253-352e893a4cad // indirect + golang.org/x/crypto v0.12.0 // indirect + golang.org/x/exp v0.0.0-20230206171751-46f607a40771 // indirect golang.org/x/mod v0.12.0 // indirect golang.org/x/net v0.14.0 // indirect golang.org/x/sync v0.3.0 // indirect - golang.org/x/sys v0.12.0 // indirect - golang.org/x/term v0.12.0 // indirect - golang.org/x/text v0.13.0 // indirect + golang.org/x/sys v0.11.0 // indirect + golang.org/x/term v0.11.0 // indirect + golang.org/x/text v0.12.0 // indirect golang.org/x/time v0.3.0 // indirect gonum.org/v1/gonum v0.11.0 // indirect google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect @@ -144,5 +138,4 @@ require ( gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - rsc.io/tmplfunc v0.0.3 // indirect ) diff --git a/go.sum b/go.sum index 284ad0c1b..0698b7526 100644 --- a/go.sum +++ b/go.sum @@ -47,8 +47,6 @@ github.com/DataDog/zstd v1.5.2/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwS github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY= github.com/Microsoft/go-winio v0.5.2 h1:a9IhgEQBCUEk6QCdml9CiJGhAws+YwffDHEMp1VMrpA= github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= -github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= -github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I= github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= @@ -61,16 +59,10 @@ github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/ava-labs/avalanche-network-runner v1.7.0 h1:SkNN9m0w8NEYjQelGlBRWDGOUiVELE5XT9LBBByBy2I= -github.com/ava-labs/avalanche-network-runner v1.7.0/go.mod h1:x9S9gDlmiGnruqXbecX9BIh1I1Ky+jqGmYdOpFeVM+0= github.com/ava-labs/avalanche-network-runner v1.7.2-0.20230825150237-723bc7b31724 h1:ptqFgQtJ5DyLb2lvuvawLJNlvo1A1qv+JXYTneNeg14= github.com/ava-labs/avalanche-network-runner v1.7.2-0.20230825150237-723bc7b31724/go.mod h1:euKHwZ77sGvGfhVj4v9WPM4jD2b5N80ldE2XHqO7lwA= -github.com/ava-labs/avalanchego v1.10.4 h1:wGldIq/zn7DTE8TvsBKq6UjyICXb9HY5joNOX73ovEU= -github.com/ava-labs/avalanchego v1.10.4/go.mod h1:lQNBWn4f27MWJGH9Jj1zOX1GlJDeHofMG/TBRaqSNSg= github.com/ava-labs/avalanchego v1.10.9 h1:qxhp3YoD2Wm/iIKP6Wb1isbkUPWmIrJxWgivDoL0obM= github.com/ava-labs/avalanchego v1.10.9/go.mod h1:C8R5uiltpc8MQ62ixxgODR+15mesWF0aAw3H+Qrl9Iw= -github.com/ava-labs/awm-relayer v0.1.1 h1:eOCdHfjT1tHl6dWlAljmzt8UFLZZiBg3ghOWixNi87g= -github.com/ava-labs/awm-relayer v0.1.1/go.mod h1:eztx3shJfCEa+seHb8rtRh+wMpY4nkhMXqPHV90D7C0= github.com/ava-labs/awm-relayer v0.2.0 h1:cj5roMKyfCsm32ot54TmtE85cbPlbvRjFq57D19q9S8= github.com/ava-labs/awm-relayer v0.2.0/go.mod h1:0fS2iFDiqigt/G6rxuiIz6fEN0Frpne99AVdzDoj2IE= github.com/ava-labs/awm-relayer v0.2.1-0.20230915205322-c997e81650b1 h1:ecjd0Tdro0uRxL345HdqVqiOnj5P1ZoJwRUmT/4tCtI= @@ -85,20 +77,14 @@ github.com/ava-labs/awm-relayer v0.2.1-0.20230920144803-34fb8976d19e h1:BDT2HOIF github.com/ava-labs/awm-relayer v0.2.1-0.20230920144803-34fb8976d19e/go.mod h1:p1zOyznNK7WxW8qQdjIyoYUroPB0cPJMiDwbNC+bkwE= github.com/ava-labs/awm-relayer v0.2.1-0.20230920145222-b8571020bdaa h1:hOMFyhAEbEprP6Qxuc6jSPRrGVpBwfPpcGqROOJCslI= github.com/ava-labs/awm-relayer v0.2.1-0.20230920145222-b8571020bdaa/go.mod h1:p1zOyznNK7WxW8qQdjIyoYUroPB0cPJMiDwbNC+bkwE= -github.com/ava-labs/coreth v0.12.4-rc.3 h1:mcY/RRRMFgxEORzbVxqBSc1gp5JAKi+U7gKxPGV0Xfs= -github.com/ava-labs/coreth v0.12.4-rc.3/go.mod h1:f08KU6tbwR8TSx/7Bh1ZV3lfmbr7XDwbNcuvbW7gDts= github.com/ava-labs/coreth v0.12.5-rc.3 h1:cpmC+fSZMsO4gaFWqXHzAHrJACf05u5HPAYmwh7nmkU= github.com/ava-labs/coreth v0.12.5-rc.3/go.mod h1:HI+jTIflnDFBd0bledgkgid1Uurwr8q1h7zb3LsFsSo= -github.com/ava-labs/subnet-evm v0.5.3-coreth-sync-rc h1:RWQ2go/o939xA3V6ANJCrtrCIr0X+1vMpnwNTjw1u0s= -github.com/ava-labs/subnet-evm v0.5.3-coreth-sync-rc/go.mod h1:pIlB9JxE+1ai+quGjuEQknY1ipbuAb4yEL+BELRoddk= github.com/ava-labs/subnet-evm v0.5.4 h1:4+UHva8rhGlvH4gDYpI0Lt6/J5ie1DqQa6kEmbebArI= github.com/ava-labs/subnet-evm v0.5.4/go.mod h1:PAyhfYnECzA17N62i7OAdKazjfSsN2l8KR5nOspg39I= github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bits-and-blooms/bitset v1.9.0 h1:g1YivPG8jOtrN013Fe8OBXubkiTwvm7/vG2vXz03ANU= -github.com/bits-and-blooms/bitset v1.9.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M= github.com/btcsuite/btcd v0.23.0 h1:V2/ZgjfDFIygAX3ZapeigkVBoVUtOJKSwrhZdlpSvaA= @@ -149,7 +135,6 @@ github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/datadriven v1.0.2 h1:H9MtNqVoVhvd9nCBwOyDjUEdZCREqbIdCJD93PBm/jA= github.com/cockroachdb/datadriven v1.0.2/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= -github.com/cockroachdb/datadriven v1.0.3-0.20230801171734-e384cf455877 h1:1MLK4YpFtIEo3ZtMA5C795Wtv5VuUnrXX7mQG+aHg6o= github.com/cockroachdb/errors v1.9.1 h1:yFVvsI0VxmRShfawbt/laCIDy/mtTqqnvoNgiy5bEV8= github.com/cockroachdb/errors v1.9.1/go.mod h1:2sxOtL2WIc096WSZqZ5h8fa17rdDq9HZOZLBCor4mBk= github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= @@ -157,23 +142,15 @@ github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZe github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811 h1:ytcWPaNPhNoGMWEhDvS3zToKcDpRsLuRolQJBVGdozk= github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811/go.mod h1:Nb5lgvnQ2+oGlE/EyZy4+2/CxRh9KfvCXnag1vtpxVM= -github.com/cockroachdb/pebble v0.0.0-20230906160148-46873a6a7a06 h1:T+Np/xtzIjYM/P5NAw0e2Rf1FGvzDau1h54MKvx8G7w= -github.com/cockroachdb/pebble v0.0.0-20230906160148-46873a6a7a06/go.mod h1:bynZ3gvVyhlvjLI7PT6dmZ7g76xzJ7HpxfjgkzCGz6s= github.com/cockroachdb/redact v1.1.3 h1:AKZds10rFSIj7qADf0g46UixK8NNLwWTNdCIGS5wfSQ= github.com/cockroachdb/redact v1.1.3/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM= -github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ= -github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= -github.com/consensys/gnark-crypto v0.11.2 h1:GJjjtWJ+db1xGao7vTsOgAOGgjfPe7eRGPL+xxMX0qE= -github.com/consensys/gnark-crypto v0.11.2/go.mod h1:v2Gy7L/4ZRosZ7Ivs+9SfUDr0f5UlG+EM5t7MPHiLuY= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/crate-crypto/go-kzg-4844 v0.4.0 h1:Lecbci8nd4rnlawQa2r2QPZrDVd6ZA/sOjBn3W1XkEY= -github.com/crate-crypto/go-kzg-4844 v0.4.0/go.mod h1:SBP7ikXEgDnUPONgm33HtuDZEDtWa3L4QtN1ocJSEQ4= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -183,12 +160,9 @@ github.com/deckarep/golang-set/v2 v2.1.0 h1:g47V4Or+DUdzbs8FxCCmgb6VYd+ptPAngjM6 github.com/deckarep/golang-set/v2 v2.1.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= -github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= @@ -198,8 +172,6 @@ github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnm github.com/dop251/goja v0.0.0-20211022113120-dc8c55024d06/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= github.com/dop251/goja v0.0.0-20230605162241-28ee0ee714f3 h1:+3HCtB74++ClLy8GgjUQYeC8R4ILzVcIe8+5edAJJnE= github.com/dop251/goja v0.0.0-20230605162241-28ee0ee714f3/go.mod h1:QMWlm50DNe14hD7t24KEqZuUdC9sOTy8W6XbCU1mlw4= -github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127 h1:qwcF+vdFrvPSEUDSX5RVoRccG8a5DhOdWdQ4zN62zzo= -github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127/go.mod h1:QMWlm50DNe14hD7t24KEqZuUdC9sOTy8W6XbCU1mlw4= github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= github.com/dop251/goja_nodejs v0.0.0-20211022123610-8dd9abb0616d/go.mod h1:DngW8aVqWbuLRMHItjPUyqdj+HWPvnQe8V8y1nDpIbM= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= @@ -214,12 +186,8 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= -github.com/ethereum/c-kzg-4844 v0.3.1 h1:sR65+68+WdnMKxseNWxSJuAv2tsUrihTpVBTfM/U5Zg= -github.com/ethereum/c-kzg-4844 v0.3.1/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= github.com/ethereum/go-ethereum v1.12.0 h1:bdnhLPtqETd4m3mS8BGMNvBTf36bO5bx/hxE2zljOa0= github.com/ethereum/go-ethereum v1.12.0/go.mod h1:/oo2X/dZLJjf2mJ6YT9wcWxa4nNJDBKDBU6sFIpx1Gs= -github.com/ethereum/go-ethereum v1.13.1 h1:UF2FaUKPIy5jeZk3X06ait3y2Q4wI+vJ1l7+UARp+60= -github.com/ethereum/go-ethereum v1.13.1/go.mod h1:xHQKzwkHSl0gnSjZK1mWa06XEdm9685AHqhRknOzqGQ= github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= @@ -347,7 +315,6 @@ github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20230207041349-798e818bf904 h1:4/hN5RUoecvl+RmJRE2YxKWtnnQls6rQjjW5oV7qg2U= github.com/google/pprof v0.0.0-20230207041349-798e818bf904/go.mod h1:uglQLonpP8qtYCYyzA+8c/9qtqgA3qsXGYqCPKARAFg= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -386,8 +353,6 @@ github.com/holiman/uint256 v1.2.3/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZm github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huin/goupnp v1.0.3 h1:N8No57ls+MnjlB+JPiCVSOyy/ot7MJTqlo7rn+NYSqQ= github.com/huin/goupnp v1.0.3/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y= -github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= -github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= github.com/hydrogen18/memlistener v0.0.0-20200120041712-dcc25e7acd91/go.mod h1:qEIFzExnS6016fRpRfxrExeVn2gbClQA99gQhnIcdhE= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= @@ -469,9 +434,6 @@ github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyua github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= -github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY= -github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU= -github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= @@ -604,12 +566,8 @@ github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a/go.mod h1:RRCYJ github.com/thepudds/fzgen v0.4.2 h1:HlEHl5hk2/cqEomf2uK5SA/FeJc12s/vIHmOG+FbACw= github.com/tklauser/go-sysconf v0.3.5 h1:uu3Xl4nkLzQfXNsWn15rPc/HQCJKObbt1dKJeWp3vU4= github.com/tklauser/go-sysconf v0.3.5/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI= -github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= -github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= github.com/tklauser/numcpus v0.2.2 h1:oyhllyrScuYI6g+h/zUvNXNp1wy7x8qQy3t/piefldA= github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZFu0T9wgjM= -github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= -github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= @@ -618,8 +576,6 @@ github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljT github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/urfave/cli/v2 v2.17.2-0.20221006022127-8f469abc00aa h1:5SqCsI/2Qya2bCzK15ozrqo2sZxkh0FHynJZOTVoV6Q= github.com/urfave/cli/v2 v2.17.2-0.20221006022127-8f469abc00aa/go.mod h1:1CNUng3PtjQMtRzJO4FMXBQvkGtuYRxxiR9xMa7jMwI= -github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs= -github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasthttp v1.6.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBnvPM1Su9w= @@ -690,8 +646,6 @@ golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= -golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= -golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -704,7 +658,6 @@ golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EH golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20230206171751-46f607a40771 h1:xP7rWLUr1e1n2xkK5YB4LI0hPEy3LJC6Wk+D4pGlOJg= golang.org/x/exp v0.0.0-20230206171751-46f607a40771/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= -golang.org/x/exp v0.0.0-20230810033253-352e893a4cad/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -872,18 +825,14 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= -golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -897,7 +846,6 @@ golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1112,5 +1060,3 @@ honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= -rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU= -rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= diff --git a/go.work.sum b/go.work.sum index aa153513e..571ce3165 100644 --- a/go.work.sum +++ b/go.work.sum @@ -1,4 +1,3 @@ -cloud.google.com/go v0.0.0-20170206221025-ce650573d812/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= @@ -708,7 +707,6 @@ cloud.google.com/go/workflows v1.10.0 h1:FfGp9w0cYnaKZJhUOMqCOJCYT/WlvYBfTQhFWV3 cloud.google.com/go/workflows v1.10.0/go.mod h1:fZ8LmRmZQWacon9UCX1r/g/DfAXx5VcPALq2CxzdePw= collectd.org v0.3.0 h1:iNBHGw1VvPJxH2B6RiFWFZ+vsjo1lCdRszBeOuwGi00= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9 h1:VpgP7xuJadIUuKccphEpTJnWhS2jkQyMt6Y7pJCD7fY= -gioui.org v0.0.0-20210308172011-57750fc8a0a6/go.mod h1:RSH6KIUZ0p2xy5zHDxgAM4zumjgTw83q2ge/PI+yyw8= git.sr.ht/~sbinet/gg v0.3.1 h1:LNhjNn8DerC8f9DHLz6lS0YYul/b602DUxDgGkd/Aik= github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9 h1:HD8gA2tkByhMAwYaFAX9w2l7vxvBQ5NMoxDrkhqhtn4= github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1 h1:qoVeMsc9/fh/yhxVaA0obYjVH/oI/ihrOoMwsLS9KSA= @@ -717,38 +715,23 @@ github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3 h1:E+m3SkZCN0Bf5q7YdTs5lSm github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0 h1:Px2UA+2RvSSvv+RvJNuUB6n7rs5Wsel4dXLe90Um2n4= github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0/go.mod h1:tPaiy8S5bQ+S5sOiDlINkp7+Ef339+Nz5L5XO+cnOHo= -github.com/BurntSushi/toml v1.2.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= -github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802 h1:1BDTz0u9nC3//pOCMdNH+CiXJVYJh5UQNCOBG7jbELc= -github.com/CloudyKit/fastprinter v0.0.0-20170127035650-74b38d55f37a/go.mod h1:EFZQ978U7x8IRnstaskI3IysnWY5Ao3QgZUKOXlsAdw= github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53 h1:sR+/8Yb4slttB4vD+b9btVEnWgL3Q00OBTzVT8B9C0c= -github.com/CloudyKit/jet v2.1.3-0.20180809161101-62edd43e4f88+incompatible/go.mod h1:HPYO+50pSWkPoj9Q/eq0aRGByCL6ScRlUmiEX5Zgm+w= github.com/CloudyKit/jet/v3 v3.0.0 h1:1PwO5w5VCtlUUl+KTOBsTGZlhjWkcybsGaAau52tOy8= github.com/CloudyKit/jet/v6 v6.1.0 h1:hvO96X345XagdH1fAoBjpBYG4a1ghhL/QzalkduPuXk= -github.com/CloudyKit/jet/v6 v6.1.0/go.mod h1:d3ypHeIRNo2+XyqnGA8s+aphtcVpjP5hPwP/Lzo7Ro4= github.com/DATA-DOG/go-sqlmock v1.3.3 h1:CWUqKXe0s8A2z6qCgkP4Kru7wC11YoAnoupUKFDnH08= github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= -github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/FactomProject/btcutilecc v0.0.0-20130527213604-d3a63a5752ec h1:1Qb69mGp/UtRPn422BH4/Y4Q3SLUrD9KHuDkm8iodFc= -github.com/GoogleCloudPlatform/cloudsql-proxy v0.0.0-20190129172621-c8b1d7a94ddf/go.mod h1:aJ4qN3TfrelA6NZ6AXsXRfmEVaYin3EDbSPJrKS8OXo= github.com/HdrHistogram/hdrhistogram-go v1.1.2 h1:5IcZpTvzydCQeHzK4Ef/D5rrSqwxob0t8PQPMybUNFM= -github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= github.com/Joker/hpp v1.0.0 h1:65+iuJYdRXv/XyN62C1uEmmOx3432rNG/rKlX6V7Kkc= -github.com/Joker/jade v1.0.1-0.20190614124447-d475f43051e7/go.mod h1:6E6s8o2AE4KhCrqr6GRJjdC/gNfTdxkIXvuGZZda2VM= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/Shopify/goreferrer v0.0.0-20220729165902-8cddb4f5de06 h1:KkH3I3sJuOLP3TjA/dfr4NAY8bghDwnXiU7cTKxQqo0= -github.com/Shopify/goreferrer v0.0.0-20220729165902-8cddb4f5de06/go.mod h1:7erjKLwalezA0k99cWs5L11HWOAPNjdUZ6RxH1BXbbM= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIOA6tDi6QXUemppXK3P9BI7mr2hd6gx8= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= -github.com/aclements/go-gg v0.0.0-20170118225347-6dbb4e4fefb0/go.mod h1:55qNq4vcpkIuHowELi5C8e+1yUHtoLoOUR9QU5j7Tes= -github.com/aclements/go-moremath v0.0.0-20210112150236-f10218a38794/go.mod h1:7e+I0LQFUI9AXWxOfsQROs9xPhoJtbsyWcjJqDd4KPY= github.com/aead/siphash v1.0.1 h1:FwHfE/T45KPKYuuSAKyyvE+oPWcaQ+CUmFW0bPlM+kg= github.com/ajg/form v1.5.1 h1:t9c7v8JUKu/XxOGBU0yjNpaMloxGEJhUkqFRq0ibGeU= -github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= -github.com/ajstarks/svgo v0.0.0-20210923152817-c3b6e2f0c527/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b h1:slYM766cy2nI3BwyRiyQj/Ud48djTMtMebDqepE95rw= github.com/alecthomas/kingpin/v2 v2.3.1 h1:ANLJcKmQm4nIaog7xdr/id6FM6zm5hHnfZrvtKPxqGg= github.com/alecthomas/kingpin/v2 v2.3.1/go.mod h1:oYL5vtsvEHZGHxU7DMp32Dvx+qL+ptGn6lWaot2vCNE= @@ -758,13 +741,11 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuy github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d h1:UQZhZ2O0vMHr2cI+DC1Mbh0TJxzA3RcLoMsFw+aXw7E= -github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 h1:s6gZFSlWYmbqAuRjVTiNNhvNRfY2Wxp9nhfyel4rklc= github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= github.com/alexliesenfeld/health v0.7.0 h1:U3mSZ3ussRbGx+/rXBjNVxjLX5cKaNh8Ly9Hx3q+yfY= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ= github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY= -github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg= github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db h1:nxAtV4VajJDhKysp2kdcJZsq8Ss1xSA0vZTkVHHJd0E= github.com/apache/arrow/go/v11 v11.0.0 h1:hqauxvFQxww+0mEU/2XHG6LT7eZternCZq+A5Yly2uM= @@ -788,7 +769,6 @@ github.com/ava-labs/avalanchego v1.9.1-rc.3/go.mod h1:qQJugll8yY/YKiy/Eutjwjn/vS github.com/ava-labs/avalanchego v1.10.5-rc.1/go.mod h1:azK88lcF5jwcPSp//RKUh2VncmrZZUrKu998C7no4Ys= github.com/ava-labs/avalanchego v1.10.6-rc.4/go.mod h1:e8LdGy0xM+QejpMoEK6wOFu2O5HMlAHPJiBPjhoTG78= github.com/ava-labs/avalanchego v1.10.8 h1:fUudA4J37y8wyNG3iiX0kpoZXunsWpCgvsGDgIsi0NY= -github.com/ava-labs/avalanchego v1.10.9-rc.4/go.mod h1:vTBLl1zK36olfLRA7IUfdbvphWqlkuarIoXxvZTHZVw= github.com/ava-labs/coreth v0.11.5-rc.0 h1:EQ4MVWFrG+gtqtTFgquL4yoZnCNA+kbMVGWAnsTMeBE= github.com/ava-labs/coreth v0.11.7-rc.0/go.mod h1:e7SuEq6g3+YWyNPiznJF6KnnAuc0HCXxiSshMNj52Sw= github.com/ava-labs/coreth v0.11.7-rc.3 h1:+GaXmcqzBDd6jFJcPrAQ/RKEFJlqCVcdTF/Q5T6woy4= @@ -818,7 +798,6 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.1.1/go.mod h1:Wi0EBZwiz/K44YliU0EKxq github.com/aws/smithy-go v1.1.0 h1:D6CSsM3gdxaGaqXnPgOBCeL6Mophqzu7KJOu7zW78sU= github.com/aws/smithy-go v1.1.0/go.mod h1:EzMw8dbp/YJL4A5/sbhGddag+NPT7q084agLbB9LgIw= github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk= -github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible h1:Ppm0npCCsmuR9oQaBtRuZcmILVE74aXE+AmrJj8L2ns= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= @@ -826,11 +805,8 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24 github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bits-and-blooms/bitset v1.5.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40 h1:y4B3+GPxKlrigF1ha5FFErxK+sr6sWxQovRMzwMhejo= github.com/boltdb/bolt v1.3.1 h1:JQmyP4ZBrce+ZQu0dY660FMfatumYDLun9hBCUVIkF4= -github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= -github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= github.com/btcsuite/btcd/btcutil v1.1.1 h1:hDcDaXiP0uEzR8Biqo2weECKqEw0uHDZ9ixIWevVQqY= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo= @@ -846,7 +822,6 @@ github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA github.com/census-instrumentation/opencensus-proto v0.4.1 h1:iKLQ0xPNFxR/2hzXZMrBo8f1j86j5WHzznCCQxV/b8g= github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= -github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927/go.mod h1:h/aW8ynjgkuj+NQRlZcDbAbM1ORAbXjXX77sX7T289U= github.com/chzyer/logex v1.1.10 h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE= github.com/chzyer/logex v1.2.0 h1:+eqR0HfOetur4tgnC8ftU5imRnhi4te+BadWS95c5AM= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8= @@ -867,14 +842,7 @@ github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1 h1:zH8ljVhhq7yC0MIeUL/IviMtY8hx2mK8cN9wEYb8ggw= github.com/cncf/xds/go v0.0.0-20230310173818-32f1caf87195 h1:58f1tJ1ra+zFINPlwLWvQsR9CzAKt2e+EWV2yX9oXQ4= github.com/cncf/xds/go v0.0.0-20230310173818-32f1caf87195/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cockroachdb/datadriven v1.0.0/go.mod h1:5Ib8Meh+jk1RlHIXej6Pzevx/NLlNvQB9pmSBZErGA4= -github.com/cockroachdb/datadriven v1.0.3-0.20230801171734-e384cf455877/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= -github.com/cockroachdb/errors v1.6.1/go.mod h1:tm6FTP5G81vwJ5lC0SizQo374JNCOPrHyXGitRJoDqM= -github.com/cockroachdb/errors v1.8.1/go.mod h1:qGwQn6JmZ+oMjuLwjWzUNqblqk0xl4CVV3SQbGwK7Ac= -github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI= -github.com/cockroachdb/redact v1.0.8/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2 h1:IKgmqgMQlVJIZj19CdocBeSfSaiCbEBZGKODaixqtHM= -github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2/go.mod h1:8BT+cPK6xvFOcRlk0R8eg+OTkcqI6baNH4xAkpiYVvQ= github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0 h1:sDMmm+q/3+BukdIpxwO365v/Rbspp2Nt5XntgQRXq8Q= github.com/consensys/gnark-crypto v0.4.1-0.20210426202927-39ac3d4b3f1f h1:C43yEtQ6NIf4ftFXD/V55gnGFgPbMQobd//YlnLjUJ8= github.com/consensys/gnark-crypto v0.9.1-0.20230105202408-1a7a29904a7c/go.mod h1:CkbdF9hbRidRJYMRzmfX8TMOr95I2pYXRHF18MzRrvA= @@ -892,14 +860,10 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:ma github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/crate-crypto/go-ipa v0.0.0-20220523130400-f11357ae11c7 h1:6IrxszG5G+O7zhtkWxq6+unVvnrm1fqV2Pe+T95DUzw= github.com/crate-crypto/go-ipa v0.0.0-20220523130400-f11357ae11c7/go.mod h1:gFnFS95y8HstDP6P9pPwzrxOOC5TRDkwbM+ao15ChAI= -github.com/crate-crypto/go-ipa v0.0.0-20230601170251-1830d0757c80/go.mod h1:gzbVz57IDJgQ9rLQwfSk696JGWof8ftznEL9GoAv3NI= -github.com/crate-crypto/go-kzg-4844 v0.3.0/go.mod h1:SBP7ikXEgDnUPONgm33HtuDZEDtWa3L4QtN1ocJSEQ4= github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c h1:/ovYnF02fwL0kvspmy9AuyKg1JhdTRUgPw4nUxd9oZM= github.com/dave/jennifer v1.2.0 h1:S15ZkFMRoJ36mGAQgWL1tnr0NQJh9rZ8qatseX/VbBc= github.com/davecgh/go-spew v0.0.0-20161028175848-04cdfd42973b/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4= -github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= github.com/decred/dcrd/lru v1.0.0 h1:Kbsb1SFDsIlaupWPwsPp+dkxiBY1frcS07PCPgotKz8= github.com/dgraph-io/badger v1.6.0 h1:DshxFxZWXUcO0xX476VJC07Xsr6ZCBVRHKZ93Oh7Evo= github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= @@ -907,11 +871,8 @@ github.com/dgryski/go-bitstream v0.0.0-20180413035011-3522498ce2c8 h1:akOQj8IVgo github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954 h1:RMLoZVzv4GliuWafOuPuQDKSm1SJph7uCRnnS61JAn4= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/djherbis/atime v1.1.0/go.mod h1:28OF6Y8s3NQWwacXc5eZTsEsiMzp7LF8MbXE+XJPdBE= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= -github.com/docker/docker v24.0.5+incompatible h1:WmgcE4fxyI6EEXxBRxsHnZXrO1pQ3smi0k/jho4HLeY= -github.com/docker/docker v24.0.5+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/dop251/goja v0.0.0-20230122112309-96b1610dd4f7/go.mod h1:yRkwfj0CBpOGre+TwBsqPV0IH0Pk73e4PXJOeNDboGs= github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7 h1:tYwu/z8Y0NkkzGEh3z21mSWggMg4LwLRFucLS7TjARg= github.com/dop251/goja_nodejs v0.0.0-20211022123610-8dd9abb0616d h1:W1n4DvpzZGOISgp7wWNtraLcHtnmnTwBlJidqtMIuwQ= @@ -936,12 +897,8 @@ github.com/fjl/gencodec v0.0.0-20220412091415-8bb9e558978c h1:CndMRAH4JIwxbW8KYq github.com/fjl/gencodec v0.0.0-20220412091415-8bb9e558978c/go.mod h1:AzA8Lj6YtixmJWL+wkKoBGsLWy9gFrAzi4g+5bCKwpY= github.com/fjl/gencodec v0.0.0-20230517082657-f9840df7b83e h1:bBLctRc7kr01YGvaDfgLbTwjFNW5jdp5y5rj8XXBHfY= github.com/fjl/gencodec v0.0.0-20230517082657-f9840df7b83e/go.mod h1:AzA8Lj6YtixmJWL+wkKoBGsLWy9gFrAzi4g+5bCKwpY= -github.com/flosch/pongo2 v0.0.0-20190707114632-bbf5a6c351f4/go.mod h1:T9YF2M40nIgbVgp3rreNmTged+9HrbNTIQf1PsaIiTA= github.com/flosch/pongo2/v4 v4.0.2 h1:gv+5Pe3vaSVmiJvh/BZa82b7/00YUGm0PIyVVLop0Hw= -github.com/flosch/pongo2/v4 v4.0.2/go.mod h1:B5ObFANs/36VwxxlgKpdchIJHMvHB562PW+BWPhwZD8= github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90 h1:WXb3TSNmHp2vHoCroCIB1foO/yQ36swABL8aOVeDpgg= -github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= -github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61 h1:IZqZOB2fydHte3kUgxrzK5E1fW7RQGeDwE8F/ZZnUYc= github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61/go.mod h1:Q0X6pkwTILDlzrGEckF6HKjXe48EgsY/l7K7vhY4MW8= @@ -949,58 +906,36 @@ github.com/gavv/httpexpect v2.0.0+incompatible h1:1X9kcRshkSKEjNJJxX9Y9mQ5BRfbxU github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/gballet/go-verkle v0.0.0-20220902153445-097bd83b7732 h1:AB7YjNrzlVHsYz06zCULVV2zYCEft82P86dSmtwxKL0= github.com/gballet/go-verkle v0.0.0-20220902153445-097bd83b7732/go.mod h1:o/XfIXWi4/GqbQirfRm5uTbXMG5NpqxkxblnbZ+QM9I= -github.com/gballet/go-verkle v0.0.0-20230607174250-df487255f46b/go.mod h1:CDncRYVRSDqwakm282WEkjfaAj1hxU/v5RXxk5nXOiI= github.com/getkin/kin-openapi v0.61.0 h1:6awGqF5nG5zkVpMsAih1QH4VgzS8phTxECUWIFo7zko= github.com/ghemawat/stream v0.0.0-20171120220530-696b145b53b9 h1:r5GgOLGbza2wVHRzK7aAj6lWZjfbAwiu/RDCVOKjRyM= -github.com/ghemawat/stream v0.0.0-20171120220530-696b145b53b9/go.mod h1:106OIgooyS7OzLDOpUGgm9fA3bQENb/cFSyyBmMoJDs= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= -github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8= -github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk= github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd h1:r04MMPyLHj/QwZuMJ5+7tJcBr1AQjpiAK/rZWRrQT7o= github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31 h1:gclg6gY70GLy3PbkQ1AERPfmLMMagS60DKF78eWwLn8= github.com/go-check/check v0.0.0-20180628173108-788fd7840127 h1:0gkP6mzaMqkmpcJYCFOLkIBwI7xFExG03bbkOkCvUPI= github.com/go-chi/chi/v5 v5.0.0 h1:DBPx88FjZJH3FsICfDAfIfnb7XxKIYVGG6lOPlhENAg= -github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= -github.com/go-fonts/dejavu v0.1.0/go.mod h1:4Wt4I4OU2Nq9asgDCteaAaWZOV24E+0/Pwo0gppep4g= -github.com/go-fonts/latin-modern v0.2.0/go.mod h1:rQVLdDMK+mK1xscDwsqM5J8U2jrRa3T0ecnM9pNujks= -github.com/go-fonts/liberation v0.1.1/go.mod h1:K6qoJYypsmfVjWg8KOVDQhLc8UDgIK2HYqyqAO9z7GY= github.com/go-fonts/liberation v0.2.0 h1:jAkAWJP4S+OsrPLZM4/eC9iW7CtHy+HBXrEwZXWo5VM= -github.com/go-fonts/liberation v0.2.0/go.mod h1:K6qoJYypsmfVjWg8KOVDQhLc8UDgIK2HYqyqAO9z7GY= -github.com/go-fonts/stix v0.1.0/go.mod h1:w/c1f0ldAUlJmLBvlbkvVXLAD+tAMqobIIQpmnUIzUY= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1 h1:QbL/5oDUmRBzO9/Z7Seo6zf912W/a6Sr4Eu0G/3Jho0= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4 h1:WtGNWLvXpe6ZudgnXrq0barxBImvnnJoMEhXAzcbM0I= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0 h1:wDJmvq38kDhkVxi50ni9ykkdUr1PKgqKOoi01fa0Mdk= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= -github.com/go-latex/latex v0.0.0-20210118124228-b3d85cf34e07/go.mod h1:CO1AlKB2CSIqUrmQPqA0gdRIlnLEY0gK5JGjh37zN5U= github.com/go-latex/latex v0.0.0-20210823091927-c0d11ff05a81 h1:6zl3BbBhdnMkpSj2YY30qV3gDcVBGtFgVsV3+/i+mKQ= -github.com/go-latex/latex v0.0.0-20210823091927-c0d11ff05a81/go.mod h1:SX0U8uGpxhq9o2S/CELCSUxEWWAuoCUcVCQWv7G2OCk= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= -github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab h1:xveKWz2iaueeTaUgdetzel+U7exyigDYBryyVfV/rZk= github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= -github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= github.com/go-openapi/swag v0.19.5 h1:lTz6Ys4CmqqCQmZPBlbQENR1/GucA2bzYTE12Pw4tFY= -github.com/go-pdf/fpdf v0.5.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhOh5M= github.com/go-pdf/fpdf v0.6.0 h1:MlgtGIfsdMEEQJr2le6b/HNr1ZlQwxyWr77r2aj2U/8= -github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= -github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= -github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJWXmqUsHwfTRRkQ= -github.com/go-playground/validator/v10 v10.11.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= -github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= @@ -1008,17 +943,14 @@ github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= github.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo= github.com/goccy/go-json v0.9.11 h1:/pAaQDLHEoCq/5FFmSKBswWmK6H0e8g4159Kc/X/nqk= -github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/godbus/dbus/v5 v5.0.4 h1:9349emZab16e7zQvpmsbtjc18ykshndd8y2PG3sgJbA= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/status v1.1.0 h1:+eIkrewn5q6b30y+g/BJINVVdi2xH7je5MPJ3ZPK3JA= github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= -github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= @@ -1026,11 +958,6 @@ github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4er github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219 h1:utua3L2IbQJmauC5IXdEA547bcoU5dozgQAfc8Onsg4= github.com/gomodule/redigo v1.7.1-0.20190724094224-574c33c3df38 h1:y0Wmhvml7cGnzPa9nocn/fMraMH/lMDdeG+rkx4VgYY= -github.com/gonum/blas v0.0.0-20181208220705-f22b278b28ac/go.mod h1:P32wAyui1PQ58Oce/KYkOqQv8cVw1zAapXOl+dRFGbc= -github.com/gonum/floats v0.0.0-20181209220543-c233463c7e82/go.mod h1:PxC8OnwL11+aosOB5+iEPoV3picfs8tUpkVd0pDo+Kg= -github.com/gonum/internal v0.0.0-20181124074243-f884aa714029/go.mod h1:Pu4dmpkhSyOzRwuXkOgAvijx4o+4YMUJJo9OvPYMkks= -github.com/gonum/lapack v0.0.0-20181123203213-e4cdc5a0bff9/go.mod h1:XA3DeT6rxh2EAE789SSiSJNqxPaC0aE9J8NTOI0Jo/A= -github.com/gonum/matrix v0.0.0-20181209220409-c518dec07be9/go.mod h1:0EXg4mc1CNP0HCqCz+K4ts155PXIlUywf0wqN+GfPZw= github.com/google/flatbuffers v2.0.8+incompatible h1:ivUb1cGomAB101ZM1T0nOiWz9pSrTMoa9+EiY7igmkM= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= @@ -1044,12 +971,10 @@ github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3 github.com/google/renameio v0.1.0 h1:GOZbcHa3HfsPKPlmyPyN2KEohoMXOhdMbHrvbpl2QaA= github.com/google/s2a-go v0.1.3 h1:FAgZmpLl/SXurPEZyCMPBIiiYeTbqfjlbdnCNTAkbGE= github.com/google/s2a-go v0.1.3/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= -github.com/google/safehtml v0.0.2/go.mod h1:L4KWwDsUJdECRAEpZoBn3O64bQaywRscowZjJAzjHnU= github.com/google/subcommands v1.2.0 h1:vWQspBTo2nEqTUFita5/KeEWlUL8kQObDFbub/EN9oE= github.com/googleapis/enterprise-certificate-proxy v0.2.1/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= github.com/googleapis/enterprise-certificate-proxy v0.2.3 h1:yk9/cqRKtT9wXZSsRH9aurXEpJX+U6FLtpYTdC3R06k= github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= -github.com/googleapis/gax-go v0.0.0-20161107002406-da06d194a00e/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY= github.com/googleapis/gax-go/v2 v2.7.0/go.mod h1:TEop28CZZQ2y+c0VxMUmu1lV+fQx57QpBWsYpwqHJx8= github.com/googleapis/gax-go/v2 v2.7.1/go.mod h1:4orTrqY6hXxxaUL4LHIPl6lGo8vAE38/qKbhSAKP6QI= github.com/googleapis/gax-go/v2 v2.8.0 h1:UBtEZqx1bjXtOQ5BVTkuYghXrr3N4V123VKJK67vJZc= @@ -1057,15 +982,11 @@ github.com/googleapis/gax-go/v2 v2.8.0/go.mod h1:4orTrqY6hXxxaUL4LHIPl6lGo8vAE38 github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8 h1:tlyzajkF3030q6M8SvmJSemC9DTHL/xaMa18b65+JM4= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY= -github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= -github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway/v2 v2.12.0/go.mod h1:ummNFgdgLhhX7aIiy35vVmQNS0rWXknfPE0qe6fmFXg= -github.com/guptarohit/asciigraph v0.5.5/go.mod h1:dYl5wwK4gNsnFf9Zp+l06rFiDZ5YtXM6x7SRWZ3KGag= github.com/hashicorp/consul/api v1.20.0 h1:9IHTjNVSZ7MIwjlW3N3a7iGiykCMDpxZu8jsxFJh0yc= github.com/hashicorp/consul/api v1.20.0/go.mod h1:nR64eD44KQ59Of/ECwt2vUmIK2DKsDzAwTmwmLl8Wpo= github.com/hashicorp/consul/sdk v0.13.1 h1:EygWVWWMczTzXGpO93awkHFzfUka6hLYJ0qhETd+6lY= @@ -1105,11 +1026,8 @@ github.com/hashicorp/memberlist v0.5.0 h1:EtYPN8DpAURiapus508I4n9CzHs2W+8NZGbmmR github.com/hashicorp/memberlist v0.5.0/go.mod h1:yvyXLpo0QaGE59Y7hDTsTzDD25JYBZ4mHgHUZ8lrOI0= github.com/hashicorp/serf v0.10.1 h1:Z1H2J60yRKvfDYAOZLd2MU0ND4AH/WDz7xYHDWQsIPY= github.com/hashicorp/serf v0.10.1/go.mod h1:yL2t6BqATOLGc5HF7qbFkTfXoPIY0WZdWHfEvMqbG+4= -github.com/holiman/billy v0.0.0-20230718173358-1c7e68d277a7 h1:3JQNjnMRil1yD0IfZKHF9GxxWKDJGj8I0IqOUol//sw= -github.com/holiman/billy v0.0.0-20230718173358-1c7e68d277a7/go.mod h1:5GuXa7vkL8u9FkFuWdVvfR5ix8hRB7DbOAaYULamFpc= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150 h1:vlNjIqmUZ9CMAWsbURYl3a6wZbw7q5RHVvlXTNS/Bs8= -github.com/hydrogen18/memlistener v0.0.0-20141126152155-54553eb933fb/go.mod h1:qEIFzExnS6016fRpRfxrExeVn2gbClQA99gQhnIcdhE= github.com/hydrogen18/memlistener v0.0.0-20200120041712-dcc25e7acd91 h1:KyZDvZ/GGn+r+Y3DKZ7UOQ/TP4xV6HNkrwiVMB1GnNY= github.com/iancoleman/strcase v0.2.0 h1:05I4QRnGpI0m37iZQRuskXh+w77mr6Z41lwQzuHLwW0= github.com/ianlancetaylor/demangle v0.0.0-20220319035150-800ac71e25c2 h1:rcanfLhLDA8nozr/K289V1zcntHr3V+SHlXwzz1ZI2g= @@ -1118,94 +1036,56 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2 github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/iris-contrib/blackfriday v2.0.0+incompatible h1:o5sHQHHm0ToHUlAJSTjW9UWicjJSDDauOOQ2AHuIVp4= github.com/iris-contrib/go.uuid v2.0.0+incompatible h1:XZubAYg61/JwnJNbZilGjf3b3pB80+OQg2qf6c8BfWE= -github.com/iris-contrib/i18n v0.0.0-20171121225848-987a633949d0/go.mod h1:pMCz62A0xJL6I+umB2YTlFRwWXaDFA0jy+5HzGiJjqI= github.com/iris-contrib/jade v1.1.4 h1:WoYdfyJFfZIUgqNAeOyRfTNQZOksSlZ6+FnXR3AEpX0= -github.com/iris-contrib/jade v1.1.4/go.mod h1:EDqR+ur9piDl6DUgs6qRrlfzmlx/D5UybogqrXvJTBE= github.com/iris-contrib/pongo2 v0.0.1 h1:zGP7pW51oi5eQZMIlGA3I+FHY9/HOQWDB+572yin0to= github.com/iris-contrib/schema v0.0.6 h1:CPSBLyx2e91H2yJzPuhGuifVRnZBBJ3pCOMbOvPZaTw= -github.com/iris-contrib/schema v0.0.6/go.mod h1:iYszG0IOsuIsfzjymw1kMzTL8YQcCWlm65f3wX8J5iA= github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e h1:UvSe12bq+Uj2hWd8aOlwPmoZ+CITRFrdit+sDGfAg8U= github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e/go.mod h1:G1CVv03EnqU1wYL2dFwXxW2An0az9JTl/ZsqXQeBlkU= -github.com/jedisct1/go-minisign v0.0.0-20230811132847-661be99b8267/go.mod h1:h1nSAbGFqGVzn6Jyl1R/iCcBUHN4g+gW1u9CoBTrb9E= github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= -github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA= -github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/jrick/logrotate v1.0.0 h1:lQ1bL/n9mBNeIXoTUoYRlK4dHuNJVofX9oWqBtPnSzI= -github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.9.1 h1:6QPYqodiu3GuPL+7mfx+NwDdp2eTkp9IfEUpgAwUN0o= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= -github.com/juju/errors v0.0.0-20181118221551-089d3ea4e4d5/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q= -github.com/juju/loggo v0.0.0-20180524022052-584905176618/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U= -github.com/juju/testing v0.0.0-20180920084828-472a3e8b2073/go.mod h1:63prj8cnj0tU0S9OHjGJn+b1h0ZghCndfnbQolrYTwA= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= -github.com/jung-kurt/gofpdf v1.0.0/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= -github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 h1:uC1QfSlInpQF+M0ao65imhwqKnz3Q2z/d8PWZRMQvDM= github.com/karalabe/usb v0.0.2 h1:M6QQBNxF+CQ8OFvxrT90BA0qBOXymndZnk5q235mFc4= github.com/karalabe/usb v0.0.2/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= -github.com/karalabe/usb v0.0.3-0.20230711191512-61db3e06439c/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= github.com/kataras/blocks v0.0.7 h1:cF3RDY/vxnSRezc7vLFlQFTYXG/yAr1o7WImJuZbzC4= -github.com/kataras/blocks v0.0.7/go.mod h1:UJIU97CluDo0f+zEjbnbkeMRlvYORtmc1304EeyXf4I= -github.com/kataras/golog v0.0.9/go.mod h1:12HJgwBIZFNGL0EJnMRhmvGA0PQGx8VFwrZtM4CqbAk= github.com/kataras/golog v0.1.7 h1:0TY5tHn5L5DlRIikepcaRR/6oInIr9AiWsxzt0vvlBE= -github.com/kataras/golog v0.1.7/go.mod h1:jOSQ+C5fUqsNSwurB/oAHq1IFSb0KI3l6GMa7xB6dZA= -github.com/kataras/iris/v12 v12.0.1/go.mod h1:udK4vLQKkdDqMGJJVd/msuMtN6hpYJhg/lSzuxjhO+U= github.com/kataras/iris/v12 v12.2.0-beta5 h1:grB/oCf5baZhmYIeDMfgN3LYrtEcmK8pbxlRvEZ2pgw= -github.com/kataras/iris/v12 v12.2.0-beta5/go.mod h1:q26aoWJ0Knx/00iPKg5iizDK7oQQSPjbD8np0XDh6dc= -github.com/kataras/neffos v0.0.10/go.mod h1:ZYmJC07hQPW67eKuzlfY7SO3bC0mw83A3j6im82hfqw= github.com/kataras/neffos v0.0.14 h1:pdJaTvUG3NQfeMbbVCI8JT2T5goPldyyfUB2PJfh1Bs= -github.com/kataras/pio v0.0.0-20190103105442-ea782b38602d/go.mod h1:NV88laa9UiiDuX9AhMbDPkGYSPugBOV6yTZB1l2K9Z0= -github.com/kataras/pio v0.0.10/go.mod h1:gS3ui9xSD+lAUpbYnjOGiQyY7sUMJO+EHpiRzhtZ5no= github.com/kataras/pio v0.0.11 h1:kqreJ5KOEXGMwHAWHDwIl+mjfNCPhAwZPa8gK7MKlyw= -github.com/kataras/pio v0.0.11/go.mod h1:38hH6SWH6m4DKSYmRhlrCJ5WItwWgCVrTNU62XZyUvI= github.com/kataras/sitemap v0.0.6 h1:w71CRMMKYMJh6LR2wTgnk5hSgjVNB9KL60n5e2KHvLY= -github.com/kataras/sitemap v0.0.6/go.mod h1:dW4dOCNs896OR1HmG+dMLdT7JjDk7mYBzoIRwuj5jA4= github.com/kataras/tunnel v0.0.4 h1:sCAqWuJV7nPzGrlb0os3j49lk2JhILT0rID38NHNLpA= -github.com/kataras/tunnel v0.0.4/go.mod h1:9FkU4LaeifdMWqZu7o20ojmW4B7hdhv2CMLwfnHGpYw= github.com/kilic/bls12-381 v0.1.0 h1:encrdjqKMEvabVQ7qYOKu1OvhqpK4s47wDYtNiPtlp4= github.com/kilic/bls12-381 v0.1.0/go.mod h1:vDTTHJONJ6G+P2R74EhnyotQDTliQDnFEwhdmfzw1ig= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0 h1:e8esj/e4R+SAOwFwN+n3zr0nYeCyeweozKfO23MvHzY= github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23 h1:FOOIBWrEkLgmlgGfMuZT83xIwfPDxEI2OHu6xUmJMFE= github.com/klauspost/asmfmt v1.3.2 h1:4Ri7ox3EwapiOjCki+hw14RyKk201CN4rzyCJRFLpK4= -github.com/klauspost/compress v1.9.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/compress v1.15.0/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= github.com/klauspost/cpuid v1.2.1 h1:vJi+O/nMdFt0vqm8NZBI6wzALWdA2X+egi0ogNyrC/w= github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4= github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.1.0 h1:Jskdu9ieNAYnjxsi0LbQp1ulIKZV1LAFgK1tWhpZgl8= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pty v1.1.1 h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw= -github.com/labstack/echo/v4 v4.1.11/go.mod h1:i541M3Fj6f76NZtHSj7TXnyM8n2gaodfvfxNnFqi74g= github.com/labstack/echo/v4 v4.9.0 h1:wPOF1CE6gvt/kmbMR4dGzWvHMPT+sAEUJOwOTtvITVY= -github.com/labstack/echo/v4 v4.9.0/go.mod h1:xkCDAdFCIf8jsFQ5NnbK7oqaF/yU1A1X20Ltm0OvSks= github.com/labstack/gommon v0.3.1 h1:OomWaJXm7xR6L1HmEtGyQf26TEn7V6X88mktX9kee9o= -github.com/labstack/gommon v0.3.1/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM= github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= -github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= github.com/lyft/protoc-gen-star/v2 v2.0.1 h1:keaAo8hRuAT0O3DfJ/wM3rufbAjGeJ1lAtWZHDjKGB0= github.com/mailgun/raymond/v2 v2.0.46 h1:aOYHhvTpF5USySJ0o7cpPno/Uh2I5qg2115K25A+Ft4= -github.com/mailgun/raymond/v2 v2.0.46/go.mod h1:lsgvL50kgt1ylcFJYZiULi5fjPBkkhNfj4KA0W54Z18= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= -github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd h1:HvFwW+cm9bCbZ/+vuGNq7CRWXql8c0y8nGeYpqmpvmk= -github.com/matryer/try v0.0.0-20161228173917-9ac251b645a2/go.mod h1:0KeJpeMD6o+O4hW7qJOT7vyQPKrWmj26uf5wMc/IiIs= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= @@ -1214,15 +1094,10 @@ github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= -github.com/mattn/go-sqlite3 v1.14.5/go.mod h1:WVKg1VTActs4Qso6iwGbiFih2UIHo0ENGwNd0Lj+XmI= github.com/mattn/goveralls v0.0.2 h1:7eJB6EqsPhRVxvwEXGnqdO2sJI0PTsrWoTMXEk9/OQc= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= -github.com/mediocregopher/mediocre-go-lib v0.0.0-20181029021733-cb65787f37ed/go.mod h1:dSsfyI2zABAdhcbvkXqgxOxrCsbYeHCPgrZkku60dSg= -github.com/mediocregopher/radix/v3 v3.3.0/go.mod h1:EmfVyvspXz1uZEyPBMyGK+kjWiKQGvsUt6O3Pj+LDCQ= github.com/mediocregopher/radix/v3 v3.4.2 h1:galbPBjIwmyREgwGCfQEN4X8lxbJnKBYurgz+VfcStA= github.com/microcosm-cc/bluemonday v1.0.21 h1:dNH3e4PSyE4vNX+KlRGHT5KrSvjeUkoNPwEORjffHJg= -github.com/microcosm-cc/bluemonday v1.0.21/go.mod h1:ytNkv4RrDrLJ2pqlsSI46O6IVXmZOBBD4SaJyDwwTkM= github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= github.com/miekg/dns v1.1.41 h1:WMszZWJG0XmzbK9FEmzH2TVcqYzFesusSIB41b8KHxY= github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= @@ -1240,20 +1115,15 @@ github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3P github.com/moul/http2curl v1.0.0 h1:dRMWoAtb+ePxMlLkrCbAqh4TlPHXvoGUSQ323/9Zahs= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= -github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/naoina/go-stringutil v0.1.0 h1:rCUeRUHjBjGTSHl0VC00jUPLz8/F9dDzYI70Hzifhks= github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416 h1:shk/vn9oCoOTmwcouEdwIeOtOGA/ELRUw/GwvxwfT+0= github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= github.com/nats-io/jwt v0.3.0 h1:xdnzwFETV++jNc4W1mw//qFyJGb2ABOombmZJQS4+Qo= -github.com/nats-io/nats.go v1.8.1/go.mod h1:BrFz9vVn0fU3AcH9Vn4Kd7W0NpJ651tD5omQ3M8LwxM= github.com/nats-io/nats.go v1.9.1 h1:ik3HbLhZ0YABLto7iX80pZLPw/6dx3T+++MZJwLnMrQ= -github.com/nats-io/nkeys v0.0.2/go.mod h1:dab7URMsZm6Z/jp9Z5UGa87Uutgc2mVpXLC4B7TDb/4= github.com/nats-io/nkeys v0.1.0 h1:qMd4+pRHgdr1nAClu+2h/2a5F2TmKcCzjCDazVgRoX4= github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/onsi/ginkgo v1.13.0/go.mod h1:+REjRxOmWfHCjfv9TTWB1jD1Frx4XydAD3zm1lskyM0= github.com/onsi/ginkgo/v2 v2.4.0/go.mod h1:iHkDK1fKGcBoEHT5W7YBq4RFWaQulw+caOMkAt4OrFo= github.com/onsi/ginkgo/v2 v2.7.0/go.mod h1:yjiuMwPokqY1XauOgju45q3sJt6VzQ/Fict1LFVcsAo= github.com/onsi/ginkgo/v2 v2.11.0/go.mod h1:ZhrRA5XmEE3x3rhlzamx/JJvujdZoJ2uvgI7kR0iZvM= @@ -1263,9 +1133,6 @@ github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/phpdave11/gofpdf v1.4.2/go.mod h1:zpO6xFn9yxo3YLyMvW8HcKWVdbNqgIfOOp2dXMnm1mY= -github.com/phpdave11/gofpdi v1.0.12/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI= -github.com/phpdave11/gofpdi v1.0.13/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI= github.com/pierrec/lz4/v4 v4.1.15 h1:MO0/ucJhngq7299dKLwIMtgTfbkoSPF6AoMYDd8Q4q0= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e h1:aoZm08cpOy4WuID//EZDgcC4zIxODThtZNPirFr42+A= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -1278,65 +1145,44 @@ github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= -github.com/prometheus/client_golang v1.12.0/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.1-0.20210607210712-147c58e9608a/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= github.com/prometheus/common v0.39.0/go.mod h1:6XBZ7lYdLCbkAVhwRsWTZn+IN5AB9F/NXd5w0BbEX0Y= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= -github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/protolambda/bls12-381-util v0.0.0-20220416220906-d8552aa452c7 h1:cZC+usqsYgHtlBaGulVnZ1hfKAi8iWtujBnRLQE698c= github.com/protolambda/bls12-381-util v0.0.0-20220416220906-d8552aa452c7/go.mod h1:IToEjHuttnUzwZI5KBSM/LOOW3qLbbrHOEfp3SbECGY= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0 h1:Ppwyp6VYCF1nvBTXL3trRso7mXMlRrw9ooo375wvi2s= -github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfFZQK844Gfx8o5WFuvpxWRwnSoipWe/p622j1v06w= -github.com/ruudk/golang-pdf417 v0.0.0-20201230142125-a7e3863a1245/go.mod h1:pQAZKsJ8yyVxGRWYNEm9oFB8ieLgKFnamEyDmSA0BRk= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/ryanuber/columnize v2.1.0+incompatible h1:j1Wcmh8OrK4Q7GXY+V7SVSY8nUWQxHW5TkBe7YUl+2s= github.com/sagikazarmark/crypt v0.10.0 h1:96E1qrToLBU6fGzo+PRRz7KGOc9FkYFiPnR3/zf8Smg= github.com/sagikazarmark/crypt v0.10.0/go.mod h1:gwTNHQVoOS3xp9Xvz5LLR+1AauC5M6880z5NWzdhOyQ= github.com/sanity-io/litter v1.5.1/go.mod h1:5Z71SvaYy5kcGtyglXOC9rrUi3c1E8CamFWjQsazTh0= github.com/schollz/closestmatch v2.1.0+incompatible h1:Uel2GXEpJqOWBrlyI+oY9LTiyyjYS17cCYRqP13/SHk= -github.com/sclevine/agouti v3.0.0+incompatible/go.mod h1:b4WX9W9L1sfQKXeJf1mUTLZKJ48R1S7H23Ji7oFO5Bw= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= -github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= -github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= -github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM= github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= @@ -1345,34 +1191,24 @@ github.com/stretchr/testify v0.0.0-20161117074351-18a02ba4a312/go.mod h1:a8OnRci github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.5/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/supranational/blst v0.3.8-0.20220526154634-513d2456b344/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= github.com/supranational/blst v0.3.11-0.20230406105308-e9dfc5ee724b/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= github.com/tdewolff/minify/v2 v2.12.4 h1:kejsHQMM17n6/gwdw53qsi6lg0TGddZADVyQOz1KMdE= -github.com/tdewolff/minify/v2 v2.12.4/go.mod h1:h+SRvSIX3kwgwTFOpSckvSxgax3uy8kZTSF1Ojrr3bk= github.com/tdewolff/parse/v2 v2.6.4 h1:KCkDvNUMof10e3QExio9OPZJT8SbdKojLBumw8YZycQ= -github.com/tdewolff/parse/v2 v2.6.4/go.mod h1:woz0cgbLwFdtbjJu8PIKxhW05KplTFQkOdX78o+Jgrs= -github.com/tdewolff/test v1.0.7/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE= github.com/thepudds/fzgen v0.4.2/go.mod h1:kHCWdsv5tdnt32NIHYDdgq083m6bMtaY0M+ipiO9xWE= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926 h1:G3dpKMzFDjgEh2q1Z7zUUtKa8ViPtH+ocF0bE0g00O8= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= -github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M= github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= -github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= github.com/urfave/negroni v1.0.0 h1:kIimOitoypq34K7TG7DUaJ9kq/N4Ofuwi1sjz0KipXc= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/fasthttp v1.40.0 h1:CRq/00MfruPGFLTQKY8b+8SfdK60TxNztjRMnH0t1Yc= -github.com/valyala/fasthttp v1.40.0/go.mod h1:t/G+3rLek+CyY9bnIE+YlMRddxVAAGjhxndDB4i4C0I= github.com/valyala/fasttemplate v1.2.1 h1:TVEnxayobAdVkhQfrfes2IzOB6o+z4roRkPF52WA1u4= github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a h1:0R4NLDRDZX6JcmhJgXi5E4b8Wg84ihbmUKp/GvSPEzc= -github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9znI5mJU= -github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= -github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= @@ -1382,7 +1218,6 @@ github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77 h1:ESFSdwYZvkeru3RtdrYueztKhOBCSAAzS4Gf+k0tEow= github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0 h1:6fRhSjgLCkTD3JnJxvaJ4Sj+TYblw757bqYgZaOq5ZY= github.com/yosssi/ace v0.0.5 h1:tUkIP/BLdKqrlrPwcmH0shwEEhTRHoGnc1wFIWmaBUA= -github.com/yosssi/ace v0.0.5/go.mod h1:ALfIzm2vT7t5ZE7uoIZqF3TQ7SAOyupFZnkrF5id+K0= github.com/yudai/gojsondiff v1.0.0 h1:27cbfqXLVEJ1o8I6v3y9lg8Ydm53EKqHXAOMxEGlCOA= github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 h1:BHyfKlQyqbsFN5p3IfnEUduWvb9is428/nNb5L3U01M= github.com/yudai/pp v2.0.1+incompatible h1:Q4//iY4pNF6yPLZIigmvcl7k/bPgrcTPIFIcmawg5bI= @@ -1406,7 +1241,6 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/automaxprocs v1.5.2/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0= go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo= go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4= @@ -1419,35 +1253,14 @@ go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190909091759-094676da4a83/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= -golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220926161630-eccd6366d1be/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I= golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= -golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20191002040644-a1355ae1e2c3/go.mod h1:NOZ3BPKG0ec/BKJQgnvsSFpcKLM5xXVWnvZS97DWHgE= -golang.org/x/exp v0.0.0-20200513190911-00229845015e/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= -golang.org/x/exp v0.0.0-20230810033253-352e893a4cad h1:g0bG7Z4uG+OgH2QDODnjp6ggkk1bJDsINcuWmJN1iJU= -golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= -golang.org/x/image v0.0.0-20190910094157-69e4b8554b2a/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20200119044424-58c23975cae1/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20200430140353-33d19683fad8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20200618115811-c13761719519/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20201208152932-35266b937fa6/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20210216034530-4410531fe030/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20210607152325-775e3b0c77b9/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= -golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= golang.org/x/image v0.0.0-20220302094943-723b81ca9867 h1:TcHcE0vrmgzNH1v3ppjcMGbhG5+9fMuvOmUYwNEF4q4= golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028 h1:4+4C/Iv2U4fMZBiMCc98MG1In4gJY5YRhtpDNeDeHWs= golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= @@ -1457,11 +1270,8 @@ golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8= -golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20221002022538-bcab6841153b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= @@ -1471,14 +1281,11 @@ golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= -golang.org/x/oauth2 v0.0.0-20170207211851-4464e7848382/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.5.0/go.mod h1:9/XBHVqLaWO3/BRHs5jbpYCnOZVjj5V0ndyaAM7KB4I= golang.org/x/oauth2 v0.6.0/go.mod h1:ycmewcwgD4Rpr3eZJLSB4Kyyljb3qDh40vJ8STE5HKw= golang.org/x/oauth2 v0.7.0 h1:qe6s0zUXlPX80/dITx3440hWZ7GwMwgDDyrSGTPJG/g= golang.org/x/oauth2 v0.7.0/go.mod h1:hPLQkd9LyjfXTiRohC/41GhcFqxisoUQ99sCUOHO9x4= -golang.org/x/perf v0.0.0-20230113213139-801c7ef9e5c5/go.mod h1:UBKtEnL8aqnd+0JHqZ+2qoMDwtuy6cYhhKNoHLBiTQc= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1488,24 +1295,12 @@ golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201101102859-da207088b7d1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210304124612-50617c2ba197/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211020174200-9d6173849985/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1515,40 +1310,25 @@ golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0= -golang.org/x/term v0.12.0 h1:/ZfYdc3zq+q02Rv9vGqTeSItdzZTSNDmfTi0mBAuidU= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/time v0.0.0-20220922220347-f3bd1da661af/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190927191325-030b2cf1153e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4= golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= -golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= golang.org/x/tools v0.9.3/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= golang.org/x/tools v0.12.0/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= -gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0= -gonum.org/v1/gonum v0.9.3/go.mod h1:TZumC3NeyVQskjXqmyWt4S3bINhy7B4eYwW69EbyX+0= -gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= -gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= -gonum.org/v1/plot v0.9.0/go.mod h1:3Pcqqmp6RHvJI72kgb8fThyUnav364FOsdDo2aGW5lY= -gonum.org/v1/plot v0.10.0/go.mod h1:JWIHJ7U20drSQb/aDpTetJzfC1KlAPldJLpkSy88dvQ= gonum.org/v1/plot v0.10.1 h1:dnifSs43YJuNMDzB7v8wV64O4ABBHReuAVAoBxqBqS4= -google.golang.org/api v0.0.0-20170206182103-3d017632ea10/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.106.0/go.mod h1:2Ts0XTHNVWxypznxWOYUeI4g3WdP9Pk2Qk58+a/O9MY= google.golang.org/api v0.108.0/go.mod h1:2Ts0XTHNVWxypznxWOYUeI4g3WdP9Pk2Qk58+a/O9MY= google.golang.org/api v0.110.0/go.mod h1:7FC4Vvx1Mooxh8C5HWjzZHcavuS2f6pmJpZx60ca7iI= @@ -1565,7 +1345,6 @@ google.golang.org/genproto v0.0.0-20230222225845-10f96fb3dbec/go.mod h1:3Dl5ZL0q google.golang.org/genproto v0.0.0-20230223222841-637eb2293923/go.mod h1:3Dl5ZL0q0isWJt+FVcfpQyirqemEuLAK/iFvg1UP1Hw= google.golang.org/genproto v0.0.0-20230303212802-e74f57abe488/go.mod h1:TvhZT5f700eVlTNwND1xoEZQeWTB2RY/65kplwl/bFA= google.golang.org/genproto v0.0.0-20230320184635-7606e756e683/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= -google.golang.org/grpc v0.0.0-20170208002647-2a6bf6142e96/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= @@ -1580,8 +1359,6 @@ google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqw google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0 h1:0vLT13EuvQ0hNvakwLuFZ/jYrLp5F3kcWHXdRggjCE8= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM= @@ -1591,11 +1368,9 @@ gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gotest.tools/v3 v3.5.0/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= honnef.co/go/tools v0.0.1-2020.1.4 h1:UoveltGrhghAA7ePc+e+QYDHXrBps2PqFZiHkGR/xK8= rsc.io/binaryregexp v0.2.0 h1:HfqmD5MEmC0zvwBuF187nq9mdnXjXsSivRiXN7SmRkE= rsc.io/pdf v0.1.1 h1:k1MczvYDUvJBe93bYd7wrZLLUEcLZAuF824/I4e5Xr4= -rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0 h1:9JKUTTIUgS6kzR9mK1YuGKv6Nl+DijDNIc0ghT58FaY= rsc.io/sampler v1.3.0 h1:7uVkIFmeBqHfdjD+gZwtXXI+RODJ2Wc4O7MPEh/QiW4= sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q= From 95248f9151e467d0e3ff072bf3be8310f6dbf564 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Thu, 28 Sep 2023 16:19:57 -0400 Subject: [PATCH 016/183] wip --- contracts/abi/NativeTokenMinter.go | 26 +- contracts/abi/NativeTokenReceiver.go | 36 +- .../NativeTokenBridge/NativeTokenReceiver.sol | 22 +- docker/defaultChainConfig.json | 2 +- docker/defaultNodeConfig.json | 2 +- tests/e2e_test.go | 608 +++++++----------- 6 files changed, 266 insertions(+), 430 deletions(-) diff --git a/contracts/abi/NativeTokenMinter.go b/contracts/abi/NativeTokenMinter.go index 9cb74a28f..899d4b366 100644 --- a/contracts/abi/NativeTokenMinter.go +++ b/contracts/abi/NativeTokenMinter.go @@ -8,11 +8,11 @@ import ( "math/big" "strings" - ethereum "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ava-labs/subnet-evm/accounts/abi" + "github.com/ava-labs/subnet-evm/accounts/abi/bind" + "github.com/ava-labs/subnet-evm/core/types" + "github.com/ava-labs/subnet-evm/interfaces" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/event" ) @@ -21,7 +21,7 @@ var ( _ = errors.New _ = big.NewInt _ = strings.NewReader - _ = ethereum.NotFound + _ = interfaces.NotFound _ = bind.Bind _ = common.Big1 _ = types.BloomLookup @@ -384,10 +384,10 @@ type NativeTokenMinterBridgeTokensIterator struct { contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration } // Next advances the iterator to the subsequent event, returning whether there @@ -542,10 +542,10 @@ type NativeTokenMinterMintNativeTokensIterator struct { contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration } // Next advances the iterator to the subsequent event, returning whether there diff --git a/contracts/abi/NativeTokenReceiver.go b/contracts/abi/NativeTokenReceiver.go index b2b27e40b..b31d1452f 100644 --- a/contracts/abi/NativeTokenReceiver.go +++ b/contracts/abi/NativeTokenReceiver.go @@ -8,11 +8,11 @@ import ( "math/big" "strings" - ethereum "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ava-labs/subnet-evm/accounts/abi" + "github.com/ava-labs/subnet-evm/accounts/abi/bind" + "github.com/ava-labs/subnet-evm/core/types" + "github.com/ava-labs/subnet-evm/interfaces" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/event" ) @@ -21,7 +21,7 @@ var ( _ = errors.New _ = big.NewInt _ = strings.NewReader - _ = ethereum.NotFound + _ = interfaces.NotFound _ = bind.Bind _ = common.Big1 _ = types.BloomLookup @@ -99,7 +99,7 @@ type NativeTokenReceiverTransactorRaw struct { // NewNativeTokenReceiver creates a new instance of NativeTokenReceiver, bound to a specific deployed contract. func NewNativeTokenReceiver(address common.Address, backend bind.ContractBackend) (*NativeTokenReceiver, error) { - contract, err := bindNativeTokenReceiver(address, backend, backend, backend) + contract, err := BindNativeTokenReceiver(address, backend, backend, backend) if err != nil { return nil, err } @@ -108,7 +108,7 @@ func NewNativeTokenReceiver(address common.Address, backend bind.ContractBackend // NewNativeTokenReceiverCaller creates a new read-only instance of NativeTokenReceiver, bound to a specific deployed contract. func NewNativeTokenReceiverCaller(address common.Address, caller bind.ContractCaller) (*NativeTokenReceiverCaller, error) { - contract, err := bindNativeTokenReceiver(address, caller, nil, nil) + contract, err := BindNativeTokenReceiver(address, caller, nil, nil) if err != nil { return nil, err } @@ -117,7 +117,7 @@ func NewNativeTokenReceiverCaller(address common.Address, caller bind.ContractCa // NewNativeTokenReceiverTransactor creates a new write-only instance of NativeTokenReceiver, bound to a specific deployed contract. func NewNativeTokenReceiverTransactor(address common.Address, transactor bind.ContractTransactor) (*NativeTokenReceiverTransactor, error) { - contract, err := bindNativeTokenReceiver(address, nil, transactor, nil) + contract, err := BindNativeTokenReceiver(address, nil, transactor, nil) if err != nil { return nil, err } @@ -126,7 +126,7 @@ func NewNativeTokenReceiverTransactor(address common.Address, transactor bind.Co // NewNativeTokenReceiverFilterer creates a new log filterer instance of NativeTokenReceiver, bound to a specific deployed contract. func NewNativeTokenReceiverFilterer(address common.Address, filterer bind.ContractFilterer) (*NativeTokenReceiverFilterer, error) { - contract, err := bindNativeTokenReceiver(address, nil, nil, filterer) + contract, err := BindNativeTokenReceiver(address, nil, nil, filterer) if err != nil { return nil, err } @@ -134,7 +134,7 @@ func NewNativeTokenReceiverFilterer(address common.Address, filterer bind.Contra } // bindNativeTokenReceiver binds a generic wrapper to an already deployed contract. -func bindNativeTokenReceiver(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { +func BindNativeTokenReceiver(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { parsed, err := NativeTokenReceiverMetaData.GetAbi() if err != nil { return nil, err @@ -384,10 +384,10 @@ type NativeTokenReceiverBridgeTokensIterator struct { contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration } // Next advances the iterator to the subsequent event, returning whether there @@ -542,10 +542,10 @@ type NativeTokenReceiverUnlockTokensIterator struct { contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration } // Next advances the iterator to the subsequent event, returning whether there diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenReceiver.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenReceiver.sol index a31e137d9..94451ed34 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenReceiver.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenReceiver.sol @@ -100,16 +100,18 @@ contract NativeTokenReceiver is ITeleporterReceiver, INativeTokenReceiver, Reent // Lock tokens in this bridge instance. Supports "fee/burn on transfer" ERC20 token // implementations by only bridging the actual balance increase reflected by the call // to transferFrom. - uint256 adjustedAmount = SafeERC20TransferFrom.safeTransferFrom( - IERC20(feeTokenContractAddress), - feeAmount - ); - - // Ensure that the adjusted amount is greater than the fee to be paid. - // The secondary fee amount is not used in this case (and can assumed to be 0) since bridging - // a native token to another chain only ever involves a single cross-chain message. - if (adjustedAmount <= feeAmount) { - revert InsufficientAdjustedAmount(adjustedAmount, feeAmount); + if (feeAmount > 0) { + uint256 adjustedAmount = SafeERC20TransferFrom.safeTransferFrom( + IERC20(feeTokenContractAddress), + feeAmount + ); + + // Ensure that the adjusted amount is greater than the fee to be paid. + // The secondary fee amount is not used in this case (and can assumed to be 0) since bridging + // a native token to another chain only ever involves a single cross-chain message. + if (adjustedAmount <= feeAmount) { + revert InsufficientAdjustedAmount(adjustedAmount, feeAmount); + } } // Send Teleporter message. diff --git a/docker/defaultChainConfig.json b/docker/defaultChainConfig.json index f21a3c906..8b93f2e90 100644 --- a/docker/defaultChainConfig.json +++ b/docker/defaultChainConfig.json @@ -1,5 +1,5 @@ { - "log-level": "info", + "log-level": "debug", "contractNativeMinterConfig": { "blockTimestamp": 0, "adminAddresses": [ diff --git a/docker/defaultNodeConfig.json b/docker/defaultNodeConfig.json index f21a3c906..8b93f2e90 100644 --- a/docker/defaultNodeConfig.json +++ b/docker/defaultNodeConfig.json @@ -1,5 +1,5 @@ { - "log-level": "info", + "log-level": "debug", "contractNativeMinterConfig": { "blockTimestamp": 0, "adminAddresses": [ diff --git a/tests/e2e_test.go b/tests/e2e_test.go index b59c6edbd..09f57d604 100644 --- a/tests/e2e_test.go +++ b/tests/e2e_test.go @@ -19,16 +19,21 @@ import ( "github.com/ava-labs/awm-relayer/messages/teleporter" relayerEvm "github.com/ava-labs/awm-relayer/vms/evm" "github.com/ava-labs/coreth/rpc" + "github.com/ava-labs/subnet-evm/accounts/abi/bind" "github.com/ava-labs/subnet-evm/core/types" "github.com/ava-labs/subnet-evm/ethclient" "github.com/ava-labs/subnet-evm/interfaces" + + // "github.com/ava-labs/subnet-evm/internal/debug" "github.com/ava-labs/subnet-evm/params" "github.com/ava-labs/subnet-evm/plugin/evm" "github.com/ava-labs/subnet-evm/tests/utils/runner" predicateutils "github.com/ava-labs/subnet-evm/utils/predicate" warpBackend "github.com/ava-labs/subnet-evm/warp" - warpPayload "github.com/ava-labs/subnet-evm/warp/payload" + + // warpPayload "github.com/ava-labs/subnet-evm/warp/payload" deployment_utils "github.com/ava-labs/teleporter/contract-deployment/deployment-utils" + "github.com/ava-labs/teleporter/contracts/abi" "github.com/ava-labs/subnet-evm/x/warp" "github.com/ethereum/go-ethereum/common" @@ -37,6 +42,7 @@ import ( "github.com/ethereum/go-ethereum/log" "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "github.com/onsi/gomega/format" ) const ( @@ -56,13 +62,14 @@ var ( MessageID: big.NewInt(1), SenderAddress: fundedAddress, DestinationAddress: fundedAddress, - RequiredGasLimit: big.NewInt(1), + RequiredGasLimit: big.NewInt(10_000_000), AllowedRelayerAddresses: []common.Address{}, Receipts: []teleporter.TeleporterMessageReceipt{}, - Message: []byte{1, 2, 3, 4}, + Message: []byte{}, } nativeTokenBridgeContractAddress common.Address nativeTokenBridgeDeployer = common.HexToAddress("0x1337cfd2dCff6270615B90938aCB1efE79801704") + tokenReceiverAddress = common.HexToAddress("0x0123456789012345678901234567890123456789") nativeTokenBridgeDeployerPK *ecdsa.PrivateKey storageLocation = fmt.Sprintf("%s/.awm-relayer-storage", os.TempDir()) subnetIDs []ids.ID @@ -83,6 +90,7 @@ func TestE2E(t *testing.T) { } RegisterFailHandler(ginkgo.Fail) + format.UseStringerRepresentation = true ginkgo.RunSpecs(t, "Teleporter e2e test") } @@ -304,18 +312,26 @@ var _ = ginkgo.BeforeSuite(func() { { nativeTokenBridgeDeployerPK, err = crypto.HexToECDSA(bridgeDeployerKeyStr) Expect(err).Should(BeNil()) + nativeTokenBridgeContractAddress = deployment_utils.DeriveEVMContractAddress(nativeTokenBridgeDeployer, 0) + fmt.Println("Native Token Bridge Contract Address: ", nativeTokenBridgeContractAddress.Hex()) cmd := exec.Command( "forge", "create", - "src/CrossChainApplications/NativeTokenBridge/NativeTokenMinter.sol:NativeTokenMinter", + "src/CrossChainApplications/NativeTokenBridge/NativeTokenReceiver.sol:NativeTokenReceiver", "--rpc-url", chainARPCURI, "--private-key", hexutil.Encode(nativeTokenBridgeDeployerPK.D.Bytes()), "--constructor-args", teleporterContractAddress.Hex(), hexutil.Encode(chainBIDInt.Bytes())) + fmt.Println(cmd.String()) cmd.Dir = "./contracts" err := cmd.Run() Expect(err).Should(BeNil()) + + time.Sleep(5 * time.Second) + bridgeCode, err := chainARPCClient.CodeAt(ctx, nativeTokenBridgeContractAddress, nil) + Expect(err).Should(BeNil()) + Expect(len(bridgeCode)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode } { cmd := exec.Command( @@ -326,10 +342,17 @@ var _ = ginkgo.BeforeSuite(func() { "--private-key", hexutil.Encode(nativeTokenBridgeDeployerPK.D.Bytes()), "--constructor-args", teleporterContractAddress.Hex(), hexutil.Encode(chainAIDInt.Bytes())) + fmt.Println(cmd.String()) + cmd.Dir = "./contracts" err := cmd.Run() Expect(err).Should(BeNil()) + + time.Sleep(5 * time.Second) + bridgeCode, err := chainBRPCClient.CodeAt(ctx, nativeTokenBridgeContractAddress, nil) + Expect(err).Should(BeNil()) + Expect(len(bridgeCode)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode } log.Info("Finished deploying Bridge contracts") @@ -350,64 +373,35 @@ var _ = ginkgo.AfterSuite(func() { // 3. Verify receipt of the message on Subnet B var _ = ginkgo.Describe("[Teleporter one way send]", ginkgo.Ordered, func() { var ( - receivedWarpMessage *avalancheWarp.Message - payload []byte - teleporterMessageID *big.Int + // teleporterMessageID *big.Int ) // Send a transaction to Subnet A to issue a Warp Message from the Teleporter contract to Subnet B - ginkgo.It("Send Message from A to B", ginkgo.Label("Teleporter", "SendTeleporter"), func() { + ginkgo.It("Send Message from A to B", ginkgo.Label("NativeTokenBridge", "SendNativeTokenBridge"), func() { ctx := context.Background() - nonceA, err := chainARPCClient.NonceAt(ctx, fundedAddress, nil) - Expect(err).Should(BeNil()) - - nonceB, err := chainBRPCClient.NonceAt(ctx, fundedAddress, nil) + nativeTokenReceiver, err := abi.NewNativeTokenReceiver(nativeTokenBridgeContractAddress, chainARPCClient) Expect(err).Should(BeNil()) - - log.Info("Packing teleporter message", "nonceA", nonceA, "nonceB", nonceB) - payload, err = teleporter.PackSendCrossChainMessageEvent(common.Hash(blockchainIDB), teleporterMessage) - Expect(err).Should(BeNil()) - - data, err := teleporter.EVMTeleporterContractABI.Pack( - "sendCrossChainMessage", - TeleporterMessageInput{ - DestinationChainID: blockchainIDB, - DestinationAddress: fundedAddress, - FeeInfo: FeeInfo{ - ContractAddress: fundedAddress, - Amount: big.NewInt(0), - }, - RequiredGasLimit: big.NewInt(1), - AllowedRelayerAddresses: []common.Address{}, - Message: []byte{1, 2, 3, 4}, - }, - ) - Expect(err).Should(BeNil()) - - // Send a transaction to the Teleporter contract - tx := newTestTeleporterMessage(chainAIDInt, teleporterContractAddress, nonceA, data) - - txSigner := types.LatestSignerForChainID(chainAIDInt) - signedTx, err := types.SignTx(tx, txSigner, fundedKey) + transactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, chainAIDInt) Expect(err).Should(BeNil()) + transactor.Value = big.NewInt(1000_000_000_000_000_000) subA, err := chainAWSClient.SubscribeNewHead(ctx, newHeadsA) Expect(err).Should(BeNil()) defer subA.Unsubscribe() - log.Info("Sending Teleporter transaction on source chain", "destinationChainID", blockchainIDB, "txHash", signedTx.Hash()) - err = chainARPCClient.SendTransaction(ctx, signedTx) + tx, err := nativeTokenReceiver.BridgeTokens(transactor, tokenReceiverAddress, tokenReceiverAddress, big.NewInt(0)) Expect(err).Should(BeNil()) // Sleep to ensure the new block is published to the subscriber time.Sleep(5 * time.Second) - receipt, err := chainARPCClient.TransactionReceipt(ctx, signedTx.Hash()) + + receipt, err := chainARPCClient.TransactionReceipt(ctx, tx.Hash()) Expect(err).Should(BeNil()) Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) }) - ginkgo.It("Relay message to destination", ginkgo.Label("Teleporter", "RelayMessage"), func() { + ginkgo.It("Relay message to destination", ginkgo.Label("NativeTokenBridge", "RelayMessage"), func() { ctx := context.Background() // Get the latest block from Subnet A, and retrieve the warp message from the logs @@ -438,22 +432,7 @@ var _ = ginkgo.Describe("[Teleporter one way send]", ginkgo.Ordered, func() { // Loop over each client on chain A to ensure they all have time to accept the block. // Note: if we did not confirm this here, the next stage could be racy since it assumes every node // has accepted the block. - for i, uri := range chainANodeURIs { - chainAWSURI := httpToWebsocketURI(uri, blockchainIDA.String()) - log.Info("Creating ethclient for blockchainA", "wsURI", chainAWSURI) - client, err := ethclient.Dial(chainAWSURI) - Expect(err).Should(BeNil()) - - // Loop until each node has advanced to >= the height of the block that emitted the warp log - for { - block, err := client.BlockByNumber(ctx, nil) - Expect(err).Should(BeNil()) - if block.NumberU64() >= newHeadA.Number.Uint64() { - log.Info("client accepted the block containing SendWarpMessage", "client", i, "height", block.NumberU64()) - break - } - } - } + waitForAllValidatorsToAcceptBlock(ctx, chainANodeURIs, blockchainIDA, newHeadA.Number.Uint64()) // Get the aggregate signature for the Warp message log.Info("Fetching aggregate signature from the source chain validators") @@ -462,365 +441,220 @@ var _ = ginkgo.Describe("[Teleporter one way send]", ginkgo.Ordered, func() { signedWarpMessageBytes, err := warpClient.GetAggregateSignature(ctx, unsignedWarpMessageID, params.WarpQuorumDenominator) Expect(err).Should(BeNil()) - // Construct the transaction to send the Warp message to the destination chain - log.Info("Constructing transaction for the destination chain") - signedMessage, err := avalancheWarp.ParseMessage(signedWarpMessageBytes) - Expect(err).Should(BeNil()) + signedTxB := constructAndSendTransaction( + ctx, + signedWarpMessageBytes, + teleporterMessage, + teleporterContractAddress, + fundedAddress, + fundedKey, + chainBRPCClient, + chainBIDInt, + ) - numSigners, err := signedMessage.Signature.NumSigners() - Expect(err).Should(BeNil()) - gasLimit, err := teleporter.CalculateReceiveMessageGasLimit(numSigners, teleporterMessage.RequiredGasLimit) + time.Sleep(5 * time.Second) + // Sleep to ensure the new block is published to the subscriber + receipt, err := chainBRPCClient.TransactionReceipt(ctx, signedTxB.Hash()) Expect(err).Should(BeNil()) - callData, err := teleporter.EVMTeleporterContractABI.Pack("receiveCrossChainMessage", fundedAddress) - Expect(err).Should(BeNil()) + cmd := exec.Command( + "cast", + "run", + "--rpc-url", chainBRPCURI, + "--verbose", + signedTxB.Hash().Hex()) - baseFee, err := chainBRPCClient.EstimateBaseFee(ctx) - Expect(err).Should(BeNil()) + fmt.Println(cmd.String()) - gasTipCap, err := chainBRPCClient.SuggestGasTipCap(ctx) - Expect(err).Should(BeNil()) + fmt.Printf("IT'S A ME, LOGIO\n %+v", receipt) - nonce, err := chainBRPCClient.NonceAt(ctx, fundedAddress, nil) + output, err := cmd.Output() + fmt.Printf("%v\n", err) Expect(err).Should(BeNil()) - gasFeeCap := baseFee.Mul(baseFee, big.NewInt(2)) - gasFeeCap.Add(gasFeeCap, big.NewInt(2500000000)) - destinationTx := predicateutils.NewPredicateTx( - chainBIDInt, - nonce, - &teleporterContractAddress, - gasLimit, - gasFeeCap, - gasTipCap, - big.NewInt(0), - callData, - types.AccessList{}, - warp.ContractAddress, - signedMessage.Bytes(), - ) + fmt.Println(string(output)) - // Sign and send the transaction on the destination chain - signer := types.LatestSignerForChainID(chainBIDInt) - signedTxB, err := types.SignTx(destinationTx, signer, fundedKey) - Expect(err).Should(BeNil()) + fmt.Sprintf("%s", output) - log.Info("Subscribing to new heads on destination chain") - subB, err := chainBWSClient.SubscribeNewHead(ctx, newHeadsB) - Expect(err).Should(BeNil()) - defer subB.Unsubscribe() - log.Info("Sending transaction to destination chain") - err = chainBRPCClient.SendTransaction(context.Background(), signedTxB) - Expect(err).Should(BeNil()) + Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) - // Sleep to ensure the new block is published to the subscriber - time.Sleep(5 * time.Second) - receipt, err := chainBRPCClient.TransactionReceipt(ctx, signedTxB.Hash()) + sendCrossChainMessageLog := receipt.Logs[0] + var event ReceiveCrossChainMessageEvent + err = teleporter.EVMTeleporterContractABI.UnpackIntoInterface(&event, "SendCrossChainMessage", sendCrossChainMessageLog.Data) Expect(err).Should(BeNil()) - Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + // teleporterMessageID = event.Message.MessageID }) - ginkgo.It("Receive message on Subnet B", ginkgo.Label("Teleporter", "ReceiveTeleporter"), func() { - ctx := context.Background() +// ginkgo.It("Receive message on Subnet B", ginkgo.Label("Teleporter", "ReceiveTeleporter"), func() { +// ctx := context.Background() + +// // Get the latest block from Subnet B +// log.Info("Waiting for new block confirmation") +// newHeadB := <-newHeadsB +// log.Info("Received new head", "height", newHeadB.Number.Uint64()) +// blockHashB := newHeadB.Hash() +// block, err := chainBRPCClient.BlockByHash(ctx, blockHashB) +// Expect(err).Should(BeNil()) +// log.Info( +// "Got block", +// "blockHash", blockHashB, +// "blockNumber", block.NumberU64(), +// "transactions", block.Transactions(), +// "numTransactions", len(block.Transactions()), +// "block", block, +// ) +// accessLists := block.Transactions()[0].AccessList() +// Expect(len(accessLists)).Should(Equal(1)) +// Expect(accessLists[0].Address).Should(Equal(warp.Module.Address)) + +// // Check the transaction storage key has warp message we're expecting +// storageKeyHashes := accessLists[0].StorageKeys +// packedPredicate := predicateutils.HashSliceToBytes(storageKeyHashes) +// predicateBytes, err := predicateutils.UnpackPredicate(packedPredicate) +// Expect(err).Should(BeNil()) +// receivedWarpMessage, err = avalancheWarp.ParseMessage(predicateBytes) +// Expect(err).Should(BeNil()) + +// // Check that the transaction has successful receipt status +// txHash := block.Transactions()[0].Hash() +// receipt, err := chainBRPCClient.TransactionReceipt(ctx, txHash) +// Expect(err).Should(BeNil()) +// Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + +// log.Info("Finished sending warp message, closing down output channel") + +// }) + +// ginkgo.It("Validate Received Warp Message Values", ginkgo.Label("Teleporter", "VerifyWarp"), func() { +// Expect(receivedWarpMessage.SourceChainID).Should(Equal(blockchainIDA)) +// addressedPayload, err := warpPayload.ParseAddressedPayload(receivedWarpMessage.Payload) +// Expect(err).Should(BeNil()) + +// receivedDestinationID, err := ids.ToID(addressedPayload.DestinationChainID.Bytes()) +// Expect(err).Should(BeNil()) +// Expect(receivedDestinationID).Should(Equal(blockchainIDB)) +// Expect(addressedPayload.DestinationAddress).Should(Equal(teleporterContractAddress)) +// Expect(addressedPayload.Payload).Should(Equal(payload)) + +// // Check that the teleporter message is correct +// receivedTeleporterMessage, err := teleporter.UnpackTeleporterMessage(addressedPayload.Payload) +// Expect(err).Should(BeNil()) +// Expect(*receivedTeleporterMessage).Should(Equal(teleporterMessage)) + +// teleporterMessageID = receivedTeleporterMessage.MessageID +// }) + +// ginkgo.It("Check Teleporter Message Received", ginkgo.Label("Teleporter", "TeleporterMessageReceived"), func() { +// data, err := teleporter.PackMessageReceivedMessage(teleporter.MessageReceivedInput{ +// OriginChainID: blockchainIDA, +// MessageID: teleporterMessageID, +// }) +// Expect(err).Should(BeNil()) +// callMessage := interfaces.CallMsg{ +// To: &teleporterContractAddress, +// Data: data, +// } +// result, err := chainBRPCClient.CallContract(context.Background(), callMessage, nil) +// Expect(err).Should(BeNil()) + +// // check the contract call result +// delivered, err := teleporter.UnpackMessageReceivedResult(result) +// Expect(err).Should(BeNil()) +// Expect(delivered).Should(BeTrue()) +// }) - // Get the latest block from Subnet B - log.Info("Waiting for new block confirmation") - newHeadB := <-newHeadsB - log.Info("Received new head", "height", newHeadB.Number.Uint64()) - blockHashB := newHeadB.Hash() - block, err := chainBRPCClient.BlockByHash(ctx, blockHashB) - Expect(err).Should(BeNil()) - log.Info( - "Got block", - "blockHash", blockHashB, - "blockNumber", block.NumberU64(), - "transactions", block.Transactions(), - "numTransactions", len(block.Transactions()), - "block", block, - ) - accessLists := block.Transactions()[0].AccessList() - Expect(len(accessLists)).Should(Equal(1)) - Expect(accessLists[0].Address).Should(Equal(warp.Module.Address)) - - // Check the transaction storage key has warp message we're expecting - storageKeyHashes := accessLists[0].StorageKeys - packedPredicate := predicateutils.HashSliceToBytes(storageKeyHashes) - predicateBytes, err := predicateutils.UnpackPredicate(packedPredicate) - Expect(err).Should(BeNil()) - receivedWarpMessage, err = avalancheWarp.ParseMessage(predicateBytes) - Expect(err).Should(BeNil()) +}) - // Check that the transaction has successful receipt status - txHash := block.Transactions()[0].Hash() - receipt, err := chainBRPCClient.TransactionReceipt(ctx, txHash) +// Blocks until all validators specified in nodeURIs have reached the specified block height +func waitForAllValidatorsToAcceptBlock(ctx context.Context, nodeURIs []string, blockchainID ids.ID, height uint64) { + for i, uri := range nodeURIs { + chainAWSURI := httpToWebsocketURI(uri, blockchainID.String()) + log.Info("Creating ethclient for blockchainA", "wsURI", chainAWSURI) + client, err := ethclient.Dial(chainAWSURI) Expect(err).Should(BeNil()) - Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) - log.Info("Finished sending warp message, closing down output channel") - - }) - - ginkgo.It("Validate Received Warp Message Values", ginkgo.Label("Teleporter", "VerifyWarp"), func() { - Expect(receivedWarpMessage.SourceChainID).Should(Equal(blockchainIDA)) - addressedPayload, err := warpPayload.ParseAddressedPayload(receivedWarpMessage.Payload) - Expect(err).Should(BeNil()) + // Loop until each node has advanced to >= the height of the block that emitted the warp log + for { + block, err := client.BlockByNumber(ctx, nil) + Expect(err).Should(BeNil()) + if block.NumberU64() >= height { + log.Info("client accepted the block containing SendWarpMessage", "client", i, "height", block.NumberU64()) + break + } + } + } +} - receivedDestinationID, err := ids.ToID(addressedPayload.DestinationChainID.Bytes()) - Expect(err).Should(BeNil()) - Expect(receivedDestinationID).Should(Equal(blockchainIDB)) - Expect(addressedPayload.DestinationAddress).Should(Equal(teleporterContractAddress)) - Expect(addressedPayload.Payload).Should(Equal(payload)) +// Constructs and sends a transaction containing a warp message for the destination chain. +// Returns the signed transaction. +func constructAndSendTransaction( + ctx context.Context, + warpMessageBytes []byte, + teleporterMessage teleporter.TeleporterMessage, + teleporterContractAddress common.Address, + fundedAddress common.Address, + fundedKey *ecdsa.PrivateKey, + client ethclient.Client, + chainID *big.Int, +) *types.Transaction { + // Construct the transaction to send the Warp message to the destination chain + log.Info("Constructing transaction for the destination chain") + signedMessage, err := avalancheWarp.ParseMessage(warpMessageBytes) + Expect(err).Should(BeNil()) - // Check that the teleporter message is correct - receivedTeleporterMessage, err := teleporter.UnpackTeleporterMessage(addressedPayload.Payload) - Expect(err).Should(BeNil()) - Expect(*receivedTeleporterMessage).Should(Equal(teleporterMessage)) + numSigners, err := signedMessage.Signature.NumSigners() + Expect(err).Should(BeNil()) - teleporterMessageID = receivedTeleporterMessage.MessageID - }) + gasLimit, err := teleporter.CalculateReceiveMessageGasLimit(numSigners, teleporterMessage.RequiredGasLimit) + Expect(err).Should(BeNil()) - ginkgo.It("Check Teleporter Message Received", ginkgo.Label("Teleporter", "TeleporterMessageReceived"), func() { - data, err := teleporter.PackMessageReceivedMessage(teleporter.MessageReceivedInput{ - OriginChainID: blockchainIDA, - MessageID: teleporterMessageID, - }) - Expect(err).Should(BeNil()) - callMessage := interfaces.CallMsg{ - To: &teleporterContractAddress, - Data: data, - } - result, err := chainBRPCClient.CallContract(context.Background(), callMessage, nil) - Expect(err).Should(BeNil()) + callData, err := teleporter.EVMTeleporterContractABI.Pack("receiveCrossChainMessage", fundedAddress) + Expect(err).Should(BeNil()) - // check the contract call result - delivered, err := teleporter.UnpackMessageReceivedResult(result) - Expect(err).Should(BeNil()) - Expect(delivered).Should(BeTrue()) - }) + baseFee, err := client.EstimateBaseFee(ctx) + Expect(err).Should(BeNil()) -}) + gasTipCap, err := client.SuggestGasTipCap(ctx) + Expect(err).Should(BeNil()) -// Ginkgo describe node that acts as a container for the teleporter e2e tests. This test suite -// will run through the following steps in order: -// 1. -var _ = ginkgo.Describe("[Native Token Bridge one way send]", ginkgo.Ordered, func() { - // Send a transaction to Subnet A to issue a Warp Message from the Teleporter contract to Subnet B - ginkgo.It("Send Message from A to B", ginkgo.Label("NativeTokenBridge", "SendNativeTokenBridge"), func() { - ctx := context.Background() + nonce, err := client.NonceAt(ctx, fundedAddress, nil) + Expect(err).Should(BeNil()) - cmd := exec.CommandContext( - ctx, - "cast", - "send", - nativeTokenBridgeContractAddress.Hex(), - "bridgeTokens(address,address,uint256)", - fundedAddress.Hex(), - fundedAddress.Hex(), // TODO use different address - "0x00", - "--rpc-url", chainARPCURI, - "--private-key", hexutil.Encode(nativeTokenBridgeDeployerPK.D.Bytes())) + gasFeeCap := baseFee.Mul(baseFee, big.NewInt(2)) + gasFeeCap.Add(gasFeeCap, big.NewInt(2500000000)) + + destinationTx := predicateutils.NewPredicateTx( + chainID, + nonce, + &teleporterContractAddress, + gasLimit, + gasFeeCap, + gasTipCap, + big.NewInt(0), + callData, + types.AccessList{}, + warp.ContractAddress, + signedMessage.Bytes(), + ) + fmt.Println(destinationTx) - err := cmd.Run() - Expect(err).Should(BeNil()) + // Sign and send the transaction on the destination chain + signer := types.LatestSignerForChainID(chainID) + signedTx, err := types.SignTx(destinationTx, signer, fundedKey) + Expect(err).Should(BeNil()) - // Sleep to ensure the new block is published to the subscriber - time.Sleep(5 * time.Second) + log.Info("Sending transaction to destination chain") + err = client.SendTransaction(context.Background(), signedTx) + Expect(err).Should(BeNil()) - }) + return signedTx +} - // ginkgo.It("Relay message to destination", ginkgo.Label("Teleporter", "RelayMessage"), func() { - // ctx := context.Background() - - // // Get the latest block from Subnet A, and retrieve the warp message from the logs - // log.Info("Waiting for new block confirmation") - // newHeadA := <-newHeadsA - // blockHashA := newHeadA.Hash() - - // log.Info("Fetching relevant warp logs from the newly produced block") - // logs, err := chainARPCClient.FilterLogs(ctx, interfaces.FilterQuery{ - // BlockHash: &blockHashA, - // Addresses: []common.Address{warp.Module.Address}, - // }) - // Expect(err).Should(BeNil()) - // Expect(len(logs)).Should(Equal(1)) - - // // Check for relevant warp log from subscription and ensure that it matches - // // the log extracted from the last block. - // txLog := logs[0] - // log.Info("Parsing logData as unsigned warp message") - // unsignedMsg, err := avalancheWarp.ParseUnsignedMessage(txLog.Data) - // Expect(err).Should(BeNil()) - - // // Set local variables for the duration of the test - // unsignedWarpMessageID := unsignedMsg.ID() - // unsignedWarpMsg := unsignedMsg - // log.Info("Parsed unsignedWarpMsg", "unsignedWarpMessageID", unsignedWarpMessageID, "unsignedWarpMessage", unsignedWarpMsg) - - // // Loop over each client on chain A to ensure they all have time to accept the block. - // // Note: if we did not confirm this here, the next stage could be racy since it assumes every node - // // has accepted the block. - // for i, uri := range chainANodeURIs { - // chainAWSURI := httpToWebsocketURI(uri, blockchainIDA.String()) - // log.Info("Creating ethclient for blockchainA", "wsURI", chainAWSURI) - // client, err := ethclient.Dial(chainAWSURI) - // Expect(err).Should(BeNil()) - - // // Loop until each node has advanced to >= the height of the block that emitted the warp log - // for { - // block, err := client.BlockByNumber(ctx, nil) - // Expect(err).Should(BeNil()) - // if block.NumberU64() >= newHeadA.Number.Uint64() { - // log.Info("client accepted the block containing SendWarpMessage", "client", i, "height", block.NumberU64()) - // break - // } - // } - // } - - // // Get the aggregate signature for the Warp message - // log.Info("Fetching aggregate signature from the source chain validators") - // warpClient, err := warpBackend.NewWarpClient(chainANodeURIs[0], blockchainIDA.String()) - // Expect(err).Should(BeNil()) - // signedWarpMessageBytes, err := warpClient.GetAggregateSignature(ctx, unsignedWarpMessageID, params.WarpQuorumDenominator) - // Expect(err).Should(BeNil()) - - // // Construct the transaction to send the Warp message to the destination chain - // log.Info("Constructing transaction for the destination chain") - // signedMessage, err := avalancheWarp.ParseMessage(signedWarpMessageBytes) - // Expect(err).Should(BeNil()) - - // numSigners, err := signedMessage.Signature.NumSigners() - // Expect(err).Should(BeNil()) - - // gasLimit, err := teleporter.CalculateReceiveMessageGasLimit(numSigners, teleporterMessage.RequiredGasLimit) - // Expect(err).Should(BeNil()) - - // callData, err := teleporter.EVMTeleporterContractABI.Pack("receiveCrossChainMessage", fundedAddress) - // Expect(err).Should(BeNil()) - - // baseFee, err := chainBRPCClient.EstimateBaseFee(ctx) - // Expect(err).Should(BeNil()) - - // gasTipCap, err := chainBRPCClient.SuggestGasTipCap(ctx) - // Expect(err).Should(BeNil()) - - // nonce, err := chainBRPCClient.NonceAt(ctx, fundedAddress, nil) - // Expect(err).Should(BeNil()) - - // gasFeeCap := baseFee.Mul(baseFee, big.NewInt(2)) - // gasFeeCap.Add(gasFeeCap, big.NewInt(2500000000)) - // destinationTx := predicateutils.NewPredicateTx( - // chainBIDInt, - // nonce, - // &teleporterContractAddress, - // gasLimit, - // gasFeeCap, - // gasTipCap, - // big.NewInt(0), - // callData, - // types.AccessList{}, - // warp.ContractAddress, - // signedMessage.Bytes(), - // ) - - // // Sign and send the transaction on the destination chain - // signer := types.LatestSignerForChainID(chainBIDInt) - // signedTxB, err := types.SignTx(destinationTx, signer, fundedKey) - // Expect(err).Should(BeNil()) - - // log.Info("Subscribing to new heads on destination chain") - // subB, err := chainBWSClient.SubscribeNewHead(ctx, newHeadsB) - // Expect(err).Should(BeNil()) - // defer subB.Unsubscribe() - - // log.Info("Sending transaction to destination chain") - // err = chainBRPCClient.SendTransaction(context.Background(), signedTxB) - // Expect(err).Should(BeNil()) - - // // Sleep to ensure the new block is published to the subscriber - // time.Sleep(5 * time.Second) - // receipt, err := chainBRPCClient.TransactionReceipt(ctx, signedTxB.Hash()) - // Expect(err).Should(BeNil()) - // Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) - // }) - - // ginkgo.It("Receive message on Subnet B", ginkgo.Label("Teleporter", "ReceiveTeleporter"), func() { - // ctx := context.Background() - - // // Get the latest block from Subnet B - // log.Info("Waiting for new block confirmation") - // newHeadB := <-newHeadsB - // log.Info("Received new head", "height", newHeadB.Number.Uint64()) - // blockHashB := newHeadB.Hash() - // block, err := chainBRPCClient.BlockByHash(ctx, blockHashB) - // Expect(err).Should(BeNil()) - // log.Info( - // "Got block", - // "blockHash", blockHashB, - // "blockNumber", block.NumberU64(), - // "transactions", block.Transactions(), - // "numTransactions", len(block.Transactions()), - // "block", block, - // ) - // accessLists := block.Transactions()[0].AccessList() - // Expect(len(accessLists)).Should(Equal(1)) - // Expect(accessLists[0].Address).Should(Equal(warp.Module.Address)) - - // // Check the transaction storage key has warp message we're expecting - // storageKeyHashes := accessLists[0].StorageKeys - // packedPredicate := predicateutils.HashSliceToBytes(storageKeyHashes) - // predicateBytes, err := predicateutils.UnpackPredicate(packedPredicate) - // Expect(err).Should(BeNil()) - // receivedWarpMessage, err = avalancheWarp.ParseMessage(predicateBytes) - // Expect(err).Should(BeNil()) - - // // Check that the transaction has successful receipt status - // txHash := block.Transactions()[0].Hash() - // receipt, err := chainBRPCClient.TransactionReceipt(ctx, txHash) - // Expect(err).Should(BeNil()) - // Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) - - // log.Info("Finished sending warp message, closing down output channel") - - // }) - - // ginkgo.It("Validate Received Warp Message Values", ginkgo.Label("Teleporter", "VerifyWarp"), func() { - // Expect(receivedWarpMessage.SourceChainID).Should(Equal(blockchainIDA)) - // addressedPayload, err := warpPayload.ParseAddressedPayload(receivedWarpMessage.Payload) - // Expect(err).Should(BeNil()) - - // receivedDestinationID, err := ids.ToID(addressedPayload.DestinationChainID.Bytes()) - // Expect(err).Should(BeNil()) - // Expect(receivedDestinationID).Should(Equal(blockchainIDB)) - // Expect(addressedPayload.DestinationAddress).Should(Equal(teleporterContractAddress)) - // Expect(addressedPayload.Payload).Should(Equal(payload)) - - // // Check that the teleporter message is correct - // receivedTeleporterMessage, err := teleporter.UnpackTeleporterMessage(addressedPayload.Payload) - // Expect(err).Should(BeNil()) - // Expect(*receivedTeleporterMessage).Should(Equal(teleporterMessage)) - - // teleporterMessageID = receivedTeleporterMessage.MessageID - // }) - - // ginkgo.It("Check Teleporter Message Received", ginkgo.Label("Teleporter", "TeleporterMessageReceived"), func() { - // data, err := teleporter.PackMessageReceivedMessage(teleporter.MessageReceivedInput{ - // OriginChainID: blockchainIDA, - // MessageID: teleporterMessageID, - // }) - // Expect(err).Should(BeNil()) - // callMessage := interfaces.CallMsg{ - // To: &teleporterContractAddress, - // Data: data, - // } - // result, err := chainBRPCClient.CallContract(context.Background(), callMessage, nil) - // Expect(err).Should(BeNil()) - - // // check the contract call result - // delivered, err := teleporter.UnpackMessageReceivedResult(result) - // Expect(err).Should(BeNil()) - // Expect(delivered).Should(BeTrue()) - // }) -}) +type ReceiveCrossChainMessageEvent struct { + DestinationChainID ids.ID + MessageID *big.Int + Message teleporter.TeleporterMessage +} \ No newline at end of file From 96f6d900db1148f0a4ac1fcd202aa206b89f0ae7 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Thu, 28 Sep 2023 17:23:21 -0400 Subject: [PATCH 017/183] working tests --- go.sum | 2 +- go.work.sum | 2 +- tests/e2e_test.go | 71 +++++++++++++++++++++-------------------------- tests/utils.go | 4 +-- 4 files changed, 35 insertions(+), 44 deletions(-) diff --git a/go.sum b/go.sum index 7fab0139c..162127531 100644 --- a/go.sum +++ b/go.sum @@ -63,7 +63,7 @@ github.com/ava-labs/avalanche-network-runner v1.7.2 h1:XFad/wZfYzDnqbLzPAPPRYU3a github.com/ava-labs/avalanche-network-runner v1.7.2/go.mod h1:naLveusSrP7YgTAqRykD1SyLOAUilCp9jGjk3MDxoPI= github.com/ava-labs/avalanchego v1.10.10 h1:EYX4LVotcfdtIQ0nJSBTcoisubx/Bzk2tM1aP3yiYiw= github.com/ava-labs/avalanchego v1.10.10/go.mod h1:6UA0nxxTvvpyuCbP2DSzx9+7uWQfQx9DPApK8JptLiE= -github.com/ava-labs/awm-relayer v0.2.2 h1:TW/cJr13bVMHL5NjBF9aTTJQTyjpwbRMH6ffX78DFmo= +github.com/ava-labs/awm-relayer v0.2.2 h1:X7HAINnW6f71gCN96W9vVrSk2Ri+euOpI/zDJkLEeMY= github.com/ava-labs/awm-relayer v0.2.2/go.mod h1:UIc0Nl/ZIRVm5fBmUWDxWahNsQWZoSfJb3ei25q5ZlQ= github.com/ava-labs/coreth v0.12.5-rc.6 h1:OajGUyKkO5Q82XSuMa8T5UD6QywtCHUiZ4Tv3RFmRBU= github.com/ava-labs/coreth v0.12.5-rc.6/go.mod h1:s5wVyy+5UCCk2m0Tq3jVmy0UqOpKBDYqRE13gInCJVs= diff --git a/go.work.sum b/go.work.sum index 3524dfa90..e4e0f4dc0 100644 --- a/go.work.sum +++ b/go.work.sum @@ -749,7 +749,7 @@ github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgI github.com/ava-labs/avalanche-network-runner v1.7.2-0.20230825150237-723bc7b31724/go.mod h1:euKHwZ77sGvGfhVj4v9WPM4jD2b5N80ldE2XHqO7lwA= github.com/ava-labs/avalanche-network-runner-sdk v0.3.0/go.mod h1:SgKJvtqvgo/Bl/c8fxEHCLaSxEbzimYfBopcfrajxQk= github.com/ava-labs/avalanchego v1.10.10-rc.4/go.mod h1:BN97sZppDSvIMIfEjrLTjdPTFkGLkb0ISJHEcoxMMNk= -github.com/ava-labs/awm-relayer v0.2.2 h1:TW/cJr13bVMHL5NjBF9aTTJQTyjpwbRMH6ffX78DFmo= +github.com/ava-labs/awm-relayer v0.2.2 h1:X7HAINnW6f71gCN96W9vVrSk2Ri+euOpI/zDJkLEeMY= github.com/ava-labs/awm-relayer v0.2.2/go.mod h1:UIc0Nl/ZIRVm5fBmUWDxWahNsQWZoSfJb3ei25q5ZlQ= github.com/ava-labs/coreth v0.12.5-rc.3/go.mod h1:HI+jTIflnDFBd0bledgkgid1Uurwr8q1h7zb3LsFsSo= github.com/ava-labs/ledger-avalanche/go v0.0.0-20230105152938-00a24d05a8c7/go.mod h1:XhiXSrh90sHUbkERzaxEftCmUz53eCijshDLZ4fByVM= diff --git a/tests/e2e_test.go b/tests/e2e_test.go index c6fc425e5..baf8c785f 100644 --- a/tests/e2e_test.go +++ b/tests/e2e_test.go @@ -18,8 +18,7 @@ import ( avalancheWarp "github.com/ava-labs/avalanchego/vms/platformvm/warp" "github.com/ava-labs/awm-relayer/messages/teleporter" relayerEvm "github.com/ava-labs/awm-relayer/vms/evm" - "github.com/ava-labs/coreth/rpc" - "github.com/ava-labs/subnet-evm/accounts/abi/bind" + // "github.com/ava-labs/subnet-evm/accounts/abi/bind" "github.com/ava-labs/subnet-evm/core/types" "github.com/ava-labs/subnet-evm/ethclient" "github.com/ava-labs/subnet-evm/interfaces" @@ -32,8 +31,7 @@ import ( warpBackend "github.com/ava-labs/subnet-evm/warp" // warpPayload "github.com/ava-labs/subnet-evm/warp/payload" - deployment_utils "github.com/ava-labs/teleporter/contract-deployment/deployment-utils" - "github.com/ava-labs/teleporter/contracts/abi" + // "github.com/ava-labs/teleporter/contracts/abi" deploymentUtils "github.com/ava-labs/teleporter/contract-deployment/utils" "github.com/ava-labs/subnet-evm/x/warp" @@ -59,15 +57,6 @@ var ( fundedAddress = common.HexToAddress("0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC") warpChainConfigPath string teleporterContractAddress common.Address - teleporterMessage = teleporter.TeleporterMessage{ - MessageID: big.NewInt(1), - SenderAddress: fundedAddress, - DestinationAddress: fundedAddress, - RequiredGasLimit: big.NewInt(10_000_000), - AllowedRelayerAddresses: []common.Address{}, - Receipts: []teleporter.TeleporterMessageReceipt{}, - Message: []byte{}, - } nativeTokenBridgeContractAddress common.Address nativeTokenBridgeDeployer = common.HexToAddress("0x1337cfd2dCff6270615B90938aCB1efE79801704") tokenReceiverAddress = common.HexToAddress("0x0123456789012345678901234567890123456789") @@ -312,7 +301,8 @@ var _ = ginkgo.BeforeSuite(func() { { nativeTokenBridgeDeployerPK, err = crypto.HexToECDSA(bridgeDeployerKeyStr) Expect(err).Should(BeNil()) - nativeTokenBridgeContractAddress = deployment_utils.DeriveEVMContractAddress(nativeTokenBridgeDeployer, 0) + nativeTokenBridgeContractAddress, err = deploymentUtils.DeriveEVMContractAddress(nativeTokenBridgeDeployer, 0) + Expect(err).Should(BeNil()) fmt.Println("Native Token Bridge Contract Address: ", nativeTokenBridgeContractAddress.Hex()) cmd := exec.Command( @@ -323,18 +313,11 @@ var _ = ginkgo.BeforeSuite(func() { "--private-key", hexutil.Encode(nativeTokenBridgeDeployerPK.D.Bytes()), "--constructor-args", teleporterContractAddress.Hex(), hexutil.Encode(chainBIDInt.Bytes())) - fmt.Println(cmd.String()) cmd.Dir = "./contracts" err := cmd.Run() Expect(err).Should(BeNil()) - time.Sleep(5 * time.Second) - bridgeCode, err := chainARPCClient.CodeAt(ctx, nativeTokenBridgeContractAddress, nil) - Expect(err).Should(BeNil()) - Expect(len(bridgeCode)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode - } - { - cmd := exec.Command( + cmd = exec.Command( "forge", "create", "src/CrossChainApplications/NativeTokenBridge/NativeTokenMinter.sol:NativeTokenMinter", @@ -342,17 +325,18 @@ var _ = ginkgo.BeforeSuite(func() { "--private-key", hexutil.Encode(nativeTokenBridgeDeployerPK.D.Bytes()), "--constructor-args", teleporterContractAddress.Hex(), hexutil.Encode(chainAIDInt.Bytes())) - fmt.Println(cmd.String()) - - cmd.Dir = "./contracts" - err := cmd.Run() + err = cmd.Run() Expect(err).Should(BeNil()) time.Sleep(5 * time.Second) - bridgeCode, err := chainBRPCClient.CodeAt(ctx, nativeTokenBridgeContractAddress, nil) + bridgeCodeA, err := chainARPCClient.CodeAt(ctx, nativeTokenBridgeContractAddress, nil) Expect(err).Should(BeNil()) - Expect(len(bridgeCode)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode + Expect(len(bridgeCodeA)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode + + bridgeCodeB, err := chainBRPCClient.CodeAt(ctx, nativeTokenBridgeContractAddress, nil) + Expect(err).Should(BeNil()) + Expect(len(bridgeCodeB)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode } log.Info("Finished deploying Bridge contracts") @@ -377,8 +361,9 @@ var _ = ginkgo.Describe("[Teleporter one way send]", ginkgo.Ordered, func() { ) // Send a transaction to Subnet A to issue a Warp Message from the Teleporter contract to Subnet B - ginkgo.It("Send Message from A to B", ginkgo.Label("NativeTokenBridge", "SendNativeTokenBridge"), func() { + ginkgo.It("Send Message from A to B", ginkgo.Label("Teleporter", "SendTeleporter"), func() { ctx := context.Background() + nonceA, err := chainARPCClient.NonceAt(ctx, fundedAddress, nil) Expect(err).Should(BeNil()) @@ -403,30 +388,32 @@ var _ = ginkgo.Describe("[Teleporter one way send]", ginkgo.Ordered, func() { txSigner := types.LatestSignerForChainID(chainAIDInt) signedTx, err := types.SignTx(tx, txSigner, fundedKey) - - nativeTokenReceiver, err := abi.NewNativeTokenReceiver(nativeTokenBridgeContractAddress, chainARPCClient) Expect(err).Should(BeNil()) - transactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, chainAIDInt) - Expect(err).Should(BeNil()) - transactor.Value = big.NewInt(1000_000_000_000_000_000) + // nativeTokenReceiver, err := abi.NewNativeTokenReceiver(nativeTokenBridgeContractAddress, chainARPCClient) + // Expect(err).Should(BeNil()) + // transactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, chainAIDInt) + + + // transactor.Value = big.NewInt(1000_000_000_000_000_000) + // bridgetx, err := nativeTokenReceiver.BridgeTokens(transactor, tokenReceiverAddress, tokenReceiverAddress, big.NewInt(0)) subA, err := chainAWSClient.SubscribeNewHead(ctx, newHeadsA) Expect(err).Should(BeNil()) defer subA.Unsubscribe() - tx, err := nativeTokenReceiver.BridgeTokens(transactor, tokenReceiverAddress, tokenReceiverAddress, big.NewInt(0)) + log.Info("Sending Teleporter transaction on source chain", "destinationChainID", blockchainIDB, "txHash", signedTx.Hash()) + err = chainARPCClient.SendTransaction(ctx, signedTx) Expect(err).Should(BeNil()) // Sleep to ensure the new block is published to the subscriber time.Sleep(5 * time.Second) - - receipt, err := chainARPCClient.TransactionReceipt(ctx, tx.Hash()) + receipt, err := chainARPCClient.TransactionReceipt(ctx, signedTx.Hash()) Expect(err).Should(BeNil()) Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) }) - ginkgo.It("Relay message to destination", ginkgo.Label("NativeTokenBridge", "RelayMessage"), func() { + ginkgo.It("Relay message to destination", ginkgo.Label("Teleporter", "RelayMessage"), func() { ctx := context.Background() // Get the latest block from Subnet A, and retrieve the warp message from the logs @@ -469,7 +456,7 @@ var _ = ginkgo.Describe("[Teleporter one way send]", ginkgo.Ordered, func() { signedTxB := constructAndSendTransaction( ctx, signedWarpMessageBytes, - teleporterMessage, + big.NewInt(1), teleporterContractAddress, fundedAddress, fundedKey, @@ -504,6 +491,10 @@ var _ = ginkgo.Describe("[Teleporter one way send]", ginkgo.Ordered, func() { result, err := chainBRPCClient.CallContract(context.Background(), callMessage, nil) Expect(err).Should(BeNil()) + // check the contract call result + delivered, err := teleporter.UnpackMessageReceivedResult(result) + Expect(err).Should(BeNil()) Expect(delivered).Should(BeTrue()) }) -}) \ No newline at end of file + +}) diff --git a/tests/utils.go b/tests/utils.go index 68db0d7d3..20e3d9746 100644 --- a/tests/utils.go +++ b/tests/utils.go @@ -143,7 +143,7 @@ func waitForAllValidatorsToAcceptBlock(ctx context.Context, nodeURIs []string, b func constructAndSendTransaction( ctx context.Context, warpMessageBytes []byte, - teleporterMessage teleporter.TeleporterMessage, + requiredGasLimit *big.Int, teleporterContractAddress common.Address, fundedAddress common.Address, fundedKey *ecdsa.PrivateKey, @@ -158,7 +158,7 @@ func constructAndSendTransaction( numSigners, err := signedMessage.Signature.NumSigners() Expect(err).Should(BeNil()) - gasLimit, err := teleporter.CalculateReceiveMessageGasLimit(numSigners, teleporterMessage.RequiredGasLimit) + gasLimit, err := teleporter.CalculateReceiveMessageGasLimit(numSigners, requiredGasLimit) Expect(err).Should(BeNil()) callData, err := teleporter.PackReceiveCrossChainMessage(teleporter.ReceiveCrossChainMessageInput{ From 06027433cee1739e26d3ea4153a8ba0e7f9a4757 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Thu, 28 Sep 2023 17:39:00 -0400 Subject: [PATCH 018/183] fix --- contracts/src/Teleporter/TeleporterMessenger.sol | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/contracts/src/Teleporter/TeleporterMessenger.sol b/contracts/src/Teleporter/TeleporterMessenger.sol index f042dbd86..f9bf3c598 100644 --- a/contracts/src/Teleporter/TeleporterMessenger.sol +++ b/contracts/src/Teleporter/TeleporterMessenger.sol @@ -221,8 +221,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { if ( sentMessageInfo[destinationChainID][messageID] .feeInfo - .contractAddress != - feeContractAddress + .contractAddress != feeContractAddress ) { revert InvalidFeeAssetContractAddress(); } @@ -233,8 +232,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { additionalFeeAmount ); - // Calculate and store the update fee amount, and emit it as an event. - // currentMessageInfo.feeInfo.amount += adjustedAmount; + // Store the updated fee amount, and emit it as an event. sentMessageInfo[destinationChainID][messageID] .feeInfo .amount += adjustedAmount; From 1dd28580ea81e92b61848c2873a79a05574ef24c Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Fri, 29 Sep 2023 10:51:43 -0400 Subject: [PATCH 019/183] Refactor bytecode extraction --- contract-deployment/utils/deployment_utils.go | 36 +++++++++++-------- tests/e2e_test.go | 1 + 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/contract-deployment/utils/deployment_utils.go b/contract-deployment/utils/deployment_utils.go index a52048fc8..734a55df8 100644 --- a/contract-deployment/utils/deployment_utils.go +++ b/contract-deployment/utils/deployment_utils.go @@ -57,29 +57,20 @@ func DeriveEVMContractAddress(sender common.Address, nonce uint64) (common.Addre return common.HexToAddress(fmt.Sprintf("0x%x", hash.Bytes()[12:])), nil } -// Constructs a keyless transaction using Nick's method -// Optionally writes the transaction, deployer address, and contract address to file -// Returns the transaction bytes, deployer address, and contract address -func ConstructKeylessTransaction(byteCodeFileName string, writeFile bool) ([]byte, common.Address, common.Address, error) { - // Convert the R and S values (which must be the same) from hex. - rsValue, ok := new(big.Int).SetString(rsValueHex, 16) - if !ok { - return nil, common.Address{}, common.Address{}, errors.New("Failed to convert R and S value to big.Int.") - } - +func ExtractByteCode(byteCodeFileName string) ([]byte, error) { log.Println("Using bytecode file at", byteCodeFileName) byteCodeFileContents, err := os.ReadFile(byteCodeFileName) if err != nil { - return nil, common.Address{}, common.Address{}, errors.Wrap(err, "Failed to read bytecode file contents") + return nil, errors.Wrap(err, "Failed to read bytecode file contents") } var byteCodeJSON byteCodeFile err = json.Unmarshal(byteCodeFileContents, &byteCodeJSON) if err != nil { - return nil, common.Address{}, common.Address{}, errors.Wrap(err, "Failed to unmarshal bytecode file contents as JSON") + return nil, errors.Wrap(err, "Failed to unmarshal bytecode file contents as JSON") } byteCodeString := byteCodeJSON.ByteCode.Object if len(byteCodeString) < 2 { - return nil, common.Address{}, common.Address{}, errors.New("Invalid byte code length.") + return nil, errors.New("Invalid byte code length.") } // Strip off leading 0x if present if byteCodeString[:2] == "0x" || byteCodeString[:2] == "0X" { @@ -87,7 +78,24 @@ func ConstructKeylessTransaction(byteCodeFileName string, writeFile bool) ([]byt } byteCode, err := hex.DecodeString(byteCodeString) if err != nil { - return nil, common.Address{}, common.Address{}, errors.Wrap(err, "Failed to decode bytecode string as hexadecimal.") + return nil, errors.Wrap(err, "Failed to decode bytecode string as hexadecimal.") + } + return byteCode, nil +} + +// Constructs a keyless transaction using Nick's method +// Optionally writes the transaction, deployer address, and contract address to file +// Returns the transaction bytes, deployer address, and contract address +func ConstructKeylessTransaction(byteCodeFileName string, writeFile bool) ([]byte, common.Address, common.Address, error) { + // Convert the R and S values (which must be the same) from hex. + rsValue, ok := new(big.Int).SetString(rsValueHex, 16) + if !ok { + return nil, common.Address{}, common.Address{}, errors.New("Failed to convert R and S value to big.Int.") + } + + byteCode, err := ExtractByteCode(byteCodeFileName) + if err != nil { + return nil, common.Address{}, common.Address{}, err } // Construct the legacy transaction with pre-determined signature values. diff --git a/tests/e2e_test.go b/tests/e2e_test.go index baf8c785f..cd4247cdb 100644 --- a/tests/e2e_test.go +++ b/tests/e2e_test.go @@ -359,6 +359,7 @@ var _ = ginkgo.Describe("[Teleporter one way send]", ginkgo.Ordered, func() { var ( teleporterMessageID *big.Int ) + ginkgo.Skip("Remove me") // Send a transaction to Subnet A to issue a Warp Message from the Teleporter contract to Subnet B ginkgo.It("Send Message from A to B", ginkgo.Label("Teleporter", "SendTeleporter"), func() { From ff56992b9a5cad60c77626bd60e059ad584ad256 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Fri, 29 Sep 2023 11:16:52 -0400 Subject: [PATCH 020/183] Add one-way transfer --- tests/e2e_test.go | 135 ++++++++++++++++++++++++++++------------------ 1 file changed, 83 insertions(+), 52 deletions(-) diff --git a/tests/e2e_test.go b/tests/e2e_test.go index cd4247cdb..843f666be 100644 --- a/tests/e2e_test.go +++ b/tests/e2e_test.go @@ -18,7 +18,9 @@ import ( avalancheWarp "github.com/ava-labs/avalanchego/vms/platformvm/warp" "github.com/ava-labs/awm-relayer/messages/teleporter" relayerEvm "github.com/ava-labs/awm-relayer/vms/evm" + // "github.com/ava-labs/subnet-evm/accounts/abi/bind" + "github.com/ava-labs/subnet-evm/accounts/abi/bind" "github.com/ava-labs/subnet-evm/core/types" "github.com/ava-labs/subnet-evm/ethclient" "github.com/ava-labs/subnet-evm/interfaces" @@ -33,6 +35,7 @@ import ( // warpPayload "github.com/ava-labs/subnet-evm/warp/payload" // "github.com/ava-labs/teleporter/contracts/abi" deploymentUtils "github.com/ava-labs/teleporter/contract-deployment/utils" + "github.com/ava-labs/teleporter/contracts/abi" "github.com/ava-labs/subnet-evm/x/warp" "github.com/ethereum/go-ethereum/common" @@ -297,49 +300,6 @@ var _ = ginkgo.BeforeSuite(func() { } log.Info("Finished deploying Teleporter contracts") - // Deploy Native Token bridge on the two subnets - { - nativeTokenBridgeDeployerPK, err = crypto.HexToECDSA(bridgeDeployerKeyStr) - Expect(err).Should(BeNil()) - nativeTokenBridgeContractAddress, err = deploymentUtils.DeriveEVMContractAddress(nativeTokenBridgeDeployer, 0) - Expect(err).Should(BeNil()) - fmt.Println("Native Token Bridge Contract Address: ", nativeTokenBridgeContractAddress.Hex()) - - cmd := exec.Command( - "forge", - "create", - "src/CrossChainApplications/NativeTokenBridge/NativeTokenReceiver.sol:NativeTokenReceiver", - "--rpc-url", chainARPCURI, - "--private-key", hexutil.Encode(nativeTokenBridgeDeployerPK.D.Bytes()), - "--constructor-args", teleporterContractAddress.Hex(), hexutil.Encode(chainBIDInt.Bytes())) - - cmd.Dir = "./contracts" - err := cmd.Run() - Expect(err).Should(BeNil()) - - cmd = exec.Command( - "forge", - "create", - "src/CrossChainApplications/NativeTokenBridge/NativeTokenMinter.sol:NativeTokenMinter", - "--rpc-url", chainBRPCURI, - "--private-key", hexutil.Encode(nativeTokenBridgeDeployerPK.D.Bytes()), - "--constructor-args", teleporterContractAddress.Hex(), hexutil.Encode(chainAIDInt.Bytes())) - - cmd.Dir = "./contracts" - err = cmd.Run() - Expect(err).Should(BeNil()) - - time.Sleep(5 * time.Second) - bridgeCodeA, err := chainARPCClient.CodeAt(ctx, nativeTokenBridgeContractAddress, nil) - Expect(err).Should(BeNil()) - Expect(len(bridgeCodeA)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode - - bridgeCodeB, err := chainBRPCClient.CodeAt(ctx, nativeTokenBridgeContractAddress, nil) - Expect(err).Should(BeNil()) - Expect(len(bridgeCodeB)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode - } - log.Info("Finished deploying Bridge contracts") - log.Info("Set up ginkgo before suite") }) @@ -359,7 +319,9 @@ var _ = ginkgo.Describe("[Teleporter one way send]", ginkgo.Ordered, func() { var ( teleporterMessageID *big.Int ) - ginkgo.Skip("Remove me") + ginkgo.BeforeEach(func(){ + ginkgo.Skip("Remove me") + }) // Send a transaction to Subnet A to issue a Warp Message from the Teleporter contract to Subnet B ginkgo.It("Send Message from A to B", ginkgo.Label("Teleporter", "SendTeleporter"), func() { @@ -391,14 +353,6 @@ var _ = ginkgo.Describe("[Teleporter one way send]", ginkgo.Ordered, func() { signedTx, err := types.SignTx(tx, txSigner, fundedKey) Expect(err).Should(BeNil()) - // nativeTokenReceiver, err := abi.NewNativeTokenReceiver(nativeTokenBridgeContractAddress, chainARPCClient) - // Expect(err).Should(BeNil()) - // transactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, chainAIDInt) - - - // transactor.Value = big.NewInt(1000_000_000_000_000_000) - // bridgetx, err := nativeTokenReceiver.BridgeTokens(transactor, tokenReceiverAddress, tokenReceiverAddress, big.NewInt(0)) - subA, err := chainAWSClient.SubscribeNewHead(ctx, newHeadsA) Expect(err).Should(BeNil()) defer subA.Unsubscribe() @@ -499,3 +453,80 @@ var _ = ginkgo.Describe("[Teleporter one way send]", ginkgo.Ordered, func() { }) }) + +var _ = ginkgo.Describe("[NativeTransfer two-way send]", ginkgo.Ordered, func() { + + // Send a transaction to Subnet A to issue a Warp Message from the Teleporter contract to Subnet B + ginkgo.It("Deploy Contracts on chains A and B", ginkgo.Label("NativeTransfer", "DeployContracs"), func() { + ctx := context.Background() + + // Deploy Native Token bridge on the two subnets + nativeTokenBridgeDeployerPK, err := crypto.HexToECDSA(bridgeDeployerKeyStr) + Expect(err).Should(BeNil()) + nativeTokenBridgeContractAddress, err = deploymentUtils.DeriveEVMContractAddress(nativeTokenBridgeDeployer, 0) + Expect(err).Should(BeNil()) + fmt.Println("Native Token Bridge Contract Address: ", nativeTokenBridgeContractAddress.Hex()) + + cmd := exec.Command( + "forge", + "create", + "src/CrossChainApplications/NativeTokenBridge/NativeTokenReceiver.sol:NativeTokenReceiver", + "--rpc-url", chainARPCURI, + "--private-key", hexutil.Encode(nativeTokenBridgeDeployerPK.D.Bytes()), + "--constructor-args", teleporterContractAddress.Hex(), hexutil.Encode(chainBIDInt.Bytes())) + + cmd.Dir = "./contracts" + err = cmd.Run() + Expect(err).Should(BeNil()) + + cmd = exec.Command( + "forge", + "create", + "src/CrossChainApplications/NativeTokenBridge/NativeTokenMinter.sol:NativeTokenMinter", + "--rpc-url", chainBRPCURI, + "--private-key", hexutil.Encode(nativeTokenBridgeDeployerPK.D.Bytes()), + "--constructor-args", teleporterContractAddress.Hex(), hexutil.Encode(chainAIDInt.Bytes())) + + cmd.Dir = "./contracts" + err = cmd.Run() + Expect(err).Should(BeNil()) + + time.Sleep(5 * time.Second) + bridgeCodeA, err := chainARPCClient.CodeAt(ctx, nativeTokenBridgeContractAddress, nil) + Expect(err).Should(BeNil()) + Expect(len(bridgeCodeA)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode + + bridgeCodeB, err := chainBRPCClient.CodeAt(ctx, nativeTokenBridgeContractAddress, nil) + Expect(err).Should(BeNil()) + Expect(len(bridgeCodeB)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode + + log.Info("Finished deploying Bridge contracts") + }) + + ginkgo.It("Transfer tokens from A to B", ginkgo.Label("NativeTransfer", "Mint Tokens on Destination"), func() { + ctx := context.Background() + + nativeTokenReceiver, err := abi.NewNativeTokenReceiver(nativeTokenBridgeContractAddress, chainARPCClient) + Expect(err).Should(BeNil()) + transactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, chainAIDInt) + Expect(err).Should(BeNil()) + transactor.Value = big.NewInt(1000_000_000_000_000_000) + + subA, err := chainAWSClient.SubscribeNewHead(ctx, newHeadsA) + Expect(err).Should(BeNil()) + defer subA.Unsubscribe() + + tx, err := nativeTokenReceiver.BridgeTokens(transactor, tokenReceiverAddress, tokenReceiverAddress, big.NewInt(0)) + Expect(err).Should(BeNil()) + + log.Info("Sending NativeTokenTransfer transaction on source chain", "destinationChainID", blockchainIDB, "txHash", tx.Hash()) + err = chainARPCClient.SendTransaction(ctx, tx) + Expect(err).Should(BeNil()) + + // Sleep to ensure the new block is published to the subscriber + time.Sleep(5 * time.Second) + receipt, err := chainARPCClient.TransactionReceipt(ctx, tx.Hash()) + Expect(err).Should(BeNil()) + Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + }) +}) \ No newline at end of file From a64ec01552bcff2f15f3dd8b9f020121e773dc6f Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Fri, 29 Sep 2023 11:36:04 -0400 Subject: [PATCH 021/183] Working transfer --- tests/e2e_test.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/e2e_test.go b/tests/e2e_test.go index 843f666be..12fed249b 100644 --- a/tests/e2e_test.go +++ b/tests/e2e_test.go @@ -459,9 +459,10 @@ var _ = ginkgo.Describe("[NativeTransfer two-way send]", ginkgo.Ordered, func() // Send a transaction to Subnet A to issue a Warp Message from the Teleporter contract to Subnet B ginkgo.It("Deploy Contracts on chains A and B", ginkgo.Label("NativeTransfer", "DeployContracs"), func() { ctx := context.Background() + var err error // Deploy Native Token bridge on the two subnets - nativeTokenBridgeDeployerPK, err := crypto.HexToECDSA(bridgeDeployerKeyStr) + nativeTokenBridgeDeployerPK, err = crypto.HexToECDSA(bridgeDeployerKeyStr) Expect(err).Should(BeNil()) nativeTokenBridgeContractAddress, err = deploymentUtils.DeriveEVMContractAddress(nativeTokenBridgeDeployer, 0) Expect(err).Should(BeNil()) @@ -505,6 +506,7 @@ var _ = ginkgo.Describe("[NativeTransfer two-way send]", ginkgo.Ordered, func() ginkgo.It("Transfer tokens from A to B", ginkgo.Label("NativeTransfer", "Mint Tokens on Destination"), func() { ctx := context.Background() + var err error nativeTokenReceiver, err := abi.NewNativeTokenReceiver(nativeTokenBridgeContractAddress, chainARPCClient) Expect(err).Should(BeNil()) @@ -518,10 +520,7 @@ var _ = ginkgo.Describe("[NativeTransfer two-way send]", ginkgo.Ordered, func() tx, err := nativeTokenReceiver.BridgeTokens(transactor, tokenReceiverAddress, tokenReceiverAddress, big.NewInt(0)) Expect(err).Should(BeNil()) - - log.Info("Sending NativeTokenTransfer transaction on source chain", "destinationChainID", blockchainIDB, "txHash", tx.Hash()) - err = chainARPCClient.SendTransaction(ctx, tx) - Expect(err).Should(BeNil()) + log.Info("Sent NativeTokenTransfer transaction on source chain", "destinationChainID", blockchainIDB, "txHash", tx.Hash()) // Sleep to ensure the new block is published to the subscriber time.Sleep(5 * time.Second) From 1c365d6e786f3a167c278a0fa155131b58ca8b84 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Fri, 29 Sep 2023 12:00:34 -0400 Subject: [PATCH 022/183] test wip --- tests/e2e_test.go | 92 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 91 insertions(+), 1 deletion(-) diff --git a/tests/e2e_test.go b/tests/e2e_test.go index 12fed249b..557fce1d6 100644 --- a/tests/e2e_test.go +++ b/tests/e2e_test.go @@ -6,6 +6,7 @@ package tests import ( "context" "crypto/ecdsa" + "encoding/hex" "fmt" "math/big" "os" @@ -455,6 +456,9 @@ var _ = ginkgo.Describe("[Teleporter one way send]", ginkgo.Ordered, func() { }) var _ = ginkgo.Describe("[NativeTransfer two-way send]", ginkgo.Ordered, func() { + var ( + teleporterMessageID *big.Int + ) // Send a transaction to Subnet A to issue a Warp Message from the Teleporter contract to Subnet B ginkgo.It("Deploy Contracts on chains A and B", ginkgo.Label("NativeTransfer", "DeployContracs"), func() { @@ -504,7 +508,7 @@ var _ = ginkgo.Describe("[NativeTransfer two-way send]", ginkgo.Ordered, func() log.Info("Finished deploying Bridge contracts") }) - ginkgo.It("Transfer tokens from A to B", ginkgo.Label("NativeTransfer", "Mint Tokens on Destination"), func() { + ginkgo.It("Transfer tokens from A to B", ginkgo.Label("NativeTransfer", "Send Teleporter mint message"), func() { ctx := context.Background() var err error @@ -528,4 +532,90 @@ var _ = ginkgo.Describe("[NativeTransfer two-way send]", ginkgo.Ordered, func() Expect(err).Should(BeNil()) Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) }) + + // ginkgo.It("Relay message to destination", ginkgo.Label("NativeTransfer", "RelayMessage"), func() { + // ctx := context.Background() + + // // Get the latest block from Subnet A, and retrieve the warp message from the logs + // log.Info("Waiting for new block confirmation") + // newHeadA := <-newHeadsA + // blockHashA := newHeadA.Hash() + + // log.Info("Fetching relevant warp logs from the newly produced block") + // logs, err := chainARPCClient.FilterLogs(ctx, interfaces.FilterQuery{ + // BlockHash: &blockHashA, + // Addresses: []common.Address{warp.Module.Address}, + // }) + // Expect(err).Should(BeNil()) + // Expect(len(logs)).Should(Equal(1)) + + // // Check for relevant warp log from subscription and ensure that it matches + // // the log extracted from the last block. + // txLog := logs[0] + // log.Info("Parsing logData as unsigned warp message") + // unsignedMsg, err := avalancheWarp.ParseUnsignedMessage(txLog.Data) + // Expect(err).Should(BeNil()) + + // // Set local variables for the duration of the test + // unsignedWarpMessageID := unsignedMsg.ID() + // unsignedWarpMsg := unsignedMsg + // log.Info("Parsed unsignedWarpMsg", "unsignedWarpMessageID", unsignedWarpMessageID, "unsignedWarpMessage", unsignedWarpMsg) + + // // Loop over each client on chain A to ensure they all have time to accept the block. + // // Note: if we did not confirm this here, the next stage could be racy since it assumes every node + // // has accepted the block. + // waitForAllValidatorsToAcceptBlock(ctx, chainANodeURIs, blockchainIDA, newHeadA.Number.Uint64()) + + // // Get the aggregate signature for the Warp message + // log.Info("Fetching aggregate signature from the source chain validators") + // warpClient, err := warpBackend.NewClient(chainANodeURIs[0], blockchainIDA.String()) + // Expect(err).Should(BeNil()) + // signedWarpMessageBytes, err := warpClient.GetAggregateSignature(ctx, unsignedWarpMessageID, params.WarpQuorumDenominator) + // Expect(err).Should(BeNil()) + + // signedTxB := constructAndSendTransaction( + // ctx, + // signedWarpMessageBytes, + // big.NewInt(1), + // teleporterContractAddress, + // fundedAddress, + // fundedKey, + // chainBRPCClient, + // chainBIDInt, + // ) + + // // Sleep to ensure the new block is published to the subscriber + // time.Sleep(5 * time.Second) + // receipt, err := chainBRPCClient.TransactionReceipt(ctx, signedTxB.Hash()) + // Expect(err).Should(BeNil()) + + + + // cmd := exec.Command( + // "cast", + // "run", + // "--rpc-url", chainBRPCURI, + // "--verbose", + // signedTxB.Hash().Hex()) + + // fmt.Println(cmd.String()) + + // time.Sleep(5000 * time.Second) + + // fmt.Printf("IT'S A ME, LOGIO\n %+v\n", receipt) + + // output, err := cmd.Output() + // fmt.Printf("OUTPUT %v\n", hex.EncodeToString(output)) + // Expect(err).Should(BeNil()) + + // Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + + // sendCrossChainMessageLog := receipt.Logs[0] + // var event SendCrossChainMessageEvent + // err = teleporter.EVMTeleporterContractABI.UnpackIntoInterface(&event, "SendCrossChainMessage", sendCrossChainMessageLog.Data) + // Expect(err).Should(BeNil()) + // teleporterMessageID = event.Message.MessageID + // teleporterMessageID.Uint64() // TODO remove + // }) + }) \ No newline at end of file From 000e4a504afc7347ffe3764a8be8f34aec230b65 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Fri, 29 Sep 2023 12:03:59 -0400 Subject: [PATCH 023/183] Rename contracts --- ...Minter.sol => INativeTokenDestination.sol} | 2 +- ...kenReceiver.sol => INativeTokenSource.sol} | 2 +- .../NativeTokenBridge/NativeTokenMinter.sol | 148 ------------------ ...okenReceiver.sol => NativeTokenSource.sol} | 4 +- 4 files changed, 4 insertions(+), 152 deletions(-) rename contracts/src/CrossChainApplications/NativeTokenBridge/{INativeTokenMinter.sol => INativeTokenDestination.sol} (96%) rename contracts/src/CrossChainApplications/NativeTokenBridge/{INativeTokenReceiver.sol => INativeTokenSource.sol} (96%) delete mode 100644 contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenMinter.sol rename contracts/src/CrossChainApplications/NativeTokenBridge/{NativeTokenReceiver.sol => NativeTokenSource.sol} (97%) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenMinter.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol similarity index 96% rename from contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenMinter.sol rename to contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol index c58b365db..de1fd21b9 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenMinter.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol @@ -8,7 +8,7 @@ pragma solidity 0.8.18; /** * @dev Interface that describes functionalities for a cross-chain ERC20 bridge. */ -interface INativeTokenMinter { +interface INativeTokenDestination { /** * @dev Emitted when tokens are locked in this bridge contract to be bridged to another chain. diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenReceiver.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol similarity index 96% rename from contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenReceiver.sol rename to contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol index fdc28e740..3753d171f 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenReceiver.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol @@ -8,7 +8,7 @@ pragma solidity 0.8.18; /** * @dev Interface that describes functionalities for a cross-chain ERC20 bridge. */ -interface INativeTokenReceiver { +interface INativeTokenSource { /** * @dev Emitted when tokens are locked in this bridge contract to be bridged to another chain. diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenMinter.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenMinter.sol deleted file mode 100644 index 74e8da121..000000000 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenMinter.sol +++ /dev/null @@ -1,148 +0,0 @@ -//SPDX-License-Identifier: MIT -pragma solidity 0.8.18; - -import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; -import "@subnet-evm-contracts/interfaces/IWarpMessenger.sol"; -import "@subnet-evm-contracts/interfaces/IAllowList.sol"; -import "@subnet-evm-contracts/interfaces/INativeMinter.sol"; -import "./INativeTokenMinter.sol"; -import "../../Teleporter/ITeleporterMessenger.sol"; -import "../../Teleporter/ITeleporterReceiver.sol"; -import "../../Teleporter/SafeERC20TransferFrom.sol"; - -// Precompiled Native Minter Contract Address -address constant MINTER_ADDRESS = 0x0200000000000000000000000000000000000001; -// Designated Blackhole Address -address constant BLACKHOLE_ADDRESS = 0x0100000000000000000000000000000000000000; - -contract NativeTokenMinter is ITeleporterReceiver, INativeTokenMinter, ReentrancyGuard { - INativeMinter private immutable _nativeMinter = INativeMinter(MINTER_ADDRESS); - - address public constant WARP_PRECOMPILE_ADDRESS = - 0x0200000000000000000000000000000000000005; - - uint256 public constant TRANSFER_NATIVE_TOKENS_REQUIRED_GAS = 300_000; // TODO this is a placeholder - bytes32 public immutable currentChainID; - bytes32 public immutable partnerChainID; - - // Used for sending an receiving Teleporter messages. - ITeleporterMessenger public immutable teleporterMessenger; - - error InvalidTeleporterMessengerAddress(); - error InvalidRecipientAddress(); - error InvalidSourceChain(); - error InvalidPartnerContractAddress(); - error CannotBridgeTokenWithinSameChain(); - error Unauthorized(); - error InsufficientPayment(); - error InsufficientAdjustedAmount(uint256 adjustedAmount, uint256 feeAmount); - - // TODO we probably want to add the original token supply from this chain to the constructor. - constructor(address teleporterMessengerAddress, bytes32 partnerChainID_) { - if (teleporterMessengerAddress == address(0)) { - revert InvalidTeleporterMessengerAddress(); - } - teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); - currentChainID = WarpMessenger(WARP_PRECOMPILE_ADDRESS) - .getBlockchainID(); - - if (partnerChainID_ == currentChainID) { - revert CannotBridgeTokenWithinSameChain(); - } - partnerChainID = partnerChainID_; - } - - /** - * @dev See {ITeleporterReceiver-receiveTeleporterMessage}. - * - * Receives a Teleporter message and routes to the appropriate internal function call. - */ - function receiveTeleporterMessage( - bytes32 nativeChainID, - address nativeBridgeAddress, - bytes calldata message - ) external nonReentrant() { - - // Only allow the Teleporter messenger to deliver messages. - if (msg.sender != address(teleporterMessenger)) { - revert Unauthorized(); - } - // Only allow messages from the partner chain. - if (nativeChainID != partnerChainID) { - revert InvalidSourceChain(); - } - // Only allow the partner contract to send messages. - if (nativeBridgeAddress != address(this)) { - revert InvalidPartnerContractAddress(); - } - - (address recipient, uint256 amount) = abi.decode(message, (address, uint256)); - - // Calls NativeMinter precompile through INativeMinter interface. - _nativeMinter.mintNativeCoin(recipient, amount); - emit MintNativeTokens(recipient, amount); - } - - /** - * @dev See {INativeTokenMinter-bridgeTokens}. - * - * Requirements: - * - * - `msg.value` must be greater than the fee amount. - */ - function bridgeTokens( - address recipient, - address feeTokenContractAddress, - uint256 feeAmount - ) external payable nonReentrant { - // The recipient cannot be the zero address. - if (recipient == address(0)) { - revert InvalidRecipientAddress(); - } - - // Lock tokens in this bridge instance. Supports "fee/burn on transfer" ERC20 token - // implementations by only bridging the actual balance increase reflected by the call - // to transferFrom. - if (feeAmount > 0) { - uint256 adjustedAmount = SafeERC20TransferFrom.safeTransferFrom( - IERC20(feeTokenContractAddress), - feeAmount - ); - - // Ensure that the adjusted amount is greater than the fee to be paid. - if (adjustedAmount <= feeAmount) { - revert InsufficientAdjustedAmount(adjustedAmount, feeAmount); - } - } - - // Burn native token by sending to BLACKHOLE_ADDRESS - payable(BLACKHOLE_ADDRESS).transfer(msg.value); - - // Send Teleporter message. - bytes memory messageData = abi.encode(recipient, msg.value); - - uint256 messageID = teleporterMessenger.sendCrossChainMessage( - TeleporterMessageInput({ - destinationChainID: partnerChainID, - destinationAddress: address(this), - feeInfo: TeleporterFeeInfo({ - contractAddress: feeTokenContractAddress, - amount: feeAmount - }), - requiredGasLimit: TRANSFER_NATIVE_TOKENS_REQUIRED_GAS, - allowedRelayerAddresses: new address[](0), - message: messageData - }) - ); - - emit BridgeTokens({ - tokenContractAddress: feeTokenContractAddress, - teleporterMessageID: messageID, - destinationChainID: partnerChainID, - destinationBridgeAddress: address(this), - recipient: recipient, - transferAmount: msg.value, - feeAmount: feeAmount - }); - } -} diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenReceiver.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol similarity index 97% rename from contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenReceiver.sol rename to contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index 94451ed34..b7f6c66d4 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenReceiver.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -3,12 +3,12 @@ pragma solidity 0.8.18; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@subnet-evm-contracts/interfaces/IWarpMessenger.sol"; -import "./INativeTokenReceiver.sol"; +import "./INativeTokenSource.sol"; import "../../Teleporter/ITeleporterMessenger.sol"; import "../../Teleporter/ITeleporterReceiver.sol"; import "../../Teleporter/SafeERC20TransferFrom.sol"; -contract NativeTokenReceiver is ITeleporterReceiver, INativeTokenReceiver, ReentrancyGuard { +contract NativeTokenSource is ITeleporterReceiver, INativeTokenSource, ReentrancyGuard { address public constant WARP_PRECOMPILE_ADDRESS = 0x0200000000000000000000000000000000000005; From 4b69e186dbccc650a674fc4b524e1b8b93a1e038 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Fri, 29 Sep 2023 12:08:43 -0400 Subject: [PATCH 024/183] Rename contracts --- .../INativeTokenDestination.sol | 4 +- .../NativeTokenBridge/INativeTokenSource.sol | 4 +- .../NativeTokenDestination.sol | 148 ++++++++++++++++++ .../NativeTokenBridge/NativeTokenSource.sol | 4 +- 4 files changed, 154 insertions(+), 6 deletions(-) create mode 100644 contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol index de1fd21b9..212ba40cf 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol @@ -13,7 +13,7 @@ interface INativeTokenDestination { /** * @dev Emitted when tokens are locked in this bridge contract to be bridged to another chain. */ - event BridgeTokens( + event TransferToSource( address indexed tokenContractAddress, uint256 indexed teleporterMessageID, bytes32 destinationChainID, @@ -36,7 +36,7 @@ interface INativeTokenDestination { * * This can be wrapping, unwrapping, and transferring a wrapped token between two non-native chains. */ - function bridgeTokens( + function transferToSource( address recipient, address feeTokenContractAddress, uint256 feeAmount diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol index 3753d171f..5638ae383 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol @@ -13,7 +13,7 @@ interface INativeTokenSource { /** * @dev Emitted when tokens are locked in this bridge contract to be bridged to another chain. */ - event BridgeTokens( + event TransferToDestination( address indexed tokenContractAddress, uint256 indexed teleporterMessageID, bytes32 destinationChainID, @@ -34,7 +34,7 @@ interface INativeTokenSource { /** * @dev Transfers native tokens to another chain as that chain's native token. */ - function bridgeTokens( + function transferToDestination( address recipient, address feeTokenContractAddress, uint256 feeAmount diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol new file mode 100644 index 000000000..1ad452eaf --- /dev/null +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -0,0 +1,148 @@ +//SPDX-License-Identifier: MIT +pragma solidity 0.8.18; + +import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; +import "@subnet-evm-contracts/interfaces/IWarpMessenger.sol"; +import "@subnet-evm-contracts/interfaces/IAllowList.sol"; +import "@subnet-evm-contracts/interfaces/INativeMinter.sol"; +import "./INativeTokenDestination.sol"; +import "../../Teleporter/ITeleporterMessenger.sol"; +import "../../Teleporter/ITeleporterReceiver.sol"; +import "../../Teleporter/SafeERC20TransferFrom.sol"; + +// Precompiled Native Minter Contract Address +address constant MINTER_ADDRESS = 0x0200000000000000000000000000000000000001; +// Designated Blackhole Address +address constant BLACKHOLE_ADDRESS = 0x0100000000000000000000000000000000000000; + +contract NativeTokenDestination is ITeleporterReceiver, INativeTokenDestination, ReentrancyGuard { + INativeMinter private immutable _nativeMinter = INativeMinter(MINTER_ADDRESS); + + address public constant WARP_PRECOMPILE_ADDRESS = + 0x0200000000000000000000000000000000000005; + + uint256 public constant TRANSFER_NATIVE_TOKENS_REQUIRED_GAS = 300_000; // TODO this is a placeholder + bytes32 public immutable currentChainID; + bytes32 public immutable partnerChainID; + + // Used for sending an receiving Teleporter messages. + ITeleporterMessenger public immutable teleporterMessenger; + + error InvalidTeleporterMessengerAddress(); + error InvalidRecipientAddress(); + error InvalidSourceChain(); + error InvalidPartnerContractAddress(); + error CannotBridgeTokenWithinSameChain(); + error Unauthorized(); + error InsufficientPayment(); + error InsufficientAdjustedAmount(uint256 adjustedAmount, uint256 feeAmount); + + // TODO we probably want to add the original token supply from this chain to the constructor. + constructor(address teleporterMessengerAddress, bytes32 partnerChainID_) { + if (teleporterMessengerAddress == address(0)) { + revert InvalidTeleporterMessengerAddress(); + } + teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); + currentChainID = WarpMessenger(WARP_PRECOMPILE_ADDRESS) + .getBlockchainID(); + + if (partnerChainID_ == currentChainID) { + revert CannotBridgeTokenWithinSameChain(); + } + partnerChainID = partnerChainID_; + } + + /** + * @dev See {ITeleporterReceiver-receiveTeleporterMessage}. + * + * Receives a Teleporter message and routes to the appropriate internal function call. + */ + function receiveTeleporterMessage( + bytes32 nativeChainID, + address nativeBridgeAddress, + bytes calldata message + ) external nonReentrant() { + + // Only allow the Teleporter messenger to deliver messages. + if (msg.sender != address(teleporterMessenger)) { + revert Unauthorized(); + } + // Only allow messages from the partner chain. + if (nativeChainID != partnerChainID) { + revert InvalidSourceChain(); + } + // Only allow the partner contract to send messages. + if (nativeBridgeAddress != address(this)) { + revert InvalidPartnerContractAddress(); + } + + (address recipient, uint256 amount) = abi.decode(message, (address, uint256)); + + // Calls NativeMinter precompile through INativeMinter interface. + _nativeMinter.mintNativeCoin(recipient, amount); + emit MintNativeTokens(recipient, amount); + } + + /** + * @dev See {INativeTokenMinter-bridgeTokens}. + * + * Requirements: + * + * - `msg.value` must be greater than the fee amount. + */ + function transferToSource( + address recipient, + address feeTokenContractAddress, + uint256 feeAmount + ) external payable nonReentrant { + // The recipient cannot be the zero address. + if (recipient == address(0)) { + revert InvalidRecipientAddress(); + } + + // Lock tokens in this bridge instance. Supports "fee/burn on transfer" ERC20 token + // implementations by only bridging the actual balance increase reflected by the call + // to transferFrom. + if (feeAmount > 0) { + uint256 adjustedAmount = SafeERC20TransferFrom.safeTransferFrom( + IERC20(feeTokenContractAddress), + feeAmount + ); + + // Ensure that the adjusted amount is greater than the fee to be paid. + if (adjustedAmount <= feeAmount) { + revert InsufficientAdjustedAmount(adjustedAmount, feeAmount); + } + } + + // Burn native token by sending to BLACKHOLE_ADDRESS + payable(BLACKHOLE_ADDRESS).transfer(msg.value); + + // Send Teleporter message. + bytes memory messageData = abi.encode(recipient, msg.value); + + uint256 messageID = teleporterMessenger.sendCrossChainMessage( + TeleporterMessageInput({ + destinationChainID: partnerChainID, + destinationAddress: address(this), + feeInfo: TeleporterFeeInfo({ + contractAddress: feeTokenContractAddress, + amount: feeAmount + }), + requiredGasLimit: TRANSFER_NATIVE_TOKENS_REQUIRED_GAS, + allowedRelayerAddresses: new address[](0), + message: messageData + }) + ); + + emit TransferToSource({ + tokenContractAddress: feeTokenContractAddress, + teleporterMessageID: messageID, + destinationChainID: partnerChainID, + destinationBridgeAddress: address(this), + recipient: recipient, + transferAmount: msg.value, + feeAmount: feeAmount + }); + } +} diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index b7f6c66d4..b29c9eb65 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -87,7 +87,7 @@ contract NativeTokenSource is ITeleporterReceiver, INativeTokenSource, Reentranc * * - `msg.value` must be greater than the fee amount. */ - function bridgeTokens( + function transferToDestination( address recipient, address feeTokenContractAddress, uint256 feeAmount @@ -131,7 +131,7 @@ contract NativeTokenSource is ITeleporterReceiver, INativeTokenSource, Reentranc }) ); - emit BridgeTokens({ + emit TransferToDestination({ tokenContractAddress: feeTokenContractAddress, teleporterMessageID: messageID, destinationChainID: partnerChainID, From db52a48e48cd52845c26e6a60d2dedc987155b0d Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Fri, 29 Sep 2023 12:17:14 -0400 Subject: [PATCH 025/183] Add partner contract address to constuctor --- .../NativeTokenDestination.sol | 32 ++++++++++------- .../NativeTokenBridge/NativeTokenSource.sol | 34 ++++++++++++------- 2 files changed, 41 insertions(+), 25 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index 1ad452eaf..379f73071 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -21,9 +21,10 @@ contract NativeTokenDestination is ITeleporterReceiver, INativeTokenDestination, address public constant WARP_PRECOMPILE_ADDRESS = 0x0200000000000000000000000000000000000005; - uint256 public constant TRANSFER_NATIVE_TOKENS_REQUIRED_GAS = 300_000; // TODO this is a placeholder + uint256 public constant TRANSFER_NATIVE_TOKENS_REQUIRED_GAS = 3000_000; // TODO this is a placeholder bytes32 public immutable currentChainID; - bytes32 public immutable partnerChainID; + bytes32 public immutable sourceChainID; + address public immutable sourceContractAddress; // Used for sending an receiving Teleporter messages. ITeleporterMessenger public immutable teleporterMessenger; @@ -35,21 +36,28 @@ contract NativeTokenDestination is ITeleporterReceiver, INativeTokenDestination, error CannotBridgeTokenWithinSameChain(); error Unauthorized(); error InsufficientPayment(); + error InvalidSourceContractAddress(); error InsufficientAdjustedAmount(uint256 adjustedAmount, uint256 feeAmount); // TODO we probably want to add the original token supply from this chain to the constructor. - constructor(address teleporterMessengerAddress, bytes32 partnerChainID_) { + constructor(address teleporterMessengerAddress, address sourceContractAddress_, bytes32 sourceChainID_) { + currentChainID = WarpMessenger(WARP_PRECOMPILE_ADDRESS) + .getBlockchainID(); + if (teleporterMessengerAddress == address(0)) { revert InvalidTeleporterMessengerAddress(); } teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); - currentChainID = WarpMessenger(WARP_PRECOMPILE_ADDRESS) - .getBlockchainID(); - if (partnerChainID_ == currentChainID) { + if (sourceContractAddress_ == address(0)) { + revert InvalidSourceContractAddress(); + } + sourceContractAddress = sourceContractAddress_; + + if (sourceChainID_ == currentChainID) { revert CannotBridgeTokenWithinSameChain(); } - partnerChainID = partnerChainID_; + sourceChainID = sourceChainID_; } /** @@ -68,7 +76,7 @@ contract NativeTokenDestination is ITeleporterReceiver, INativeTokenDestination, revert Unauthorized(); } // Only allow messages from the partner chain. - if (nativeChainID != partnerChainID) { + if (nativeChainID != sourceChainID) { revert InvalidSourceChain(); } // Only allow the partner contract to send messages. @@ -123,8 +131,8 @@ contract NativeTokenDestination is ITeleporterReceiver, INativeTokenDestination, uint256 messageID = teleporterMessenger.sendCrossChainMessage( TeleporterMessageInput({ - destinationChainID: partnerChainID, - destinationAddress: address(this), + destinationChainID: sourceChainID, + destinationAddress: sourceContractAddress, feeInfo: TeleporterFeeInfo({ contractAddress: feeTokenContractAddress, amount: feeAmount @@ -138,8 +146,8 @@ contract NativeTokenDestination is ITeleporterReceiver, INativeTokenDestination, emit TransferToSource({ tokenContractAddress: feeTokenContractAddress, teleporterMessageID: messageID, - destinationChainID: partnerChainID, - destinationBridgeAddress: address(this), + destinationChainID: sourceChainID, + destinationBridgeAddress: sourceContractAddress, recipient: recipient, transferAmount: msg.value, feeAmount: feeAmount diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index b29c9eb65..07eb8bd66 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -12,9 +12,10 @@ contract NativeTokenSource is ITeleporterReceiver, INativeTokenSource, Reentranc address public constant WARP_PRECOMPILE_ADDRESS = 0x0200000000000000000000000000000000000005; - uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 200_000; // TODO this is a placeholder + uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 2000_000; // TODO this is a placeholder bytes32 public immutable currentChainID; - bytes32 public immutable partnerChainID; + bytes32 public immutable destinationChainID; + address public immutable destinationContractAddress; // Used for sending an receiving Teleporter messages. ITeleporterMessenger public immutable teleporterMessenger; @@ -27,20 +28,27 @@ contract NativeTokenSource is ITeleporterReceiver, INativeTokenSource, Reentranc error CannotBridgeTokenWithinSameChain(); error Unauthorized(); error InsufficientPayment(); + error InvalidDestinationContractAddress(); error InsufficientAdjustedAmount(uint256 adjustedAmount, uint256 feeAmount); - constructor(address teleporterMessengerAddress, bytes32 partnerChainID_) { + constructor(address teleporterMessengerAddress, address destinationContractAddress_, bytes32 destinationChainID_) { + currentChainID = WarpMessenger(WARP_PRECOMPILE_ADDRESS) + .getBlockchainID(); + if (teleporterMessengerAddress == address(0)) { revert InvalidTeleporterMessengerAddress(); } teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); - currentChainID = WarpMessenger(WARP_PRECOMPILE_ADDRESS) - .getBlockchainID(); - if (partnerChainID_ == currentChainID) { + if (destinationContractAddress_ == address(0)) { + revert InvalidDestinationContractAddress(); + } + destinationContractAddress = destinationContractAddress_; + + if (destinationChainID_ == currentChainID) { revert CannotBridgeTokenWithinSameChain(); } - partnerChainID = partnerChainID_; + destinationChainID = destinationChainID_; } /** @@ -59,11 +67,11 @@ contract NativeTokenSource is ITeleporterReceiver, INativeTokenSource, Reentranc revert Unauthorized(); } // Only allow messages from the partner chain. - if (nativeChainID != partnerChainID) { + if (nativeChainID != destinationChainID) { revert InvalidSourceChain(); } // Only allow the partner contract to send messages. - if (nativeBridgeAddress != address(this)) { + if (nativeBridgeAddress != destinationContractAddress) { revert InvalidPartnerContractAddress(); } @@ -119,8 +127,8 @@ contract NativeTokenSource is ITeleporterReceiver, INativeTokenSource, Reentranc uint256 messageID = teleporterMessenger.sendCrossChainMessage( TeleporterMessageInput({ - destinationChainID: partnerChainID, - destinationAddress: address(this), + destinationChainID: destinationChainID, + destinationAddress: destinationContractAddress, feeInfo: TeleporterFeeInfo({ contractAddress: feeTokenContractAddress, amount: feeAmount @@ -134,8 +142,8 @@ contract NativeTokenSource is ITeleporterReceiver, INativeTokenSource, Reentranc emit TransferToDestination({ tokenContractAddress: feeTokenContractAddress, teleporterMessageID: messageID, - destinationChainID: partnerChainID, - destinationBridgeAddress: address(this), + destinationChainID: destinationChainID, + destinationBridgeAddress: destinationContractAddress, recipient: recipient, transferAmount: msg.value, feeAmount: feeAmount From 9bbf156502fbb3ee824494094cdd9ce8c514fc68 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Fri, 29 Sep 2023 12:22:16 -0400 Subject: [PATCH 026/183] Regenerate abi files --- contracts/abi/NativeTokenDestination.go | 702 ++++++++++++++++++++++++ contracts/abi/NativeTokenMinter.go | 671 ---------------------- contracts/abi/NativeTokenReceiver.go | 671 ---------------------- contracts/abi/NativeTokenSource.go | 702 ++++++++++++++++++++++++ 4 files changed, 1404 insertions(+), 1342 deletions(-) create mode 100644 contracts/abi/NativeTokenDestination.go delete mode 100644 contracts/abi/NativeTokenMinter.go delete mode 100644 contracts/abi/NativeTokenReceiver.go create mode 100644 contracts/abi/NativeTokenSource.go diff --git a/contracts/abi/NativeTokenDestination.go b/contracts/abi/NativeTokenDestination.go new file mode 100644 index 000000000..8deab1ac8 --- /dev/null +++ b/contracts/abi/NativeTokenDestination.go @@ -0,0 +1,702 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package abi + +import ( + "errors" + "math/big" + "strings" + + "github.com/ava-labs/subnet-evm/accounts/abi" + "github.com/ava-labs/subnet-evm/accounts/abi/bind" + "github.com/ava-labs/subnet-evm/core/types" + "github.com/ava-labs/subnet-evm/interfaces" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = interfaces.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// NativeTokenDestinationMetaData contains all meta data concerning the NativeTokenDestination contract. +var NativeTokenDestinationMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"sourceContractAddress_\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceChainID_\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CannotBridgeTokenWithinSameChain\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"adjustedAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"InsufficientAdjustedAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientPayment\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidPartnerContractAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidRecipientAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSourceChain\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSourceContractAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTeleporterMessengerAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Unauthorized\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"MintNativeTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"tokenContractAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destinationBridgeAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"transferAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WARP_PRECOMPILE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentChainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"nativeChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeBridgeAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceChainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeTokenContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", +} + +// NativeTokenDestinationABI is the input ABI used to generate the binding from. +// Deprecated: Use NativeTokenDestinationMetaData.ABI instead. +var NativeTokenDestinationABI = NativeTokenDestinationMetaData.ABI + +// NativeTokenDestination is an auto generated Go binding around an Ethereum contract. +type NativeTokenDestination struct { + NativeTokenDestinationCaller // Read-only binding to the contract + NativeTokenDestinationTransactor // Write-only binding to the contract + NativeTokenDestinationFilterer // Log filterer for contract events +} + +// NativeTokenDestinationCaller is an auto generated read-only Go binding around an Ethereum contract. +type NativeTokenDestinationCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// NativeTokenDestinationTransactor is an auto generated write-only Go binding around an Ethereum contract. +type NativeTokenDestinationTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// NativeTokenDestinationFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type NativeTokenDestinationFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// NativeTokenDestinationSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type NativeTokenDestinationSession struct { + Contract *NativeTokenDestination // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// NativeTokenDestinationCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type NativeTokenDestinationCallerSession struct { + Contract *NativeTokenDestinationCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// NativeTokenDestinationTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type NativeTokenDestinationTransactorSession struct { + Contract *NativeTokenDestinationTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// NativeTokenDestinationRaw is an auto generated low-level Go binding around an Ethereum contract. +type NativeTokenDestinationRaw struct { + Contract *NativeTokenDestination // Generic contract binding to access the raw methods on +} + +// NativeTokenDestinationCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type NativeTokenDestinationCallerRaw struct { + Contract *NativeTokenDestinationCaller // Generic read-only contract binding to access the raw methods on +} + +// NativeTokenDestinationTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type NativeTokenDestinationTransactorRaw struct { + Contract *NativeTokenDestinationTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewNativeTokenDestination creates a new instance of NativeTokenDestination, bound to a specific deployed contract. +func NewNativeTokenDestination(address common.Address, backend bind.ContractBackend) (*NativeTokenDestination, error) { + contract, err := bindNativeTokenDestination(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &NativeTokenDestination{NativeTokenDestinationCaller: NativeTokenDestinationCaller{contract: contract}, NativeTokenDestinationTransactor: NativeTokenDestinationTransactor{contract: contract}, NativeTokenDestinationFilterer: NativeTokenDestinationFilterer{contract: contract}}, nil +} + +// NewNativeTokenDestinationCaller creates a new read-only instance of NativeTokenDestination, bound to a specific deployed contract. +func NewNativeTokenDestinationCaller(address common.Address, caller bind.ContractCaller) (*NativeTokenDestinationCaller, error) { + contract, err := bindNativeTokenDestination(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &NativeTokenDestinationCaller{contract: contract}, nil +} + +// NewNativeTokenDestinationTransactor creates a new write-only instance of NativeTokenDestination, bound to a specific deployed contract. +func NewNativeTokenDestinationTransactor(address common.Address, transactor bind.ContractTransactor) (*NativeTokenDestinationTransactor, error) { + contract, err := bindNativeTokenDestination(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &NativeTokenDestinationTransactor{contract: contract}, nil +} + +// NewNativeTokenDestinationFilterer creates a new log filterer instance of NativeTokenDestination, bound to a specific deployed contract. +func NewNativeTokenDestinationFilterer(address common.Address, filterer bind.ContractFilterer) (*NativeTokenDestinationFilterer, error) { + contract, err := bindNativeTokenDestination(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &NativeTokenDestinationFilterer{contract: contract}, nil +} + +// bindNativeTokenDestination binds a generic wrapper to an already deployed contract. +func bindNativeTokenDestination(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := NativeTokenDestinationMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_NativeTokenDestination *NativeTokenDestinationRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _NativeTokenDestination.Contract.NativeTokenDestinationCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_NativeTokenDestination *NativeTokenDestinationRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _NativeTokenDestination.Contract.NativeTokenDestinationTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_NativeTokenDestination *NativeTokenDestinationRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _NativeTokenDestination.Contract.NativeTokenDestinationTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_NativeTokenDestination *NativeTokenDestinationCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _NativeTokenDestination.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_NativeTokenDestination *NativeTokenDestinationTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _NativeTokenDestination.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_NativeTokenDestination *NativeTokenDestinationTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _NativeTokenDestination.Contract.contract.Transact(opts, method, params...) +} + +// TRANSFERNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xab285230. +// +// Solidity: function TRANSFER_NATIVE_TOKENS_REQUIRED_GAS() view returns(uint256) +func (_NativeTokenDestination *NativeTokenDestinationCaller) TRANSFERNATIVETOKENSREQUIREDGAS(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _NativeTokenDestination.contract.Call(opts, &out, "TRANSFER_NATIVE_TOKENS_REQUIRED_GAS") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TRANSFERNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xab285230. +// +// Solidity: function TRANSFER_NATIVE_TOKENS_REQUIRED_GAS() view returns(uint256) +func (_NativeTokenDestination *NativeTokenDestinationSession) TRANSFERNATIVETOKENSREQUIREDGAS() (*big.Int, error) { + return _NativeTokenDestination.Contract.TRANSFERNATIVETOKENSREQUIREDGAS(&_NativeTokenDestination.CallOpts) +} + +// TRANSFERNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xab285230. +// +// Solidity: function TRANSFER_NATIVE_TOKENS_REQUIRED_GAS() view returns(uint256) +func (_NativeTokenDestination *NativeTokenDestinationCallerSession) TRANSFERNATIVETOKENSREQUIREDGAS() (*big.Int, error) { + return _NativeTokenDestination.Contract.TRANSFERNATIVETOKENSREQUIREDGAS(&_NativeTokenDestination.CallOpts) +} + +// WARPPRECOMPILEADDRESS is a free data retrieval call binding the contract method 0x74971856. +// +// Solidity: function WARP_PRECOMPILE_ADDRESS() view returns(address) +func (_NativeTokenDestination *NativeTokenDestinationCaller) WARPPRECOMPILEADDRESS(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _NativeTokenDestination.contract.Call(opts, &out, "WARP_PRECOMPILE_ADDRESS") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// WARPPRECOMPILEADDRESS is a free data retrieval call binding the contract method 0x74971856. +// +// Solidity: function WARP_PRECOMPILE_ADDRESS() view returns(address) +func (_NativeTokenDestination *NativeTokenDestinationSession) WARPPRECOMPILEADDRESS() (common.Address, error) { + return _NativeTokenDestination.Contract.WARPPRECOMPILEADDRESS(&_NativeTokenDestination.CallOpts) +} + +// WARPPRECOMPILEADDRESS is a free data retrieval call binding the contract method 0x74971856. +// +// Solidity: function WARP_PRECOMPILE_ADDRESS() view returns(address) +func (_NativeTokenDestination *NativeTokenDestinationCallerSession) WARPPRECOMPILEADDRESS() (common.Address, error) { + return _NativeTokenDestination.Contract.WARPPRECOMPILEADDRESS(&_NativeTokenDestination.CallOpts) +} + +// CurrentChainID is a free data retrieval call binding the contract method 0xb179e1e7. +// +// Solidity: function currentChainID() view returns(bytes32) +func (_NativeTokenDestination *NativeTokenDestinationCaller) CurrentChainID(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _NativeTokenDestination.contract.Call(opts, &out, "currentChainID") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// CurrentChainID is a free data retrieval call binding the contract method 0xb179e1e7. +// +// Solidity: function currentChainID() view returns(bytes32) +func (_NativeTokenDestination *NativeTokenDestinationSession) CurrentChainID() ([32]byte, error) { + return _NativeTokenDestination.Contract.CurrentChainID(&_NativeTokenDestination.CallOpts) +} + +// CurrentChainID is a free data retrieval call binding the contract method 0xb179e1e7. +// +// Solidity: function currentChainID() view returns(bytes32) +func (_NativeTokenDestination *NativeTokenDestinationCallerSession) CurrentChainID() ([32]byte, error) { + return _NativeTokenDestination.Contract.CurrentChainID(&_NativeTokenDestination.CallOpts) +} + +// SourceChainID is a free data retrieval call binding the contract method 0x4c335368. +// +// Solidity: function sourceChainID() view returns(bytes32) +func (_NativeTokenDestination *NativeTokenDestinationCaller) SourceChainID(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _NativeTokenDestination.contract.Call(opts, &out, "sourceChainID") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// SourceChainID is a free data retrieval call binding the contract method 0x4c335368. +// +// Solidity: function sourceChainID() view returns(bytes32) +func (_NativeTokenDestination *NativeTokenDestinationSession) SourceChainID() ([32]byte, error) { + return _NativeTokenDestination.Contract.SourceChainID(&_NativeTokenDestination.CallOpts) +} + +// SourceChainID is a free data retrieval call binding the contract method 0x4c335368. +// +// Solidity: function sourceChainID() view returns(bytes32) +func (_NativeTokenDestination *NativeTokenDestinationCallerSession) SourceChainID() ([32]byte, error) { + return _NativeTokenDestination.Contract.SourceChainID(&_NativeTokenDestination.CallOpts) +} + +// SourceContractAddress is a free data retrieval call binding the contract method 0x3a85f16a. +// +// Solidity: function sourceContractAddress() view returns(address) +func (_NativeTokenDestination *NativeTokenDestinationCaller) SourceContractAddress(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _NativeTokenDestination.contract.Call(opts, &out, "sourceContractAddress") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// SourceContractAddress is a free data retrieval call binding the contract method 0x3a85f16a. +// +// Solidity: function sourceContractAddress() view returns(address) +func (_NativeTokenDestination *NativeTokenDestinationSession) SourceContractAddress() (common.Address, error) { + return _NativeTokenDestination.Contract.SourceContractAddress(&_NativeTokenDestination.CallOpts) +} + +// SourceContractAddress is a free data retrieval call binding the contract method 0x3a85f16a. +// +// Solidity: function sourceContractAddress() view returns(address) +func (_NativeTokenDestination *NativeTokenDestinationCallerSession) SourceContractAddress() (common.Address, error) { + return _NativeTokenDestination.Contract.SourceContractAddress(&_NativeTokenDestination.CallOpts) +} + +// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// +// Solidity: function teleporterMessenger() view returns(address) +func (_NativeTokenDestination *NativeTokenDestinationCaller) TeleporterMessenger(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _NativeTokenDestination.contract.Call(opts, &out, "teleporterMessenger") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// +// Solidity: function teleporterMessenger() view returns(address) +func (_NativeTokenDestination *NativeTokenDestinationSession) TeleporterMessenger() (common.Address, error) { + return _NativeTokenDestination.Contract.TeleporterMessenger(&_NativeTokenDestination.CallOpts) +} + +// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// +// Solidity: function teleporterMessenger() view returns(address) +func (_NativeTokenDestination *NativeTokenDestinationCallerSession) TeleporterMessenger() (common.Address, error) { + return _NativeTokenDestination.Contract.TeleporterMessenger(&_NativeTokenDestination.CallOpts) +} + +// ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. +// +// Solidity: function receiveTeleporterMessage(bytes32 nativeChainID, address nativeBridgeAddress, bytes message) returns() +func (_NativeTokenDestination *NativeTokenDestinationTransactor) ReceiveTeleporterMessage(opts *bind.TransactOpts, nativeChainID [32]byte, nativeBridgeAddress common.Address, message []byte) (*types.Transaction, error) { + return _NativeTokenDestination.contract.Transact(opts, "receiveTeleporterMessage", nativeChainID, nativeBridgeAddress, message) +} + +// ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. +// +// Solidity: function receiveTeleporterMessage(bytes32 nativeChainID, address nativeBridgeAddress, bytes message) returns() +func (_NativeTokenDestination *NativeTokenDestinationSession) ReceiveTeleporterMessage(nativeChainID [32]byte, nativeBridgeAddress common.Address, message []byte) (*types.Transaction, error) { + return _NativeTokenDestination.Contract.ReceiveTeleporterMessage(&_NativeTokenDestination.TransactOpts, nativeChainID, nativeBridgeAddress, message) +} + +// ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. +// +// Solidity: function receiveTeleporterMessage(bytes32 nativeChainID, address nativeBridgeAddress, bytes message) returns() +func (_NativeTokenDestination *NativeTokenDestinationTransactorSession) ReceiveTeleporterMessage(nativeChainID [32]byte, nativeBridgeAddress common.Address, message []byte) (*types.Transaction, error) { + return _NativeTokenDestination.Contract.ReceiveTeleporterMessage(&_NativeTokenDestination.TransactOpts, nativeChainID, nativeBridgeAddress, message) +} + +// TransferToSource is a paid mutator transaction binding the contract method 0x281c91de. +// +// Solidity: function transferToSource(address recipient, address feeTokenContractAddress, uint256 feeAmount) payable returns() +func (_NativeTokenDestination *NativeTokenDestinationTransactor) TransferToSource(opts *bind.TransactOpts, recipient common.Address, feeTokenContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { + return _NativeTokenDestination.contract.Transact(opts, "transferToSource", recipient, feeTokenContractAddress, feeAmount) +} + +// TransferToSource is a paid mutator transaction binding the contract method 0x281c91de. +// +// Solidity: function transferToSource(address recipient, address feeTokenContractAddress, uint256 feeAmount) payable returns() +func (_NativeTokenDestination *NativeTokenDestinationSession) TransferToSource(recipient common.Address, feeTokenContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { + return _NativeTokenDestination.Contract.TransferToSource(&_NativeTokenDestination.TransactOpts, recipient, feeTokenContractAddress, feeAmount) +} + +// TransferToSource is a paid mutator transaction binding the contract method 0x281c91de. +// +// Solidity: function transferToSource(address recipient, address feeTokenContractAddress, uint256 feeAmount) payable returns() +func (_NativeTokenDestination *NativeTokenDestinationTransactorSession) TransferToSource(recipient common.Address, feeTokenContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { + return _NativeTokenDestination.Contract.TransferToSource(&_NativeTokenDestination.TransactOpts, recipient, feeTokenContractAddress, feeAmount) +} + +// NativeTokenDestinationMintNativeTokensIterator is returned from FilterMintNativeTokens and is used to iterate over the raw logs and unpacked data for MintNativeTokens events raised by the NativeTokenDestination contract. +type NativeTokenDestinationMintNativeTokensIterator struct { + Event *NativeTokenDestinationMintNativeTokens // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *NativeTokenDestinationMintNativeTokensIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(NativeTokenDestinationMintNativeTokens) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(NativeTokenDestinationMintNativeTokens) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *NativeTokenDestinationMintNativeTokensIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *NativeTokenDestinationMintNativeTokensIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// NativeTokenDestinationMintNativeTokens represents a MintNativeTokens event raised by the NativeTokenDestination contract. +type NativeTokenDestinationMintNativeTokens struct { + Recipient common.Address + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterMintNativeTokens is a free log retrieval operation binding the contract event 0xe2899f7ef7618206fa13efbcde0c05cccd83f35ac3b18ef860021181d61fa680. +// +// Solidity: event MintNativeTokens(address recipient, uint256 amount) +func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterMintNativeTokens(opts *bind.FilterOpts) (*NativeTokenDestinationMintNativeTokensIterator, error) { + + logs, sub, err := _NativeTokenDestination.contract.FilterLogs(opts, "MintNativeTokens") + if err != nil { + return nil, err + } + return &NativeTokenDestinationMintNativeTokensIterator{contract: _NativeTokenDestination.contract, event: "MintNativeTokens", logs: logs, sub: sub}, nil +} + +// WatchMintNativeTokens is a free log subscription operation binding the contract event 0xe2899f7ef7618206fa13efbcde0c05cccd83f35ac3b18ef860021181d61fa680. +// +// Solidity: event MintNativeTokens(address recipient, uint256 amount) +func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchMintNativeTokens(opts *bind.WatchOpts, sink chan<- *NativeTokenDestinationMintNativeTokens) (event.Subscription, error) { + + logs, sub, err := _NativeTokenDestination.contract.WatchLogs(opts, "MintNativeTokens") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(NativeTokenDestinationMintNativeTokens) + if err := _NativeTokenDestination.contract.UnpackLog(event, "MintNativeTokens", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseMintNativeTokens is a log parse operation binding the contract event 0xe2899f7ef7618206fa13efbcde0c05cccd83f35ac3b18ef860021181d61fa680. +// +// Solidity: event MintNativeTokens(address recipient, uint256 amount) +func (_NativeTokenDestination *NativeTokenDestinationFilterer) ParseMintNativeTokens(log types.Log) (*NativeTokenDestinationMintNativeTokens, error) { + event := new(NativeTokenDestinationMintNativeTokens) + if err := _NativeTokenDestination.contract.UnpackLog(event, "MintNativeTokens", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// NativeTokenDestinationTransferToSourceIterator is returned from FilterTransferToSource and is used to iterate over the raw logs and unpacked data for TransferToSource events raised by the NativeTokenDestination contract. +type NativeTokenDestinationTransferToSourceIterator struct { + Event *NativeTokenDestinationTransferToSource // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *NativeTokenDestinationTransferToSourceIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(NativeTokenDestinationTransferToSource) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(NativeTokenDestinationTransferToSource) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *NativeTokenDestinationTransferToSourceIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *NativeTokenDestinationTransferToSourceIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// NativeTokenDestinationTransferToSource represents a TransferToSource event raised by the NativeTokenDestination contract. +type NativeTokenDestinationTransferToSource struct { + TokenContractAddress common.Address + TeleporterMessageID *big.Int + DestinationChainID [32]byte + DestinationBridgeAddress common.Address + Recipient common.Address + TransferAmount *big.Int + FeeAmount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTransferToSource is a free log retrieval operation binding the contract event 0xd68353fcc47e706f53e30e6761a3cf2576d0e791c663e962b868bf38010db9a3. +// +// Solidity: event TransferToSource(address indexed tokenContractAddress, uint256 indexed teleporterMessageID, bytes32 destinationChainID, address destinationBridgeAddress, address recipient, uint256 transferAmount, uint256 feeAmount) +func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterTransferToSource(opts *bind.FilterOpts, tokenContractAddress []common.Address, teleporterMessageID []*big.Int) (*NativeTokenDestinationTransferToSourceIterator, error) { + + var tokenContractAddressRule []interface{} + for _, tokenContractAddressItem := range tokenContractAddress { + tokenContractAddressRule = append(tokenContractAddressRule, tokenContractAddressItem) + } + var teleporterMessageIDRule []interface{} + for _, teleporterMessageIDItem := range teleporterMessageID { + teleporterMessageIDRule = append(teleporterMessageIDRule, teleporterMessageIDItem) + } + + logs, sub, err := _NativeTokenDestination.contract.FilterLogs(opts, "TransferToSource", tokenContractAddressRule, teleporterMessageIDRule) + if err != nil { + return nil, err + } + return &NativeTokenDestinationTransferToSourceIterator{contract: _NativeTokenDestination.contract, event: "TransferToSource", logs: logs, sub: sub}, nil +} + +// WatchTransferToSource is a free log subscription operation binding the contract event 0xd68353fcc47e706f53e30e6761a3cf2576d0e791c663e962b868bf38010db9a3. +// +// Solidity: event TransferToSource(address indexed tokenContractAddress, uint256 indexed teleporterMessageID, bytes32 destinationChainID, address destinationBridgeAddress, address recipient, uint256 transferAmount, uint256 feeAmount) +func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchTransferToSource(opts *bind.WatchOpts, sink chan<- *NativeTokenDestinationTransferToSource, tokenContractAddress []common.Address, teleporterMessageID []*big.Int) (event.Subscription, error) { + + var tokenContractAddressRule []interface{} + for _, tokenContractAddressItem := range tokenContractAddress { + tokenContractAddressRule = append(tokenContractAddressRule, tokenContractAddressItem) + } + var teleporterMessageIDRule []interface{} + for _, teleporterMessageIDItem := range teleporterMessageID { + teleporterMessageIDRule = append(teleporterMessageIDRule, teleporterMessageIDItem) + } + + logs, sub, err := _NativeTokenDestination.contract.WatchLogs(opts, "TransferToSource", tokenContractAddressRule, teleporterMessageIDRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(NativeTokenDestinationTransferToSource) + if err := _NativeTokenDestination.contract.UnpackLog(event, "TransferToSource", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseTransferToSource is a log parse operation binding the contract event 0xd68353fcc47e706f53e30e6761a3cf2576d0e791c663e962b868bf38010db9a3. +// +// Solidity: event TransferToSource(address indexed tokenContractAddress, uint256 indexed teleporterMessageID, bytes32 destinationChainID, address destinationBridgeAddress, address recipient, uint256 transferAmount, uint256 feeAmount) +func (_NativeTokenDestination *NativeTokenDestinationFilterer) ParseTransferToSource(log types.Log) (*NativeTokenDestinationTransferToSource, error) { + event := new(NativeTokenDestinationTransferToSource) + if err := _NativeTokenDestination.contract.UnpackLog(event, "TransferToSource", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/contracts/abi/NativeTokenMinter.go b/contracts/abi/NativeTokenMinter.go deleted file mode 100644 index 899d4b366..000000000 --- a/contracts/abi/NativeTokenMinter.go +++ /dev/null @@ -1,671 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package abi - -import ( - "errors" - "math/big" - "strings" - - "github.com/ava-labs/subnet-evm/accounts/abi" - "github.com/ava-labs/subnet-evm/accounts/abi/bind" - "github.com/ava-labs/subnet-evm/core/types" - "github.com/ava-labs/subnet-evm/interfaces" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/event" -) - -// Reference imports to suppress errors if they are not otherwise used. -var ( - _ = errors.New - _ = big.NewInt - _ = strings.NewReader - _ = interfaces.NotFound - _ = bind.Bind - _ = common.Big1 - _ = types.BloomLookup - _ = event.NewSubscription - _ = abi.ConvertType -) - -// NativeTokenMinterMetaData contains all meta data concerning the NativeTokenMinter contract. -var NativeTokenMinterMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"partnerChainID_\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CannotBridgeTokenWithinSameChain\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"adjustedAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"InsufficientAdjustedAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientPayment\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidPartnerContractAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidRecipientAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSourceChain\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTeleporterMessengerAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Unauthorized\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"tokenContractAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destinationBridgeAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"transferAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"BridgeTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"MintNativeTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WARP_PRECOMPILE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeTokenContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"bridgeTokens\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentChainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"partnerChainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"nativeChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeBridgeAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", -} - -// NativeTokenMinterABI is the input ABI used to generate the binding from. -// Deprecated: Use NativeTokenMinterMetaData.ABI instead. -var NativeTokenMinterABI = NativeTokenMinterMetaData.ABI - -// NativeTokenMinter is an auto generated Go binding around an Ethereum contract. -type NativeTokenMinter struct { - NativeTokenMinterCaller // Read-only binding to the contract - NativeTokenMinterTransactor // Write-only binding to the contract - NativeTokenMinterFilterer // Log filterer for contract events -} - -// NativeTokenMinterCaller is an auto generated read-only Go binding around an Ethereum contract. -type NativeTokenMinterCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// NativeTokenMinterTransactor is an auto generated write-only Go binding around an Ethereum contract. -type NativeTokenMinterTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// NativeTokenMinterFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type NativeTokenMinterFilterer struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// NativeTokenMinterSession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type NativeTokenMinterSession struct { - Contract *NativeTokenMinter // Generic contract binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// NativeTokenMinterCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type NativeTokenMinterCallerSession struct { - Contract *NativeTokenMinterCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// NativeTokenMinterTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type NativeTokenMinterTransactorSession struct { - Contract *NativeTokenMinterTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// NativeTokenMinterRaw is an auto generated low-level Go binding around an Ethereum contract. -type NativeTokenMinterRaw struct { - Contract *NativeTokenMinter // Generic contract binding to access the raw methods on -} - -// NativeTokenMinterCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type NativeTokenMinterCallerRaw struct { - Contract *NativeTokenMinterCaller // Generic read-only contract binding to access the raw methods on -} - -// NativeTokenMinterTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type NativeTokenMinterTransactorRaw struct { - Contract *NativeTokenMinterTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewNativeTokenMinter creates a new instance of NativeTokenMinter, bound to a specific deployed contract. -func NewNativeTokenMinter(address common.Address, backend bind.ContractBackend) (*NativeTokenMinter, error) { - contract, err := bindNativeTokenMinter(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &NativeTokenMinter{NativeTokenMinterCaller: NativeTokenMinterCaller{contract: contract}, NativeTokenMinterTransactor: NativeTokenMinterTransactor{contract: contract}, NativeTokenMinterFilterer: NativeTokenMinterFilterer{contract: contract}}, nil -} - -// NewNativeTokenMinterCaller creates a new read-only instance of NativeTokenMinter, bound to a specific deployed contract. -func NewNativeTokenMinterCaller(address common.Address, caller bind.ContractCaller) (*NativeTokenMinterCaller, error) { - contract, err := bindNativeTokenMinter(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &NativeTokenMinterCaller{contract: contract}, nil -} - -// NewNativeTokenMinterTransactor creates a new write-only instance of NativeTokenMinter, bound to a specific deployed contract. -func NewNativeTokenMinterTransactor(address common.Address, transactor bind.ContractTransactor) (*NativeTokenMinterTransactor, error) { - contract, err := bindNativeTokenMinter(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &NativeTokenMinterTransactor{contract: contract}, nil -} - -// NewNativeTokenMinterFilterer creates a new log filterer instance of NativeTokenMinter, bound to a specific deployed contract. -func NewNativeTokenMinterFilterer(address common.Address, filterer bind.ContractFilterer) (*NativeTokenMinterFilterer, error) { - contract, err := bindNativeTokenMinter(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &NativeTokenMinterFilterer{contract: contract}, nil -} - -// bindNativeTokenMinter binds a generic wrapper to an already deployed contract. -func bindNativeTokenMinter(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := NativeTokenMinterMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_NativeTokenMinter *NativeTokenMinterRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _NativeTokenMinter.Contract.NativeTokenMinterCaller.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_NativeTokenMinter *NativeTokenMinterRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _NativeTokenMinter.Contract.NativeTokenMinterTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_NativeTokenMinter *NativeTokenMinterRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _NativeTokenMinter.Contract.NativeTokenMinterTransactor.contract.Transact(opts, method, params...) -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_NativeTokenMinter *NativeTokenMinterCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _NativeTokenMinter.Contract.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_NativeTokenMinter *NativeTokenMinterTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _NativeTokenMinter.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_NativeTokenMinter *NativeTokenMinterTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _NativeTokenMinter.Contract.contract.Transact(opts, method, params...) -} - -// TRANSFERNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xab285230. -// -// Solidity: function TRANSFER_NATIVE_TOKENS_REQUIRED_GAS() view returns(uint256) -func (_NativeTokenMinter *NativeTokenMinterCaller) TRANSFERNATIVETOKENSREQUIREDGAS(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _NativeTokenMinter.contract.Call(opts, &out, "TRANSFER_NATIVE_TOKENS_REQUIRED_GAS") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// TRANSFERNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xab285230. -// -// Solidity: function TRANSFER_NATIVE_TOKENS_REQUIRED_GAS() view returns(uint256) -func (_NativeTokenMinter *NativeTokenMinterSession) TRANSFERNATIVETOKENSREQUIREDGAS() (*big.Int, error) { - return _NativeTokenMinter.Contract.TRANSFERNATIVETOKENSREQUIREDGAS(&_NativeTokenMinter.CallOpts) -} - -// TRANSFERNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xab285230. -// -// Solidity: function TRANSFER_NATIVE_TOKENS_REQUIRED_GAS() view returns(uint256) -func (_NativeTokenMinter *NativeTokenMinterCallerSession) TRANSFERNATIVETOKENSREQUIREDGAS() (*big.Int, error) { - return _NativeTokenMinter.Contract.TRANSFERNATIVETOKENSREQUIREDGAS(&_NativeTokenMinter.CallOpts) -} - -// WARPPRECOMPILEADDRESS is a free data retrieval call binding the contract method 0x74971856. -// -// Solidity: function WARP_PRECOMPILE_ADDRESS() view returns(address) -func (_NativeTokenMinter *NativeTokenMinterCaller) WARPPRECOMPILEADDRESS(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _NativeTokenMinter.contract.Call(opts, &out, "WARP_PRECOMPILE_ADDRESS") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// WARPPRECOMPILEADDRESS is a free data retrieval call binding the contract method 0x74971856. -// -// Solidity: function WARP_PRECOMPILE_ADDRESS() view returns(address) -func (_NativeTokenMinter *NativeTokenMinterSession) WARPPRECOMPILEADDRESS() (common.Address, error) { - return _NativeTokenMinter.Contract.WARPPRECOMPILEADDRESS(&_NativeTokenMinter.CallOpts) -} - -// WARPPRECOMPILEADDRESS is a free data retrieval call binding the contract method 0x74971856. -// -// Solidity: function WARP_PRECOMPILE_ADDRESS() view returns(address) -func (_NativeTokenMinter *NativeTokenMinterCallerSession) WARPPRECOMPILEADDRESS() (common.Address, error) { - return _NativeTokenMinter.Contract.WARPPRECOMPILEADDRESS(&_NativeTokenMinter.CallOpts) -} - -// CurrentChainID is a free data retrieval call binding the contract method 0xb179e1e7. -// -// Solidity: function currentChainID() view returns(bytes32) -func (_NativeTokenMinter *NativeTokenMinterCaller) CurrentChainID(opts *bind.CallOpts) ([32]byte, error) { - var out []interface{} - err := _NativeTokenMinter.contract.Call(opts, &out, "currentChainID") - - if err != nil { - return *new([32]byte), err - } - - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - - return out0, err - -} - -// CurrentChainID is a free data retrieval call binding the contract method 0xb179e1e7. -// -// Solidity: function currentChainID() view returns(bytes32) -func (_NativeTokenMinter *NativeTokenMinterSession) CurrentChainID() ([32]byte, error) { - return _NativeTokenMinter.Contract.CurrentChainID(&_NativeTokenMinter.CallOpts) -} - -// CurrentChainID is a free data retrieval call binding the contract method 0xb179e1e7. -// -// Solidity: function currentChainID() view returns(bytes32) -func (_NativeTokenMinter *NativeTokenMinterCallerSession) CurrentChainID() ([32]byte, error) { - return _NativeTokenMinter.Contract.CurrentChainID(&_NativeTokenMinter.CallOpts) -} - -// PartnerChainID is a free data retrieval call binding the contract method 0x9c224734. -// -// Solidity: function partnerChainID() view returns(bytes32) -func (_NativeTokenMinter *NativeTokenMinterCaller) PartnerChainID(opts *bind.CallOpts) ([32]byte, error) { - var out []interface{} - err := _NativeTokenMinter.contract.Call(opts, &out, "partnerChainID") - - if err != nil { - return *new([32]byte), err - } - - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - - return out0, err - -} - -// PartnerChainID is a free data retrieval call binding the contract method 0x9c224734. -// -// Solidity: function partnerChainID() view returns(bytes32) -func (_NativeTokenMinter *NativeTokenMinterSession) PartnerChainID() ([32]byte, error) { - return _NativeTokenMinter.Contract.PartnerChainID(&_NativeTokenMinter.CallOpts) -} - -// PartnerChainID is a free data retrieval call binding the contract method 0x9c224734. -// -// Solidity: function partnerChainID() view returns(bytes32) -func (_NativeTokenMinter *NativeTokenMinterCallerSession) PartnerChainID() ([32]byte, error) { - return _NativeTokenMinter.Contract.PartnerChainID(&_NativeTokenMinter.CallOpts) -} - -// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. -// -// Solidity: function teleporterMessenger() view returns(address) -func (_NativeTokenMinter *NativeTokenMinterCaller) TeleporterMessenger(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _NativeTokenMinter.contract.Call(opts, &out, "teleporterMessenger") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. -// -// Solidity: function teleporterMessenger() view returns(address) -func (_NativeTokenMinter *NativeTokenMinterSession) TeleporterMessenger() (common.Address, error) { - return _NativeTokenMinter.Contract.TeleporterMessenger(&_NativeTokenMinter.CallOpts) -} - -// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. -// -// Solidity: function teleporterMessenger() view returns(address) -func (_NativeTokenMinter *NativeTokenMinterCallerSession) TeleporterMessenger() (common.Address, error) { - return _NativeTokenMinter.Contract.TeleporterMessenger(&_NativeTokenMinter.CallOpts) -} - -// BridgeTokens is a paid mutator transaction binding the contract method 0xf9fe683e. -// -// Solidity: function bridgeTokens(address recipient, address feeTokenContractAddress, uint256 feeAmount) payable returns() -func (_NativeTokenMinter *NativeTokenMinterTransactor) BridgeTokens(opts *bind.TransactOpts, recipient common.Address, feeTokenContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { - return _NativeTokenMinter.contract.Transact(opts, "bridgeTokens", recipient, feeTokenContractAddress, feeAmount) -} - -// BridgeTokens is a paid mutator transaction binding the contract method 0xf9fe683e. -// -// Solidity: function bridgeTokens(address recipient, address feeTokenContractAddress, uint256 feeAmount) payable returns() -func (_NativeTokenMinter *NativeTokenMinterSession) BridgeTokens(recipient common.Address, feeTokenContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { - return _NativeTokenMinter.Contract.BridgeTokens(&_NativeTokenMinter.TransactOpts, recipient, feeTokenContractAddress, feeAmount) -} - -// BridgeTokens is a paid mutator transaction binding the contract method 0xf9fe683e. -// -// Solidity: function bridgeTokens(address recipient, address feeTokenContractAddress, uint256 feeAmount) payable returns() -func (_NativeTokenMinter *NativeTokenMinterTransactorSession) BridgeTokens(recipient common.Address, feeTokenContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { - return _NativeTokenMinter.Contract.BridgeTokens(&_NativeTokenMinter.TransactOpts, recipient, feeTokenContractAddress, feeAmount) -} - -// ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. -// -// Solidity: function receiveTeleporterMessage(bytes32 nativeChainID, address nativeBridgeAddress, bytes message) returns() -func (_NativeTokenMinter *NativeTokenMinterTransactor) ReceiveTeleporterMessage(opts *bind.TransactOpts, nativeChainID [32]byte, nativeBridgeAddress common.Address, message []byte) (*types.Transaction, error) { - return _NativeTokenMinter.contract.Transact(opts, "receiveTeleporterMessage", nativeChainID, nativeBridgeAddress, message) -} - -// ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. -// -// Solidity: function receiveTeleporterMessage(bytes32 nativeChainID, address nativeBridgeAddress, bytes message) returns() -func (_NativeTokenMinter *NativeTokenMinterSession) ReceiveTeleporterMessage(nativeChainID [32]byte, nativeBridgeAddress common.Address, message []byte) (*types.Transaction, error) { - return _NativeTokenMinter.Contract.ReceiveTeleporterMessage(&_NativeTokenMinter.TransactOpts, nativeChainID, nativeBridgeAddress, message) -} - -// ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. -// -// Solidity: function receiveTeleporterMessage(bytes32 nativeChainID, address nativeBridgeAddress, bytes message) returns() -func (_NativeTokenMinter *NativeTokenMinterTransactorSession) ReceiveTeleporterMessage(nativeChainID [32]byte, nativeBridgeAddress common.Address, message []byte) (*types.Transaction, error) { - return _NativeTokenMinter.Contract.ReceiveTeleporterMessage(&_NativeTokenMinter.TransactOpts, nativeChainID, nativeBridgeAddress, message) -} - -// NativeTokenMinterBridgeTokensIterator is returned from FilterBridgeTokens and is used to iterate over the raw logs and unpacked data for BridgeTokens events raised by the NativeTokenMinter contract. -type NativeTokenMinterBridgeTokensIterator struct { - Event *NativeTokenMinterBridgeTokens // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub interfaces.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *NativeTokenMinterBridgeTokensIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(NativeTokenMinterBridgeTokens) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(NativeTokenMinterBridgeTokens) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *NativeTokenMinterBridgeTokensIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *NativeTokenMinterBridgeTokensIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// NativeTokenMinterBridgeTokens represents a BridgeTokens event raised by the NativeTokenMinter contract. -type NativeTokenMinterBridgeTokens struct { - TokenContractAddress common.Address - TeleporterMessageID *big.Int - DestinationChainID [32]byte - DestinationBridgeAddress common.Address - Recipient common.Address - TransferAmount *big.Int - FeeAmount *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterBridgeTokens is a free log retrieval operation binding the contract event 0xfd68c031379d96b674b8ff93f8bba98792a892b18f15c19e26dc84485f4f33e2. -// -// Solidity: event BridgeTokens(address indexed tokenContractAddress, uint256 indexed teleporterMessageID, bytes32 destinationChainID, address destinationBridgeAddress, address recipient, uint256 transferAmount, uint256 feeAmount) -func (_NativeTokenMinter *NativeTokenMinterFilterer) FilterBridgeTokens(opts *bind.FilterOpts, tokenContractAddress []common.Address, teleporterMessageID []*big.Int) (*NativeTokenMinterBridgeTokensIterator, error) { - - var tokenContractAddressRule []interface{} - for _, tokenContractAddressItem := range tokenContractAddress { - tokenContractAddressRule = append(tokenContractAddressRule, tokenContractAddressItem) - } - var teleporterMessageIDRule []interface{} - for _, teleporterMessageIDItem := range teleporterMessageID { - teleporterMessageIDRule = append(teleporterMessageIDRule, teleporterMessageIDItem) - } - - logs, sub, err := _NativeTokenMinter.contract.FilterLogs(opts, "BridgeTokens", tokenContractAddressRule, teleporterMessageIDRule) - if err != nil { - return nil, err - } - return &NativeTokenMinterBridgeTokensIterator{contract: _NativeTokenMinter.contract, event: "BridgeTokens", logs: logs, sub: sub}, nil -} - -// WatchBridgeTokens is a free log subscription operation binding the contract event 0xfd68c031379d96b674b8ff93f8bba98792a892b18f15c19e26dc84485f4f33e2. -// -// Solidity: event BridgeTokens(address indexed tokenContractAddress, uint256 indexed teleporterMessageID, bytes32 destinationChainID, address destinationBridgeAddress, address recipient, uint256 transferAmount, uint256 feeAmount) -func (_NativeTokenMinter *NativeTokenMinterFilterer) WatchBridgeTokens(opts *bind.WatchOpts, sink chan<- *NativeTokenMinterBridgeTokens, tokenContractAddress []common.Address, teleporterMessageID []*big.Int) (event.Subscription, error) { - - var tokenContractAddressRule []interface{} - for _, tokenContractAddressItem := range tokenContractAddress { - tokenContractAddressRule = append(tokenContractAddressRule, tokenContractAddressItem) - } - var teleporterMessageIDRule []interface{} - for _, teleporterMessageIDItem := range teleporterMessageID { - teleporterMessageIDRule = append(teleporterMessageIDRule, teleporterMessageIDItem) - } - - logs, sub, err := _NativeTokenMinter.contract.WatchLogs(opts, "BridgeTokens", tokenContractAddressRule, teleporterMessageIDRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(NativeTokenMinterBridgeTokens) - if err := _NativeTokenMinter.contract.UnpackLog(event, "BridgeTokens", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseBridgeTokens is a log parse operation binding the contract event 0xfd68c031379d96b674b8ff93f8bba98792a892b18f15c19e26dc84485f4f33e2. -// -// Solidity: event BridgeTokens(address indexed tokenContractAddress, uint256 indexed teleporterMessageID, bytes32 destinationChainID, address destinationBridgeAddress, address recipient, uint256 transferAmount, uint256 feeAmount) -func (_NativeTokenMinter *NativeTokenMinterFilterer) ParseBridgeTokens(log types.Log) (*NativeTokenMinterBridgeTokens, error) { - event := new(NativeTokenMinterBridgeTokens) - if err := _NativeTokenMinter.contract.UnpackLog(event, "BridgeTokens", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// NativeTokenMinterMintNativeTokensIterator is returned from FilterMintNativeTokens and is used to iterate over the raw logs and unpacked data for MintNativeTokens events raised by the NativeTokenMinter contract. -type NativeTokenMinterMintNativeTokensIterator struct { - Event *NativeTokenMinterMintNativeTokens // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub interfaces.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *NativeTokenMinterMintNativeTokensIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(NativeTokenMinterMintNativeTokens) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(NativeTokenMinterMintNativeTokens) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *NativeTokenMinterMintNativeTokensIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *NativeTokenMinterMintNativeTokensIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// NativeTokenMinterMintNativeTokens represents a MintNativeTokens event raised by the NativeTokenMinter contract. -type NativeTokenMinterMintNativeTokens struct { - Recipient common.Address - Amount *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterMintNativeTokens is a free log retrieval operation binding the contract event 0xe2899f7ef7618206fa13efbcde0c05cccd83f35ac3b18ef860021181d61fa680. -// -// Solidity: event MintNativeTokens(address recipient, uint256 amount) -func (_NativeTokenMinter *NativeTokenMinterFilterer) FilterMintNativeTokens(opts *bind.FilterOpts) (*NativeTokenMinterMintNativeTokensIterator, error) { - - logs, sub, err := _NativeTokenMinter.contract.FilterLogs(opts, "MintNativeTokens") - if err != nil { - return nil, err - } - return &NativeTokenMinterMintNativeTokensIterator{contract: _NativeTokenMinter.contract, event: "MintNativeTokens", logs: logs, sub: sub}, nil -} - -// WatchMintNativeTokens is a free log subscription operation binding the contract event 0xe2899f7ef7618206fa13efbcde0c05cccd83f35ac3b18ef860021181d61fa680. -// -// Solidity: event MintNativeTokens(address recipient, uint256 amount) -func (_NativeTokenMinter *NativeTokenMinterFilterer) WatchMintNativeTokens(opts *bind.WatchOpts, sink chan<- *NativeTokenMinterMintNativeTokens) (event.Subscription, error) { - - logs, sub, err := _NativeTokenMinter.contract.WatchLogs(opts, "MintNativeTokens") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(NativeTokenMinterMintNativeTokens) - if err := _NativeTokenMinter.contract.UnpackLog(event, "MintNativeTokens", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseMintNativeTokens is a log parse operation binding the contract event 0xe2899f7ef7618206fa13efbcde0c05cccd83f35ac3b18ef860021181d61fa680. -// -// Solidity: event MintNativeTokens(address recipient, uint256 amount) -func (_NativeTokenMinter *NativeTokenMinterFilterer) ParseMintNativeTokens(log types.Log) (*NativeTokenMinterMintNativeTokens, error) { - event := new(NativeTokenMinterMintNativeTokens) - if err := _NativeTokenMinter.contract.UnpackLog(event, "MintNativeTokens", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} diff --git a/contracts/abi/NativeTokenReceiver.go b/contracts/abi/NativeTokenReceiver.go deleted file mode 100644 index b31d1452f..000000000 --- a/contracts/abi/NativeTokenReceiver.go +++ /dev/null @@ -1,671 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package abi - -import ( - "errors" - "math/big" - "strings" - - "github.com/ava-labs/subnet-evm/accounts/abi" - "github.com/ava-labs/subnet-evm/accounts/abi/bind" - "github.com/ava-labs/subnet-evm/core/types" - "github.com/ava-labs/subnet-evm/interfaces" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/event" -) - -// Reference imports to suppress errors if they are not otherwise used. -var ( - _ = errors.New - _ = big.NewInt - _ = strings.NewReader - _ = interfaces.NotFound - _ = bind.Bind - _ = common.Big1 - _ = types.BloomLookup - _ = event.NewSubscription - _ = abi.ConvertType -) - -// NativeTokenReceiverMetaData contains all meta data concerning the NativeTokenReceiver contract. -var NativeTokenReceiverMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"partnerChainID_\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CannotBridgeTokenWithinSameChain\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"adjustedAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"InsufficientAdjustedAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientPayment\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidPartnerContractAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidRecipientAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSourceChain\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTeleporterMessengerAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Unauthorized\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"tokenContractAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destinationBridgeAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"transferAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"BridgeTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WARP_PRECOMPILE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeTokenContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"bridgeTokens\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentChainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"partnerChainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"nativeChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeBridgeAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", -} - -// NativeTokenReceiverABI is the input ABI used to generate the binding from. -// Deprecated: Use NativeTokenReceiverMetaData.ABI instead. -var NativeTokenReceiverABI = NativeTokenReceiverMetaData.ABI - -// NativeTokenReceiver is an auto generated Go binding around an Ethereum contract. -type NativeTokenReceiver struct { - NativeTokenReceiverCaller // Read-only binding to the contract - NativeTokenReceiverTransactor // Write-only binding to the contract - NativeTokenReceiverFilterer // Log filterer for contract events -} - -// NativeTokenReceiverCaller is an auto generated read-only Go binding around an Ethereum contract. -type NativeTokenReceiverCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// NativeTokenReceiverTransactor is an auto generated write-only Go binding around an Ethereum contract. -type NativeTokenReceiverTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// NativeTokenReceiverFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type NativeTokenReceiverFilterer struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// NativeTokenReceiverSession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type NativeTokenReceiverSession struct { - Contract *NativeTokenReceiver // Generic contract binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// NativeTokenReceiverCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type NativeTokenReceiverCallerSession struct { - Contract *NativeTokenReceiverCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// NativeTokenReceiverTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type NativeTokenReceiverTransactorSession struct { - Contract *NativeTokenReceiverTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// NativeTokenReceiverRaw is an auto generated low-level Go binding around an Ethereum contract. -type NativeTokenReceiverRaw struct { - Contract *NativeTokenReceiver // Generic contract binding to access the raw methods on -} - -// NativeTokenReceiverCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type NativeTokenReceiverCallerRaw struct { - Contract *NativeTokenReceiverCaller // Generic read-only contract binding to access the raw methods on -} - -// NativeTokenReceiverTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type NativeTokenReceiverTransactorRaw struct { - Contract *NativeTokenReceiverTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewNativeTokenReceiver creates a new instance of NativeTokenReceiver, bound to a specific deployed contract. -func NewNativeTokenReceiver(address common.Address, backend bind.ContractBackend) (*NativeTokenReceiver, error) { - contract, err := BindNativeTokenReceiver(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &NativeTokenReceiver{NativeTokenReceiverCaller: NativeTokenReceiverCaller{contract: contract}, NativeTokenReceiverTransactor: NativeTokenReceiverTransactor{contract: contract}, NativeTokenReceiverFilterer: NativeTokenReceiverFilterer{contract: contract}}, nil -} - -// NewNativeTokenReceiverCaller creates a new read-only instance of NativeTokenReceiver, bound to a specific deployed contract. -func NewNativeTokenReceiverCaller(address common.Address, caller bind.ContractCaller) (*NativeTokenReceiverCaller, error) { - contract, err := BindNativeTokenReceiver(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &NativeTokenReceiverCaller{contract: contract}, nil -} - -// NewNativeTokenReceiverTransactor creates a new write-only instance of NativeTokenReceiver, bound to a specific deployed contract. -func NewNativeTokenReceiverTransactor(address common.Address, transactor bind.ContractTransactor) (*NativeTokenReceiverTransactor, error) { - contract, err := BindNativeTokenReceiver(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &NativeTokenReceiverTransactor{contract: contract}, nil -} - -// NewNativeTokenReceiverFilterer creates a new log filterer instance of NativeTokenReceiver, bound to a specific deployed contract. -func NewNativeTokenReceiverFilterer(address common.Address, filterer bind.ContractFilterer) (*NativeTokenReceiverFilterer, error) { - contract, err := BindNativeTokenReceiver(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &NativeTokenReceiverFilterer{contract: contract}, nil -} - -// bindNativeTokenReceiver binds a generic wrapper to an already deployed contract. -func BindNativeTokenReceiver(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := NativeTokenReceiverMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_NativeTokenReceiver *NativeTokenReceiverRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _NativeTokenReceiver.Contract.NativeTokenReceiverCaller.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_NativeTokenReceiver *NativeTokenReceiverRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _NativeTokenReceiver.Contract.NativeTokenReceiverTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_NativeTokenReceiver *NativeTokenReceiverRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _NativeTokenReceiver.Contract.NativeTokenReceiverTransactor.contract.Transact(opts, method, params...) -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_NativeTokenReceiver *NativeTokenReceiverCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _NativeTokenReceiver.Contract.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_NativeTokenReceiver *NativeTokenReceiverTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _NativeTokenReceiver.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_NativeTokenReceiver *NativeTokenReceiverTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _NativeTokenReceiver.Contract.contract.Transact(opts, method, params...) -} - -// MINTNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xb6171f73. -// -// Solidity: function MINT_NATIVE_TOKENS_REQUIRED_GAS() view returns(uint256) -func (_NativeTokenReceiver *NativeTokenReceiverCaller) MINTNATIVETOKENSREQUIREDGAS(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _NativeTokenReceiver.contract.Call(opts, &out, "MINT_NATIVE_TOKENS_REQUIRED_GAS") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// MINTNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xb6171f73. -// -// Solidity: function MINT_NATIVE_TOKENS_REQUIRED_GAS() view returns(uint256) -func (_NativeTokenReceiver *NativeTokenReceiverSession) MINTNATIVETOKENSREQUIREDGAS() (*big.Int, error) { - return _NativeTokenReceiver.Contract.MINTNATIVETOKENSREQUIREDGAS(&_NativeTokenReceiver.CallOpts) -} - -// MINTNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xb6171f73. -// -// Solidity: function MINT_NATIVE_TOKENS_REQUIRED_GAS() view returns(uint256) -func (_NativeTokenReceiver *NativeTokenReceiverCallerSession) MINTNATIVETOKENSREQUIREDGAS() (*big.Int, error) { - return _NativeTokenReceiver.Contract.MINTNATIVETOKENSREQUIREDGAS(&_NativeTokenReceiver.CallOpts) -} - -// WARPPRECOMPILEADDRESS is a free data retrieval call binding the contract method 0x74971856. -// -// Solidity: function WARP_PRECOMPILE_ADDRESS() view returns(address) -func (_NativeTokenReceiver *NativeTokenReceiverCaller) WARPPRECOMPILEADDRESS(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _NativeTokenReceiver.contract.Call(opts, &out, "WARP_PRECOMPILE_ADDRESS") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// WARPPRECOMPILEADDRESS is a free data retrieval call binding the contract method 0x74971856. -// -// Solidity: function WARP_PRECOMPILE_ADDRESS() view returns(address) -func (_NativeTokenReceiver *NativeTokenReceiverSession) WARPPRECOMPILEADDRESS() (common.Address, error) { - return _NativeTokenReceiver.Contract.WARPPRECOMPILEADDRESS(&_NativeTokenReceiver.CallOpts) -} - -// WARPPRECOMPILEADDRESS is a free data retrieval call binding the contract method 0x74971856. -// -// Solidity: function WARP_PRECOMPILE_ADDRESS() view returns(address) -func (_NativeTokenReceiver *NativeTokenReceiverCallerSession) WARPPRECOMPILEADDRESS() (common.Address, error) { - return _NativeTokenReceiver.Contract.WARPPRECOMPILEADDRESS(&_NativeTokenReceiver.CallOpts) -} - -// CurrentChainID is a free data retrieval call binding the contract method 0xb179e1e7. -// -// Solidity: function currentChainID() view returns(bytes32) -func (_NativeTokenReceiver *NativeTokenReceiverCaller) CurrentChainID(opts *bind.CallOpts) ([32]byte, error) { - var out []interface{} - err := _NativeTokenReceiver.contract.Call(opts, &out, "currentChainID") - - if err != nil { - return *new([32]byte), err - } - - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - - return out0, err - -} - -// CurrentChainID is a free data retrieval call binding the contract method 0xb179e1e7. -// -// Solidity: function currentChainID() view returns(bytes32) -func (_NativeTokenReceiver *NativeTokenReceiverSession) CurrentChainID() ([32]byte, error) { - return _NativeTokenReceiver.Contract.CurrentChainID(&_NativeTokenReceiver.CallOpts) -} - -// CurrentChainID is a free data retrieval call binding the contract method 0xb179e1e7. -// -// Solidity: function currentChainID() view returns(bytes32) -func (_NativeTokenReceiver *NativeTokenReceiverCallerSession) CurrentChainID() ([32]byte, error) { - return _NativeTokenReceiver.Contract.CurrentChainID(&_NativeTokenReceiver.CallOpts) -} - -// PartnerChainID is a free data retrieval call binding the contract method 0x9c224734. -// -// Solidity: function partnerChainID() view returns(bytes32) -func (_NativeTokenReceiver *NativeTokenReceiverCaller) PartnerChainID(opts *bind.CallOpts) ([32]byte, error) { - var out []interface{} - err := _NativeTokenReceiver.contract.Call(opts, &out, "partnerChainID") - - if err != nil { - return *new([32]byte), err - } - - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - - return out0, err - -} - -// PartnerChainID is a free data retrieval call binding the contract method 0x9c224734. -// -// Solidity: function partnerChainID() view returns(bytes32) -func (_NativeTokenReceiver *NativeTokenReceiverSession) PartnerChainID() ([32]byte, error) { - return _NativeTokenReceiver.Contract.PartnerChainID(&_NativeTokenReceiver.CallOpts) -} - -// PartnerChainID is a free data retrieval call binding the contract method 0x9c224734. -// -// Solidity: function partnerChainID() view returns(bytes32) -func (_NativeTokenReceiver *NativeTokenReceiverCallerSession) PartnerChainID() ([32]byte, error) { - return _NativeTokenReceiver.Contract.PartnerChainID(&_NativeTokenReceiver.CallOpts) -} - -// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. -// -// Solidity: function teleporterMessenger() view returns(address) -func (_NativeTokenReceiver *NativeTokenReceiverCaller) TeleporterMessenger(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _NativeTokenReceiver.contract.Call(opts, &out, "teleporterMessenger") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. -// -// Solidity: function teleporterMessenger() view returns(address) -func (_NativeTokenReceiver *NativeTokenReceiverSession) TeleporterMessenger() (common.Address, error) { - return _NativeTokenReceiver.Contract.TeleporterMessenger(&_NativeTokenReceiver.CallOpts) -} - -// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. -// -// Solidity: function teleporterMessenger() view returns(address) -func (_NativeTokenReceiver *NativeTokenReceiverCallerSession) TeleporterMessenger() (common.Address, error) { - return _NativeTokenReceiver.Contract.TeleporterMessenger(&_NativeTokenReceiver.CallOpts) -} - -// BridgeTokens is a paid mutator transaction binding the contract method 0xf9fe683e. -// -// Solidity: function bridgeTokens(address recipient, address feeTokenContractAddress, uint256 feeAmount) payable returns() -func (_NativeTokenReceiver *NativeTokenReceiverTransactor) BridgeTokens(opts *bind.TransactOpts, recipient common.Address, feeTokenContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { - return _NativeTokenReceiver.contract.Transact(opts, "bridgeTokens", recipient, feeTokenContractAddress, feeAmount) -} - -// BridgeTokens is a paid mutator transaction binding the contract method 0xf9fe683e. -// -// Solidity: function bridgeTokens(address recipient, address feeTokenContractAddress, uint256 feeAmount) payable returns() -func (_NativeTokenReceiver *NativeTokenReceiverSession) BridgeTokens(recipient common.Address, feeTokenContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { - return _NativeTokenReceiver.Contract.BridgeTokens(&_NativeTokenReceiver.TransactOpts, recipient, feeTokenContractAddress, feeAmount) -} - -// BridgeTokens is a paid mutator transaction binding the contract method 0xf9fe683e. -// -// Solidity: function bridgeTokens(address recipient, address feeTokenContractAddress, uint256 feeAmount) payable returns() -func (_NativeTokenReceiver *NativeTokenReceiverTransactorSession) BridgeTokens(recipient common.Address, feeTokenContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { - return _NativeTokenReceiver.Contract.BridgeTokens(&_NativeTokenReceiver.TransactOpts, recipient, feeTokenContractAddress, feeAmount) -} - -// ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. -// -// Solidity: function receiveTeleporterMessage(bytes32 nativeChainID, address nativeBridgeAddress, bytes message) returns() -func (_NativeTokenReceiver *NativeTokenReceiverTransactor) ReceiveTeleporterMessage(opts *bind.TransactOpts, nativeChainID [32]byte, nativeBridgeAddress common.Address, message []byte) (*types.Transaction, error) { - return _NativeTokenReceiver.contract.Transact(opts, "receiveTeleporterMessage", nativeChainID, nativeBridgeAddress, message) -} - -// ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. -// -// Solidity: function receiveTeleporterMessage(bytes32 nativeChainID, address nativeBridgeAddress, bytes message) returns() -func (_NativeTokenReceiver *NativeTokenReceiverSession) ReceiveTeleporterMessage(nativeChainID [32]byte, nativeBridgeAddress common.Address, message []byte) (*types.Transaction, error) { - return _NativeTokenReceiver.Contract.ReceiveTeleporterMessage(&_NativeTokenReceiver.TransactOpts, nativeChainID, nativeBridgeAddress, message) -} - -// ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. -// -// Solidity: function receiveTeleporterMessage(bytes32 nativeChainID, address nativeBridgeAddress, bytes message) returns() -func (_NativeTokenReceiver *NativeTokenReceiverTransactorSession) ReceiveTeleporterMessage(nativeChainID [32]byte, nativeBridgeAddress common.Address, message []byte) (*types.Transaction, error) { - return _NativeTokenReceiver.Contract.ReceiveTeleporterMessage(&_NativeTokenReceiver.TransactOpts, nativeChainID, nativeBridgeAddress, message) -} - -// NativeTokenReceiverBridgeTokensIterator is returned from FilterBridgeTokens and is used to iterate over the raw logs and unpacked data for BridgeTokens events raised by the NativeTokenReceiver contract. -type NativeTokenReceiverBridgeTokensIterator struct { - Event *NativeTokenReceiverBridgeTokens // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub interfaces.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *NativeTokenReceiverBridgeTokensIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(NativeTokenReceiverBridgeTokens) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(NativeTokenReceiverBridgeTokens) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *NativeTokenReceiverBridgeTokensIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *NativeTokenReceiverBridgeTokensIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// NativeTokenReceiverBridgeTokens represents a BridgeTokens event raised by the NativeTokenReceiver contract. -type NativeTokenReceiverBridgeTokens struct { - TokenContractAddress common.Address - TeleporterMessageID *big.Int - DestinationChainID [32]byte - DestinationBridgeAddress common.Address - Recipient common.Address - TransferAmount *big.Int - FeeAmount *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterBridgeTokens is a free log retrieval operation binding the contract event 0xfd68c031379d96b674b8ff93f8bba98792a892b18f15c19e26dc84485f4f33e2. -// -// Solidity: event BridgeTokens(address indexed tokenContractAddress, uint256 indexed teleporterMessageID, bytes32 destinationChainID, address destinationBridgeAddress, address recipient, uint256 transferAmount, uint256 feeAmount) -func (_NativeTokenReceiver *NativeTokenReceiverFilterer) FilterBridgeTokens(opts *bind.FilterOpts, tokenContractAddress []common.Address, teleporterMessageID []*big.Int) (*NativeTokenReceiverBridgeTokensIterator, error) { - - var tokenContractAddressRule []interface{} - for _, tokenContractAddressItem := range tokenContractAddress { - tokenContractAddressRule = append(tokenContractAddressRule, tokenContractAddressItem) - } - var teleporterMessageIDRule []interface{} - for _, teleporterMessageIDItem := range teleporterMessageID { - teleporterMessageIDRule = append(teleporterMessageIDRule, teleporterMessageIDItem) - } - - logs, sub, err := _NativeTokenReceiver.contract.FilterLogs(opts, "BridgeTokens", tokenContractAddressRule, teleporterMessageIDRule) - if err != nil { - return nil, err - } - return &NativeTokenReceiverBridgeTokensIterator{contract: _NativeTokenReceiver.contract, event: "BridgeTokens", logs: logs, sub: sub}, nil -} - -// WatchBridgeTokens is a free log subscription operation binding the contract event 0xfd68c031379d96b674b8ff93f8bba98792a892b18f15c19e26dc84485f4f33e2. -// -// Solidity: event BridgeTokens(address indexed tokenContractAddress, uint256 indexed teleporterMessageID, bytes32 destinationChainID, address destinationBridgeAddress, address recipient, uint256 transferAmount, uint256 feeAmount) -func (_NativeTokenReceiver *NativeTokenReceiverFilterer) WatchBridgeTokens(opts *bind.WatchOpts, sink chan<- *NativeTokenReceiverBridgeTokens, tokenContractAddress []common.Address, teleporterMessageID []*big.Int) (event.Subscription, error) { - - var tokenContractAddressRule []interface{} - for _, tokenContractAddressItem := range tokenContractAddress { - tokenContractAddressRule = append(tokenContractAddressRule, tokenContractAddressItem) - } - var teleporterMessageIDRule []interface{} - for _, teleporterMessageIDItem := range teleporterMessageID { - teleporterMessageIDRule = append(teleporterMessageIDRule, teleporterMessageIDItem) - } - - logs, sub, err := _NativeTokenReceiver.contract.WatchLogs(opts, "BridgeTokens", tokenContractAddressRule, teleporterMessageIDRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(NativeTokenReceiverBridgeTokens) - if err := _NativeTokenReceiver.contract.UnpackLog(event, "BridgeTokens", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseBridgeTokens is a log parse operation binding the contract event 0xfd68c031379d96b674b8ff93f8bba98792a892b18f15c19e26dc84485f4f33e2. -// -// Solidity: event BridgeTokens(address indexed tokenContractAddress, uint256 indexed teleporterMessageID, bytes32 destinationChainID, address destinationBridgeAddress, address recipient, uint256 transferAmount, uint256 feeAmount) -func (_NativeTokenReceiver *NativeTokenReceiverFilterer) ParseBridgeTokens(log types.Log) (*NativeTokenReceiverBridgeTokens, error) { - event := new(NativeTokenReceiverBridgeTokens) - if err := _NativeTokenReceiver.contract.UnpackLog(event, "BridgeTokens", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// NativeTokenReceiverUnlockTokensIterator is returned from FilterUnlockTokens and is used to iterate over the raw logs and unpacked data for UnlockTokens events raised by the NativeTokenReceiver contract. -type NativeTokenReceiverUnlockTokensIterator struct { - Event *NativeTokenReceiverUnlockTokens // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub interfaces.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *NativeTokenReceiverUnlockTokensIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(NativeTokenReceiverUnlockTokens) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(NativeTokenReceiverUnlockTokens) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *NativeTokenReceiverUnlockTokensIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *NativeTokenReceiverUnlockTokensIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// NativeTokenReceiverUnlockTokens represents a UnlockTokens event raised by the NativeTokenReceiver contract. -type NativeTokenReceiverUnlockTokens struct { - Recipient common.Address - Amount *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterUnlockTokens is a free log retrieval operation binding the contract event 0x55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407. -// -// Solidity: event UnlockTokens(address recipient, uint256 amount) -func (_NativeTokenReceiver *NativeTokenReceiverFilterer) FilterUnlockTokens(opts *bind.FilterOpts) (*NativeTokenReceiverUnlockTokensIterator, error) { - - logs, sub, err := _NativeTokenReceiver.contract.FilterLogs(opts, "UnlockTokens") - if err != nil { - return nil, err - } - return &NativeTokenReceiverUnlockTokensIterator{contract: _NativeTokenReceiver.contract, event: "UnlockTokens", logs: logs, sub: sub}, nil -} - -// WatchUnlockTokens is a free log subscription operation binding the contract event 0x55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407. -// -// Solidity: event UnlockTokens(address recipient, uint256 amount) -func (_NativeTokenReceiver *NativeTokenReceiverFilterer) WatchUnlockTokens(opts *bind.WatchOpts, sink chan<- *NativeTokenReceiverUnlockTokens) (event.Subscription, error) { - - logs, sub, err := _NativeTokenReceiver.contract.WatchLogs(opts, "UnlockTokens") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(NativeTokenReceiverUnlockTokens) - if err := _NativeTokenReceiver.contract.UnpackLog(event, "UnlockTokens", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseUnlockTokens is a log parse operation binding the contract event 0x55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407. -// -// Solidity: event UnlockTokens(address recipient, uint256 amount) -func (_NativeTokenReceiver *NativeTokenReceiverFilterer) ParseUnlockTokens(log types.Log) (*NativeTokenReceiverUnlockTokens, error) { - event := new(NativeTokenReceiverUnlockTokens) - if err := _NativeTokenReceiver.contract.UnpackLog(event, "UnlockTokens", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} diff --git a/contracts/abi/NativeTokenSource.go b/contracts/abi/NativeTokenSource.go new file mode 100644 index 000000000..87d818200 --- /dev/null +++ b/contracts/abi/NativeTokenSource.go @@ -0,0 +1,702 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package abi + +import ( + "errors" + "math/big" + "strings" + + "github.com/ava-labs/subnet-evm/accounts/abi" + "github.com/ava-labs/subnet-evm/accounts/abi/bind" + "github.com/ava-labs/subnet-evm/core/types" + "github.com/ava-labs/subnet-evm/interfaces" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = interfaces.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// NativeTokenSourceMetaData contains all meta data concerning the NativeTokenSource contract. +var NativeTokenSourceMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationContractAddress_\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationChainID_\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CannotBridgeTokenWithinSameChain\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"adjustedAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"InsufficientAdjustedAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientPayment\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidDestinationContractAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidPartnerContractAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidRecipient\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidRecipientAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSourceChain\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTeleporterMessengerAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Unauthorized\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"tokenContractAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destinationBridgeAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"transferAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WARP_PRECOMPILE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentChainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationChainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"nativeChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeBridgeAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeTokenContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", +} + +// NativeTokenSourceABI is the input ABI used to generate the binding from. +// Deprecated: Use NativeTokenSourceMetaData.ABI instead. +var NativeTokenSourceABI = NativeTokenSourceMetaData.ABI + +// NativeTokenSource is an auto generated Go binding around an Ethereum contract. +type NativeTokenSource struct { + NativeTokenSourceCaller // Read-only binding to the contract + NativeTokenSourceTransactor // Write-only binding to the contract + NativeTokenSourceFilterer // Log filterer for contract events +} + +// NativeTokenSourceCaller is an auto generated read-only Go binding around an Ethereum contract. +type NativeTokenSourceCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// NativeTokenSourceTransactor is an auto generated write-only Go binding around an Ethereum contract. +type NativeTokenSourceTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// NativeTokenSourceFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type NativeTokenSourceFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// NativeTokenSourceSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type NativeTokenSourceSession struct { + Contract *NativeTokenSource // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// NativeTokenSourceCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type NativeTokenSourceCallerSession struct { + Contract *NativeTokenSourceCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// NativeTokenSourceTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type NativeTokenSourceTransactorSession struct { + Contract *NativeTokenSourceTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// NativeTokenSourceRaw is an auto generated low-level Go binding around an Ethereum contract. +type NativeTokenSourceRaw struct { + Contract *NativeTokenSource // Generic contract binding to access the raw methods on +} + +// NativeTokenSourceCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type NativeTokenSourceCallerRaw struct { + Contract *NativeTokenSourceCaller // Generic read-only contract binding to access the raw methods on +} + +// NativeTokenSourceTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type NativeTokenSourceTransactorRaw struct { + Contract *NativeTokenSourceTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewNativeTokenSource creates a new instance of NativeTokenSource, bound to a specific deployed contract. +func NewNativeTokenSource(address common.Address, backend bind.ContractBackend) (*NativeTokenSource, error) { + contract, err := bindNativeTokenSource(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &NativeTokenSource{NativeTokenSourceCaller: NativeTokenSourceCaller{contract: contract}, NativeTokenSourceTransactor: NativeTokenSourceTransactor{contract: contract}, NativeTokenSourceFilterer: NativeTokenSourceFilterer{contract: contract}}, nil +} + +// NewNativeTokenSourceCaller creates a new read-only instance of NativeTokenSource, bound to a specific deployed contract. +func NewNativeTokenSourceCaller(address common.Address, caller bind.ContractCaller) (*NativeTokenSourceCaller, error) { + contract, err := bindNativeTokenSource(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &NativeTokenSourceCaller{contract: contract}, nil +} + +// NewNativeTokenSourceTransactor creates a new write-only instance of NativeTokenSource, bound to a specific deployed contract. +func NewNativeTokenSourceTransactor(address common.Address, transactor bind.ContractTransactor) (*NativeTokenSourceTransactor, error) { + contract, err := bindNativeTokenSource(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &NativeTokenSourceTransactor{contract: contract}, nil +} + +// NewNativeTokenSourceFilterer creates a new log filterer instance of NativeTokenSource, bound to a specific deployed contract. +func NewNativeTokenSourceFilterer(address common.Address, filterer bind.ContractFilterer) (*NativeTokenSourceFilterer, error) { + contract, err := bindNativeTokenSource(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &NativeTokenSourceFilterer{contract: contract}, nil +} + +// bindNativeTokenSource binds a generic wrapper to an already deployed contract. +func bindNativeTokenSource(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := NativeTokenSourceMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_NativeTokenSource *NativeTokenSourceRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _NativeTokenSource.Contract.NativeTokenSourceCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_NativeTokenSource *NativeTokenSourceRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _NativeTokenSource.Contract.NativeTokenSourceTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_NativeTokenSource *NativeTokenSourceRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _NativeTokenSource.Contract.NativeTokenSourceTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_NativeTokenSource *NativeTokenSourceCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _NativeTokenSource.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_NativeTokenSource *NativeTokenSourceTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _NativeTokenSource.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_NativeTokenSource *NativeTokenSourceTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _NativeTokenSource.Contract.contract.Transact(opts, method, params...) +} + +// MINTNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xb6171f73. +// +// Solidity: function MINT_NATIVE_TOKENS_REQUIRED_GAS() view returns(uint256) +func (_NativeTokenSource *NativeTokenSourceCaller) MINTNATIVETOKENSREQUIREDGAS(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _NativeTokenSource.contract.Call(opts, &out, "MINT_NATIVE_TOKENS_REQUIRED_GAS") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// MINTNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xb6171f73. +// +// Solidity: function MINT_NATIVE_TOKENS_REQUIRED_GAS() view returns(uint256) +func (_NativeTokenSource *NativeTokenSourceSession) MINTNATIVETOKENSREQUIREDGAS() (*big.Int, error) { + return _NativeTokenSource.Contract.MINTNATIVETOKENSREQUIREDGAS(&_NativeTokenSource.CallOpts) +} + +// MINTNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xb6171f73. +// +// Solidity: function MINT_NATIVE_TOKENS_REQUIRED_GAS() view returns(uint256) +func (_NativeTokenSource *NativeTokenSourceCallerSession) MINTNATIVETOKENSREQUIREDGAS() (*big.Int, error) { + return _NativeTokenSource.Contract.MINTNATIVETOKENSREQUIREDGAS(&_NativeTokenSource.CallOpts) +} + +// WARPPRECOMPILEADDRESS is a free data retrieval call binding the contract method 0x74971856. +// +// Solidity: function WARP_PRECOMPILE_ADDRESS() view returns(address) +func (_NativeTokenSource *NativeTokenSourceCaller) WARPPRECOMPILEADDRESS(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _NativeTokenSource.contract.Call(opts, &out, "WARP_PRECOMPILE_ADDRESS") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// WARPPRECOMPILEADDRESS is a free data retrieval call binding the contract method 0x74971856. +// +// Solidity: function WARP_PRECOMPILE_ADDRESS() view returns(address) +func (_NativeTokenSource *NativeTokenSourceSession) WARPPRECOMPILEADDRESS() (common.Address, error) { + return _NativeTokenSource.Contract.WARPPRECOMPILEADDRESS(&_NativeTokenSource.CallOpts) +} + +// WARPPRECOMPILEADDRESS is a free data retrieval call binding the contract method 0x74971856. +// +// Solidity: function WARP_PRECOMPILE_ADDRESS() view returns(address) +func (_NativeTokenSource *NativeTokenSourceCallerSession) WARPPRECOMPILEADDRESS() (common.Address, error) { + return _NativeTokenSource.Contract.WARPPRECOMPILEADDRESS(&_NativeTokenSource.CallOpts) +} + +// CurrentChainID is a free data retrieval call binding the contract method 0xb179e1e7. +// +// Solidity: function currentChainID() view returns(bytes32) +func (_NativeTokenSource *NativeTokenSourceCaller) CurrentChainID(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _NativeTokenSource.contract.Call(opts, &out, "currentChainID") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// CurrentChainID is a free data retrieval call binding the contract method 0xb179e1e7. +// +// Solidity: function currentChainID() view returns(bytes32) +func (_NativeTokenSource *NativeTokenSourceSession) CurrentChainID() ([32]byte, error) { + return _NativeTokenSource.Contract.CurrentChainID(&_NativeTokenSource.CallOpts) +} + +// CurrentChainID is a free data retrieval call binding the contract method 0xb179e1e7. +// +// Solidity: function currentChainID() view returns(bytes32) +func (_NativeTokenSource *NativeTokenSourceCallerSession) CurrentChainID() ([32]byte, error) { + return _NativeTokenSource.Contract.CurrentChainID(&_NativeTokenSource.CallOpts) +} + +// DestinationChainID is a free data retrieval call binding the contract method 0x7a9cffc8. +// +// Solidity: function destinationChainID() view returns(bytes32) +func (_NativeTokenSource *NativeTokenSourceCaller) DestinationChainID(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _NativeTokenSource.contract.Call(opts, &out, "destinationChainID") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// DestinationChainID is a free data retrieval call binding the contract method 0x7a9cffc8. +// +// Solidity: function destinationChainID() view returns(bytes32) +func (_NativeTokenSource *NativeTokenSourceSession) DestinationChainID() ([32]byte, error) { + return _NativeTokenSource.Contract.DestinationChainID(&_NativeTokenSource.CallOpts) +} + +// DestinationChainID is a free data retrieval call binding the contract method 0x7a9cffc8. +// +// Solidity: function destinationChainID() view returns(bytes32) +func (_NativeTokenSource *NativeTokenSourceCallerSession) DestinationChainID() ([32]byte, error) { + return _NativeTokenSource.Contract.DestinationChainID(&_NativeTokenSource.CallOpts) +} + +// DestinationContractAddress is a free data retrieval call binding the contract method 0x04d6baf7. +// +// Solidity: function destinationContractAddress() view returns(address) +func (_NativeTokenSource *NativeTokenSourceCaller) DestinationContractAddress(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _NativeTokenSource.contract.Call(opts, &out, "destinationContractAddress") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// DestinationContractAddress is a free data retrieval call binding the contract method 0x04d6baf7. +// +// Solidity: function destinationContractAddress() view returns(address) +func (_NativeTokenSource *NativeTokenSourceSession) DestinationContractAddress() (common.Address, error) { + return _NativeTokenSource.Contract.DestinationContractAddress(&_NativeTokenSource.CallOpts) +} + +// DestinationContractAddress is a free data retrieval call binding the contract method 0x04d6baf7. +// +// Solidity: function destinationContractAddress() view returns(address) +func (_NativeTokenSource *NativeTokenSourceCallerSession) DestinationContractAddress() (common.Address, error) { + return _NativeTokenSource.Contract.DestinationContractAddress(&_NativeTokenSource.CallOpts) +} + +// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// +// Solidity: function teleporterMessenger() view returns(address) +func (_NativeTokenSource *NativeTokenSourceCaller) TeleporterMessenger(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _NativeTokenSource.contract.Call(opts, &out, "teleporterMessenger") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// +// Solidity: function teleporterMessenger() view returns(address) +func (_NativeTokenSource *NativeTokenSourceSession) TeleporterMessenger() (common.Address, error) { + return _NativeTokenSource.Contract.TeleporterMessenger(&_NativeTokenSource.CallOpts) +} + +// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// +// Solidity: function teleporterMessenger() view returns(address) +func (_NativeTokenSource *NativeTokenSourceCallerSession) TeleporterMessenger() (common.Address, error) { + return _NativeTokenSource.Contract.TeleporterMessenger(&_NativeTokenSource.CallOpts) +} + +// ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. +// +// Solidity: function receiveTeleporterMessage(bytes32 nativeChainID, address nativeBridgeAddress, bytes message) returns() +func (_NativeTokenSource *NativeTokenSourceTransactor) ReceiveTeleporterMessage(opts *bind.TransactOpts, nativeChainID [32]byte, nativeBridgeAddress common.Address, message []byte) (*types.Transaction, error) { + return _NativeTokenSource.contract.Transact(opts, "receiveTeleporterMessage", nativeChainID, nativeBridgeAddress, message) +} + +// ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. +// +// Solidity: function receiveTeleporterMessage(bytes32 nativeChainID, address nativeBridgeAddress, bytes message) returns() +func (_NativeTokenSource *NativeTokenSourceSession) ReceiveTeleporterMessage(nativeChainID [32]byte, nativeBridgeAddress common.Address, message []byte) (*types.Transaction, error) { + return _NativeTokenSource.Contract.ReceiveTeleporterMessage(&_NativeTokenSource.TransactOpts, nativeChainID, nativeBridgeAddress, message) +} + +// ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. +// +// Solidity: function receiveTeleporterMessage(bytes32 nativeChainID, address nativeBridgeAddress, bytes message) returns() +func (_NativeTokenSource *NativeTokenSourceTransactorSession) ReceiveTeleporterMessage(nativeChainID [32]byte, nativeBridgeAddress common.Address, message []byte) (*types.Transaction, error) { + return _NativeTokenSource.Contract.ReceiveTeleporterMessage(&_NativeTokenSource.TransactOpts, nativeChainID, nativeBridgeAddress, message) +} + +// TransferToDestination is a paid mutator transaction binding the contract method 0x3c7bf510. +// +// Solidity: function transferToDestination(address recipient, address feeTokenContractAddress, uint256 feeAmount) payable returns() +func (_NativeTokenSource *NativeTokenSourceTransactor) TransferToDestination(opts *bind.TransactOpts, recipient common.Address, feeTokenContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { + return _NativeTokenSource.contract.Transact(opts, "transferToDestination", recipient, feeTokenContractAddress, feeAmount) +} + +// TransferToDestination is a paid mutator transaction binding the contract method 0x3c7bf510. +// +// Solidity: function transferToDestination(address recipient, address feeTokenContractAddress, uint256 feeAmount) payable returns() +func (_NativeTokenSource *NativeTokenSourceSession) TransferToDestination(recipient common.Address, feeTokenContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { + return _NativeTokenSource.Contract.TransferToDestination(&_NativeTokenSource.TransactOpts, recipient, feeTokenContractAddress, feeAmount) +} + +// TransferToDestination is a paid mutator transaction binding the contract method 0x3c7bf510. +// +// Solidity: function transferToDestination(address recipient, address feeTokenContractAddress, uint256 feeAmount) payable returns() +func (_NativeTokenSource *NativeTokenSourceTransactorSession) TransferToDestination(recipient common.Address, feeTokenContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { + return _NativeTokenSource.Contract.TransferToDestination(&_NativeTokenSource.TransactOpts, recipient, feeTokenContractAddress, feeAmount) +} + +// NativeTokenSourceTransferToDestinationIterator is returned from FilterTransferToDestination and is used to iterate over the raw logs and unpacked data for TransferToDestination events raised by the NativeTokenSource contract. +type NativeTokenSourceTransferToDestinationIterator struct { + Event *NativeTokenSourceTransferToDestination // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *NativeTokenSourceTransferToDestinationIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(NativeTokenSourceTransferToDestination) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(NativeTokenSourceTransferToDestination) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *NativeTokenSourceTransferToDestinationIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *NativeTokenSourceTransferToDestinationIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// NativeTokenSourceTransferToDestination represents a TransferToDestination event raised by the NativeTokenSource contract. +type NativeTokenSourceTransferToDestination struct { + TokenContractAddress common.Address + TeleporterMessageID *big.Int + DestinationChainID [32]byte + DestinationBridgeAddress common.Address + Recipient common.Address + TransferAmount *big.Int + FeeAmount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTransferToDestination is a free log retrieval operation binding the contract event 0x0bd44c3ad8913eab944c838cd210d05b9c7ec0254d9c1fdb0571af8b573c5b94. +// +// Solidity: event TransferToDestination(address indexed tokenContractAddress, uint256 indexed teleporterMessageID, bytes32 destinationChainID, address destinationBridgeAddress, address recipient, uint256 transferAmount, uint256 feeAmount) +func (_NativeTokenSource *NativeTokenSourceFilterer) FilterTransferToDestination(opts *bind.FilterOpts, tokenContractAddress []common.Address, teleporterMessageID []*big.Int) (*NativeTokenSourceTransferToDestinationIterator, error) { + + var tokenContractAddressRule []interface{} + for _, tokenContractAddressItem := range tokenContractAddress { + tokenContractAddressRule = append(tokenContractAddressRule, tokenContractAddressItem) + } + var teleporterMessageIDRule []interface{} + for _, teleporterMessageIDItem := range teleporterMessageID { + teleporterMessageIDRule = append(teleporterMessageIDRule, teleporterMessageIDItem) + } + + logs, sub, err := _NativeTokenSource.contract.FilterLogs(opts, "TransferToDestination", tokenContractAddressRule, teleporterMessageIDRule) + if err != nil { + return nil, err + } + return &NativeTokenSourceTransferToDestinationIterator{contract: _NativeTokenSource.contract, event: "TransferToDestination", logs: logs, sub: sub}, nil +} + +// WatchTransferToDestination is a free log subscription operation binding the contract event 0x0bd44c3ad8913eab944c838cd210d05b9c7ec0254d9c1fdb0571af8b573c5b94. +// +// Solidity: event TransferToDestination(address indexed tokenContractAddress, uint256 indexed teleporterMessageID, bytes32 destinationChainID, address destinationBridgeAddress, address recipient, uint256 transferAmount, uint256 feeAmount) +func (_NativeTokenSource *NativeTokenSourceFilterer) WatchTransferToDestination(opts *bind.WatchOpts, sink chan<- *NativeTokenSourceTransferToDestination, tokenContractAddress []common.Address, teleporterMessageID []*big.Int) (event.Subscription, error) { + + var tokenContractAddressRule []interface{} + for _, tokenContractAddressItem := range tokenContractAddress { + tokenContractAddressRule = append(tokenContractAddressRule, tokenContractAddressItem) + } + var teleporterMessageIDRule []interface{} + for _, teleporterMessageIDItem := range teleporterMessageID { + teleporterMessageIDRule = append(teleporterMessageIDRule, teleporterMessageIDItem) + } + + logs, sub, err := _NativeTokenSource.contract.WatchLogs(opts, "TransferToDestination", tokenContractAddressRule, teleporterMessageIDRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(NativeTokenSourceTransferToDestination) + if err := _NativeTokenSource.contract.UnpackLog(event, "TransferToDestination", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseTransferToDestination is a log parse operation binding the contract event 0x0bd44c3ad8913eab944c838cd210d05b9c7ec0254d9c1fdb0571af8b573c5b94. +// +// Solidity: event TransferToDestination(address indexed tokenContractAddress, uint256 indexed teleporterMessageID, bytes32 destinationChainID, address destinationBridgeAddress, address recipient, uint256 transferAmount, uint256 feeAmount) +func (_NativeTokenSource *NativeTokenSourceFilterer) ParseTransferToDestination(log types.Log) (*NativeTokenSourceTransferToDestination, error) { + event := new(NativeTokenSourceTransferToDestination) + if err := _NativeTokenSource.contract.UnpackLog(event, "TransferToDestination", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// NativeTokenSourceUnlockTokensIterator is returned from FilterUnlockTokens and is used to iterate over the raw logs and unpacked data for UnlockTokens events raised by the NativeTokenSource contract. +type NativeTokenSourceUnlockTokensIterator struct { + Event *NativeTokenSourceUnlockTokens // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *NativeTokenSourceUnlockTokensIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(NativeTokenSourceUnlockTokens) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(NativeTokenSourceUnlockTokens) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *NativeTokenSourceUnlockTokensIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *NativeTokenSourceUnlockTokensIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// NativeTokenSourceUnlockTokens represents a UnlockTokens event raised by the NativeTokenSource contract. +type NativeTokenSourceUnlockTokens struct { + Recipient common.Address + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterUnlockTokens is a free log retrieval operation binding the contract event 0x55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407. +// +// Solidity: event UnlockTokens(address recipient, uint256 amount) +func (_NativeTokenSource *NativeTokenSourceFilterer) FilterUnlockTokens(opts *bind.FilterOpts) (*NativeTokenSourceUnlockTokensIterator, error) { + + logs, sub, err := _NativeTokenSource.contract.FilterLogs(opts, "UnlockTokens") + if err != nil { + return nil, err + } + return &NativeTokenSourceUnlockTokensIterator{contract: _NativeTokenSource.contract, event: "UnlockTokens", logs: logs, sub: sub}, nil +} + +// WatchUnlockTokens is a free log subscription operation binding the contract event 0x55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407. +// +// Solidity: event UnlockTokens(address recipient, uint256 amount) +func (_NativeTokenSource *NativeTokenSourceFilterer) WatchUnlockTokens(opts *bind.WatchOpts, sink chan<- *NativeTokenSourceUnlockTokens) (event.Subscription, error) { + + logs, sub, err := _NativeTokenSource.contract.WatchLogs(opts, "UnlockTokens") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(NativeTokenSourceUnlockTokens) + if err := _NativeTokenSource.contract.UnpackLog(event, "UnlockTokens", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseUnlockTokens is a log parse operation binding the contract event 0x55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407. +// +// Solidity: event UnlockTokens(address recipient, uint256 amount) +func (_NativeTokenSource *NativeTokenSourceFilterer) ParseUnlockTokens(log types.Log) (*NativeTokenSourceUnlockTokens, error) { + event := new(NativeTokenSourceUnlockTokens) + if err := _NativeTokenSource.contract.UnpackLog(event, "UnlockTokens", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} From 4ec83d3cbc1412a40ffc391806f27cd2fd5f103b Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Fri, 29 Sep 2023 12:28:52 -0400 Subject: [PATCH 027/183] Format contracts --- .../INativeTokenDestination.sol | 6 +- .../NativeTokenBridge/INativeTokenSource.sol | 6 +- .../NativeTokenDestination.sol | 181 +++++++++-------- .../NativeTokenBridge/NativeTokenSource.sol | 188 +++++++++--------- 4 files changed, 197 insertions(+), 184 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol index 212ba40cf..766715989 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol @@ -9,7 +9,6 @@ pragma solidity 0.8.18; * @dev Interface that describes functionalities for a cross-chain ERC20 bridge. */ interface INativeTokenDestination { - /** * @dev Emitted when tokens are locked in this bridge contract to be bridged to another chain. */ @@ -26,10 +25,7 @@ interface INativeTokenDestination { /** * @dev Emitted when minting bridge tokens. */ - event MintNativeTokens( - address recipient, - uint256 amount - ); + event MintNativeTokens(address recipient, uint256 amount); /** * @dev Transfers ERC20 tokens to another chain. diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol index 5638ae383..388414838 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol @@ -9,7 +9,6 @@ pragma solidity 0.8.18; * @dev Interface that describes functionalities for a cross-chain ERC20 bridge. */ interface INativeTokenSource { - /** * @dev Emitted when tokens are locked in this bridge contract to be bridged to another chain. */ @@ -26,10 +25,7 @@ interface INativeTokenSource { /** * @dev Emitted when tokens are unlocked on this chain. */ - event UnlockTokens( - address recipient, - uint256 amount - ); + event UnlockTokens(address recipient, uint256 amount); /** * @dev Transfers native tokens to another chain as that chain's native token. diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index 379f73071..9753b8f56 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -15,89 +15,100 @@ address constant MINTER_ADDRESS = 0x0200000000000000000000000000000000000001; // Designated Blackhole Address address constant BLACKHOLE_ADDRESS = 0x0100000000000000000000000000000000000000; -contract NativeTokenDestination is ITeleporterReceiver, INativeTokenDestination, ReentrancyGuard { - INativeMinter private immutable _nativeMinter = INativeMinter(MINTER_ADDRESS); - - address public constant WARP_PRECOMPILE_ADDRESS = - 0x0200000000000000000000000000000000000005; - - uint256 public constant TRANSFER_NATIVE_TOKENS_REQUIRED_GAS = 3000_000; // TODO this is a placeholder - bytes32 public immutable currentChainID; - bytes32 public immutable sourceChainID; - address public immutable sourceContractAddress; - - // Used for sending an receiving Teleporter messages. - ITeleporterMessenger public immutable teleporterMessenger; - - error InvalidTeleporterMessengerAddress(); - error InvalidRecipientAddress(); - error InvalidSourceChain(); - error InvalidPartnerContractAddress(); - error CannotBridgeTokenWithinSameChain(); - error Unauthorized(); - error InsufficientPayment(); - error InvalidSourceContractAddress(); - error InsufficientAdjustedAmount(uint256 adjustedAmount, uint256 feeAmount); - - // TODO we probably want to add the original token supply from this chain to the constructor. - constructor(address teleporterMessengerAddress, address sourceContractAddress_, bytes32 sourceChainID_) { - currentChainID = WarpMessenger(WARP_PRECOMPILE_ADDRESS) - .getBlockchainID(); - - if (teleporterMessengerAddress == address(0)) { - revert InvalidTeleporterMessengerAddress(); - } - teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); +contract NativeTokenDestination is + ITeleporterReceiver, + INativeTokenDestination, + ReentrancyGuard +{ + INativeMinter private immutable _nativeMinter = + INativeMinter(MINTER_ADDRESS); + + address public constant WARP_PRECOMPILE_ADDRESS = + 0x0200000000000000000000000000000000000005; + + uint256 public constant TRANSFER_NATIVE_TOKENS_REQUIRED_GAS = 3000_000; // TODO this is a placeholder + bytes32 public immutable currentChainID; + bytes32 public immutable sourceChainID; + address public immutable sourceContractAddress; + + // Used for sending an receiving Teleporter messages. + ITeleporterMessenger public immutable teleporterMessenger; + + error InvalidTeleporterMessengerAddress(); + error InvalidRecipientAddress(); + error InvalidSourceChain(); + error InvalidPartnerContractAddress(); + error CannotBridgeTokenWithinSameChain(); + error Unauthorized(); + error InsufficientPayment(); + error InvalidSourceContractAddress(); + error InsufficientAdjustedAmount(uint256 adjustedAmount, uint256 feeAmount); + + // TODO we probably want to add the original token supply from this chain to the constructor. + constructor( + address teleporterMessengerAddress, + address sourceContractAddress_, + bytes32 sourceChainID_ + ) { + currentChainID = WarpMessenger(WARP_PRECOMPILE_ADDRESS) + .getBlockchainID(); + + if (teleporterMessengerAddress == address(0)) { + revert InvalidTeleporterMessengerAddress(); + } + teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); - if (sourceContractAddress_ == address(0)) { - revert InvalidSourceContractAddress(); - } - sourceContractAddress = sourceContractAddress_; + if (sourceContractAddress_ == address(0)) { + revert InvalidSourceContractAddress(); + } + sourceContractAddress = sourceContractAddress_; - if (sourceChainID_ == currentChainID) { - revert CannotBridgeTokenWithinSameChain(); - } - sourceChainID = sourceChainID_; - } - - /** - * @dev See {ITeleporterReceiver-receiveTeleporterMessage}. - * - * Receives a Teleporter message and routes to the appropriate internal function call. - */ - function receiveTeleporterMessage( - bytes32 nativeChainID, - address nativeBridgeAddress, - bytes calldata message - ) external nonReentrant() { - - // Only allow the Teleporter messenger to deliver messages. - if (msg.sender != address(teleporterMessenger)) { - revert Unauthorized(); - } - // Only allow messages from the partner chain. - if (nativeChainID != sourceChainID) { - revert InvalidSourceChain(); - } - // Only allow the partner contract to send messages. - if (nativeBridgeAddress != address(this)) { - revert InvalidPartnerContractAddress(); + if (sourceChainID_ == currentChainID) { + revert CannotBridgeTokenWithinSameChain(); + } + sourceChainID = sourceChainID_; } - (address recipient, uint256 amount) = abi.decode(message, (address, uint256)); + /** + * @dev See {ITeleporterReceiver-receiveTeleporterMessage}. + * + * Receives a Teleporter message and routes to the appropriate internal function call. + */ + function receiveTeleporterMessage( + bytes32 nativeChainID, + address nativeBridgeAddress, + bytes calldata message + ) external nonReentrant { + // Only allow the Teleporter messenger to deliver messages. + if (msg.sender != address(teleporterMessenger)) { + revert Unauthorized(); + } + // Only allow messages from the partner chain. + if (nativeChainID != sourceChainID) { + revert InvalidSourceChain(); + } + // Only allow the partner contract to send messages. + if (nativeBridgeAddress != address(this)) { + revert InvalidPartnerContractAddress(); + } - // Calls NativeMinter precompile through INativeMinter interface. - _nativeMinter.mintNativeCoin(recipient, amount); - emit MintNativeTokens(recipient, amount); - } + (address recipient, uint256 amount) = abi.decode( + message, + (address, uint256) + ); + + // Calls NativeMinter precompile through INativeMinter interface. + _nativeMinter.mintNativeCoin(recipient, amount); + emit MintNativeTokens(recipient, amount); + } /** - * @dev See {INativeTokenMinter-bridgeTokens}. - * - * Requirements: - * - * - `msg.value` must be greater than the fee amount. - */ + * @dev See {INativeTokenMinter-bridgeTokens}. + * + * Requirements: + * + * - `msg.value` must be greater than the fee amount. + */ function transferToSource( address recipient, address feeTokenContractAddress, @@ -112,15 +123,15 @@ contract NativeTokenDestination is ITeleporterReceiver, INativeTokenDestination, // implementations by only bridging the actual balance increase reflected by the call // to transferFrom. if (feeAmount > 0) { - uint256 adjustedAmount = SafeERC20TransferFrom.safeTransferFrom( - IERC20(feeTokenContractAddress), - feeAmount - ); - - // Ensure that the adjusted amount is greater than the fee to be paid. - if (adjustedAmount <= feeAmount) { - revert InsufficientAdjustedAmount(adjustedAmount, feeAmount); - } + uint256 adjustedAmount = SafeERC20TransferFrom.safeTransferFrom( + IERC20(feeTokenContractAddress), + feeAmount + ); + + // Ensure that the adjusted amount is greater than the fee to be paid. + if (adjustedAmount <= feeAmount) { + revert InsufficientAdjustedAmount(adjustedAmount, feeAmount); + } } // Burn native token by sending to BLACKHOLE_ADDRESS diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index 07eb8bd66..9cca94aea 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -8,93 +8,103 @@ import "../../Teleporter/ITeleporterMessenger.sol"; import "../../Teleporter/ITeleporterReceiver.sol"; import "../../Teleporter/SafeERC20TransferFrom.sol"; -contract NativeTokenSource is ITeleporterReceiver, INativeTokenSource, ReentrancyGuard { - address public constant WARP_PRECOMPILE_ADDRESS = - 0x0200000000000000000000000000000000000005; - - uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 2000_000; // TODO this is a placeholder - bytes32 public immutable currentChainID; - bytes32 public immutable destinationChainID; - address public immutable destinationContractAddress; - - // Used for sending an receiving Teleporter messages. - ITeleporterMessenger public immutable teleporterMessenger; - - error InvalidTeleporterMessengerAddress(); - error InvalidRecipientAddress(); - error InvalidSourceChain(); - error InvalidRecipient(); - error InvalidPartnerContractAddress(); - error CannotBridgeTokenWithinSameChain(); - error Unauthorized(); - error InsufficientPayment(); - error InvalidDestinationContractAddress(); - error InsufficientAdjustedAmount(uint256 adjustedAmount, uint256 feeAmount); - - constructor(address teleporterMessengerAddress, address destinationContractAddress_, bytes32 destinationChainID_) { - currentChainID = WarpMessenger(WARP_PRECOMPILE_ADDRESS) - .getBlockchainID(); - - if (teleporterMessengerAddress == address(0)) { - revert InvalidTeleporterMessengerAddress(); - } - teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); +contract NativeTokenSource is + ITeleporterReceiver, + INativeTokenSource, + ReentrancyGuard +{ + address public constant WARP_PRECOMPILE_ADDRESS = + 0x0200000000000000000000000000000000000005; + + uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 2000_000; // TODO this is a placeholder + bytes32 public immutable currentChainID; + bytes32 public immutable destinationChainID; + address public immutable destinationContractAddress; + + // Used for sending an receiving Teleporter messages. + ITeleporterMessenger public immutable teleporterMessenger; + + error InvalidTeleporterMessengerAddress(); + error InvalidRecipientAddress(); + error InvalidSourceChain(); + error InvalidRecipient(); + error InvalidPartnerContractAddress(); + error CannotBridgeTokenWithinSameChain(); + error Unauthorized(); + error InsufficientPayment(); + error InvalidDestinationContractAddress(); + error InsufficientAdjustedAmount(uint256 adjustedAmount, uint256 feeAmount); + + constructor( + address teleporterMessengerAddress, + address destinationContractAddress_, + bytes32 destinationChainID_ + ) { + currentChainID = WarpMessenger(WARP_PRECOMPILE_ADDRESS) + .getBlockchainID(); + + if (teleporterMessengerAddress == address(0)) { + revert InvalidTeleporterMessengerAddress(); + } + teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); - if (destinationContractAddress_ == address(0)) { - revert InvalidDestinationContractAddress(); - } - destinationContractAddress = destinationContractAddress_; + if (destinationContractAddress_ == address(0)) { + revert InvalidDestinationContractAddress(); + } + destinationContractAddress = destinationContractAddress_; - if (destinationChainID_ == currentChainID) { - revert CannotBridgeTokenWithinSameChain(); - } - destinationChainID = destinationChainID_; - } - - /** - * @dev See {ITeleporterReceiver-receiveTeleporterMessage}. - * - * Receives a Teleporter message and routes to the appropriate internal function call. - */ - function receiveTeleporterMessage( - bytes32 nativeChainID, - address nativeBridgeAddress, - bytes calldata message - ) external nonReentrant { - - // Only allow the Teleporter messenger to deliver messages. - if (msg.sender != address(teleporterMessenger)) { - revert Unauthorized(); - } - // Only allow messages from the partner chain. - if (nativeChainID != destinationChainID) { - revert InvalidSourceChain(); - } - // Only allow the partner contract to send messages. - if (nativeBridgeAddress != destinationContractAddress) { - revert InvalidPartnerContractAddress(); + if (destinationChainID_ == currentChainID) { + revert CannotBridgeTokenWithinSameChain(); + } + destinationChainID = destinationChainID_; } - (address recipient, uint256 amount) = abi.decode(message, (address, uint256)); - if (recipient == address(0)) { - revert InvalidRecipient(); - } + /** + * @dev See {ITeleporterReceiver-receiveTeleporterMessage}. + * + * Receives a Teleporter message and routes to the appropriate internal function call. + */ + function receiveTeleporterMessage( + bytes32 nativeChainID, + address nativeBridgeAddress, + bytes calldata message + ) external nonReentrant { + // Only allow the Teleporter messenger to deliver messages. + if (msg.sender != address(teleporterMessenger)) { + revert Unauthorized(); + } + // Only allow messages from the partner chain. + if (nativeChainID != destinationChainID) { + revert InvalidSourceChain(); + } + // Only allow the partner contract to send messages. + if (nativeBridgeAddress != destinationContractAddress) { + revert InvalidPartnerContractAddress(); + } - // TODO set up starting threshold. + (address recipient, uint256 amount) = abi.decode( + message, + (address, uint256) + ); + if (recipient == address(0)) { + revert InvalidRecipient(); + } - // Send to recipient - payable(recipient).transfer(amount); + // TODO set up starting threshold. - emit UnlockTokens(recipient, amount); - } + // Send to recipient + payable(recipient).transfer(amount); + + emit UnlockTokens(recipient, amount); + } /** - * @dev See {IERC20Bridge-bridgeTokens}. - * - * Requirements: - * - * - `msg.value` must be greater than the fee amount. - */ + * @dev See {IERC20Bridge-bridgeTokens}. + * + * Requirements: + * + * - `msg.value` must be greater than the fee amount. + */ function transferToDestination( address recipient, address feeTokenContractAddress, @@ -109,17 +119,17 @@ contract NativeTokenSource is ITeleporterReceiver, INativeTokenSource, Reentranc // implementations by only bridging the actual balance increase reflected by the call // to transferFrom. if (feeAmount > 0) { - uint256 adjustedAmount = SafeERC20TransferFrom.safeTransferFrom( - IERC20(feeTokenContractAddress), - feeAmount - ); - - // Ensure that the adjusted amount is greater than the fee to be paid. - // The secondary fee amount is not used in this case (and can assumed to be 0) since bridging - // a native token to another chain only ever involves a single cross-chain message. - if (adjustedAmount <= feeAmount) { - revert InsufficientAdjustedAmount(adjustedAmount, feeAmount); - } + uint256 adjustedAmount = SafeERC20TransferFrom.safeTransferFrom( + IERC20(feeTokenContractAddress), + feeAmount + ); + + // Ensure that the adjusted amount is greater than the fee to be paid. + // The secondary fee amount is not used in this case (and can assumed to be 0) since bridging + // a native token to another chain only ever involves a single cross-chain message. + if (adjustedAmount <= feeAmount) { + revert InsufficientAdjustedAmount(adjustedAmount, feeAmount); + } } // Send Teleporter message. From ece2e5bcf60d6712b188f0148a5b0463059a7768 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Fri, 29 Sep 2023 12:31:04 -0400 Subject: [PATCH 028/183] Fixup test --- tests/e2e_test.go | 176 +++++++++++++++++++++++----------------------- 1 file changed, 88 insertions(+), 88 deletions(-) diff --git a/tests/e2e_test.go b/tests/e2e_test.go index 557fce1d6..6c2c8c96e 100644 --- a/tests/e2e_test.go +++ b/tests/e2e_test.go @@ -478,7 +478,7 @@ var _ = ginkgo.Describe("[NativeTransfer two-way send]", ginkgo.Ordered, func() "src/CrossChainApplications/NativeTokenBridge/NativeTokenReceiver.sol:NativeTokenReceiver", "--rpc-url", chainARPCURI, "--private-key", hexutil.Encode(nativeTokenBridgeDeployerPK.D.Bytes()), - "--constructor-args", teleporterContractAddress.Hex(), hexutil.Encode(chainBIDInt.Bytes())) + "--constructor-args", teleporterContractAddress.Hex(), nativeTokenBridgeContractAddress.Hex(), hexutil.Encode(chainBIDInt.Bytes())) cmd.Dir = "./contracts" err = cmd.Run() @@ -490,7 +490,7 @@ var _ = ginkgo.Describe("[NativeTransfer two-way send]", ginkgo.Ordered, func() "src/CrossChainApplications/NativeTokenBridge/NativeTokenMinter.sol:NativeTokenMinter", "--rpc-url", chainBRPCURI, "--private-key", hexutil.Encode(nativeTokenBridgeDeployerPK.D.Bytes()), - "--constructor-args", teleporterContractAddress.Hex(), hexutil.Encode(chainAIDInt.Bytes())) + "--constructor-args", teleporterContractAddress.Hex(), nativeTokenBridgeContractAddress.Hex(), hexutil.Encode(chainAIDInt.Bytes())) cmd.Dir = "./contracts" err = cmd.Run() @@ -512,7 +512,7 @@ var _ = ginkgo.Describe("[NativeTransfer two-way send]", ginkgo.Ordered, func() ctx := context.Background() var err error - nativeTokenReceiver, err := abi.NewNativeTokenReceiver(nativeTokenBridgeContractAddress, chainARPCClient) + nativeTokenReceiver, err := abi.NewNativeTokenSource(nativeTokenBridgeContractAddress, chainARPCClient) Expect(err).Should(BeNil()) transactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, chainAIDInt) Expect(err).Should(BeNil()) @@ -522,7 +522,7 @@ var _ = ginkgo.Describe("[NativeTransfer two-way send]", ginkgo.Ordered, func() Expect(err).Should(BeNil()) defer subA.Unsubscribe() - tx, err := nativeTokenReceiver.BridgeTokens(transactor, tokenReceiverAddress, tokenReceiverAddress, big.NewInt(0)) + tx, err := nativeTokenReceiver.TransferToDestination(transactor, tokenReceiverAddress, tokenReceiverAddress, big.NewInt(0)) Expect(err).Should(BeNil()) log.Info("Sent NativeTokenTransfer transaction on source chain", "destinationChainID", blockchainIDB, "txHash", tx.Hash()) @@ -533,89 +533,89 @@ var _ = ginkgo.Describe("[NativeTransfer two-way send]", ginkgo.Ordered, func() Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) }) - // ginkgo.It("Relay message to destination", ginkgo.Label("NativeTransfer", "RelayMessage"), func() { - // ctx := context.Background() - - // // Get the latest block from Subnet A, and retrieve the warp message from the logs - // log.Info("Waiting for new block confirmation") - // newHeadA := <-newHeadsA - // blockHashA := newHeadA.Hash() - - // log.Info("Fetching relevant warp logs from the newly produced block") - // logs, err := chainARPCClient.FilterLogs(ctx, interfaces.FilterQuery{ - // BlockHash: &blockHashA, - // Addresses: []common.Address{warp.Module.Address}, - // }) - // Expect(err).Should(BeNil()) - // Expect(len(logs)).Should(Equal(1)) - - // // Check for relevant warp log from subscription and ensure that it matches - // // the log extracted from the last block. - // txLog := logs[0] - // log.Info("Parsing logData as unsigned warp message") - // unsignedMsg, err := avalancheWarp.ParseUnsignedMessage(txLog.Data) - // Expect(err).Should(BeNil()) - - // // Set local variables for the duration of the test - // unsignedWarpMessageID := unsignedMsg.ID() - // unsignedWarpMsg := unsignedMsg - // log.Info("Parsed unsignedWarpMsg", "unsignedWarpMessageID", unsignedWarpMessageID, "unsignedWarpMessage", unsignedWarpMsg) - - // // Loop over each client on chain A to ensure they all have time to accept the block. - // // Note: if we did not confirm this here, the next stage could be racy since it assumes every node - // // has accepted the block. - // waitForAllValidatorsToAcceptBlock(ctx, chainANodeURIs, blockchainIDA, newHeadA.Number.Uint64()) - - // // Get the aggregate signature for the Warp message - // log.Info("Fetching aggregate signature from the source chain validators") - // warpClient, err := warpBackend.NewClient(chainANodeURIs[0], blockchainIDA.String()) - // Expect(err).Should(BeNil()) - // signedWarpMessageBytes, err := warpClient.GetAggregateSignature(ctx, unsignedWarpMessageID, params.WarpQuorumDenominator) - // Expect(err).Should(BeNil()) - - // signedTxB := constructAndSendTransaction( - // ctx, - // signedWarpMessageBytes, - // big.NewInt(1), - // teleporterContractAddress, - // fundedAddress, - // fundedKey, - // chainBRPCClient, - // chainBIDInt, - // ) - - // // Sleep to ensure the new block is published to the subscriber - // time.Sleep(5 * time.Second) - // receipt, err := chainBRPCClient.TransactionReceipt(ctx, signedTxB.Hash()) - // Expect(err).Should(BeNil()) - - - - // cmd := exec.Command( - // "cast", - // "run", - // "--rpc-url", chainBRPCURI, - // "--verbose", - // signedTxB.Hash().Hex()) - - // fmt.Println(cmd.String()) - - // time.Sleep(5000 * time.Second) - - // fmt.Printf("IT'S A ME, LOGIO\n %+v\n", receipt) - - // output, err := cmd.Output() - // fmt.Printf("OUTPUT %v\n", hex.EncodeToString(output)) - // Expect(err).Should(BeNil()) - - // Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) - - // sendCrossChainMessageLog := receipt.Logs[0] - // var event SendCrossChainMessageEvent - // err = teleporter.EVMTeleporterContractABI.UnpackIntoInterface(&event, "SendCrossChainMessage", sendCrossChainMessageLog.Data) - // Expect(err).Should(BeNil()) - // teleporterMessageID = event.Message.MessageID - // teleporterMessageID.Uint64() // TODO remove - // }) + ginkgo.It("Relay message to destination", ginkgo.Label("NativeTransfer", "RelayMessage"), func() { + ctx := context.Background() + + // Get the latest block from Subnet A, and retrieve the warp message from the logs + log.Info("Waiting for new block confirmation") + newHeadA := <-newHeadsA + blockHashA := newHeadA.Hash() + + log.Info("Fetching relevant warp logs from the newly produced block") + logs, err := chainARPCClient.FilterLogs(ctx, interfaces.FilterQuery{ + BlockHash: &blockHashA, + Addresses: []common.Address{warp.Module.Address}, + }) + Expect(err).Should(BeNil()) + Expect(len(logs)).Should(Equal(1)) + + // Check for relevant warp log from subscription and ensure that it matches + // the log extracted from the last block. + txLog := logs[0] + log.Info("Parsing logData as unsigned warp message") + unsignedMsg, err := avalancheWarp.ParseUnsignedMessage(txLog.Data) + Expect(err).Should(BeNil()) + + // Set local variables for the duration of the test + unsignedWarpMessageID := unsignedMsg.ID() + unsignedWarpMsg := unsignedMsg + log.Info("Parsed unsignedWarpMsg", "unsignedWarpMessageID", unsignedWarpMessageID, "unsignedWarpMessage", unsignedWarpMsg) + + // Loop over each client on chain A to ensure they all have time to accept the block. + // Note: if we did not confirm this here, the next stage could be racy since it assumes every node + // has accepted the block. + waitForAllValidatorsToAcceptBlock(ctx, chainANodeURIs, blockchainIDA, newHeadA.Number.Uint64()) + + // Get the aggregate signature for the Warp message + log.Info("Fetching aggregate signature from the source chain validators") + warpClient, err := warpBackend.NewClient(chainANodeURIs[0], blockchainIDA.String()) + Expect(err).Should(BeNil()) + signedWarpMessageBytes, err := warpClient.GetAggregateSignature(ctx, unsignedWarpMessageID, params.WarpQuorumDenominator) + Expect(err).Should(BeNil()) + + signedTxB := constructAndSendTransaction( + ctx, + signedWarpMessageBytes, + big.NewInt(1), + teleporterContractAddress, + fundedAddress, + fundedKey, + chainBRPCClient, + chainBIDInt, + ) + + // Sleep to ensure the new block is published to the subscriber + time.Sleep(5 * time.Second) + receipt, err := chainBRPCClient.TransactionReceipt(ctx, signedTxB.Hash()) + Expect(err).Should(BeNil()) + + + + cmd := exec.Command( + "cast", + "run", + "--rpc-url", chainBRPCURI, + "--verbose", + signedTxB.Hash().Hex()) + + fmt.Println(cmd.String()) + + time.Sleep(5000 * time.Second) + + fmt.Printf("IT'S A ME, LOGIO\n %+v\n", receipt) + + output, err := cmd.Output() + fmt.Printf("OUTPUT %v\n", hex.EncodeToString(output)) + Expect(err).Should(BeNil()) + + Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + + sendCrossChainMessageLog := receipt.Logs[0] + var event SendCrossChainMessageEvent + err = teleporter.EVMTeleporterContractABI.UnpackIntoInterface(&event, "SendCrossChainMessage", sendCrossChainMessageLog.Data) + Expect(err).Should(BeNil()) + teleporterMessageID = event.Message.MessageID + teleporterMessageID.Uint64() // TODO remove + }) }) \ No newline at end of file From 4d00724007dd535ed3de75aca799f1a8f017f33d Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Fri, 29 Sep 2023 12:38:57 -0400 Subject: [PATCH 029/183] Fix comments in interfaces --- .../NativeTokenBridge/INativeTokenDestination.sol | 9 ++++----- .../NativeTokenBridge/INativeTokenSource.sol | 6 +++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol index 766715989..f107d7619 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol @@ -6,11 +6,11 @@ pragma solidity 0.8.18; /** - * @dev Interface that describes functionalities for a cross-chain ERC20 bridge. + * @dev Interface that describes functionalities for a cross-chain native token bridge. */ interface INativeTokenDestination { /** - * @dev Emitted when tokens are locked in this bridge contract to be bridged to another chain. + * @dev Emitted when tokens are burned in this bridge contract to be bridged to the source chain. */ event TransferToSource( address indexed tokenContractAddress, @@ -28,9 +28,8 @@ interface INativeTokenDestination { event MintNativeTokens(address recipient, uint256 amount); /** - * @dev Transfers ERC20 tokens to another chain. - * - * This can be wrapping, unwrapping, and transferring a wrapped token between two non-native chains. + * @dev This burns native tokens on this chain, and sends a message to the source + * chain to mint unlock tokens there. */ function transferToSource( address recipient, diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol index 388414838..525351dd3 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol @@ -6,11 +6,11 @@ pragma solidity 0.8.18; /** - * @dev Interface that describes functionalities for a cross-chain ERC20 bridge. + * @dev Interface that describes functionalities for a cross-chain native token bridge. */ interface INativeTokenSource { /** - * @dev Emitted when tokens are locked in this bridge contract to be bridged to another chain. + * @dev Emitted when tokens are locked in this bridge contract to be bridged to the destination chain. */ event TransferToDestination( address indexed tokenContractAddress, @@ -28,7 +28,7 @@ interface INativeTokenSource { event UnlockTokens(address recipient, uint256 amount); /** - * @dev Transfers native tokens to another chain as that chain's native token. + * @dev Transfers native tokens to the destination chain as that chain's native token. */ function transferToDestination( address recipient, From 6ca248fca6712656eed0a93f775b6bb2503e70bd Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Fri, 29 Sep 2023 14:32:05 -0400 Subject: [PATCH 030/183] Broken test --- .../NativeTokenDestination.sol | 2 +- .../NativeTokenBridge/NativeTokenSource.sol | 2 +- tests/e2e_test.go | 24 ++----------------- 3 files changed, 4 insertions(+), 24 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index 9753b8f56..b90aa7591 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -26,7 +26,7 @@ contract NativeTokenDestination is address public constant WARP_PRECOMPILE_ADDRESS = 0x0200000000000000000000000000000000000005; - uint256 public constant TRANSFER_NATIVE_TOKENS_REQUIRED_GAS = 3000_000; // TODO this is a placeholder + uint256 public constant TRANSFER_NATIVE_TOKENS_REQUIRED_GAS = 10_000_000; // TODO this is a placeholder bytes32 public immutable currentChainID; bytes32 public immutable sourceChainID; address public immutable sourceContractAddress; diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index 9cca94aea..72468649e 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -16,7 +16,7 @@ contract NativeTokenSource is address public constant WARP_PRECOMPILE_ADDRESS = 0x0200000000000000000000000000000000000005; - uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 2000_000; // TODO this is a placeholder + uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 10_000_000; // TODO this is a placeholder bytes32 public immutable currentChainID; bytes32 public immutable destinationChainID; address public immutable destinationContractAddress; diff --git a/tests/e2e_test.go b/tests/e2e_test.go index 6c2c8c96e..efb5edaae 100644 --- a/tests/e2e_test.go +++ b/tests/e2e_test.go @@ -475,7 +475,7 @@ var _ = ginkgo.Describe("[NativeTransfer two-way send]", ginkgo.Ordered, func() cmd := exec.Command( "forge", "create", - "src/CrossChainApplications/NativeTokenBridge/NativeTokenReceiver.sol:NativeTokenReceiver", + "src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol:NativeTokenSource", "--rpc-url", chainARPCURI, "--private-key", hexutil.Encode(nativeTokenBridgeDeployerPK.D.Bytes()), "--constructor-args", teleporterContractAddress.Hex(), nativeTokenBridgeContractAddress.Hex(), hexutil.Encode(chainBIDInt.Bytes())) @@ -487,7 +487,7 @@ var _ = ginkgo.Describe("[NativeTransfer two-way send]", ginkgo.Ordered, func() cmd = exec.Command( "forge", "create", - "src/CrossChainApplications/NativeTokenBridge/NativeTokenMinter.sol:NativeTokenMinter", + "src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol:NativeTokenDestination", "--rpc-url", chainBRPCURI, "--private-key", hexutil.Encode(nativeTokenBridgeDeployerPK.D.Bytes()), "--constructor-args", teleporterContractAddress.Hex(), nativeTokenBridgeContractAddress.Hex(), hexutil.Encode(chainAIDInt.Bytes())) @@ -588,26 +588,6 @@ var _ = ginkgo.Describe("[NativeTransfer two-way send]", ginkgo.Ordered, func() time.Sleep(5 * time.Second) receipt, err := chainBRPCClient.TransactionReceipt(ctx, signedTxB.Hash()) Expect(err).Should(BeNil()) - - - - cmd := exec.Command( - "cast", - "run", - "--rpc-url", chainBRPCURI, - "--verbose", - signedTxB.Hash().Hex()) - - fmt.Println(cmd.String()) - - time.Sleep(5000 * time.Second) - - fmt.Printf("IT'S A ME, LOGIO\n %+v\n", receipt) - - output, err := cmd.Output() - fmt.Printf("OUTPUT %v\n", hex.EncodeToString(output)) - Expect(err).Should(BeNil()) - Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) sendCrossChainMessageLog := receipt.Logs[0] From f9e7710145e111d13f766df58b7a9a0d9dde36b5 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Fri, 29 Sep 2023 18:19:35 -0400 Subject: [PATCH 031/183] Review fixes --- .../INativeTokenDestination.sol | 16 +++-- .../NativeTokenBridge/INativeTokenSource.sol | 17 +++-- .../NativeTokenDestination.sol | 63 +++++++------------ .../NativeTokenBridge/NativeTokenSource.sol | 63 +++++++------------ tests/e2e_test.go | 9 +-- 5 files changed, 75 insertions(+), 93 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol index f107d7619..e26771c88 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol @@ -9,16 +9,24 @@ pragma solidity 0.8.18; * @dev Interface that describes functionalities for a cross-chain native token bridge. */ interface INativeTokenDestination { + error InvalidTeleporterMessengerAddress(); + error InvalidRecipientAddress(); + error InvalidSourceChain(); + error InvalidPartnerContractAddress(); + error CannotBridgeTokenWithinSameChain(); + error Unauthorized(); + error InsufficientPayment(); + error InvalidSourceContractAddress(); + error InsufficientAdjustedAmount(uint256 adjustedAmount, uint256 feeAmount); + /** * @dev Emitted when tokens are burned in this bridge contract to be bridged to the source chain. */ event TransferToSource( - address indexed tokenContractAddress, uint256 indexed teleporterMessageID, - bytes32 destinationChainID, - address destinationBridgeAddress, address recipient, uint256 transferAmount, + address feeContractAddress, uint256 feeAmount ); @@ -33,7 +41,7 @@ interface INativeTokenDestination { */ function transferToSource( address recipient, - address feeTokenContractAddress, + address feeContractAddress, uint256 feeAmount ) external payable; } diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol index 525351dd3..dd6ac17da 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol @@ -9,16 +9,25 @@ pragma solidity 0.8.18; * @dev Interface that describes functionalities for a cross-chain native token bridge. */ interface INativeTokenSource { + error InvalidTeleporterMessengerAddress(); + error InvalidRecipientAddress(); + error InvalidSourceChain(); + error InvalidRecipient(); + error InvalidPartnerContractAddress(); + error CannotBridgeTokenWithinSameChain(); + error Unauthorized(); + error InsufficientPayment(); + error InvalidDestinationContractAddress(); + error InsufficientAdjustedAmount(uint256 adjustedAmount, uint256 feeAmount); + /** * @dev Emitted when tokens are locked in this bridge contract to be bridged to the destination chain. */ event TransferToDestination( - address indexed tokenContractAddress, uint256 indexed teleporterMessageID, - bytes32 destinationChainID, - address destinationBridgeAddress, address recipient, uint256 transferAmount, + address feeContractAddress, uint256 feeAmount ); @@ -32,7 +41,7 @@ interface INativeTokenSource { */ function transferToDestination( address recipient, - address feeTokenContractAddress, + address feeContractAddress, uint256 feeAmount ) external payable; } diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index b90aa7591..474b45fc1 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -13,20 +13,21 @@ import "../../Teleporter/SafeERC20TransferFrom.sol"; // Precompiled Native Minter Contract Address address constant MINTER_ADDRESS = 0x0200000000000000000000000000000000000001; // Designated Blackhole Address -address constant BLACKHOLE_ADDRESS = 0x0100000000000000000000000000000000000000; +address constant BLACKHOLE_ADDRESS = 0x0100000000000000000000000000000000000001; +// Precompiled Warp address +address constant WARP_PRECOMPILE_ADDRESS = 0x0200000000000000000000000000000000000005; contract NativeTokenDestination is ITeleporterReceiver, INativeTokenDestination, ReentrancyGuard { + using SafeERC20 for IERC20; + INativeMinter private immutable _nativeMinter = INativeMinter(MINTER_ADDRESS); - address public constant WARP_PRECOMPILE_ADDRESS = - 0x0200000000000000000000000000000000000005; - - uint256 public constant TRANSFER_NATIVE_TOKENS_REQUIRED_GAS = 10_000_000; // TODO this is a placeholder + uint256 public constant TRANSFER_NATIVE_TOKENS_REQUIRED_GAS = 150_000; // TODO this is a placeholder bytes32 public immutable currentChainID; bytes32 public immutable sourceChainID; address public immutable sourceContractAddress; @@ -34,21 +35,11 @@ contract NativeTokenDestination is // Used for sending an receiving Teleporter messages. ITeleporterMessenger public immutable teleporterMessenger; - error InvalidTeleporterMessengerAddress(); - error InvalidRecipientAddress(); - error InvalidSourceChain(); - error InvalidPartnerContractAddress(); - error CannotBridgeTokenWithinSameChain(); - error Unauthorized(); - error InsufficientPayment(); - error InvalidSourceContractAddress(); - error InsufficientAdjustedAmount(uint256 adjustedAmount, uint256 feeAmount); - // TODO we probably want to add the original token supply from this chain to the constructor. constructor( address teleporterMessengerAddress, - address sourceContractAddress_, - bytes32 sourceChainID_ + bytes32 sourceChainID_, + address sourceContractAddress_ ) { currentChainID = WarpMessenger(WARP_PRECOMPILE_ADDRESS) .getBlockchainID(); @@ -75,8 +66,8 @@ contract NativeTokenDestination is * Receives a Teleporter message and routes to the appropriate internal function call. */ function receiveTeleporterMessage( - bytes32 nativeChainID, - address nativeBridgeAddress, + bytes32 senderChainID, + address senderAddress, bytes calldata message ) external nonReentrant { // Only allow the Teleporter messenger to deliver messages. @@ -84,11 +75,11 @@ contract NativeTokenDestination is revert Unauthorized(); } // Only allow messages from the partner chain. - if (nativeChainID != sourceChainID) { + if (senderChainID != sourceChainID) { revert InvalidSourceChain(); } // Only allow the partner contract to send messages. - if (nativeBridgeAddress != address(this)) { + if (senderAddress != sourceContractAddress) { revert InvalidPartnerContractAddress(); } @@ -104,14 +95,10 @@ contract NativeTokenDestination is /** * @dev See {INativeTokenMinter-bridgeTokens}. - * - * Requirements: - * - * - `msg.value` must be greater than the fee amount. */ function transferToSource( address recipient, - address feeTokenContractAddress, + address feeContractAddress, uint256 feeAmount ) external payable nonReentrant { // The recipient cannot be the zero address. @@ -122,16 +109,16 @@ contract NativeTokenDestination is // Lock tokens in this bridge instance. Supports "fee/burn on transfer" ERC20 token // implementations by only bridging the actual balance increase reflected by the call // to transferFrom. + uint256 adjustedAmount = 0; if (feeAmount > 0) { - uint256 adjustedAmount = SafeERC20TransferFrom.safeTransferFrom( - IERC20(feeTokenContractAddress), + adjustedAmount = SafeERC20TransferFrom.safeTransferFrom( + IERC20(feeContractAddress), feeAmount ); - - // Ensure that the adjusted amount is greater than the fee to be paid. - if (adjustedAmount <= feeAmount) { - revert InsufficientAdjustedAmount(adjustedAmount, feeAmount); - } + IERC20(feeContractAddress).safeIncreaseAllowance( + address(teleporterMessenger), + adjustedAmount + ); } // Burn native token by sending to BLACKHOLE_ADDRESS @@ -145,8 +132,8 @@ contract NativeTokenDestination is destinationChainID: sourceChainID, destinationAddress: sourceContractAddress, feeInfo: TeleporterFeeInfo({ - contractAddress: feeTokenContractAddress, - amount: feeAmount + contractAddress: feeContractAddress, + amount: adjustedAmount }), requiredGasLimit: TRANSFER_NATIVE_TOKENS_REQUIRED_GAS, allowedRelayerAddresses: new address[](0), @@ -155,13 +142,11 @@ contract NativeTokenDestination is ); emit TransferToSource({ - tokenContractAddress: feeTokenContractAddress, teleporterMessageID: messageID, - destinationChainID: sourceChainID, - destinationBridgeAddress: sourceContractAddress, recipient: recipient, transferAmount: msg.value, - feeAmount: feeAmount + feeContractAddress: feeContractAddress, + feeAmount: adjustedAmount }); } } diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index 72468649e..c6394a2b8 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -8,15 +8,17 @@ import "../../Teleporter/ITeleporterMessenger.sol"; import "../../Teleporter/ITeleporterReceiver.sol"; import "../../Teleporter/SafeERC20TransferFrom.sol"; +// Precompiled Warp address +address constant WARP_PRECOMPILE_ADDRESS = 0x0200000000000000000000000000000000000005; + contract NativeTokenSource is ITeleporterReceiver, INativeTokenSource, ReentrancyGuard { - address public constant WARP_PRECOMPILE_ADDRESS = - 0x0200000000000000000000000000000000000005; + using SafeERC20 for IERC20; - uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 10_000_000; // TODO this is a placeholder + uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 150_000; // TODO this is a placeholder bytes32 public immutable currentChainID; bytes32 public immutable destinationChainID; address public immutable destinationContractAddress; @@ -24,21 +26,10 @@ contract NativeTokenSource is // Used for sending an receiving Teleporter messages. ITeleporterMessenger public immutable teleporterMessenger; - error InvalidTeleporterMessengerAddress(); - error InvalidRecipientAddress(); - error InvalidSourceChain(); - error InvalidRecipient(); - error InvalidPartnerContractAddress(); - error CannotBridgeTokenWithinSameChain(); - error Unauthorized(); - error InsufficientPayment(); - error InvalidDestinationContractAddress(); - error InsufficientAdjustedAmount(uint256 adjustedAmount, uint256 feeAmount); - constructor( address teleporterMessengerAddress, - address destinationContractAddress_, - bytes32 destinationChainID_ + bytes32 destinationChainID_, + address destinationContractAddress_ ) { currentChainID = WarpMessenger(WARP_PRECOMPILE_ADDRESS) .getBlockchainID(); @@ -65,8 +56,8 @@ contract NativeTokenSource is * Receives a Teleporter message and routes to the appropriate internal function call. */ function receiveTeleporterMessage( - bytes32 nativeChainID, - address nativeBridgeAddress, + bytes32 senderChainID, + address senderAddress, bytes calldata message ) external nonReentrant { // Only allow the Teleporter messenger to deliver messages. @@ -74,11 +65,11 @@ contract NativeTokenSource is revert Unauthorized(); } // Only allow messages from the partner chain. - if (nativeChainID != destinationChainID) { + if (senderChainID != destinationChainID) { revert InvalidSourceChain(); } // Only allow the partner contract to send messages. - if (nativeBridgeAddress != destinationContractAddress) { + if (senderAddress != destinationContractAddress) { revert InvalidPartnerContractAddress(); } @@ -100,14 +91,10 @@ contract NativeTokenSource is /** * @dev See {IERC20Bridge-bridgeTokens}. - * - * Requirements: - * - * - `msg.value` must be greater than the fee amount. */ function transferToDestination( address recipient, - address feeTokenContractAddress, + address feeContractAddress, uint256 feeAmount ) external payable nonReentrant { // The recipient cannot be the zero address. @@ -118,18 +105,16 @@ contract NativeTokenSource is // Lock tokens in this bridge instance. Supports "fee/burn on transfer" ERC20 token // implementations by only bridging the actual balance increase reflected by the call // to transferFrom. + uint256 adjustedAmount = 0; if (feeAmount > 0) { - uint256 adjustedAmount = SafeERC20TransferFrom.safeTransferFrom( - IERC20(feeTokenContractAddress), + adjustedAmount = SafeERC20TransferFrom.safeTransferFrom( + IERC20(feeContractAddress), feeAmount ); - - // Ensure that the adjusted amount is greater than the fee to be paid. - // The secondary fee amount is not used in this case (and can assumed to be 0) since bridging - // a native token to another chain only ever involves a single cross-chain message. - if (adjustedAmount <= feeAmount) { - revert InsufficientAdjustedAmount(adjustedAmount, feeAmount); - } + IERC20(feeContractAddress).safeIncreaseAllowance( + address(teleporterMessenger), + adjustedAmount + ); } // Send Teleporter message. @@ -140,8 +125,8 @@ contract NativeTokenSource is destinationChainID: destinationChainID, destinationAddress: destinationContractAddress, feeInfo: TeleporterFeeInfo({ - contractAddress: feeTokenContractAddress, - amount: feeAmount + contractAddress: feeContractAddress, + amount: adjustedAmount }), requiredGasLimit: MINT_NATIVE_TOKENS_REQUIRED_GAS, allowedRelayerAddresses: new address[](0), @@ -150,13 +135,11 @@ contract NativeTokenSource is ); emit TransferToDestination({ - tokenContractAddress: feeTokenContractAddress, teleporterMessageID: messageID, - destinationChainID: destinationChainID, - destinationBridgeAddress: destinationContractAddress, recipient: recipient, transferAmount: msg.value, - feeAmount: feeAmount + feeContractAddress: feeContractAddress, + feeAmount: adjustedAmount }); } } diff --git a/tests/e2e_test.go b/tests/e2e_test.go index efb5edaae..744225a4d 100644 --- a/tests/e2e_test.go +++ b/tests/e2e_test.go @@ -6,7 +6,6 @@ package tests import ( "context" "crypto/ecdsa" - "encoding/hex" "fmt" "math/big" "os" @@ -20,9 +19,9 @@ import ( "github.com/ava-labs/awm-relayer/messages/teleporter" relayerEvm "github.com/ava-labs/awm-relayer/vms/evm" - // "github.com/ava-labs/subnet-evm/accounts/abi/bind" "github.com/ava-labs/subnet-evm/accounts/abi/bind" "github.com/ava-labs/subnet-evm/core/types" + // "github.com/ava-labs/subnet-evm/eth/tracers" "github.com/ava-labs/subnet-evm/ethclient" "github.com/ava-labs/subnet-evm/interfaces" @@ -33,8 +32,6 @@ import ( "github.com/ava-labs/subnet-evm/tests/utils/runner" warpBackend "github.com/ava-labs/subnet-evm/warp" - // warpPayload "github.com/ava-labs/subnet-evm/warp/payload" - // "github.com/ava-labs/teleporter/contracts/abi" deploymentUtils "github.com/ava-labs/teleporter/contract-deployment/utils" "github.com/ava-labs/teleporter/contracts/abi" @@ -478,7 +475,7 @@ var _ = ginkgo.Describe("[NativeTransfer two-way send]", ginkgo.Ordered, func() "src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol:NativeTokenSource", "--rpc-url", chainARPCURI, "--private-key", hexutil.Encode(nativeTokenBridgeDeployerPK.D.Bytes()), - "--constructor-args", teleporterContractAddress.Hex(), nativeTokenBridgeContractAddress.Hex(), hexutil.Encode(chainBIDInt.Bytes())) + "--constructor-args", teleporterContractAddress.Hex(), hexutil.Encode(chainBIDInt.Bytes()), nativeTokenBridgeContractAddress.Hex()) cmd.Dir = "./contracts" err = cmd.Run() @@ -490,7 +487,7 @@ var _ = ginkgo.Describe("[NativeTransfer two-way send]", ginkgo.Ordered, func() "src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol:NativeTokenDestination", "--rpc-url", chainBRPCURI, "--private-key", hexutil.Encode(nativeTokenBridgeDeployerPK.D.Bytes()), - "--constructor-args", teleporterContractAddress.Hex(), nativeTokenBridgeContractAddress.Hex(), hexutil.Encode(chainAIDInt.Bytes())) + "--constructor-args", teleporterContractAddress.Hex(), hexutil.Encode(chainAIDInt.Bytes()), nativeTokenBridgeContractAddress.Hex()) cmd.Dir = "./contracts" err = cmd.Run() From d01048488e954c5a3b6e9afe4873442a119c6a81 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 3 Oct 2023 13:55:20 -0400 Subject: [PATCH 032/183] Working mint --- docker/defaultChainConfig.json | 8 +------- docker/defaultNodeConfig.json | 8 +------- tests/e2e_test.go | 28 +++++++++++++++++++--------- tests/utils.go | 1 + tests/warp-genesis.json | 1 - 5 files changed, 22 insertions(+), 24 deletions(-) diff --git a/docker/defaultChainConfig.json b/docker/defaultChainConfig.json index 8b93f2e90..1eb85c60f 100644 --- a/docker/defaultChainConfig.json +++ b/docker/defaultChainConfig.json @@ -1,9 +1,3 @@ { - "log-level": "debug", - "contractNativeMinterConfig": { - "blockTimestamp": 0, - "adminAddresses": [ - "0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC" - ] - } + "log-level": "info" } \ No newline at end of file diff --git a/docker/defaultNodeConfig.json b/docker/defaultNodeConfig.json index 8b93f2e90..1eb85c60f 100644 --- a/docker/defaultNodeConfig.json +++ b/docker/defaultNodeConfig.json @@ -1,9 +1,3 @@ { - "log-level": "debug", - "contractNativeMinterConfig": { - "blockTimestamp": 0, - "adminAddresses": [ - "0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC" - ] - } + "log-level": "info" } \ No newline at end of file diff --git a/tests/e2e_test.go b/tests/e2e_test.go index 744225a4d..038bf633e 100644 --- a/tests/e2e_test.go +++ b/tests/e2e_test.go @@ -21,11 +21,9 @@ import ( "github.com/ava-labs/subnet-evm/accounts/abi/bind" "github.com/ava-labs/subnet-evm/core/types" - // "github.com/ava-labs/subnet-evm/eth/tracers" "github.com/ava-labs/subnet-evm/ethclient" "github.com/ava-labs/subnet-evm/interfaces" - // "github.com/ava-labs/subnet-evm/internal/debug" "github.com/ava-labs/subnet-evm/params" "github.com/ava-labs/subnet-evm/plugin/evm" "github.com/ava-labs/subnet-evm/rpc" @@ -106,7 +104,7 @@ var _ = ginkgo.BeforeSuite(func() { } f, err := os.CreateTemp(os.TempDir(), "config.json") Expect(err).Should(BeNil()) - _, err = f.Write([]byte(`{"warp-api-enabled": true}`)) + _, err = f.Write([]byte(`{"warp-api-enabled": true, "eth-apis":["eth","eth-filter","net","web3","internal-eth","internal-blockchain","internal-transaction","debug","debug-tracer"]}`)) Expect(err).Should(BeNil()) warpChainConfigPath = f.Name() @@ -456,6 +454,7 @@ var _ = ginkgo.Describe("[NativeTransfer two-way send]", ginkgo.Ordered, func() var ( teleporterMessageID *big.Int ) + valueToSend := int64(1000_000_000_000_000_000) // Send a transaction to Subnet A to issue a Warp Message from the Teleporter contract to Subnet B ginkgo.It("Deploy Contracts on chains A and B", ginkgo.Label("NativeTransfer", "DeployContracs"), func() { @@ -475,9 +474,10 @@ var _ = ginkgo.Describe("[NativeTransfer two-way send]", ginkgo.Ordered, func() "src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol:NativeTokenSource", "--rpc-url", chainARPCURI, "--private-key", hexutil.Encode(nativeTokenBridgeDeployerPK.D.Bytes()), - "--constructor-args", teleporterContractAddress.Hex(), hexutil.Encode(chainBIDInt.Bytes()), nativeTokenBridgeContractAddress.Hex()) + "--constructor-args", teleporterContractAddress.Hex(), "0x"+blockchainIDB.Hex(), nativeTokenBridgeContractAddress.Hex()) cmd.Dir = "./contracts" + fmt.Println("SOURCE ", cmd.String()) err = cmd.Run() Expect(err).Should(BeNil()) @@ -487,9 +487,10 @@ var _ = ginkgo.Describe("[NativeTransfer two-way send]", ginkgo.Ordered, func() "src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol:NativeTokenDestination", "--rpc-url", chainBRPCURI, "--private-key", hexutil.Encode(nativeTokenBridgeDeployerPK.D.Bytes()), - "--constructor-args", teleporterContractAddress.Hex(), hexutil.Encode(chainAIDInt.Bytes()), nativeTokenBridgeContractAddress.Hex()) + "--constructor-args", teleporterContractAddress.Hex(), "0x"+blockchainIDA.Hex(), nativeTokenBridgeContractAddress.Hex()) cmd.Dir = "./contracts" + fmt.Println("DEST ", cmd.String()) err = cmd.Run() Expect(err).Should(BeNil()) @@ -513,7 +514,7 @@ var _ = ginkgo.Describe("[NativeTransfer two-way send]", ginkgo.Ordered, func() Expect(err).Should(BeNil()) transactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, chainAIDInt) Expect(err).Should(BeNil()) - transactor.Value = big.NewInt(1000_000_000_000_000_000) + transactor.Value = big.NewInt(valueToSend) subA, err := chainAWSClient.SubscribeNewHead(ctx, newHeadsA) Expect(err).Should(BeNil()) @@ -521,7 +522,7 @@ var _ = ginkgo.Describe("[NativeTransfer two-way send]", ginkgo.Ordered, func() tx, err := nativeTokenReceiver.TransferToDestination(transactor, tokenReceiverAddress, tokenReceiverAddress, big.NewInt(0)) Expect(err).Should(BeNil()) - log.Info("Sent NativeTokenTransfer transaction on source chain", "destinationChainID", blockchainIDB, "txHash", tx.Hash()) + log.Info("Sent NativeTokenTransfer transaction on source chain", "destinationChainID", blockchainIDB, "txHash", tx.Hash().Hex()) // Sleep to ensure the new block is published to the subscriber time.Sleep(5 * time.Second) @@ -570,6 +571,11 @@ var _ = ginkgo.Describe("[NativeTransfer two-way send]", ginkgo.Ordered, func() signedWarpMessageBytes, err := warpClient.GetAggregateSignature(ctx, unsignedWarpMessageID, params.WarpQuorumDenominator) Expect(err).Should(BeNil()) + // Check starting balance is 0 + bal, err := chainBRPCClient.BalanceAt(ctx, tokenReceiverAddress, nil) + Expect(err).Should(BeNil()) + Expect(bal.Int64()).Should(Equal(common.Big0.Int64())) + signedTxB := constructAndSendTransaction( ctx, signedWarpMessageBytes, @@ -587,12 +593,16 @@ var _ = ginkgo.Describe("[NativeTransfer two-way send]", ginkgo.Ordered, func() Expect(err).Should(BeNil()) Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) - sendCrossChainMessageLog := receipt.Logs[0] + sendCrossChainMessageLog := receipt.Logs[2] var event SendCrossChainMessageEvent err = teleporter.EVMTeleporterContractABI.UnpackIntoInterface(&event, "SendCrossChainMessage", sendCrossChainMessageLog.Data) Expect(err).Should(BeNil()) teleporterMessageID = event.Message.MessageID - teleporterMessageID.Uint64() // TODO remove + teleporterMessageID.Uint64() + + bal, err = chainBRPCClient.BalanceAt(ctx, tokenReceiverAddress, nil) + Expect(err).Should(BeNil()) + Expect(bal.Int64()).Should(Equal(valueToSend)) }) }) \ No newline at end of file diff --git a/tests/utils.go b/tests/utils.go index 20e3d9746..192dbf1e9 100644 --- a/tests/utils.go +++ b/tests/utils.go @@ -200,6 +200,7 @@ func constructAndSendTransaction( log.Info("Sending transaction to destination chain") err = client.SendTransaction(context.Background(), signedTx) Expect(err).Should(BeNil()) + log.Info("Successfully sent transaction", "hash", signedTx.Hash().Hex()) return signedTx } diff --git a/tests/warp-genesis.json b/tests/warp-genesis.json index 4504fdc36..5bae402e9 100644 --- a/tests/warp-genesis.json +++ b/tests/warp-genesis.json @@ -29,7 +29,6 @@ "contractNativeMinterConfig": { "blockTimestamp": 0, "adminAddresses": [ - "0x1337cfd2dCff6270615B90938aCB1efE79801704", "0xAcB633F5B00099c7ec187eB00156c5cd9D854b5B" ] } From 52e2d3ae06ecd30774dd84c4b0d8142927b7b312 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 3 Oct 2023 13:59:22 -0400 Subject: [PATCH 033/183] linter --- .../INativeTokenDestination.sol | 20 ++++++++--------- .../NativeTokenBridge/INativeTokenSource.sol | 22 +++++++++---------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol index e26771c88..3a99bbede 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol @@ -9,16 +9,6 @@ pragma solidity 0.8.18; * @dev Interface that describes functionalities for a cross-chain native token bridge. */ interface INativeTokenDestination { - error InvalidTeleporterMessengerAddress(); - error InvalidRecipientAddress(); - error InvalidSourceChain(); - error InvalidPartnerContractAddress(); - error CannotBridgeTokenWithinSameChain(); - error Unauthorized(); - error InsufficientPayment(); - error InvalidSourceContractAddress(); - error InsufficientAdjustedAmount(uint256 adjustedAmount, uint256 feeAmount); - /** * @dev Emitted when tokens are burned in this bridge contract to be bridged to the source chain. */ @@ -34,6 +24,16 @@ interface INativeTokenDestination { * @dev Emitted when minting bridge tokens. */ event MintNativeTokens(address recipient, uint256 amount); + + error InvalidTeleporterMessengerAddress(); + error InvalidRecipientAddress(); + error InvalidSourceChain(); + error InvalidPartnerContractAddress(); + error CannotBridgeTokenWithinSameChain(); + error Unauthorized(); + error InsufficientPayment(); + error InvalidSourceContractAddress(); + error InsufficientAdjustedAmount(uint256 adjustedAmount, uint256 feeAmount); /** * @dev This burns native tokens on this chain, and sends a message to the source diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol index dd6ac17da..ea1a39892 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol @@ -9,17 +9,6 @@ pragma solidity 0.8.18; * @dev Interface that describes functionalities for a cross-chain native token bridge. */ interface INativeTokenSource { - error InvalidTeleporterMessengerAddress(); - error InvalidRecipientAddress(); - error InvalidSourceChain(); - error InvalidRecipient(); - error InvalidPartnerContractAddress(); - error CannotBridgeTokenWithinSameChain(); - error Unauthorized(); - error InsufficientPayment(); - error InvalidDestinationContractAddress(); - error InsufficientAdjustedAmount(uint256 adjustedAmount, uint256 feeAmount); - /** * @dev Emitted when tokens are locked in this bridge contract to be bridged to the destination chain. */ @@ -36,6 +25,17 @@ interface INativeTokenSource { */ event UnlockTokens(address recipient, uint256 amount); + error InvalidTeleporterMessengerAddress(); + error InvalidRecipientAddress(); + error InvalidSourceChain(); + error InvalidRecipient(); + error InvalidPartnerContractAddress(); + error CannotBridgeTokenWithinSameChain(); + error Unauthorized(); + error InsufficientPayment(); + error InvalidDestinationContractAddress(); + error InsufficientAdjustedAmount(uint256 adjustedAmount, uint256 feeAmount); + /** * @dev Transfers native tokens to the destination chain as that chain's native token. */ From ba18e5baea5b20df502fc4f91a780d378579f6ab Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Wed, 4 Oct 2023 10:31:00 -0400 Subject: [PATCH 034/183] Working e2e roundtrip --- tests/e2e_test.go | 116 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 106 insertions(+), 10 deletions(-) diff --git a/tests/e2e_test.go b/tests/e2e_test.go index 038bf633e..fca7f20f7 100644 --- a/tests/e2e_test.go +++ b/tests/e2e_test.go @@ -71,6 +71,7 @@ var ( chainARPCURI, chainBRPCURI string chainAIDInt, chainBIDInt *big.Int newHeadsA chan *types.Header + newHeadsB chan *types.Header ) func TestE2E(t *testing.T) { @@ -179,6 +180,7 @@ var _ = ginkgo.BeforeSuite(func() { chainAWSClient, err = ethclient.Dial(chainAWSURI) Expect(err).Should(BeNil()) chainARPCClient, err = ethclient.Dial(chainARPCURI) + defer chainARPCClient.Close() Expect(err).Should(BeNil()) chainAIDInt, err = chainARPCClient.ChainID(context.Background()) @@ -196,6 +198,7 @@ var _ = ginkgo.BeforeSuite(func() { Expect(err).Should(BeNil()) newHeadsA = make(chan *types.Header, 10) + newHeadsB = make(chan *types.Header, 10) log.Info("Finished setting up e2e test subnet variables") @@ -451,10 +454,8 @@ var _ = ginkgo.Describe("[Teleporter one way send]", ginkgo.Ordered, func() { }) var _ = ginkgo.Describe("[NativeTransfer two-way send]", ginkgo.Ordered, func() { - var ( - teleporterMessageID *big.Int - ) valueToSend := int64(1000_000_000_000_000_000) + valueToReturn := valueToSend/4 // Send a transaction to Subnet A to issue a Warp Message from the Teleporter contract to Subnet B ginkgo.It("Deploy Contracts on chains A and B", ginkgo.Label("NativeTransfer", "DeployContracs"), func() { @@ -506,11 +507,11 @@ var _ = ginkgo.Describe("[NativeTransfer two-way send]", ginkgo.Ordered, func() log.Info("Finished deploying Bridge contracts") }) - ginkgo.It("Transfer tokens from A to B", ginkgo.Label("NativeTransfer", "Send Teleporter mint message"), func() { + ginkgo.It("Transfer tokens from A to B", ginkgo.Label("NativeTransfer", "Lock and Mint"), func() { ctx := context.Background() var err error - nativeTokenReceiver, err := abi.NewNativeTokenSource(nativeTokenBridgeContractAddress, chainARPCClient) + nativeTokenSource, err := abi.NewNativeTokenSource(nativeTokenBridgeContractAddress, chainARPCClient) Expect(err).Should(BeNil()) transactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, chainAIDInt) Expect(err).Should(BeNil()) @@ -520,9 +521,9 @@ var _ = ginkgo.Describe("[NativeTransfer two-way send]", ginkgo.Ordered, func() Expect(err).Should(BeNil()) defer subA.Unsubscribe() - tx, err := nativeTokenReceiver.TransferToDestination(transactor, tokenReceiverAddress, tokenReceiverAddress, big.NewInt(0)) + tx, err := nativeTokenSource.TransferToDestination(transactor, tokenReceiverAddress, tokenReceiverAddress, big.NewInt(0)) Expect(err).Should(BeNil()) - log.Info("Sent NativeTokenTransfer transaction on source chain", "destinationChainID", blockchainIDB, "txHash", tx.Hash().Hex()) + log.Info("Sent TransferToDestination transaction on source chain", "destinationChainID", blockchainIDB, "txHash", tx.Hash().Hex()) // Sleep to ensure the new block is published to the subscriber time.Sleep(5 * time.Second) @@ -531,7 +532,7 @@ var _ = ginkgo.Describe("[NativeTransfer two-way send]", ginkgo.Ordered, func() Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) }) - ginkgo.It("Relay message to destination", ginkgo.Label("NativeTransfer", "RelayMessage"), func() { + ginkgo.It("Relay message to destination", ginkgo.Label("NativeTransfer", "RelayMessage A -> B"), func() { ctx := context.Background() // Get the latest block from Subnet A, and retrieve the warp message from the logs @@ -597,12 +598,107 @@ var _ = ginkgo.Describe("[NativeTransfer two-way send]", ginkgo.Ordered, func() var event SendCrossChainMessageEvent err = teleporter.EVMTeleporterContractABI.UnpackIntoInterface(&event, "SendCrossChainMessage", sendCrossChainMessageLog.Data) Expect(err).Should(BeNil()) - teleporterMessageID = event.Message.MessageID - teleporterMessageID.Uint64() bal, err = chainBRPCClient.BalanceAt(ctx, tokenReceiverAddress, nil) Expect(err).Should(BeNil()) Expect(bal.Int64()).Should(Equal(valueToSend)) }) + ginkgo.It("Transfer tokens from B to A", ginkgo.Label("NativeTransfer", "Burn and Unlock"), func() { + ctx := context.Background() + var err error + + nativeTokenDestination, err := abi.NewNativeTokenDestination(nativeTokenBridgeContractAddress, chainBRPCClient) + Expect(err).Should(BeNil()) + transactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, chainBIDInt) + Expect(err).Should(BeNil()) + transactor.Value = big.NewInt(valueToReturn) + + subB, err := chainBWSClient.SubscribeNewHead(ctx, newHeadsB) + Expect(err).Should(BeNil()) + defer subB.Unsubscribe() + + tx, err := nativeTokenDestination.TransferToSource(transactor, tokenReceiverAddress, tokenReceiverAddress, big.NewInt(0)) + Expect(err).Should(BeNil()) + log.Info("Sent TransferToSource transaction on destination chain", "sourceChainID", blockchainIDA, "txHash", tx.Hash().Hex()) + + // Sleep to ensure the new block is published to the subscriber + time.Sleep(5 * time.Second) + receipt, err := chainBRPCClient.TransactionReceipt(ctx, tx.Hash()) + Expect(err).Should(BeNil()) + Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + }) + + ginkgo.It("Relay message to source", ginkgo.Label("NativeTransfer", "RelayMessage B -> A"), func() { + ctx := context.Background() + + // Get the latest block from Subnet A, and retrieve the warp message from the logs + log.Info("Waiting for new block confirmation") + newHeadB := <-newHeadsB + blockHashB := newHeadB.Hash() + + log.Info("Fetching relevant warp logs from the newly produced block") + logs, err := chainBRPCClient.FilterLogs(ctx, interfaces.FilterQuery{ + BlockHash: &blockHashB, + Addresses: []common.Address{warp.Module.Address}, + }) + Expect(err).Should(BeNil()) + Expect(len(logs)).Should(Equal(1)) + + // Check for relevant warp log from subscription and ensure that it matches + // the log extracted from the last block. + txLog := logs[0] + log.Info("Parsing logData as unsigned warp message") + unsignedMsg, err := avalancheWarp.ParseUnsignedMessage(txLog.Data) + Expect(err).Should(BeNil()) + + // Set local variables for the duration of the test + unsignedWarpMessageID := unsignedMsg.ID() + unsignedWarpMsg := unsignedMsg + log.Info("Parsed unsignedWarpMsg", "unsignedWarpMessageID", unsignedWarpMessageID, "unsignedWarpMessage", unsignedWarpMsg) + + // Loop over each client on chain A to ensure they all have time to accept the block. + // Note: if we did not confirm this here, the next stage could be racy since it assumes every node + // has accepted the block. + waitForAllValidatorsToAcceptBlock(ctx, chainBNodeURIs, blockchainIDB, newHeadB.Number.Uint64()) + + // Get the aggregate signature for the Warp message + log.Info("Fetching aggregate signature from the source chain validators") + warpClient, err := warpBackend.NewClient(chainBNodeURIs[0], blockchainIDB.String()) + Expect(err).Should(BeNil()) + signedWarpMessageBytes, err := warpClient.GetAggregateSignature(ctx, unsignedWarpMessageID, params.WarpQuorumDenominator) + Expect(err).Should(BeNil()) + + // Check starting balance is 0 + bal, err := chainARPCClient.BalanceAt(ctx, tokenReceiverAddress, nil) + Expect(err).Should(BeNil()) + Expect(bal.Int64()).Should(Equal(common.Big0.Int64())) + + signedTxA := constructAndSendTransaction( + ctx, + signedWarpMessageBytes, + big.NewInt(1), + teleporterContractAddress, + fundedAddress, + fundedKey, + chainARPCClient, + chainAIDInt, + ) + + // Sleep to ensure the new block is published to the subscriber + time.Sleep(5 * time.Second) + receipt, err := chainARPCClient.TransactionReceipt(ctx, signedTxA.Hash()) + Expect(err).Should(BeNil()) + Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + + sendCrossChainMessageLog := receipt.Logs[2] + var event SendCrossChainMessageEvent + err = teleporter.EVMTeleporterContractABI.UnpackIntoInterface(&event, "SendCrossChainMessage", sendCrossChainMessageLog.Data) + Expect(err).Should(BeNil()) + + bal, err = chainARPCClient.BalanceAt(ctx, tokenReceiverAddress, nil) + Expect(err).Should(BeNil()) + Expect(bal.Int64()).Should(Equal(valueToReturn)) + }) + }) \ No newline at end of file From c9c2cc90fb89ddd882e90df5ce5362d97b206b6c Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Wed, 4 Oct 2023 11:05:26 -0400 Subject: [PATCH 035/183] Change revert to require --- .../INativeTokenDestination.sol | 10 ---- .../NativeTokenBridge/INativeTokenSource.sol | 11 ---- .../NativeTokenDestination.sol | 46 +++++++---------- .../NativeTokenBridge/NativeTokenSource.sol | 51 +++++++------------ 4 files changed, 36 insertions(+), 82 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol index 3a99bbede..65deafcf8 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol @@ -24,16 +24,6 @@ interface INativeTokenDestination { * @dev Emitted when minting bridge tokens. */ event MintNativeTokens(address recipient, uint256 amount); - - error InvalidTeleporterMessengerAddress(); - error InvalidRecipientAddress(); - error InvalidSourceChain(); - error InvalidPartnerContractAddress(); - error CannotBridgeTokenWithinSameChain(); - error Unauthorized(); - error InsufficientPayment(); - error InvalidSourceContractAddress(); - error InsufficientAdjustedAmount(uint256 adjustedAmount, uint256 feeAmount); /** * @dev This burns native tokens on this chain, and sends a message to the source diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol index ea1a39892..3c3514d93 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol @@ -25,17 +25,6 @@ interface INativeTokenSource { */ event UnlockTokens(address recipient, uint256 amount); - error InvalidTeleporterMessengerAddress(); - error InvalidRecipientAddress(); - error InvalidSourceChain(); - error InvalidRecipient(); - error InvalidPartnerContractAddress(); - error CannotBridgeTokenWithinSameChain(); - error Unauthorized(); - error InsufficientPayment(); - error InvalidDestinationContractAddress(); - error InsufficientAdjustedAmount(uint256 adjustedAmount, uint256 feeAmount); - /** * @dev Transfers native tokens to the destination chain as that chain's native token. */ diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index 474b45fc1..2838f4d35 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -28,8 +28,8 @@ contract NativeTokenDestination is INativeMinter(MINTER_ADDRESS); uint256 public constant TRANSFER_NATIVE_TOKENS_REQUIRED_GAS = 150_000; // TODO this is a placeholder - bytes32 public immutable currentChainID; - bytes32 public immutable sourceChainID; + bytes32 public immutable currentBlockchainID; + bytes32 public immutable sourceBlockchainID; address public immutable sourceContractAddress; // Used for sending an receiving Teleporter messages. @@ -38,26 +38,20 @@ contract NativeTokenDestination is // TODO we probably want to add the original token supply from this chain to the constructor. constructor( address teleporterMessengerAddress, - bytes32 sourceChainID_, + bytes32 sourceBlockchainID_, address sourceContractAddress_ ) { - currentChainID = WarpMessenger(WARP_PRECOMPILE_ADDRESS) + currentBlockchainID = WarpMessenger(WARP_PRECOMPILE_ADDRESS) .getBlockchainID(); - if (teleporterMessengerAddress == address(0)) { - revert InvalidTeleporterMessengerAddress(); - } + require(teleporterMessengerAddress != address(0), "Invalid Teleporter Messenger Address"); teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); - if (sourceContractAddress_ == address(0)) { - revert InvalidSourceContractAddress(); - } + require(sourceContractAddress_ != address(0), "Invalid Source Contract Address"); sourceContractAddress = sourceContractAddress_; - if (sourceChainID_ == currentChainID) { - revert CannotBridgeTokenWithinSameChain(); - } - sourceChainID = sourceChainID_; + require(sourceBlockchainID_ != currentBlockchainID, "Cannot Bridge With Same Blockchain"); + sourceBlockchainID = sourceBlockchainID_; } /** @@ -66,22 +60,18 @@ contract NativeTokenDestination is * Receives a Teleporter message and routes to the appropriate internal function call. */ function receiveTeleporterMessage( - bytes32 senderChainID, + bytes32 senderBlockchainID, address senderAddress, bytes calldata message ) external nonReentrant { // Only allow the Teleporter messenger to deliver messages. - if (msg.sender != address(teleporterMessenger)) { - revert Unauthorized(); - } - // Only allow messages from the partner chain. - if (senderChainID != sourceChainID) { - revert InvalidSourceChain(); - } + require(msg.sender == address(teleporterMessenger), "Unauthorized"); + + // Only allow messages from the source chain. + require(senderBlockchainID == sourceBlockchainID, "Invalid Source Chain"); + // Only allow the partner contract to send messages. - if (senderAddress != sourceContractAddress) { - revert InvalidPartnerContractAddress(); - } + require(senderAddress == sourceContractAddress, "Invalid Sender address"); (address recipient, uint256 amount) = abi.decode( message, @@ -102,9 +92,7 @@ contract NativeTokenDestination is uint256 feeAmount ) external payable nonReentrant { // The recipient cannot be the zero address. - if (recipient == address(0)) { - revert InvalidRecipientAddress(); - } + require(recipient != address(0), "Invalid Recipient Address"); // Lock tokens in this bridge instance. Supports "fee/burn on transfer" ERC20 token // implementations by only bridging the actual balance increase reflected by the call @@ -129,7 +117,7 @@ contract NativeTokenDestination is uint256 messageID = teleporterMessenger.sendCrossChainMessage( TeleporterMessageInput({ - destinationChainID: sourceChainID, + destinationChainID: sourceBlockchainID, destinationAddress: sourceContractAddress, feeInfo: TeleporterFeeInfo({ contractAddress: feeContractAddress, diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index c6394a2b8..d09ee565a 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -19,8 +19,8 @@ contract NativeTokenSource is using SafeERC20 for IERC20; uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 150_000; // TODO this is a placeholder - bytes32 public immutable currentChainID; - bytes32 public immutable destinationChainID; + bytes32 public immutable currentBlockchainID; + bytes32 public immutable destinationBlockchainID; address public immutable destinationContractAddress; // Used for sending an receiving Teleporter messages. @@ -28,26 +28,20 @@ contract NativeTokenSource is constructor( address teleporterMessengerAddress, - bytes32 destinationChainID_, + bytes32 destinationBlockchainID_, address destinationContractAddress_ ) { - currentChainID = WarpMessenger(WARP_PRECOMPILE_ADDRESS) + currentBlockchainID = WarpMessenger(WARP_PRECOMPILE_ADDRESS) .getBlockchainID(); - if (teleporterMessengerAddress == address(0)) { - revert InvalidTeleporterMessengerAddress(); - } + require(teleporterMessengerAddress != address(0), "Invalid Teleporter Messenger Address"); teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); - if (destinationContractAddress_ == address(0)) { - revert InvalidDestinationContractAddress(); - } + require(destinationContractAddress_ != address(0), "Invalid Destination Contract Address"); destinationContractAddress = destinationContractAddress_; - if (destinationChainID_ == currentChainID) { - revert CannotBridgeTokenWithinSameChain(); - } - destinationChainID = destinationChainID_; + require(destinationBlockchainID_ != currentBlockchainID, "Cannot Bridge With Same Blockchain"); + destinationBlockchainID = destinationBlockchainID_; } /** @@ -56,30 +50,25 @@ contract NativeTokenSource is * Receives a Teleporter message and routes to the appropriate internal function call. */ function receiveTeleporterMessage( - bytes32 senderChainID, + bytes32 senderBlockchainID, address senderAddress, bytes calldata message ) external nonReentrant { + // Only allow the Teleporter messenger to deliver messages. - if (msg.sender != address(teleporterMessenger)) { - revert Unauthorized(); - } - // Only allow messages from the partner chain. - if (senderChainID != destinationChainID) { - revert InvalidSourceChain(); - } + require(msg.sender == address(teleporterMessenger), "Unauthorized"); + + // Only allow messages from the destination chain. + require(senderBlockchainID == destinationBlockchainID, "Invalid Destination Chain"); + // Only allow the partner contract to send messages. - if (senderAddress != destinationContractAddress) { - revert InvalidPartnerContractAddress(); - } + require(senderAddress == destinationContractAddress, "Invalid Sender address"); (address recipient, uint256 amount) = abi.decode( message, (address, uint256) ); - if (recipient == address(0)) { - revert InvalidRecipient(); - } + require(recipient != address(0), "Invalid Recipient Address"); // TODO set up starting threshold. @@ -98,9 +87,7 @@ contract NativeTokenSource is uint256 feeAmount ) external payable nonReentrant { // The recipient cannot be the zero address. - if (recipient == address(0)) { - revert InvalidRecipientAddress(); - } + require(recipient != address(0), "Invalid Recipient Address"); // Lock tokens in this bridge instance. Supports "fee/burn on transfer" ERC20 token // implementations by only bridging the actual balance increase reflected by the call @@ -122,7 +109,7 @@ contract NativeTokenSource is uint256 messageID = teleporterMessenger.sendCrossChainMessage( TeleporterMessageInput({ - destinationChainID: destinationChainID, + destinationChainID: destinationBlockchainID, destinationAddress: destinationContractAddress, feeInfo: TeleporterFeeInfo({ contractAddress: feeContractAddress, From 9c2c7008886b8b8b68888d785a57591aed791587 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Wed, 4 Oct 2023 11:46:02 -0400 Subject: [PATCH 036/183] clean up contracts --- .../INativeTokenDestination.sol | 9 ++++--- .../NativeTokenBridge/INativeTokenSource.sol | 9 ++++--- .../NativeTokenDestination.sol | 25 ++++++++++++------- .../NativeTokenBridge/NativeTokenSource.sol | 18 +++++++------ 4 files changed, 36 insertions(+), 25 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol index 65deafcf8..701c67d11 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol @@ -13,11 +13,12 @@ interface INativeTokenDestination { * @dev Emitted when tokens are burned in this bridge contract to be bridged to the source chain. */ event TransferToSource( - uint256 indexed teleporterMessageID, - address recipient, - uint256 transferAmount, + address indexed sender, + address indexed recipient, + uint256 amount, address feeContractAddress, - uint256 feeAmount + uint256 feeAmount, + uint256 teleporterMessageID ); /** diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol index 3c3514d93..13d2a6fde 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol @@ -13,11 +13,12 @@ interface INativeTokenSource { * @dev Emitted when tokens are locked in this bridge contract to be bridged to the destination chain. */ event TransferToDestination( - uint256 indexed teleporterMessageID, - address recipient, - uint256 transferAmount, + address indexed sender, + address indexed recipient, + uint256 amount, address feeContractAddress, - uint256 feeAmount + uint256 feeAmount, + uint256 teleporterMessageID ); /** diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index 2838f4d35..97901f0ab 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -12,7 +12,12 @@ import "../../Teleporter/SafeERC20TransferFrom.sol"; // Precompiled Native Minter Contract Address address constant MINTER_ADDRESS = 0x0200000000000000000000000000000000000001; -// Designated Blackhole Address +// This is the address where the burned base fee go. We use this to send the amount of +// burned tokens back to the source chain. +address constant BURNED_TX_FEES_ADDRESS = 0x0100000000000000000000000000000000000000; +// Designated Blackhole Address. This is where we burn token before sending an unlock +// message to the source chain. Different from the burned tx fee address so we can +// track each separately. address constant BLACKHOLE_ADDRESS = 0x0100000000000000000000000000000000000001; // Precompiled Warp address address constant WARP_PRECOMPILE_ADDRESS = 0x0200000000000000000000000000000000000005; @@ -47,11 +52,12 @@ contract NativeTokenDestination is require(teleporterMessengerAddress != address(0), "Invalid Teleporter Messenger Address"); teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); - require(sourceContractAddress_ != address(0), "Invalid Source Contract Address"); - sourceContractAddress = sourceContractAddress_; - + require(sourceBlockchainID_ != bytes32(0), "Invalid Source Chain ID"); require(sourceBlockchainID_ != currentBlockchainID, "Cannot Bridge With Same Blockchain"); sourceBlockchainID = sourceBlockchainID_; + + require(sourceContractAddress_ != address(0), "Invalid Source Contract Address"); + sourceContractAddress = sourceContractAddress_; } /** @@ -65,13 +71,13 @@ contract NativeTokenDestination is bytes calldata message ) external nonReentrant { // Only allow the Teleporter messenger to deliver messages. - require(msg.sender == address(teleporterMessenger), "Unauthorized"); + require(msg.sender == address(teleporterMessenger), "Unauthorized teleporter contract"); // Only allow messages from the source chain. require(senderBlockchainID == sourceBlockchainID, "Invalid Source Chain"); // Only allow the partner contract to send messages. - require(senderAddress == sourceContractAddress, "Invalid Sender address"); + require(senderAddress == sourceContractAddress, "Unauthorized Sender"); (address recipient, uint256 amount) = abi.decode( message, @@ -130,11 +136,12 @@ contract NativeTokenDestination is ); emit TransferToSource({ - teleporterMessageID: messageID, + sender: msg.sender, recipient: recipient, - transferAmount: msg.value, + amount: msg.value, feeContractAddress: feeContractAddress, - feeAmount: adjustedAmount + feeAmount: adjustedAmount, + teleporterMessageID: messageID }); } } diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index d09ee565a..5891e06f7 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -37,11 +37,12 @@ contract NativeTokenSource is require(teleporterMessengerAddress != address(0), "Invalid Teleporter Messenger Address"); teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); - require(destinationContractAddress_ != address(0), "Invalid Destination Contract Address"); - destinationContractAddress = destinationContractAddress_; - + require(destinationBlockchainID_ != bytes32(0), "Invalid Destination Chain ID"); require(destinationBlockchainID_ != currentBlockchainID, "Cannot Bridge With Same Blockchain"); destinationBlockchainID = destinationBlockchainID_; + + require(destinationContractAddress_ != address(0), "Invalid Destination Contract Address"); + destinationContractAddress = destinationContractAddress_; } /** @@ -56,13 +57,13 @@ contract NativeTokenSource is ) external nonReentrant { // Only allow the Teleporter messenger to deliver messages. - require(msg.sender == address(teleporterMessenger), "Unauthorized"); + require(msg.sender == address(teleporterMessenger), "Unauthorized teleporter contract"); // Only allow messages from the destination chain. require(senderBlockchainID == destinationBlockchainID, "Invalid Destination Chain"); // Only allow the partner contract to send messages. - require(senderAddress == destinationContractAddress, "Invalid Sender address"); + require(senderAddress == destinationContractAddress, "Unauthorized Sender"); (address recipient, uint256 amount) = abi.decode( message, @@ -122,11 +123,12 @@ contract NativeTokenSource is ); emit TransferToDestination({ - teleporterMessageID: messageID, + sender: msg.sender, recipient: recipient, - transferAmount: msg.value, + amount: msg.value, feeContractAddress: feeContractAddress, - feeAmount: adjustedAmount + feeAmount: adjustedAmount, + teleporterMessageID: messageID }); } } From 03a473fbe2992627c01708c3b8587efab3cc7231 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Wed, 4 Oct 2023 12:26:16 -0400 Subject: [PATCH 037/183] Add tokenReserve --- .../INativeTokenDestination.sol | 7 +++ .../NativeTokenDestination.sol | 57 ++++++++++++++++--- .../NativeTokenBridge/NativeTokenSource.sol | 38 +++++++++---- 3 files changed, 84 insertions(+), 18 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol index 701c67d11..6389a0d94 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol @@ -20,6 +20,13 @@ interface INativeTokenDestination { uint256 feeAmount, uint256 teleporterMessageID ); + /** + * @dev Emitted when tokens are not minted in order to collateralize the source contract. + */ + event CollateralAdded( + uint256 amount, + uint256 remaining + ); /** * @dev Emitted when minting bridge tokens. diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index 97901f0ab..4a53c2ba1 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -36,6 +36,10 @@ contract NativeTokenDestination is bytes32 public immutable currentBlockchainID; bytes32 public immutable sourceBlockchainID; address public immutable sourceContractAddress; + // We will not mint the first `tokenReserve` tokens sent to this subnet. + // This should be constructed to match the initial token supply of this subnet. + // This will mean we will not mint tokens until the source contact is collateralized. + uint256 public tokenReserve; // Used for sending an receiving Teleporter messages. ITeleporterMessenger public immutable teleporterMessenger; @@ -44,20 +48,32 @@ contract NativeTokenDestination is constructor( address teleporterMessengerAddress, bytes32 sourceBlockchainID_, - address sourceContractAddress_ + address sourceContractAddress_, + uint256 tokenReserve_ ) { currentBlockchainID = WarpMessenger(WARP_PRECOMPILE_ADDRESS) .getBlockchainID(); - require(teleporterMessengerAddress != address(0), "Invalid Teleporter Messenger Address"); + require( + teleporterMessengerAddress != address(0), + "Invalid Teleporter Messenger Address" + ); teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); require(sourceBlockchainID_ != bytes32(0), "Invalid Source Chain ID"); - require(sourceBlockchainID_ != currentBlockchainID, "Cannot Bridge With Same Blockchain"); + require( + sourceBlockchainID_ != currentBlockchainID, + "Cannot Bridge With Same Blockchain" + ); sourceBlockchainID = sourceBlockchainID_; - require(sourceContractAddress_ != address(0), "Invalid Source Contract Address"); + require( + sourceContractAddress_ != address(0), + "Invalid Source Contract Address" + ); sourceContractAddress = sourceContractAddress_; + + tokenReserve = tokenReserve_; } /** @@ -71,10 +87,16 @@ contract NativeTokenDestination is bytes calldata message ) external nonReentrant { // Only allow the Teleporter messenger to deliver messages. - require(msg.sender == address(teleporterMessenger), "Unauthorized teleporter contract"); + require( + msg.sender == address(teleporterMessenger), + "Unauthorized teleporter contract" + ); // Only allow messages from the source chain. - require(senderBlockchainID == sourceBlockchainID, "Invalid Source Chain"); + require( + senderBlockchainID == sourceBlockchainID, + "Invalid Source Chain" + ); // Only allow the partner contract to send messages. require(senderAddress == sourceContractAddress, "Unauthorized Sender"); @@ -83,10 +105,24 @@ contract NativeTokenDestination is message, (address, uint256) ); + require(recipient != address(0), "Invalid Recipient Address"); + + uint256 adjustedAmount = amount; + if (tokenReserve > 0) { + if (amount > tokenReserve) { + emit CollateralAdded({amount: tokenReserve, remaining: 0}); + adjustedAmount = amount - tokenReserve; + tokenReserve = 0; + } else { + tokenReserve -= amount; + emit CollateralAdded({amount: amount, remaining: tokenReserve}); + return; + } + } // Calls NativeMinter precompile through INativeMinter interface. - _nativeMinter.mintNativeCoin(recipient, amount); - emit MintNativeTokens(recipient, amount); + _nativeMinter.mintNativeCoin(recipient, adjustedAmount); + emit MintNativeTokens(recipient, adjustedAmount); } /** @@ -100,6 +136,11 @@ contract NativeTokenDestination is // The recipient cannot be the zero address. require(recipient != address(0), "Invalid Recipient Address"); + require( + tokenReserve == 0, + "Cannot release tokens until source contract is collateralized" + ); + // Lock tokens in this bridge instance. Supports "fee/burn on transfer" ERC20 token // implementations by only bridging the actual balance increase reflected by the call // to transferFrom. diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index 5891e06f7..d76336ea9 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -34,14 +34,26 @@ contract NativeTokenSource is currentBlockchainID = WarpMessenger(WARP_PRECOMPILE_ADDRESS) .getBlockchainID(); - require(teleporterMessengerAddress != address(0), "Invalid Teleporter Messenger Address"); + require( + teleporterMessengerAddress != address(0), + "Invalid Teleporter Messenger Address" + ); teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); - require(destinationBlockchainID_ != bytes32(0), "Invalid Destination Chain ID"); - require(destinationBlockchainID_ != currentBlockchainID, "Cannot Bridge With Same Blockchain"); + require( + destinationBlockchainID_ != bytes32(0), + "Invalid Destination Chain ID" + ); + require( + destinationBlockchainID_ != currentBlockchainID, + "Cannot Bridge With Same Blockchain" + ); destinationBlockchainID = destinationBlockchainID_; - require(destinationContractAddress_ != address(0), "Invalid Destination Contract Address"); + require( + destinationContractAddress_ != address(0), + "Invalid Destination Contract Address" + ); destinationContractAddress = destinationContractAddress_; } @@ -55,15 +67,23 @@ contract NativeTokenSource is address senderAddress, bytes calldata message ) external nonReentrant { - // Only allow the Teleporter messenger to deliver messages. - require(msg.sender == address(teleporterMessenger), "Unauthorized teleporter contract"); + require( + msg.sender == address(teleporterMessenger), + "Unauthorized teleporter contract" + ); // Only allow messages from the destination chain. - require(senderBlockchainID == destinationBlockchainID, "Invalid Destination Chain"); + require( + senderBlockchainID == destinationBlockchainID, + "Invalid Destination Chain" + ); // Only allow the partner contract to send messages. - require(senderAddress == destinationContractAddress, "Unauthorized Sender"); + require( + senderAddress == destinationContractAddress, + "Unauthorized Sender" + ); (address recipient, uint256 amount) = abi.decode( message, @@ -71,8 +91,6 @@ contract NativeTokenSource is ); require(recipient != address(0), "Invalid Recipient Address"); - // TODO set up starting threshold. - // Send to recipient payable(recipient).transfer(amount); From 3f36fb3c4eef3b1982bc17e3495c21d434a2b6cb Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Wed, 4 Oct 2023 12:28:55 -0400 Subject: [PATCH 038/183] remove check for custom errors --- contracts/src/.solhint.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contracts/src/.solhint.json b/contracts/src/.solhint.json index 457ab6485..821499e56 100644 --- a/contracts/src/.solhint.json +++ b/contracts/src/.solhint.json @@ -26,6 +26,7 @@ ], "func-named-parameters": ["warn", 5], "no-global-import": "off", - "one-contract-per-file": "off" + "one-contract-per-file": "off", + "custom-errors": "off" } } From eeecf1f3a6eed730d1f82597cf39a3e70d3c3725 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Wed, 4 Oct 2023 16:21:22 -0400 Subject: [PATCH 039/183] Update abi --- contracts/abi/NativeTokenDestination.go | 342 +++++++++++++++++------- contracts/abi/NativeTokenSource.go | 176 +++++------- 2 files changed, 310 insertions(+), 208 deletions(-) diff --git a/contracts/abi/NativeTokenDestination.go b/contracts/abi/NativeTokenDestination.go index 8deab1ac8..607427ef0 100644 --- a/contracts/abi/NativeTokenDestination.go +++ b/contracts/abi/NativeTokenDestination.go @@ -31,7 +31,7 @@ var ( // NativeTokenDestinationMetaData contains all meta data concerning the NativeTokenDestination contract. var NativeTokenDestinationMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"sourceContractAddress_\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceChainID_\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CannotBridgeTokenWithinSameChain\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"adjustedAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"InsufficientAdjustedAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientPayment\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidPartnerContractAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidRecipientAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSourceChain\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSourceContractAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTeleporterMessengerAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Unauthorized\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"MintNativeTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"tokenContractAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destinationBridgeAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"transferAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WARP_PRECOMPILE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentChainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"nativeChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeBridgeAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceChainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeTokenContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"sourceContractAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenReserve_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"MintNativeTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tokenReserve\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", } // NativeTokenDestinationABI is the input ABI used to generate the binding from. @@ -211,43 +211,12 @@ func (_NativeTokenDestination *NativeTokenDestinationCallerSession) TRANSFERNATI return _NativeTokenDestination.Contract.TRANSFERNATIVETOKENSREQUIREDGAS(&_NativeTokenDestination.CallOpts) } -// WARPPRECOMPILEADDRESS is a free data retrieval call binding the contract method 0x74971856. +// CurrentBlockchainID is a free data retrieval call binding the contract method 0x4950d2d0. // -// Solidity: function WARP_PRECOMPILE_ADDRESS() view returns(address) -func (_NativeTokenDestination *NativeTokenDestinationCaller) WARPPRECOMPILEADDRESS(opts *bind.CallOpts) (common.Address, error) { +// Solidity: function currentBlockchainID() view returns(bytes32) +func (_NativeTokenDestination *NativeTokenDestinationCaller) CurrentBlockchainID(opts *bind.CallOpts) ([32]byte, error) { var out []interface{} - err := _NativeTokenDestination.contract.Call(opts, &out, "WARP_PRECOMPILE_ADDRESS") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// WARPPRECOMPILEADDRESS is a free data retrieval call binding the contract method 0x74971856. -// -// Solidity: function WARP_PRECOMPILE_ADDRESS() view returns(address) -func (_NativeTokenDestination *NativeTokenDestinationSession) WARPPRECOMPILEADDRESS() (common.Address, error) { - return _NativeTokenDestination.Contract.WARPPRECOMPILEADDRESS(&_NativeTokenDestination.CallOpts) -} - -// WARPPRECOMPILEADDRESS is a free data retrieval call binding the contract method 0x74971856. -// -// Solidity: function WARP_PRECOMPILE_ADDRESS() view returns(address) -func (_NativeTokenDestination *NativeTokenDestinationCallerSession) WARPPRECOMPILEADDRESS() (common.Address, error) { - return _NativeTokenDestination.Contract.WARPPRECOMPILEADDRESS(&_NativeTokenDestination.CallOpts) -} - -// CurrentChainID is a free data retrieval call binding the contract method 0xb179e1e7. -// -// Solidity: function currentChainID() view returns(bytes32) -func (_NativeTokenDestination *NativeTokenDestinationCaller) CurrentChainID(opts *bind.CallOpts) ([32]byte, error) { - var out []interface{} - err := _NativeTokenDestination.contract.Call(opts, &out, "currentChainID") + err := _NativeTokenDestination.contract.Call(opts, &out, "currentBlockchainID") if err != nil { return *new([32]byte), err @@ -259,26 +228,26 @@ func (_NativeTokenDestination *NativeTokenDestinationCaller) CurrentChainID(opts } -// CurrentChainID is a free data retrieval call binding the contract method 0xb179e1e7. +// CurrentBlockchainID is a free data retrieval call binding the contract method 0x4950d2d0. // -// Solidity: function currentChainID() view returns(bytes32) -func (_NativeTokenDestination *NativeTokenDestinationSession) CurrentChainID() ([32]byte, error) { - return _NativeTokenDestination.Contract.CurrentChainID(&_NativeTokenDestination.CallOpts) +// Solidity: function currentBlockchainID() view returns(bytes32) +func (_NativeTokenDestination *NativeTokenDestinationSession) CurrentBlockchainID() ([32]byte, error) { + return _NativeTokenDestination.Contract.CurrentBlockchainID(&_NativeTokenDestination.CallOpts) } -// CurrentChainID is a free data retrieval call binding the contract method 0xb179e1e7. +// CurrentBlockchainID is a free data retrieval call binding the contract method 0x4950d2d0. // -// Solidity: function currentChainID() view returns(bytes32) -func (_NativeTokenDestination *NativeTokenDestinationCallerSession) CurrentChainID() ([32]byte, error) { - return _NativeTokenDestination.Contract.CurrentChainID(&_NativeTokenDestination.CallOpts) +// Solidity: function currentBlockchainID() view returns(bytes32) +func (_NativeTokenDestination *NativeTokenDestinationCallerSession) CurrentBlockchainID() ([32]byte, error) { + return _NativeTokenDestination.Contract.CurrentBlockchainID(&_NativeTokenDestination.CallOpts) } -// SourceChainID is a free data retrieval call binding the contract method 0x4c335368. +// SourceBlockchainID is a free data retrieval call binding the contract method 0x29b7b3fd. // -// Solidity: function sourceChainID() view returns(bytes32) -func (_NativeTokenDestination *NativeTokenDestinationCaller) SourceChainID(opts *bind.CallOpts) ([32]byte, error) { +// Solidity: function sourceBlockchainID() view returns(bytes32) +func (_NativeTokenDestination *NativeTokenDestinationCaller) SourceBlockchainID(opts *bind.CallOpts) ([32]byte, error) { var out []interface{} - err := _NativeTokenDestination.contract.Call(opts, &out, "sourceChainID") + err := _NativeTokenDestination.contract.Call(opts, &out, "sourceBlockchainID") if err != nil { return *new([32]byte), err @@ -290,18 +259,18 @@ func (_NativeTokenDestination *NativeTokenDestinationCaller) SourceChainID(opts } -// SourceChainID is a free data retrieval call binding the contract method 0x4c335368. +// SourceBlockchainID is a free data retrieval call binding the contract method 0x29b7b3fd. // -// Solidity: function sourceChainID() view returns(bytes32) -func (_NativeTokenDestination *NativeTokenDestinationSession) SourceChainID() ([32]byte, error) { - return _NativeTokenDestination.Contract.SourceChainID(&_NativeTokenDestination.CallOpts) +// Solidity: function sourceBlockchainID() view returns(bytes32) +func (_NativeTokenDestination *NativeTokenDestinationSession) SourceBlockchainID() ([32]byte, error) { + return _NativeTokenDestination.Contract.SourceBlockchainID(&_NativeTokenDestination.CallOpts) } -// SourceChainID is a free data retrieval call binding the contract method 0x4c335368. +// SourceBlockchainID is a free data retrieval call binding the contract method 0x29b7b3fd. // -// Solidity: function sourceChainID() view returns(bytes32) -func (_NativeTokenDestination *NativeTokenDestinationCallerSession) SourceChainID() ([32]byte, error) { - return _NativeTokenDestination.Contract.SourceChainID(&_NativeTokenDestination.CallOpts) +// Solidity: function sourceBlockchainID() view returns(bytes32) +func (_NativeTokenDestination *NativeTokenDestinationCallerSession) SourceBlockchainID() ([32]byte, error) { + return _NativeTokenDestination.Contract.SourceBlockchainID(&_NativeTokenDestination.CallOpts) } // SourceContractAddress is a free data retrieval call binding the contract method 0x3a85f16a. @@ -366,46 +335,212 @@ func (_NativeTokenDestination *NativeTokenDestinationCallerSession) TeleporterMe return _NativeTokenDestination.Contract.TeleporterMessenger(&_NativeTokenDestination.CallOpts) } +// TokenReserve is a free data retrieval call binding the contract method 0xcbcb3171. +// +// Solidity: function tokenReserve() view returns(uint256) +func (_NativeTokenDestination *NativeTokenDestinationCaller) TokenReserve(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _NativeTokenDestination.contract.Call(opts, &out, "tokenReserve") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TokenReserve is a free data retrieval call binding the contract method 0xcbcb3171. +// +// Solidity: function tokenReserve() view returns(uint256) +func (_NativeTokenDestination *NativeTokenDestinationSession) TokenReserve() (*big.Int, error) { + return _NativeTokenDestination.Contract.TokenReserve(&_NativeTokenDestination.CallOpts) +} + +// TokenReserve is a free data retrieval call binding the contract method 0xcbcb3171. +// +// Solidity: function tokenReserve() view returns(uint256) +func (_NativeTokenDestination *NativeTokenDestinationCallerSession) TokenReserve() (*big.Int, error) { + return _NativeTokenDestination.Contract.TokenReserve(&_NativeTokenDestination.CallOpts) +} + // ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. // -// Solidity: function receiveTeleporterMessage(bytes32 nativeChainID, address nativeBridgeAddress, bytes message) returns() -func (_NativeTokenDestination *NativeTokenDestinationTransactor) ReceiveTeleporterMessage(opts *bind.TransactOpts, nativeChainID [32]byte, nativeBridgeAddress common.Address, message []byte) (*types.Transaction, error) { - return _NativeTokenDestination.contract.Transact(opts, "receiveTeleporterMessage", nativeChainID, nativeBridgeAddress, message) +// Solidity: function receiveTeleporterMessage(bytes32 senderBlockchainID, address senderAddress, bytes message) returns() +func (_NativeTokenDestination *NativeTokenDestinationTransactor) ReceiveTeleporterMessage(opts *bind.TransactOpts, senderBlockchainID [32]byte, senderAddress common.Address, message []byte) (*types.Transaction, error) { + return _NativeTokenDestination.contract.Transact(opts, "receiveTeleporterMessage", senderBlockchainID, senderAddress, message) } // ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. // -// Solidity: function receiveTeleporterMessage(bytes32 nativeChainID, address nativeBridgeAddress, bytes message) returns() -func (_NativeTokenDestination *NativeTokenDestinationSession) ReceiveTeleporterMessage(nativeChainID [32]byte, nativeBridgeAddress common.Address, message []byte) (*types.Transaction, error) { - return _NativeTokenDestination.Contract.ReceiveTeleporterMessage(&_NativeTokenDestination.TransactOpts, nativeChainID, nativeBridgeAddress, message) +// Solidity: function receiveTeleporterMessage(bytes32 senderBlockchainID, address senderAddress, bytes message) returns() +func (_NativeTokenDestination *NativeTokenDestinationSession) ReceiveTeleporterMessage(senderBlockchainID [32]byte, senderAddress common.Address, message []byte) (*types.Transaction, error) { + return _NativeTokenDestination.Contract.ReceiveTeleporterMessage(&_NativeTokenDestination.TransactOpts, senderBlockchainID, senderAddress, message) } // ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. // -// Solidity: function receiveTeleporterMessage(bytes32 nativeChainID, address nativeBridgeAddress, bytes message) returns() -func (_NativeTokenDestination *NativeTokenDestinationTransactorSession) ReceiveTeleporterMessage(nativeChainID [32]byte, nativeBridgeAddress common.Address, message []byte) (*types.Transaction, error) { - return _NativeTokenDestination.Contract.ReceiveTeleporterMessage(&_NativeTokenDestination.TransactOpts, nativeChainID, nativeBridgeAddress, message) +// Solidity: function receiveTeleporterMessage(bytes32 senderBlockchainID, address senderAddress, bytes message) returns() +func (_NativeTokenDestination *NativeTokenDestinationTransactorSession) ReceiveTeleporterMessage(senderBlockchainID [32]byte, senderAddress common.Address, message []byte) (*types.Transaction, error) { + return _NativeTokenDestination.Contract.ReceiveTeleporterMessage(&_NativeTokenDestination.TransactOpts, senderBlockchainID, senderAddress, message) } // TransferToSource is a paid mutator transaction binding the contract method 0x281c91de. // -// Solidity: function transferToSource(address recipient, address feeTokenContractAddress, uint256 feeAmount) payable returns() -func (_NativeTokenDestination *NativeTokenDestinationTransactor) TransferToSource(opts *bind.TransactOpts, recipient common.Address, feeTokenContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { - return _NativeTokenDestination.contract.Transact(opts, "transferToSource", recipient, feeTokenContractAddress, feeAmount) +// Solidity: function transferToSource(address recipient, address feeContractAddress, uint256 feeAmount) payable returns() +func (_NativeTokenDestination *NativeTokenDestinationTransactor) TransferToSource(opts *bind.TransactOpts, recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { + return _NativeTokenDestination.contract.Transact(opts, "transferToSource", recipient, feeContractAddress, feeAmount) } // TransferToSource is a paid mutator transaction binding the contract method 0x281c91de. // -// Solidity: function transferToSource(address recipient, address feeTokenContractAddress, uint256 feeAmount) payable returns() -func (_NativeTokenDestination *NativeTokenDestinationSession) TransferToSource(recipient common.Address, feeTokenContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { - return _NativeTokenDestination.Contract.TransferToSource(&_NativeTokenDestination.TransactOpts, recipient, feeTokenContractAddress, feeAmount) +// Solidity: function transferToSource(address recipient, address feeContractAddress, uint256 feeAmount) payable returns() +func (_NativeTokenDestination *NativeTokenDestinationSession) TransferToSource(recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { + return _NativeTokenDestination.Contract.TransferToSource(&_NativeTokenDestination.TransactOpts, recipient, feeContractAddress, feeAmount) } // TransferToSource is a paid mutator transaction binding the contract method 0x281c91de. // -// Solidity: function transferToSource(address recipient, address feeTokenContractAddress, uint256 feeAmount) payable returns() -func (_NativeTokenDestination *NativeTokenDestinationTransactorSession) TransferToSource(recipient common.Address, feeTokenContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { - return _NativeTokenDestination.Contract.TransferToSource(&_NativeTokenDestination.TransactOpts, recipient, feeTokenContractAddress, feeAmount) +// Solidity: function transferToSource(address recipient, address feeContractAddress, uint256 feeAmount) payable returns() +func (_NativeTokenDestination *NativeTokenDestinationTransactorSession) TransferToSource(recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { + return _NativeTokenDestination.Contract.TransferToSource(&_NativeTokenDestination.TransactOpts, recipient, feeContractAddress, feeAmount) +} + +// NativeTokenDestinationCollateralAddedIterator is returned from FilterCollateralAdded and is used to iterate over the raw logs and unpacked data for CollateralAdded events raised by the NativeTokenDestination contract. +type NativeTokenDestinationCollateralAddedIterator struct { + Event *NativeTokenDestinationCollateralAdded // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *NativeTokenDestinationCollateralAddedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(NativeTokenDestinationCollateralAdded) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(NativeTokenDestinationCollateralAdded) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *NativeTokenDestinationCollateralAddedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *NativeTokenDestinationCollateralAddedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// NativeTokenDestinationCollateralAdded represents a CollateralAdded event raised by the NativeTokenDestination contract. +type NativeTokenDestinationCollateralAdded struct { + Amount *big.Int + Remaining *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterCollateralAdded is a free log retrieval operation binding the contract event 0x244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449. +// +// Solidity: event CollateralAdded(uint256 amount, uint256 remaining) +func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterCollateralAdded(opts *bind.FilterOpts) (*NativeTokenDestinationCollateralAddedIterator, error) { + + logs, sub, err := _NativeTokenDestination.contract.FilterLogs(opts, "CollateralAdded") + if err != nil { + return nil, err + } + return &NativeTokenDestinationCollateralAddedIterator{contract: _NativeTokenDestination.contract, event: "CollateralAdded", logs: logs, sub: sub}, nil +} + +// WatchCollateralAdded is a free log subscription operation binding the contract event 0x244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449. +// +// Solidity: event CollateralAdded(uint256 amount, uint256 remaining) +func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchCollateralAdded(opts *bind.WatchOpts, sink chan<- *NativeTokenDestinationCollateralAdded) (event.Subscription, error) { + + logs, sub, err := _NativeTokenDestination.contract.WatchLogs(opts, "CollateralAdded") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(NativeTokenDestinationCollateralAdded) + if err := _NativeTokenDestination.contract.UnpackLog(event, "CollateralAdded", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseCollateralAdded is a log parse operation binding the contract event 0x244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449. +// +// Solidity: event CollateralAdded(uint256 amount, uint256 remaining) +func (_NativeTokenDestination *NativeTokenDestinationFilterer) ParseCollateralAdded(log types.Log) (*NativeTokenDestinationCollateralAdded, error) { + event := new(NativeTokenDestinationCollateralAdded) + if err := _NativeTokenDestination.contract.UnpackLog(event, "CollateralAdded", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil } // NativeTokenDestinationMintNativeTokensIterator is returned from FilterMintNativeTokens and is used to iterate over the raw logs and unpacked data for MintNativeTokens events raised by the NativeTokenDestination contract. @@ -612,52 +747,51 @@ func (it *NativeTokenDestinationTransferToSourceIterator) Close() error { // NativeTokenDestinationTransferToSource represents a TransferToSource event raised by the NativeTokenDestination contract. type NativeTokenDestinationTransferToSource struct { - TokenContractAddress common.Address - TeleporterMessageID *big.Int - DestinationChainID [32]byte - DestinationBridgeAddress common.Address - Recipient common.Address - TransferAmount *big.Int - FeeAmount *big.Int - Raw types.Log // Blockchain specific contextual infos + Sender common.Address + Recipient common.Address + Amount *big.Int + FeeContractAddress common.Address + FeeAmount *big.Int + TeleporterMessageID *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterTransferToSource is a free log retrieval operation binding the contract event 0xd68353fcc47e706f53e30e6761a3cf2576d0e791c663e962b868bf38010db9a3. +// FilterTransferToSource is a free log retrieval operation binding the contract event 0x343e0fe771af9fa258c07a602fad6dfd80c51eda78604397e553106360933bfc. // -// Solidity: event TransferToSource(address indexed tokenContractAddress, uint256 indexed teleporterMessageID, bytes32 destinationChainID, address destinationBridgeAddress, address recipient, uint256 transferAmount, uint256 feeAmount) -func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterTransferToSource(opts *bind.FilterOpts, tokenContractAddress []common.Address, teleporterMessageID []*big.Int) (*NativeTokenDestinationTransferToSourceIterator, error) { +// Solidity: event TransferToSource(address indexed sender, address indexed recipient, uint256 amount, address feeContractAddress, uint256 feeAmount, uint256 teleporterMessageID) +func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterTransferToSource(opts *bind.FilterOpts, sender []common.Address, recipient []common.Address) (*NativeTokenDestinationTransferToSourceIterator, error) { - var tokenContractAddressRule []interface{} - for _, tokenContractAddressItem := range tokenContractAddress { - tokenContractAddressRule = append(tokenContractAddressRule, tokenContractAddressItem) + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) } - var teleporterMessageIDRule []interface{} - for _, teleporterMessageIDItem := range teleporterMessageID { - teleporterMessageIDRule = append(teleporterMessageIDRule, teleporterMessageIDItem) + var recipientRule []interface{} + for _, recipientItem := range recipient { + recipientRule = append(recipientRule, recipientItem) } - logs, sub, err := _NativeTokenDestination.contract.FilterLogs(opts, "TransferToSource", tokenContractAddressRule, teleporterMessageIDRule) + logs, sub, err := _NativeTokenDestination.contract.FilterLogs(opts, "TransferToSource", senderRule, recipientRule) if err != nil { return nil, err } return &NativeTokenDestinationTransferToSourceIterator{contract: _NativeTokenDestination.contract, event: "TransferToSource", logs: logs, sub: sub}, nil } -// WatchTransferToSource is a free log subscription operation binding the contract event 0xd68353fcc47e706f53e30e6761a3cf2576d0e791c663e962b868bf38010db9a3. +// WatchTransferToSource is a free log subscription operation binding the contract event 0x343e0fe771af9fa258c07a602fad6dfd80c51eda78604397e553106360933bfc. // -// Solidity: event TransferToSource(address indexed tokenContractAddress, uint256 indexed teleporterMessageID, bytes32 destinationChainID, address destinationBridgeAddress, address recipient, uint256 transferAmount, uint256 feeAmount) -func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchTransferToSource(opts *bind.WatchOpts, sink chan<- *NativeTokenDestinationTransferToSource, tokenContractAddress []common.Address, teleporterMessageID []*big.Int) (event.Subscription, error) { +// Solidity: event TransferToSource(address indexed sender, address indexed recipient, uint256 amount, address feeContractAddress, uint256 feeAmount, uint256 teleporterMessageID) +func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchTransferToSource(opts *bind.WatchOpts, sink chan<- *NativeTokenDestinationTransferToSource, sender []common.Address, recipient []common.Address) (event.Subscription, error) { - var tokenContractAddressRule []interface{} - for _, tokenContractAddressItem := range tokenContractAddress { - tokenContractAddressRule = append(tokenContractAddressRule, tokenContractAddressItem) + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) } - var teleporterMessageIDRule []interface{} - for _, teleporterMessageIDItem := range teleporterMessageID { - teleporterMessageIDRule = append(teleporterMessageIDRule, teleporterMessageIDItem) + var recipientRule []interface{} + for _, recipientItem := range recipient { + recipientRule = append(recipientRule, recipientItem) } - logs, sub, err := _NativeTokenDestination.contract.WatchLogs(opts, "TransferToSource", tokenContractAddressRule, teleporterMessageIDRule) + logs, sub, err := _NativeTokenDestination.contract.WatchLogs(opts, "TransferToSource", senderRule, recipientRule) if err != nil { return nil, err } @@ -689,9 +823,9 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchTransferToSo }), nil } -// ParseTransferToSource is a log parse operation binding the contract event 0xd68353fcc47e706f53e30e6761a3cf2576d0e791c663e962b868bf38010db9a3. +// ParseTransferToSource is a log parse operation binding the contract event 0x343e0fe771af9fa258c07a602fad6dfd80c51eda78604397e553106360933bfc. // -// Solidity: event TransferToSource(address indexed tokenContractAddress, uint256 indexed teleporterMessageID, bytes32 destinationChainID, address destinationBridgeAddress, address recipient, uint256 transferAmount, uint256 feeAmount) +// Solidity: event TransferToSource(address indexed sender, address indexed recipient, uint256 amount, address feeContractAddress, uint256 feeAmount, uint256 teleporterMessageID) func (_NativeTokenDestination *NativeTokenDestinationFilterer) ParseTransferToSource(log types.Log) (*NativeTokenDestinationTransferToSource, error) { event := new(NativeTokenDestinationTransferToSource) if err := _NativeTokenDestination.contract.UnpackLog(event, "TransferToSource", log); err != nil { diff --git a/contracts/abi/NativeTokenSource.go b/contracts/abi/NativeTokenSource.go index 87d818200..a787b1332 100644 --- a/contracts/abi/NativeTokenSource.go +++ b/contracts/abi/NativeTokenSource.go @@ -31,7 +31,7 @@ var ( // NativeTokenSourceMetaData contains all meta data concerning the NativeTokenSource contract. var NativeTokenSourceMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationContractAddress_\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationChainID_\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CannotBridgeTokenWithinSameChain\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"adjustedAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"InsufficientAdjustedAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientPayment\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidDestinationContractAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidPartnerContractAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidRecipient\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidRecipientAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSourceChain\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTeleporterMessengerAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Unauthorized\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"tokenContractAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destinationBridgeAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"transferAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WARP_PRECOMPILE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentChainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationChainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"nativeChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeBridgeAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeTokenContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationContractAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", } // NativeTokenSourceABI is the input ABI used to generate the binding from. @@ -211,43 +211,12 @@ func (_NativeTokenSource *NativeTokenSourceCallerSession) MINTNATIVETOKENSREQUIR return _NativeTokenSource.Contract.MINTNATIVETOKENSREQUIREDGAS(&_NativeTokenSource.CallOpts) } -// WARPPRECOMPILEADDRESS is a free data retrieval call binding the contract method 0x74971856. +// CurrentBlockchainID is a free data retrieval call binding the contract method 0x4950d2d0. // -// Solidity: function WARP_PRECOMPILE_ADDRESS() view returns(address) -func (_NativeTokenSource *NativeTokenSourceCaller) WARPPRECOMPILEADDRESS(opts *bind.CallOpts) (common.Address, error) { +// Solidity: function currentBlockchainID() view returns(bytes32) +func (_NativeTokenSource *NativeTokenSourceCaller) CurrentBlockchainID(opts *bind.CallOpts) ([32]byte, error) { var out []interface{} - err := _NativeTokenSource.contract.Call(opts, &out, "WARP_PRECOMPILE_ADDRESS") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// WARPPRECOMPILEADDRESS is a free data retrieval call binding the contract method 0x74971856. -// -// Solidity: function WARP_PRECOMPILE_ADDRESS() view returns(address) -func (_NativeTokenSource *NativeTokenSourceSession) WARPPRECOMPILEADDRESS() (common.Address, error) { - return _NativeTokenSource.Contract.WARPPRECOMPILEADDRESS(&_NativeTokenSource.CallOpts) -} - -// WARPPRECOMPILEADDRESS is a free data retrieval call binding the contract method 0x74971856. -// -// Solidity: function WARP_PRECOMPILE_ADDRESS() view returns(address) -func (_NativeTokenSource *NativeTokenSourceCallerSession) WARPPRECOMPILEADDRESS() (common.Address, error) { - return _NativeTokenSource.Contract.WARPPRECOMPILEADDRESS(&_NativeTokenSource.CallOpts) -} - -// CurrentChainID is a free data retrieval call binding the contract method 0xb179e1e7. -// -// Solidity: function currentChainID() view returns(bytes32) -func (_NativeTokenSource *NativeTokenSourceCaller) CurrentChainID(opts *bind.CallOpts) ([32]byte, error) { - var out []interface{} - err := _NativeTokenSource.contract.Call(opts, &out, "currentChainID") + err := _NativeTokenSource.contract.Call(opts, &out, "currentBlockchainID") if err != nil { return *new([32]byte), err @@ -259,26 +228,26 @@ func (_NativeTokenSource *NativeTokenSourceCaller) CurrentChainID(opts *bind.Cal } -// CurrentChainID is a free data retrieval call binding the contract method 0xb179e1e7. +// CurrentBlockchainID is a free data retrieval call binding the contract method 0x4950d2d0. // -// Solidity: function currentChainID() view returns(bytes32) -func (_NativeTokenSource *NativeTokenSourceSession) CurrentChainID() ([32]byte, error) { - return _NativeTokenSource.Contract.CurrentChainID(&_NativeTokenSource.CallOpts) +// Solidity: function currentBlockchainID() view returns(bytes32) +func (_NativeTokenSource *NativeTokenSourceSession) CurrentBlockchainID() ([32]byte, error) { + return _NativeTokenSource.Contract.CurrentBlockchainID(&_NativeTokenSource.CallOpts) } -// CurrentChainID is a free data retrieval call binding the contract method 0xb179e1e7. +// CurrentBlockchainID is a free data retrieval call binding the contract method 0x4950d2d0. // -// Solidity: function currentChainID() view returns(bytes32) -func (_NativeTokenSource *NativeTokenSourceCallerSession) CurrentChainID() ([32]byte, error) { - return _NativeTokenSource.Contract.CurrentChainID(&_NativeTokenSource.CallOpts) +// Solidity: function currentBlockchainID() view returns(bytes32) +func (_NativeTokenSource *NativeTokenSourceCallerSession) CurrentBlockchainID() ([32]byte, error) { + return _NativeTokenSource.Contract.CurrentBlockchainID(&_NativeTokenSource.CallOpts) } -// DestinationChainID is a free data retrieval call binding the contract method 0x7a9cffc8. +// DestinationBlockchainID is a free data retrieval call binding the contract method 0x41d3014d. // -// Solidity: function destinationChainID() view returns(bytes32) -func (_NativeTokenSource *NativeTokenSourceCaller) DestinationChainID(opts *bind.CallOpts) ([32]byte, error) { +// Solidity: function destinationBlockchainID() view returns(bytes32) +func (_NativeTokenSource *NativeTokenSourceCaller) DestinationBlockchainID(opts *bind.CallOpts) ([32]byte, error) { var out []interface{} - err := _NativeTokenSource.contract.Call(opts, &out, "destinationChainID") + err := _NativeTokenSource.contract.Call(opts, &out, "destinationBlockchainID") if err != nil { return *new([32]byte), err @@ -290,18 +259,18 @@ func (_NativeTokenSource *NativeTokenSourceCaller) DestinationChainID(opts *bind } -// DestinationChainID is a free data retrieval call binding the contract method 0x7a9cffc8. +// DestinationBlockchainID is a free data retrieval call binding the contract method 0x41d3014d. // -// Solidity: function destinationChainID() view returns(bytes32) -func (_NativeTokenSource *NativeTokenSourceSession) DestinationChainID() ([32]byte, error) { - return _NativeTokenSource.Contract.DestinationChainID(&_NativeTokenSource.CallOpts) +// Solidity: function destinationBlockchainID() view returns(bytes32) +func (_NativeTokenSource *NativeTokenSourceSession) DestinationBlockchainID() ([32]byte, error) { + return _NativeTokenSource.Contract.DestinationBlockchainID(&_NativeTokenSource.CallOpts) } -// DestinationChainID is a free data retrieval call binding the contract method 0x7a9cffc8. +// DestinationBlockchainID is a free data retrieval call binding the contract method 0x41d3014d. // -// Solidity: function destinationChainID() view returns(bytes32) -func (_NativeTokenSource *NativeTokenSourceCallerSession) DestinationChainID() ([32]byte, error) { - return _NativeTokenSource.Contract.DestinationChainID(&_NativeTokenSource.CallOpts) +// Solidity: function destinationBlockchainID() view returns(bytes32) +func (_NativeTokenSource *NativeTokenSourceCallerSession) DestinationBlockchainID() ([32]byte, error) { + return _NativeTokenSource.Contract.DestinationBlockchainID(&_NativeTokenSource.CallOpts) } // DestinationContractAddress is a free data retrieval call binding the contract method 0x04d6baf7. @@ -368,44 +337,44 @@ func (_NativeTokenSource *NativeTokenSourceCallerSession) TeleporterMessenger() // ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. // -// Solidity: function receiveTeleporterMessage(bytes32 nativeChainID, address nativeBridgeAddress, bytes message) returns() -func (_NativeTokenSource *NativeTokenSourceTransactor) ReceiveTeleporterMessage(opts *bind.TransactOpts, nativeChainID [32]byte, nativeBridgeAddress common.Address, message []byte) (*types.Transaction, error) { - return _NativeTokenSource.contract.Transact(opts, "receiveTeleporterMessage", nativeChainID, nativeBridgeAddress, message) +// Solidity: function receiveTeleporterMessage(bytes32 senderBlockchainID, address senderAddress, bytes message) returns() +func (_NativeTokenSource *NativeTokenSourceTransactor) ReceiveTeleporterMessage(opts *bind.TransactOpts, senderBlockchainID [32]byte, senderAddress common.Address, message []byte) (*types.Transaction, error) { + return _NativeTokenSource.contract.Transact(opts, "receiveTeleporterMessage", senderBlockchainID, senderAddress, message) } // ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. // -// Solidity: function receiveTeleporterMessage(bytes32 nativeChainID, address nativeBridgeAddress, bytes message) returns() -func (_NativeTokenSource *NativeTokenSourceSession) ReceiveTeleporterMessage(nativeChainID [32]byte, nativeBridgeAddress common.Address, message []byte) (*types.Transaction, error) { - return _NativeTokenSource.Contract.ReceiveTeleporterMessage(&_NativeTokenSource.TransactOpts, nativeChainID, nativeBridgeAddress, message) +// Solidity: function receiveTeleporterMessage(bytes32 senderBlockchainID, address senderAddress, bytes message) returns() +func (_NativeTokenSource *NativeTokenSourceSession) ReceiveTeleporterMessage(senderBlockchainID [32]byte, senderAddress common.Address, message []byte) (*types.Transaction, error) { + return _NativeTokenSource.Contract.ReceiveTeleporterMessage(&_NativeTokenSource.TransactOpts, senderBlockchainID, senderAddress, message) } // ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. // -// Solidity: function receiveTeleporterMessage(bytes32 nativeChainID, address nativeBridgeAddress, bytes message) returns() -func (_NativeTokenSource *NativeTokenSourceTransactorSession) ReceiveTeleporterMessage(nativeChainID [32]byte, nativeBridgeAddress common.Address, message []byte) (*types.Transaction, error) { - return _NativeTokenSource.Contract.ReceiveTeleporterMessage(&_NativeTokenSource.TransactOpts, nativeChainID, nativeBridgeAddress, message) +// Solidity: function receiveTeleporterMessage(bytes32 senderBlockchainID, address senderAddress, bytes message) returns() +func (_NativeTokenSource *NativeTokenSourceTransactorSession) ReceiveTeleporterMessage(senderBlockchainID [32]byte, senderAddress common.Address, message []byte) (*types.Transaction, error) { + return _NativeTokenSource.Contract.ReceiveTeleporterMessage(&_NativeTokenSource.TransactOpts, senderBlockchainID, senderAddress, message) } // TransferToDestination is a paid mutator transaction binding the contract method 0x3c7bf510. // -// Solidity: function transferToDestination(address recipient, address feeTokenContractAddress, uint256 feeAmount) payable returns() -func (_NativeTokenSource *NativeTokenSourceTransactor) TransferToDestination(opts *bind.TransactOpts, recipient common.Address, feeTokenContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { - return _NativeTokenSource.contract.Transact(opts, "transferToDestination", recipient, feeTokenContractAddress, feeAmount) +// Solidity: function transferToDestination(address recipient, address feeContractAddress, uint256 feeAmount) payable returns() +func (_NativeTokenSource *NativeTokenSourceTransactor) TransferToDestination(opts *bind.TransactOpts, recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { + return _NativeTokenSource.contract.Transact(opts, "transferToDestination", recipient, feeContractAddress, feeAmount) } // TransferToDestination is a paid mutator transaction binding the contract method 0x3c7bf510. // -// Solidity: function transferToDestination(address recipient, address feeTokenContractAddress, uint256 feeAmount) payable returns() -func (_NativeTokenSource *NativeTokenSourceSession) TransferToDestination(recipient common.Address, feeTokenContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { - return _NativeTokenSource.Contract.TransferToDestination(&_NativeTokenSource.TransactOpts, recipient, feeTokenContractAddress, feeAmount) +// Solidity: function transferToDestination(address recipient, address feeContractAddress, uint256 feeAmount) payable returns() +func (_NativeTokenSource *NativeTokenSourceSession) TransferToDestination(recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { + return _NativeTokenSource.Contract.TransferToDestination(&_NativeTokenSource.TransactOpts, recipient, feeContractAddress, feeAmount) } // TransferToDestination is a paid mutator transaction binding the contract method 0x3c7bf510. // -// Solidity: function transferToDestination(address recipient, address feeTokenContractAddress, uint256 feeAmount) payable returns() -func (_NativeTokenSource *NativeTokenSourceTransactorSession) TransferToDestination(recipient common.Address, feeTokenContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { - return _NativeTokenSource.Contract.TransferToDestination(&_NativeTokenSource.TransactOpts, recipient, feeTokenContractAddress, feeAmount) +// Solidity: function transferToDestination(address recipient, address feeContractAddress, uint256 feeAmount) payable returns() +func (_NativeTokenSource *NativeTokenSourceTransactorSession) TransferToDestination(recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { + return _NativeTokenSource.Contract.TransferToDestination(&_NativeTokenSource.TransactOpts, recipient, feeContractAddress, feeAmount) } // NativeTokenSourceTransferToDestinationIterator is returned from FilterTransferToDestination and is used to iterate over the raw logs and unpacked data for TransferToDestination events raised by the NativeTokenSource contract. @@ -477,52 +446,51 @@ func (it *NativeTokenSourceTransferToDestinationIterator) Close() error { // NativeTokenSourceTransferToDestination represents a TransferToDestination event raised by the NativeTokenSource contract. type NativeTokenSourceTransferToDestination struct { - TokenContractAddress common.Address - TeleporterMessageID *big.Int - DestinationChainID [32]byte - DestinationBridgeAddress common.Address - Recipient common.Address - TransferAmount *big.Int - FeeAmount *big.Int - Raw types.Log // Blockchain specific contextual infos + Sender common.Address + Recipient common.Address + Amount *big.Int + FeeContractAddress common.Address + FeeAmount *big.Int + TeleporterMessageID *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterTransferToDestination is a free log retrieval operation binding the contract event 0x0bd44c3ad8913eab944c838cd210d05b9c7ec0254d9c1fdb0571af8b573c5b94. +// FilterTransferToDestination is a free log retrieval operation binding the contract event 0x32d7e0a933e2b2b5890fd273e9ba2e9293d619805a7ca90d11f41eddc56d2b97. // -// Solidity: event TransferToDestination(address indexed tokenContractAddress, uint256 indexed teleporterMessageID, bytes32 destinationChainID, address destinationBridgeAddress, address recipient, uint256 transferAmount, uint256 feeAmount) -func (_NativeTokenSource *NativeTokenSourceFilterer) FilterTransferToDestination(opts *bind.FilterOpts, tokenContractAddress []common.Address, teleporterMessageID []*big.Int) (*NativeTokenSourceTransferToDestinationIterator, error) { +// Solidity: event TransferToDestination(address indexed sender, address indexed recipient, uint256 amount, address feeContractAddress, uint256 feeAmount, uint256 teleporterMessageID) +func (_NativeTokenSource *NativeTokenSourceFilterer) FilterTransferToDestination(opts *bind.FilterOpts, sender []common.Address, recipient []common.Address) (*NativeTokenSourceTransferToDestinationIterator, error) { - var tokenContractAddressRule []interface{} - for _, tokenContractAddressItem := range tokenContractAddress { - tokenContractAddressRule = append(tokenContractAddressRule, tokenContractAddressItem) + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) } - var teleporterMessageIDRule []interface{} - for _, teleporterMessageIDItem := range teleporterMessageID { - teleporterMessageIDRule = append(teleporterMessageIDRule, teleporterMessageIDItem) + var recipientRule []interface{} + for _, recipientItem := range recipient { + recipientRule = append(recipientRule, recipientItem) } - logs, sub, err := _NativeTokenSource.contract.FilterLogs(opts, "TransferToDestination", tokenContractAddressRule, teleporterMessageIDRule) + logs, sub, err := _NativeTokenSource.contract.FilterLogs(opts, "TransferToDestination", senderRule, recipientRule) if err != nil { return nil, err } return &NativeTokenSourceTransferToDestinationIterator{contract: _NativeTokenSource.contract, event: "TransferToDestination", logs: logs, sub: sub}, nil } -// WatchTransferToDestination is a free log subscription operation binding the contract event 0x0bd44c3ad8913eab944c838cd210d05b9c7ec0254d9c1fdb0571af8b573c5b94. +// WatchTransferToDestination is a free log subscription operation binding the contract event 0x32d7e0a933e2b2b5890fd273e9ba2e9293d619805a7ca90d11f41eddc56d2b97. // -// Solidity: event TransferToDestination(address indexed tokenContractAddress, uint256 indexed teleporterMessageID, bytes32 destinationChainID, address destinationBridgeAddress, address recipient, uint256 transferAmount, uint256 feeAmount) -func (_NativeTokenSource *NativeTokenSourceFilterer) WatchTransferToDestination(opts *bind.WatchOpts, sink chan<- *NativeTokenSourceTransferToDestination, tokenContractAddress []common.Address, teleporterMessageID []*big.Int) (event.Subscription, error) { +// Solidity: event TransferToDestination(address indexed sender, address indexed recipient, uint256 amount, address feeContractAddress, uint256 feeAmount, uint256 teleporterMessageID) +func (_NativeTokenSource *NativeTokenSourceFilterer) WatchTransferToDestination(opts *bind.WatchOpts, sink chan<- *NativeTokenSourceTransferToDestination, sender []common.Address, recipient []common.Address) (event.Subscription, error) { - var tokenContractAddressRule []interface{} - for _, tokenContractAddressItem := range tokenContractAddress { - tokenContractAddressRule = append(tokenContractAddressRule, tokenContractAddressItem) + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) } - var teleporterMessageIDRule []interface{} - for _, teleporterMessageIDItem := range teleporterMessageID { - teleporterMessageIDRule = append(teleporterMessageIDRule, teleporterMessageIDItem) + var recipientRule []interface{} + for _, recipientItem := range recipient { + recipientRule = append(recipientRule, recipientItem) } - logs, sub, err := _NativeTokenSource.contract.WatchLogs(opts, "TransferToDestination", tokenContractAddressRule, teleporterMessageIDRule) + logs, sub, err := _NativeTokenSource.contract.WatchLogs(opts, "TransferToDestination", senderRule, recipientRule) if err != nil { return nil, err } @@ -554,9 +522,9 @@ func (_NativeTokenSource *NativeTokenSourceFilterer) WatchTransferToDestination( }), nil } -// ParseTransferToDestination is a log parse operation binding the contract event 0x0bd44c3ad8913eab944c838cd210d05b9c7ec0254d9c1fdb0571af8b573c5b94. +// ParseTransferToDestination is a log parse operation binding the contract event 0x32d7e0a933e2b2b5890fd273e9ba2e9293d619805a7ca90d11f41eddc56d2b97. // -// Solidity: event TransferToDestination(address indexed tokenContractAddress, uint256 indexed teleporterMessageID, bytes32 destinationChainID, address destinationBridgeAddress, address recipient, uint256 transferAmount, uint256 feeAmount) +// Solidity: event TransferToDestination(address indexed sender, address indexed recipient, uint256 amount, address feeContractAddress, uint256 feeAmount, uint256 teleporterMessageID) func (_NativeTokenSource *NativeTokenSourceFilterer) ParseTransferToDestination(log types.Log) (*NativeTokenSourceTransferToDestination, error) { event := new(NativeTokenSourceTransferToDestination) if err := _NativeTokenSource.contract.UnpackLog(event, "TransferToDestination", log); err != nil { From 3456f8bfc1629038fc07279aa6baaaba182eb6ce Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Wed, 4 Oct 2023 16:21:41 -0400 Subject: [PATCH 040/183] Deploy contract through abi instead of forge --- tests/e2e_test.go | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/tests/e2e_test.go b/tests/e2e_test.go index fca7f20f7..b54e5e288 100644 --- a/tests/e2e_test.go +++ b/tests/e2e_test.go @@ -9,7 +9,6 @@ import ( "fmt" "math/big" "os" - "os/exec" "testing" "time" @@ -48,6 +47,8 @@ const ( bridgeDeployerKeyStr = "aad7440febfc8f9d73a58c3cb1f1754779a566978f9ebffcd4f4698e9b043985" warpGenesisFile = "./tests/warp-genesis.json" teleporterByteCodeFile = "./contracts/out/TeleporterMessenger.sol/TeleporterMessenger.json" + NativeTokenSourceByteCodeFile = "./contracts/out/NativeTokenSource.sol/NativeTokenSource.json" + NativeTokenDestinationByteCodeFile = "./contracts/out/NativeTokenDestination.sol/NativeTokenDestination.json" ) var ( @@ -469,31 +470,25 @@ var _ = ginkgo.Describe("[NativeTransfer two-way send]", ginkgo.Ordered, func() Expect(err).Should(BeNil()) fmt.Println("Native Token Bridge Contract Address: ", nativeTokenBridgeContractAddress.Hex()) - cmd := exec.Command( - "forge", - "create", - "src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol:NativeTokenSource", - "--rpc-url", chainARPCURI, - "--private-key", hexutil.Encode(nativeTokenBridgeDeployerPK.D.Bytes()), - "--constructor-args", teleporterContractAddress.Hex(), "0x"+blockchainIDB.Hex(), nativeTokenBridgeContractAddress.Hex()) - cmd.Dir = "./contracts" - fmt.Println("SOURCE ", cmd.String()) - err = cmd.Run() + nativeTokenSourceBytecode, err := deploymentUtils.ExtractByteCode(NativeTokenSourceByteCodeFile) + Expect(err).Should(BeNil()) + chainATransactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, chainAIDInt) + Expect(err).Should(BeNil()) + nativeTokenSourceAbi, err := abi.NativeTokenSourceMetaData.GetAbi() + Expect(err).Should(BeNil()) + _, _, _, err = bind.DeployContract(chainATransactor, *nativeTokenSourceAbi, nativeTokenSourceBytecode, chainARPCClient, teleporterContractAddress, blockchainIDB, nativeTokenBridgeContractAddress) Expect(err).Should(BeNil()) - cmd = exec.Command( - "forge", - "create", - "src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol:NativeTokenDestination", - "--rpc-url", chainBRPCURI, - "--private-key", hexutil.Encode(nativeTokenBridgeDeployerPK.D.Bytes()), - "--constructor-args", teleporterContractAddress.Hex(), "0x"+blockchainIDA.Hex(), nativeTokenBridgeContractAddress.Hex()) - - cmd.Dir = "./contracts" - fmt.Println("DEST ", cmd.String()) - err = cmd.Run() + nativeTokenDestinationBytecode, err := deploymentUtils.ExtractByteCode(NativeTokenDestinationByteCodeFile) Expect(err).Should(BeNil()) + chainBTransactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, chainBIDInt) + Expect(err).Should(BeNil()) + nativeTokenDestinationAbi, err := abi.NativeTokenDestinationMetaData.GetAbi() + Expect(err).Should(BeNil()) + _, _, _, err = bind.DeployContract(chainBTransactor, *nativeTokenDestinationAbi, nativeTokenDestinationBytecode, chainBRPCClient, teleporterContractAddress, blockchainIDA, nativeTokenBridgeContractAddress, common.Big0) + Expect(err).Should(BeNil()) + time.Sleep(5 * time.Second) bridgeCodeA, err := chainARPCClient.CodeAt(ctx, nativeTokenBridgeContractAddress, nil) From 7cda837ccddb2a54d2a2bce33dd678defe0933db Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Wed, 4 Oct 2023 16:46:29 -0400 Subject: [PATCH 041/183] cleanup --- tests/e2e_test.go | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/tests/e2e_test.go b/tests/e2e_test.go index b54e5e288..ed4af8014 100644 --- a/tests/e2e_test.go +++ b/tests/e2e_test.go @@ -455,15 +455,18 @@ var _ = ginkgo.Describe("[Teleporter one way send]", ginkgo.Ordered, func() { }) var _ = ginkgo.Describe("[NativeTransfer two-way send]", ginkgo.Ordered, func() { - valueToSend := int64(1000_000_000_000_000_000) - valueToReturn := valueToSend/4 + const ( + valueToSend = int64(1000_000_000_000_000_000) + valueToReturn = valueToSend/4 + ) + var ( + ctx = context.Background() + err error + ) // Send a transaction to Subnet A to issue a Warp Message from the Teleporter contract to Subnet B ginkgo.It("Deploy Contracts on chains A and B", ginkgo.Label("NativeTransfer", "DeployContracs"), func() { - ctx := context.Background() - var err error - - // Deploy Native Token bridge on the two subnets + // Deploy Native Token bridge on the two subnets nativeTokenBridgeDeployerPK, err = crypto.HexToECDSA(bridgeDeployerKeyStr) Expect(err).Should(BeNil()) nativeTokenBridgeContractAddress, err = deploymentUtils.DeriveEVMContractAddress(nativeTokenBridgeDeployer, 0) @@ -503,9 +506,6 @@ var _ = ginkgo.Describe("[NativeTransfer two-way send]", ginkgo.Ordered, func() }) ginkgo.It("Transfer tokens from A to B", ginkgo.Label("NativeTransfer", "Lock and Mint"), func() { - ctx := context.Background() - var err error - nativeTokenSource, err := abi.NewNativeTokenSource(nativeTokenBridgeContractAddress, chainARPCClient) Expect(err).Should(BeNil()) transactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, chainAIDInt) @@ -528,8 +528,6 @@ var _ = ginkgo.Describe("[NativeTransfer two-way send]", ginkgo.Ordered, func() }) ginkgo.It("Relay message to destination", ginkgo.Label("NativeTransfer", "RelayMessage A -> B"), func() { - ctx := context.Background() - // Get the latest block from Subnet A, and retrieve the warp message from the logs log.Info("Waiting for new block confirmation") newHeadA := <-newHeadsA @@ -600,9 +598,6 @@ var _ = ginkgo.Describe("[NativeTransfer two-way send]", ginkgo.Ordered, func() }) ginkgo.It("Transfer tokens from B to A", ginkgo.Label("NativeTransfer", "Burn and Unlock"), func() { - ctx := context.Background() - var err error - nativeTokenDestination, err := abi.NewNativeTokenDestination(nativeTokenBridgeContractAddress, chainBRPCClient) Expect(err).Should(BeNil()) transactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, chainBIDInt) @@ -625,8 +620,6 @@ var _ = ginkgo.Describe("[NativeTransfer two-way send]", ginkgo.Ordered, func() }) ginkgo.It("Relay message to source", ginkgo.Label("NativeTransfer", "RelayMessage B -> A"), func() { - ctx := context.Background() - // Get the latest block from Subnet A, and retrieve the warp message from the logs log.Info("Waiting for new block confirmation") newHeadB := <-newHeadsB From fb56ad62c579ae7bf2c4f512bcf3caea103b47b5 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Thu, 5 Oct 2023 09:08:26 -0400 Subject: [PATCH 042/183] Use abigen script for native token contracts --- .../NativeTokenDestination.go | 348 +++++++++--------- .../NativeTokenSource}/NativeTokenSource.go | 296 +++++++-------- scripts/abi_go_bindings.sh | 2 +- 3 files changed, 323 insertions(+), 323 deletions(-) rename {contracts/abi => abis/NativeTokenDestination}/NativeTokenDestination.go (66%) rename {contracts/abi => abis/NativeTokenSource}/NativeTokenSource.go (66%) diff --git a/contracts/abi/NativeTokenDestination.go b/abis/NativeTokenDestination/NativeTokenDestination.go similarity index 66% rename from contracts/abi/NativeTokenDestination.go rename to abis/NativeTokenDestination/NativeTokenDestination.go index 607427ef0..4d6e9b180 100644 --- a/contracts/abi/NativeTokenDestination.go +++ b/abis/NativeTokenDestination/NativeTokenDestination.go @@ -1,7 +1,7 @@ // Code generated - DO NOT EDIT. // This file is a generated binding and any manual changes will be lost. -package abi +package nativetokendestination import ( "errors" @@ -29,113 +29,113 @@ var ( _ = abi.ConvertType ) -// NativeTokenDestinationMetaData contains all meta data concerning the NativeTokenDestination contract. -var NativeTokenDestinationMetaData = &bind.MetaData{ +// NativetokendestinationMetaData contains all meta data concerning the Nativetokendestination contract. +var NativetokendestinationMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"sourceContractAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenReserve_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"MintNativeTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tokenReserve\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", } -// NativeTokenDestinationABI is the input ABI used to generate the binding from. -// Deprecated: Use NativeTokenDestinationMetaData.ABI instead. -var NativeTokenDestinationABI = NativeTokenDestinationMetaData.ABI +// NativetokendestinationABI is the input ABI used to generate the binding from. +// Deprecated: Use NativetokendestinationMetaData.ABI instead. +var NativetokendestinationABI = NativetokendestinationMetaData.ABI -// NativeTokenDestination is an auto generated Go binding around an Ethereum contract. -type NativeTokenDestination struct { - NativeTokenDestinationCaller // Read-only binding to the contract - NativeTokenDestinationTransactor // Write-only binding to the contract - NativeTokenDestinationFilterer // Log filterer for contract events +// Nativetokendestination is an auto generated Go binding around an Ethereum contract. +type Nativetokendestination struct { + NativetokendestinationCaller // Read-only binding to the contract + NativetokendestinationTransactor // Write-only binding to the contract + NativetokendestinationFilterer // Log filterer for contract events } -// NativeTokenDestinationCaller is an auto generated read-only Go binding around an Ethereum contract. -type NativeTokenDestinationCaller struct { +// NativetokendestinationCaller is an auto generated read-only Go binding around an Ethereum contract. +type NativetokendestinationCaller struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls } -// NativeTokenDestinationTransactor is an auto generated write-only Go binding around an Ethereum contract. -type NativeTokenDestinationTransactor struct { +// NativetokendestinationTransactor is an auto generated write-only Go binding around an Ethereum contract. +type NativetokendestinationTransactor struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls } -// NativeTokenDestinationFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type NativeTokenDestinationFilterer struct { +// NativetokendestinationFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type NativetokendestinationFilterer struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls } -// NativeTokenDestinationSession is an auto generated Go binding around an Ethereum contract, +// NativetokendestinationSession is an auto generated Go binding around an Ethereum contract, // with pre-set call and transact options. -type NativeTokenDestinationSession struct { - Contract *NativeTokenDestination // Generic contract binding to set the session for +type NativetokendestinationSession struct { + Contract *Nativetokendestination // Generic contract binding to set the session for CallOpts bind.CallOpts // Call options to use throughout this session TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session } -// NativeTokenDestinationCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// NativetokendestinationCallerSession is an auto generated read-only Go binding around an Ethereum contract, // with pre-set call options. -type NativeTokenDestinationCallerSession struct { - Contract *NativeTokenDestinationCaller // Generic contract caller binding to set the session for +type NativetokendestinationCallerSession struct { + Contract *NativetokendestinationCaller // Generic contract caller binding to set the session for CallOpts bind.CallOpts // Call options to use throughout this session } -// NativeTokenDestinationTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// NativetokendestinationTransactorSession is an auto generated write-only Go binding around an Ethereum contract, // with pre-set transact options. -type NativeTokenDestinationTransactorSession struct { - Contract *NativeTokenDestinationTransactor // Generic contract transactor binding to set the session for +type NativetokendestinationTransactorSession struct { + Contract *NativetokendestinationTransactor // Generic contract transactor binding to set the session for TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session } -// NativeTokenDestinationRaw is an auto generated low-level Go binding around an Ethereum contract. -type NativeTokenDestinationRaw struct { - Contract *NativeTokenDestination // Generic contract binding to access the raw methods on +// NativetokendestinationRaw is an auto generated low-level Go binding around an Ethereum contract. +type NativetokendestinationRaw struct { + Contract *Nativetokendestination // Generic contract binding to access the raw methods on } -// NativeTokenDestinationCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type NativeTokenDestinationCallerRaw struct { - Contract *NativeTokenDestinationCaller // Generic read-only contract binding to access the raw methods on +// NativetokendestinationCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type NativetokendestinationCallerRaw struct { + Contract *NativetokendestinationCaller // Generic read-only contract binding to access the raw methods on } -// NativeTokenDestinationTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type NativeTokenDestinationTransactorRaw struct { - Contract *NativeTokenDestinationTransactor // Generic write-only contract binding to access the raw methods on +// NativetokendestinationTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type NativetokendestinationTransactorRaw struct { + Contract *NativetokendestinationTransactor // Generic write-only contract binding to access the raw methods on } -// NewNativeTokenDestination creates a new instance of NativeTokenDestination, bound to a specific deployed contract. -func NewNativeTokenDestination(address common.Address, backend bind.ContractBackend) (*NativeTokenDestination, error) { - contract, err := bindNativeTokenDestination(address, backend, backend, backend) +// NewNativetokendestination creates a new instance of Nativetokendestination, bound to a specific deployed contract. +func NewNativetokendestination(address common.Address, backend bind.ContractBackend) (*Nativetokendestination, error) { + contract, err := bindNativetokendestination(address, backend, backend, backend) if err != nil { return nil, err } - return &NativeTokenDestination{NativeTokenDestinationCaller: NativeTokenDestinationCaller{contract: contract}, NativeTokenDestinationTransactor: NativeTokenDestinationTransactor{contract: contract}, NativeTokenDestinationFilterer: NativeTokenDestinationFilterer{contract: contract}}, nil + return &Nativetokendestination{NativetokendestinationCaller: NativetokendestinationCaller{contract: contract}, NativetokendestinationTransactor: NativetokendestinationTransactor{contract: contract}, NativetokendestinationFilterer: NativetokendestinationFilterer{contract: contract}}, nil } -// NewNativeTokenDestinationCaller creates a new read-only instance of NativeTokenDestination, bound to a specific deployed contract. -func NewNativeTokenDestinationCaller(address common.Address, caller bind.ContractCaller) (*NativeTokenDestinationCaller, error) { - contract, err := bindNativeTokenDestination(address, caller, nil, nil) +// NewNativetokendestinationCaller creates a new read-only instance of Nativetokendestination, bound to a specific deployed contract. +func NewNativetokendestinationCaller(address common.Address, caller bind.ContractCaller) (*NativetokendestinationCaller, error) { + contract, err := bindNativetokendestination(address, caller, nil, nil) if err != nil { return nil, err } - return &NativeTokenDestinationCaller{contract: contract}, nil + return &NativetokendestinationCaller{contract: contract}, nil } -// NewNativeTokenDestinationTransactor creates a new write-only instance of NativeTokenDestination, bound to a specific deployed contract. -func NewNativeTokenDestinationTransactor(address common.Address, transactor bind.ContractTransactor) (*NativeTokenDestinationTransactor, error) { - contract, err := bindNativeTokenDestination(address, nil, transactor, nil) +// NewNativetokendestinationTransactor creates a new write-only instance of Nativetokendestination, bound to a specific deployed contract. +func NewNativetokendestinationTransactor(address common.Address, transactor bind.ContractTransactor) (*NativetokendestinationTransactor, error) { + contract, err := bindNativetokendestination(address, nil, transactor, nil) if err != nil { return nil, err } - return &NativeTokenDestinationTransactor{contract: contract}, nil + return &NativetokendestinationTransactor{contract: contract}, nil } -// NewNativeTokenDestinationFilterer creates a new log filterer instance of NativeTokenDestination, bound to a specific deployed contract. -func NewNativeTokenDestinationFilterer(address common.Address, filterer bind.ContractFilterer) (*NativeTokenDestinationFilterer, error) { - contract, err := bindNativeTokenDestination(address, nil, nil, filterer) +// NewNativetokendestinationFilterer creates a new log filterer instance of Nativetokendestination, bound to a specific deployed contract. +func NewNativetokendestinationFilterer(address common.Address, filterer bind.ContractFilterer) (*NativetokendestinationFilterer, error) { + contract, err := bindNativetokendestination(address, nil, nil, filterer) if err != nil { return nil, err } - return &NativeTokenDestinationFilterer{contract: contract}, nil + return &NativetokendestinationFilterer{contract: contract}, nil } -// bindNativeTokenDestination binds a generic wrapper to an already deployed contract. -func bindNativeTokenDestination(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := NativeTokenDestinationMetaData.GetAbi() +// bindNativetokendestination binds a generic wrapper to an already deployed contract. +func bindNativetokendestination(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := NativetokendestinationMetaData.GetAbi() if err != nil { return nil, err } @@ -146,46 +146,46 @@ func bindNativeTokenDestination(address common.Address, caller bind.ContractCall // sets the output to result. The result type might be a single field for simple // returns, a slice of interfaces for anonymous returns and a struct for named // returns. -func (_NativeTokenDestination *NativeTokenDestinationRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _NativeTokenDestination.Contract.NativeTokenDestinationCaller.contract.Call(opts, result, method, params...) +func (_Nativetokendestination *NativetokendestinationRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Nativetokendestination.Contract.NativetokendestinationCaller.contract.Call(opts, result, method, params...) } // Transfer initiates a plain transaction to move funds to the contract, calling // its default method if one is available. -func (_NativeTokenDestination *NativeTokenDestinationRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _NativeTokenDestination.Contract.NativeTokenDestinationTransactor.contract.Transfer(opts) +func (_Nativetokendestination *NativetokendestinationRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Nativetokendestination.Contract.NativetokendestinationTransactor.contract.Transfer(opts) } // Transact invokes the (paid) contract method with params as input values. -func (_NativeTokenDestination *NativeTokenDestinationRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _NativeTokenDestination.Contract.NativeTokenDestinationTransactor.contract.Transact(opts, method, params...) +func (_Nativetokendestination *NativetokendestinationRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Nativetokendestination.Contract.NativetokendestinationTransactor.contract.Transact(opts, method, params...) } // Call invokes the (constant) contract method with params as input values and // sets the output to result. The result type might be a single field for simple // returns, a slice of interfaces for anonymous returns and a struct for named // returns. -func (_NativeTokenDestination *NativeTokenDestinationCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _NativeTokenDestination.Contract.contract.Call(opts, result, method, params...) +func (_Nativetokendestination *NativetokendestinationCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Nativetokendestination.Contract.contract.Call(opts, result, method, params...) } // Transfer initiates a plain transaction to move funds to the contract, calling // its default method if one is available. -func (_NativeTokenDestination *NativeTokenDestinationTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _NativeTokenDestination.Contract.contract.Transfer(opts) +func (_Nativetokendestination *NativetokendestinationTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Nativetokendestination.Contract.contract.Transfer(opts) } // Transact invokes the (paid) contract method with params as input values. -func (_NativeTokenDestination *NativeTokenDestinationTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _NativeTokenDestination.Contract.contract.Transact(opts, method, params...) +func (_Nativetokendestination *NativetokendestinationTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Nativetokendestination.Contract.contract.Transact(opts, method, params...) } // TRANSFERNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xab285230. // // Solidity: function TRANSFER_NATIVE_TOKENS_REQUIRED_GAS() view returns(uint256) -func (_NativeTokenDestination *NativeTokenDestinationCaller) TRANSFERNATIVETOKENSREQUIREDGAS(opts *bind.CallOpts) (*big.Int, error) { +func (_Nativetokendestination *NativetokendestinationCaller) TRANSFERNATIVETOKENSREQUIREDGAS(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _NativeTokenDestination.contract.Call(opts, &out, "TRANSFER_NATIVE_TOKENS_REQUIRED_GAS") + err := _Nativetokendestination.contract.Call(opts, &out, "TRANSFER_NATIVE_TOKENS_REQUIRED_GAS") if err != nil { return *new(*big.Int), err @@ -200,23 +200,23 @@ func (_NativeTokenDestination *NativeTokenDestinationCaller) TRANSFERNATIVETOKEN // TRANSFERNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xab285230. // // Solidity: function TRANSFER_NATIVE_TOKENS_REQUIRED_GAS() view returns(uint256) -func (_NativeTokenDestination *NativeTokenDestinationSession) TRANSFERNATIVETOKENSREQUIREDGAS() (*big.Int, error) { - return _NativeTokenDestination.Contract.TRANSFERNATIVETOKENSREQUIREDGAS(&_NativeTokenDestination.CallOpts) +func (_Nativetokendestination *NativetokendestinationSession) TRANSFERNATIVETOKENSREQUIREDGAS() (*big.Int, error) { + return _Nativetokendestination.Contract.TRANSFERNATIVETOKENSREQUIREDGAS(&_Nativetokendestination.CallOpts) } // TRANSFERNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xab285230. // // Solidity: function TRANSFER_NATIVE_TOKENS_REQUIRED_GAS() view returns(uint256) -func (_NativeTokenDestination *NativeTokenDestinationCallerSession) TRANSFERNATIVETOKENSREQUIREDGAS() (*big.Int, error) { - return _NativeTokenDestination.Contract.TRANSFERNATIVETOKENSREQUIREDGAS(&_NativeTokenDestination.CallOpts) +func (_Nativetokendestination *NativetokendestinationCallerSession) TRANSFERNATIVETOKENSREQUIREDGAS() (*big.Int, error) { + return _Nativetokendestination.Contract.TRANSFERNATIVETOKENSREQUIREDGAS(&_Nativetokendestination.CallOpts) } // CurrentBlockchainID is a free data retrieval call binding the contract method 0x4950d2d0. // // Solidity: function currentBlockchainID() view returns(bytes32) -func (_NativeTokenDestination *NativeTokenDestinationCaller) CurrentBlockchainID(opts *bind.CallOpts) ([32]byte, error) { +func (_Nativetokendestination *NativetokendestinationCaller) CurrentBlockchainID(opts *bind.CallOpts) ([32]byte, error) { var out []interface{} - err := _NativeTokenDestination.contract.Call(opts, &out, "currentBlockchainID") + err := _Nativetokendestination.contract.Call(opts, &out, "currentBlockchainID") if err != nil { return *new([32]byte), err @@ -231,23 +231,23 @@ func (_NativeTokenDestination *NativeTokenDestinationCaller) CurrentBlockchainID // CurrentBlockchainID is a free data retrieval call binding the contract method 0x4950d2d0. // // Solidity: function currentBlockchainID() view returns(bytes32) -func (_NativeTokenDestination *NativeTokenDestinationSession) CurrentBlockchainID() ([32]byte, error) { - return _NativeTokenDestination.Contract.CurrentBlockchainID(&_NativeTokenDestination.CallOpts) +func (_Nativetokendestination *NativetokendestinationSession) CurrentBlockchainID() ([32]byte, error) { + return _Nativetokendestination.Contract.CurrentBlockchainID(&_Nativetokendestination.CallOpts) } // CurrentBlockchainID is a free data retrieval call binding the contract method 0x4950d2d0. // // Solidity: function currentBlockchainID() view returns(bytes32) -func (_NativeTokenDestination *NativeTokenDestinationCallerSession) CurrentBlockchainID() ([32]byte, error) { - return _NativeTokenDestination.Contract.CurrentBlockchainID(&_NativeTokenDestination.CallOpts) +func (_Nativetokendestination *NativetokendestinationCallerSession) CurrentBlockchainID() ([32]byte, error) { + return _Nativetokendestination.Contract.CurrentBlockchainID(&_Nativetokendestination.CallOpts) } // SourceBlockchainID is a free data retrieval call binding the contract method 0x29b7b3fd. // // Solidity: function sourceBlockchainID() view returns(bytes32) -func (_NativeTokenDestination *NativeTokenDestinationCaller) SourceBlockchainID(opts *bind.CallOpts) ([32]byte, error) { +func (_Nativetokendestination *NativetokendestinationCaller) SourceBlockchainID(opts *bind.CallOpts) ([32]byte, error) { var out []interface{} - err := _NativeTokenDestination.contract.Call(opts, &out, "sourceBlockchainID") + err := _Nativetokendestination.contract.Call(opts, &out, "sourceBlockchainID") if err != nil { return *new([32]byte), err @@ -262,23 +262,23 @@ func (_NativeTokenDestination *NativeTokenDestinationCaller) SourceBlockchainID( // SourceBlockchainID is a free data retrieval call binding the contract method 0x29b7b3fd. // // Solidity: function sourceBlockchainID() view returns(bytes32) -func (_NativeTokenDestination *NativeTokenDestinationSession) SourceBlockchainID() ([32]byte, error) { - return _NativeTokenDestination.Contract.SourceBlockchainID(&_NativeTokenDestination.CallOpts) +func (_Nativetokendestination *NativetokendestinationSession) SourceBlockchainID() ([32]byte, error) { + return _Nativetokendestination.Contract.SourceBlockchainID(&_Nativetokendestination.CallOpts) } // SourceBlockchainID is a free data retrieval call binding the contract method 0x29b7b3fd. // // Solidity: function sourceBlockchainID() view returns(bytes32) -func (_NativeTokenDestination *NativeTokenDestinationCallerSession) SourceBlockchainID() ([32]byte, error) { - return _NativeTokenDestination.Contract.SourceBlockchainID(&_NativeTokenDestination.CallOpts) +func (_Nativetokendestination *NativetokendestinationCallerSession) SourceBlockchainID() ([32]byte, error) { + return _Nativetokendestination.Contract.SourceBlockchainID(&_Nativetokendestination.CallOpts) } // SourceContractAddress is a free data retrieval call binding the contract method 0x3a85f16a. // // Solidity: function sourceContractAddress() view returns(address) -func (_NativeTokenDestination *NativeTokenDestinationCaller) SourceContractAddress(opts *bind.CallOpts) (common.Address, error) { +func (_Nativetokendestination *NativetokendestinationCaller) SourceContractAddress(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _NativeTokenDestination.contract.Call(opts, &out, "sourceContractAddress") + err := _Nativetokendestination.contract.Call(opts, &out, "sourceContractAddress") if err != nil { return *new(common.Address), err @@ -293,23 +293,23 @@ func (_NativeTokenDestination *NativeTokenDestinationCaller) SourceContractAddre // SourceContractAddress is a free data retrieval call binding the contract method 0x3a85f16a. // // Solidity: function sourceContractAddress() view returns(address) -func (_NativeTokenDestination *NativeTokenDestinationSession) SourceContractAddress() (common.Address, error) { - return _NativeTokenDestination.Contract.SourceContractAddress(&_NativeTokenDestination.CallOpts) +func (_Nativetokendestination *NativetokendestinationSession) SourceContractAddress() (common.Address, error) { + return _Nativetokendestination.Contract.SourceContractAddress(&_Nativetokendestination.CallOpts) } // SourceContractAddress is a free data retrieval call binding the contract method 0x3a85f16a. // // Solidity: function sourceContractAddress() view returns(address) -func (_NativeTokenDestination *NativeTokenDestinationCallerSession) SourceContractAddress() (common.Address, error) { - return _NativeTokenDestination.Contract.SourceContractAddress(&_NativeTokenDestination.CallOpts) +func (_Nativetokendestination *NativetokendestinationCallerSession) SourceContractAddress() (common.Address, error) { + return _Nativetokendestination.Contract.SourceContractAddress(&_Nativetokendestination.CallOpts) } // TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. // // Solidity: function teleporterMessenger() view returns(address) -func (_NativeTokenDestination *NativeTokenDestinationCaller) TeleporterMessenger(opts *bind.CallOpts) (common.Address, error) { +func (_Nativetokendestination *NativetokendestinationCaller) TeleporterMessenger(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _NativeTokenDestination.contract.Call(opts, &out, "teleporterMessenger") + err := _Nativetokendestination.contract.Call(opts, &out, "teleporterMessenger") if err != nil { return *new(common.Address), err @@ -324,23 +324,23 @@ func (_NativeTokenDestination *NativeTokenDestinationCaller) TeleporterMessenger // TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. // // Solidity: function teleporterMessenger() view returns(address) -func (_NativeTokenDestination *NativeTokenDestinationSession) TeleporterMessenger() (common.Address, error) { - return _NativeTokenDestination.Contract.TeleporterMessenger(&_NativeTokenDestination.CallOpts) +func (_Nativetokendestination *NativetokendestinationSession) TeleporterMessenger() (common.Address, error) { + return _Nativetokendestination.Contract.TeleporterMessenger(&_Nativetokendestination.CallOpts) } // TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. // // Solidity: function teleporterMessenger() view returns(address) -func (_NativeTokenDestination *NativeTokenDestinationCallerSession) TeleporterMessenger() (common.Address, error) { - return _NativeTokenDestination.Contract.TeleporterMessenger(&_NativeTokenDestination.CallOpts) +func (_Nativetokendestination *NativetokendestinationCallerSession) TeleporterMessenger() (common.Address, error) { + return _Nativetokendestination.Contract.TeleporterMessenger(&_Nativetokendestination.CallOpts) } // TokenReserve is a free data retrieval call binding the contract method 0xcbcb3171. // // Solidity: function tokenReserve() view returns(uint256) -func (_NativeTokenDestination *NativeTokenDestinationCaller) TokenReserve(opts *bind.CallOpts) (*big.Int, error) { +func (_Nativetokendestination *NativetokendestinationCaller) TokenReserve(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _NativeTokenDestination.contract.Call(opts, &out, "tokenReserve") + err := _Nativetokendestination.contract.Call(opts, &out, "tokenReserve") if err != nil { return *new(*big.Int), err @@ -355,62 +355,62 @@ func (_NativeTokenDestination *NativeTokenDestinationCaller) TokenReserve(opts * // TokenReserve is a free data retrieval call binding the contract method 0xcbcb3171. // // Solidity: function tokenReserve() view returns(uint256) -func (_NativeTokenDestination *NativeTokenDestinationSession) TokenReserve() (*big.Int, error) { - return _NativeTokenDestination.Contract.TokenReserve(&_NativeTokenDestination.CallOpts) +func (_Nativetokendestination *NativetokendestinationSession) TokenReserve() (*big.Int, error) { + return _Nativetokendestination.Contract.TokenReserve(&_Nativetokendestination.CallOpts) } // TokenReserve is a free data retrieval call binding the contract method 0xcbcb3171. // // Solidity: function tokenReserve() view returns(uint256) -func (_NativeTokenDestination *NativeTokenDestinationCallerSession) TokenReserve() (*big.Int, error) { - return _NativeTokenDestination.Contract.TokenReserve(&_NativeTokenDestination.CallOpts) +func (_Nativetokendestination *NativetokendestinationCallerSession) TokenReserve() (*big.Int, error) { + return _Nativetokendestination.Contract.TokenReserve(&_Nativetokendestination.CallOpts) } // ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. // // Solidity: function receiveTeleporterMessage(bytes32 senderBlockchainID, address senderAddress, bytes message) returns() -func (_NativeTokenDestination *NativeTokenDestinationTransactor) ReceiveTeleporterMessage(opts *bind.TransactOpts, senderBlockchainID [32]byte, senderAddress common.Address, message []byte) (*types.Transaction, error) { - return _NativeTokenDestination.contract.Transact(opts, "receiveTeleporterMessage", senderBlockchainID, senderAddress, message) +func (_Nativetokendestination *NativetokendestinationTransactor) ReceiveTeleporterMessage(opts *bind.TransactOpts, senderBlockchainID [32]byte, senderAddress common.Address, message []byte) (*types.Transaction, error) { + return _Nativetokendestination.contract.Transact(opts, "receiveTeleporterMessage", senderBlockchainID, senderAddress, message) } // ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. // // Solidity: function receiveTeleporterMessage(bytes32 senderBlockchainID, address senderAddress, bytes message) returns() -func (_NativeTokenDestination *NativeTokenDestinationSession) ReceiveTeleporterMessage(senderBlockchainID [32]byte, senderAddress common.Address, message []byte) (*types.Transaction, error) { - return _NativeTokenDestination.Contract.ReceiveTeleporterMessage(&_NativeTokenDestination.TransactOpts, senderBlockchainID, senderAddress, message) +func (_Nativetokendestination *NativetokendestinationSession) ReceiveTeleporterMessage(senderBlockchainID [32]byte, senderAddress common.Address, message []byte) (*types.Transaction, error) { + return _Nativetokendestination.Contract.ReceiveTeleporterMessage(&_Nativetokendestination.TransactOpts, senderBlockchainID, senderAddress, message) } // ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. // // Solidity: function receiveTeleporterMessage(bytes32 senderBlockchainID, address senderAddress, bytes message) returns() -func (_NativeTokenDestination *NativeTokenDestinationTransactorSession) ReceiveTeleporterMessage(senderBlockchainID [32]byte, senderAddress common.Address, message []byte) (*types.Transaction, error) { - return _NativeTokenDestination.Contract.ReceiveTeleporterMessage(&_NativeTokenDestination.TransactOpts, senderBlockchainID, senderAddress, message) +func (_Nativetokendestination *NativetokendestinationTransactorSession) ReceiveTeleporterMessage(senderBlockchainID [32]byte, senderAddress common.Address, message []byte) (*types.Transaction, error) { + return _Nativetokendestination.Contract.ReceiveTeleporterMessage(&_Nativetokendestination.TransactOpts, senderBlockchainID, senderAddress, message) } // TransferToSource is a paid mutator transaction binding the contract method 0x281c91de. // // Solidity: function transferToSource(address recipient, address feeContractAddress, uint256 feeAmount) payable returns() -func (_NativeTokenDestination *NativeTokenDestinationTransactor) TransferToSource(opts *bind.TransactOpts, recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { - return _NativeTokenDestination.contract.Transact(opts, "transferToSource", recipient, feeContractAddress, feeAmount) +func (_Nativetokendestination *NativetokendestinationTransactor) TransferToSource(opts *bind.TransactOpts, recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { + return _Nativetokendestination.contract.Transact(opts, "transferToSource", recipient, feeContractAddress, feeAmount) } // TransferToSource is a paid mutator transaction binding the contract method 0x281c91de. // // Solidity: function transferToSource(address recipient, address feeContractAddress, uint256 feeAmount) payable returns() -func (_NativeTokenDestination *NativeTokenDestinationSession) TransferToSource(recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { - return _NativeTokenDestination.Contract.TransferToSource(&_NativeTokenDestination.TransactOpts, recipient, feeContractAddress, feeAmount) +func (_Nativetokendestination *NativetokendestinationSession) TransferToSource(recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { + return _Nativetokendestination.Contract.TransferToSource(&_Nativetokendestination.TransactOpts, recipient, feeContractAddress, feeAmount) } // TransferToSource is a paid mutator transaction binding the contract method 0x281c91de. // // Solidity: function transferToSource(address recipient, address feeContractAddress, uint256 feeAmount) payable returns() -func (_NativeTokenDestination *NativeTokenDestinationTransactorSession) TransferToSource(recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { - return _NativeTokenDestination.Contract.TransferToSource(&_NativeTokenDestination.TransactOpts, recipient, feeContractAddress, feeAmount) +func (_Nativetokendestination *NativetokendestinationTransactorSession) TransferToSource(recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { + return _Nativetokendestination.Contract.TransferToSource(&_Nativetokendestination.TransactOpts, recipient, feeContractAddress, feeAmount) } -// NativeTokenDestinationCollateralAddedIterator is returned from FilterCollateralAdded and is used to iterate over the raw logs and unpacked data for CollateralAdded events raised by the NativeTokenDestination contract. -type NativeTokenDestinationCollateralAddedIterator struct { - Event *NativeTokenDestinationCollateralAdded // Event containing the contract specifics and raw log +// NativetokendestinationCollateralAddedIterator is returned from FilterCollateralAdded and is used to iterate over the raw logs and unpacked data for CollateralAdded events raised by the Nativetokendestination contract. +type NativetokendestinationCollateralAddedIterator struct { + Event *NativetokendestinationCollateralAdded // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -424,7 +424,7 @@ type NativeTokenDestinationCollateralAddedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *NativeTokenDestinationCollateralAddedIterator) Next() bool { +func (it *NativetokendestinationCollateralAddedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -433,7 +433,7 @@ func (it *NativeTokenDestinationCollateralAddedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(NativeTokenDestinationCollateralAdded) + it.Event = new(NativetokendestinationCollateralAdded) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -448,7 +448,7 @@ func (it *NativeTokenDestinationCollateralAddedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(NativeTokenDestinationCollateralAdded) + it.Event = new(NativetokendestinationCollateralAdded) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -464,19 +464,19 @@ func (it *NativeTokenDestinationCollateralAddedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *NativeTokenDestinationCollateralAddedIterator) Error() error { +func (it *NativetokendestinationCollateralAddedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *NativeTokenDestinationCollateralAddedIterator) Close() error { +func (it *NativetokendestinationCollateralAddedIterator) Close() error { it.sub.Unsubscribe() return nil } -// NativeTokenDestinationCollateralAdded represents a CollateralAdded event raised by the NativeTokenDestination contract. -type NativeTokenDestinationCollateralAdded struct { +// NativetokendestinationCollateralAdded represents a CollateralAdded event raised by the Nativetokendestination contract. +type NativetokendestinationCollateralAdded struct { Amount *big.Int Remaining *big.Int Raw types.Log // Blockchain specific contextual infos @@ -485,21 +485,21 @@ type NativeTokenDestinationCollateralAdded struct { // FilterCollateralAdded is a free log retrieval operation binding the contract event 0x244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449. // // Solidity: event CollateralAdded(uint256 amount, uint256 remaining) -func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterCollateralAdded(opts *bind.FilterOpts) (*NativeTokenDestinationCollateralAddedIterator, error) { +func (_Nativetokendestination *NativetokendestinationFilterer) FilterCollateralAdded(opts *bind.FilterOpts) (*NativetokendestinationCollateralAddedIterator, error) { - logs, sub, err := _NativeTokenDestination.contract.FilterLogs(opts, "CollateralAdded") + logs, sub, err := _Nativetokendestination.contract.FilterLogs(opts, "CollateralAdded") if err != nil { return nil, err } - return &NativeTokenDestinationCollateralAddedIterator{contract: _NativeTokenDestination.contract, event: "CollateralAdded", logs: logs, sub: sub}, nil + return &NativetokendestinationCollateralAddedIterator{contract: _Nativetokendestination.contract, event: "CollateralAdded", logs: logs, sub: sub}, nil } // WatchCollateralAdded is a free log subscription operation binding the contract event 0x244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449. // // Solidity: event CollateralAdded(uint256 amount, uint256 remaining) -func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchCollateralAdded(opts *bind.WatchOpts, sink chan<- *NativeTokenDestinationCollateralAdded) (event.Subscription, error) { +func (_Nativetokendestination *NativetokendestinationFilterer) WatchCollateralAdded(opts *bind.WatchOpts, sink chan<- *NativetokendestinationCollateralAdded) (event.Subscription, error) { - logs, sub, err := _NativeTokenDestination.contract.WatchLogs(opts, "CollateralAdded") + logs, sub, err := _Nativetokendestination.contract.WatchLogs(opts, "CollateralAdded") if err != nil { return nil, err } @@ -509,8 +509,8 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchCollateralAd select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(NativeTokenDestinationCollateralAdded) - if err := _NativeTokenDestination.contract.UnpackLog(event, "CollateralAdded", log); err != nil { + event := new(NativetokendestinationCollateralAdded) + if err := _Nativetokendestination.contract.UnpackLog(event, "CollateralAdded", log); err != nil { return err } event.Raw = log @@ -534,18 +534,18 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchCollateralAd // ParseCollateralAdded is a log parse operation binding the contract event 0x244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449. // // Solidity: event CollateralAdded(uint256 amount, uint256 remaining) -func (_NativeTokenDestination *NativeTokenDestinationFilterer) ParseCollateralAdded(log types.Log) (*NativeTokenDestinationCollateralAdded, error) { - event := new(NativeTokenDestinationCollateralAdded) - if err := _NativeTokenDestination.contract.UnpackLog(event, "CollateralAdded", log); err != nil { +func (_Nativetokendestination *NativetokendestinationFilterer) ParseCollateralAdded(log types.Log) (*NativetokendestinationCollateralAdded, error) { + event := new(NativetokendestinationCollateralAdded) + if err := _Nativetokendestination.contract.UnpackLog(event, "CollateralAdded", log); err != nil { return nil, err } event.Raw = log return event, nil } -// NativeTokenDestinationMintNativeTokensIterator is returned from FilterMintNativeTokens and is used to iterate over the raw logs and unpacked data for MintNativeTokens events raised by the NativeTokenDestination contract. -type NativeTokenDestinationMintNativeTokensIterator struct { - Event *NativeTokenDestinationMintNativeTokens // Event containing the contract specifics and raw log +// NativetokendestinationMintNativeTokensIterator is returned from FilterMintNativeTokens and is used to iterate over the raw logs and unpacked data for MintNativeTokens events raised by the Nativetokendestination contract. +type NativetokendestinationMintNativeTokensIterator struct { + Event *NativetokendestinationMintNativeTokens // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -559,7 +559,7 @@ type NativeTokenDestinationMintNativeTokensIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *NativeTokenDestinationMintNativeTokensIterator) Next() bool { +func (it *NativetokendestinationMintNativeTokensIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -568,7 +568,7 @@ func (it *NativeTokenDestinationMintNativeTokensIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(NativeTokenDestinationMintNativeTokens) + it.Event = new(NativetokendestinationMintNativeTokens) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -583,7 +583,7 @@ func (it *NativeTokenDestinationMintNativeTokensIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(NativeTokenDestinationMintNativeTokens) + it.Event = new(NativetokendestinationMintNativeTokens) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -599,19 +599,19 @@ func (it *NativeTokenDestinationMintNativeTokensIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *NativeTokenDestinationMintNativeTokensIterator) Error() error { +func (it *NativetokendestinationMintNativeTokensIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *NativeTokenDestinationMintNativeTokensIterator) Close() error { +func (it *NativetokendestinationMintNativeTokensIterator) Close() error { it.sub.Unsubscribe() return nil } -// NativeTokenDestinationMintNativeTokens represents a MintNativeTokens event raised by the NativeTokenDestination contract. -type NativeTokenDestinationMintNativeTokens struct { +// NativetokendestinationMintNativeTokens represents a MintNativeTokens event raised by the Nativetokendestination contract. +type NativetokendestinationMintNativeTokens struct { Recipient common.Address Amount *big.Int Raw types.Log // Blockchain specific contextual infos @@ -620,21 +620,21 @@ type NativeTokenDestinationMintNativeTokens struct { // FilterMintNativeTokens is a free log retrieval operation binding the contract event 0xe2899f7ef7618206fa13efbcde0c05cccd83f35ac3b18ef860021181d61fa680. // // Solidity: event MintNativeTokens(address recipient, uint256 amount) -func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterMintNativeTokens(opts *bind.FilterOpts) (*NativeTokenDestinationMintNativeTokensIterator, error) { +func (_Nativetokendestination *NativetokendestinationFilterer) FilterMintNativeTokens(opts *bind.FilterOpts) (*NativetokendestinationMintNativeTokensIterator, error) { - logs, sub, err := _NativeTokenDestination.contract.FilterLogs(opts, "MintNativeTokens") + logs, sub, err := _Nativetokendestination.contract.FilterLogs(opts, "MintNativeTokens") if err != nil { return nil, err } - return &NativeTokenDestinationMintNativeTokensIterator{contract: _NativeTokenDestination.contract, event: "MintNativeTokens", logs: logs, sub: sub}, nil + return &NativetokendestinationMintNativeTokensIterator{contract: _Nativetokendestination.contract, event: "MintNativeTokens", logs: logs, sub: sub}, nil } // WatchMintNativeTokens is a free log subscription operation binding the contract event 0xe2899f7ef7618206fa13efbcde0c05cccd83f35ac3b18ef860021181d61fa680. // // Solidity: event MintNativeTokens(address recipient, uint256 amount) -func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchMintNativeTokens(opts *bind.WatchOpts, sink chan<- *NativeTokenDestinationMintNativeTokens) (event.Subscription, error) { +func (_Nativetokendestination *NativetokendestinationFilterer) WatchMintNativeTokens(opts *bind.WatchOpts, sink chan<- *NativetokendestinationMintNativeTokens) (event.Subscription, error) { - logs, sub, err := _NativeTokenDestination.contract.WatchLogs(opts, "MintNativeTokens") + logs, sub, err := _Nativetokendestination.contract.WatchLogs(opts, "MintNativeTokens") if err != nil { return nil, err } @@ -644,8 +644,8 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchMintNativeTo select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(NativeTokenDestinationMintNativeTokens) - if err := _NativeTokenDestination.contract.UnpackLog(event, "MintNativeTokens", log); err != nil { + event := new(NativetokendestinationMintNativeTokens) + if err := _Nativetokendestination.contract.UnpackLog(event, "MintNativeTokens", log); err != nil { return err } event.Raw = log @@ -669,18 +669,18 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchMintNativeTo // ParseMintNativeTokens is a log parse operation binding the contract event 0xe2899f7ef7618206fa13efbcde0c05cccd83f35ac3b18ef860021181d61fa680. // // Solidity: event MintNativeTokens(address recipient, uint256 amount) -func (_NativeTokenDestination *NativeTokenDestinationFilterer) ParseMintNativeTokens(log types.Log) (*NativeTokenDestinationMintNativeTokens, error) { - event := new(NativeTokenDestinationMintNativeTokens) - if err := _NativeTokenDestination.contract.UnpackLog(event, "MintNativeTokens", log); err != nil { +func (_Nativetokendestination *NativetokendestinationFilterer) ParseMintNativeTokens(log types.Log) (*NativetokendestinationMintNativeTokens, error) { + event := new(NativetokendestinationMintNativeTokens) + if err := _Nativetokendestination.contract.UnpackLog(event, "MintNativeTokens", log); err != nil { return nil, err } event.Raw = log return event, nil } -// NativeTokenDestinationTransferToSourceIterator is returned from FilterTransferToSource and is used to iterate over the raw logs and unpacked data for TransferToSource events raised by the NativeTokenDestination contract. -type NativeTokenDestinationTransferToSourceIterator struct { - Event *NativeTokenDestinationTransferToSource // Event containing the contract specifics and raw log +// NativetokendestinationTransferToSourceIterator is returned from FilterTransferToSource and is used to iterate over the raw logs and unpacked data for TransferToSource events raised by the Nativetokendestination contract. +type NativetokendestinationTransferToSourceIterator struct { + Event *NativetokendestinationTransferToSource // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -694,7 +694,7 @@ type NativeTokenDestinationTransferToSourceIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *NativeTokenDestinationTransferToSourceIterator) Next() bool { +func (it *NativetokendestinationTransferToSourceIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -703,7 +703,7 @@ func (it *NativeTokenDestinationTransferToSourceIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(NativeTokenDestinationTransferToSource) + it.Event = new(NativetokendestinationTransferToSource) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -718,7 +718,7 @@ func (it *NativeTokenDestinationTransferToSourceIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(NativeTokenDestinationTransferToSource) + it.Event = new(NativetokendestinationTransferToSource) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -734,19 +734,19 @@ func (it *NativeTokenDestinationTransferToSourceIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *NativeTokenDestinationTransferToSourceIterator) Error() error { +func (it *NativetokendestinationTransferToSourceIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *NativeTokenDestinationTransferToSourceIterator) Close() error { +func (it *NativetokendestinationTransferToSourceIterator) Close() error { it.sub.Unsubscribe() return nil } -// NativeTokenDestinationTransferToSource represents a TransferToSource event raised by the NativeTokenDestination contract. -type NativeTokenDestinationTransferToSource struct { +// NativetokendestinationTransferToSource represents a TransferToSource event raised by the Nativetokendestination contract. +type NativetokendestinationTransferToSource struct { Sender common.Address Recipient common.Address Amount *big.Int @@ -759,7 +759,7 @@ type NativeTokenDestinationTransferToSource struct { // FilterTransferToSource is a free log retrieval operation binding the contract event 0x343e0fe771af9fa258c07a602fad6dfd80c51eda78604397e553106360933bfc. // // Solidity: event TransferToSource(address indexed sender, address indexed recipient, uint256 amount, address feeContractAddress, uint256 feeAmount, uint256 teleporterMessageID) -func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterTransferToSource(opts *bind.FilterOpts, sender []common.Address, recipient []common.Address) (*NativeTokenDestinationTransferToSourceIterator, error) { +func (_Nativetokendestination *NativetokendestinationFilterer) FilterTransferToSource(opts *bind.FilterOpts, sender []common.Address, recipient []common.Address) (*NativetokendestinationTransferToSourceIterator, error) { var senderRule []interface{} for _, senderItem := range sender { @@ -770,17 +770,17 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterTransferToS recipientRule = append(recipientRule, recipientItem) } - logs, sub, err := _NativeTokenDestination.contract.FilterLogs(opts, "TransferToSource", senderRule, recipientRule) + logs, sub, err := _Nativetokendestination.contract.FilterLogs(opts, "TransferToSource", senderRule, recipientRule) if err != nil { return nil, err } - return &NativeTokenDestinationTransferToSourceIterator{contract: _NativeTokenDestination.contract, event: "TransferToSource", logs: logs, sub: sub}, nil + return &NativetokendestinationTransferToSourceIterator{contract: _Nativetokendestination.contract, event: "TransferToSource", logs: logs, sub: sub}, nil } // WatchTransferToSource is a free log subscription operation binding the contract event 0x343e0fe771af9fa258c07a602fad6dfd80c51eda78604397e553106360933bfc. // // Solidity: event TransferToSource(address indexed sender, address indexed recipient, uint256 amount, address feeContractAddress, uint256 feeAmount, uint256 teleporterMessageID) -func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchTransferToSource(opts *bind.WatchOpts, sink chan<- *NativeTokenDestinationTransferToSource, sender []common.Address, recipient []common.Address) (event.Subscription, error) { +func (_Nativetokendestination *NativetokendestinationFilterer) WatchTransferToSource(opts *bind.WatchOpts, sink chan<- *NativetokendestinationTransferToSource, sender []common.Address, recipient []common.Address) (event.Subscription, error) { var senderRule []interface{} for _, senderItem := range sender { @@ -791,7 +791,7 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchTransferToSo recipientRule = append(recipientRule, recipientItem) } - logs, sub, err := _NativeTokenDestination.contract.WatchLogs(opts, "TransferToSource", senderRule, recipientRule) + logs, sub, err := _Nativetokendestination.contract.WatchLogs(opts, "TransferToSource", senderRule, recipientRule) if err != nil { return nil, err } @@ -801,8 +801,8 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchTransferToSo select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(NativeTokenDestinationTransferToSource) - if err := _NativeTokenDestination.contract.UnpackLog(event, "TransferToSource", log); err != nil { + event := new(NativetokendestinationTransferToSource) + if err := _Nativetokendestination.contract.UnpackLog(event, "TransferToSource", log); err != nil { return err } event.Raw = log @@ -826,9 +826,9 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchTransferToSo // ParseTransferToSource is a log parse operation binding the contract event 0x343e0fe771af9fa258c07a602fad6dfd80c51eda78604397e553106360933bfc. // // Solidity: event TransferToSource(address indexed sender, address indexed recipient, uint256 amount, address feeContractAddress, uint256 feeAmount, uint256 teleporterMessageID) -func (_NativeTokenDestination *NativeTokenDestinationFilterer) ParseTransferToSource(log types.Log) (*NativeTokenDestinationTransferToSource, error) { - event := new(NativeTokenDestinationTransferToSource) - if err := _NativeTokenDestination.contract.UnpackLog(event, "TransferToSource", log); err != nil { +func (_Nativetokendestination *NativetokendestinationFilterer) ParseTransferToSource(log types.Log) (*NativetokendestinationTransferToSource, error) { + event := new(NativetokendestinationTransferToSource) + if err := _Nativetokendestination.contract.UnpackLog(event, "TransferToSource", log); err != nil { return nil, err } event.Raw = log diff --git a/contracts/abi/NativeTokenSource.go b/abis/NativeTokenSource/NativeTokenSource.go similarity index 66% rename from contracts/abi/NativeTokenSource.go rename to abis/NativeTokenSource/NativeTokenSource.go index a787b1332..425c115d9 100644 --- a/contracts/abi/NativeTokenSource.go +++ b/abis/NativeTokenSource/NativeTokenSource.go @@ -1,7 +1,7 @@ // Code generated - DO NOT EDIT. // This file is a generated binding and any manual changes will be lost. -package abi +package nativetokensource import ( "errors" @@ -29,113 +29,113 @@ var ( _ = abi.ConvertType ) -// NativeTokenSourceMetaData contains all meta data concerning the NativeTokenSource contract. -var NativeTokenSourceMetaData = &bind.MetaData{ +// NativetokensourceMetaData contains all meta data concerning the Nativetokensource contract. +var NativetokensourceMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationContractAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", } -// NativeTokenSourceABI is the input ABI used to generate the binding from. -// Deprecated: Use NativeTokenSourceMetaData.ABI instead. -var NativeTokenSourceABI = NativeTokenSourceMetaData.ABI +// NativetokensourceABI is the input ABI used to generate the binding from. +// Deprecated: Use NativetokensourceMetaData.ABI instead. +var NativetokensourceABI = NativetokensourceMetaData.ABI -// NativeTokenSource is an auto generated Go binding around an Ethereum contract. -type NativeTokenSource struct { - NativeTokenSourceCaller // Read-only binding to the contract - NativeTokenSourceTransactor // Write-only binding to the contract - NativeTokenSourceFilterer // Log filterer for contract events +// Nativetokensource is an auto generated Go binding around an Ethereum contract. +type Nativetokensource struct { + NativetokensourceCaller // Read-only binding to the contract + NativetokensourceTransactor // Write-only binding to the contract + NativetokensourceFilterer // Log filterer for contract events } -// NativeTokenSourceCaller is an auto generated read-only Go binding around an Ethereum contract. -type NativeTokenSourceCaller struct { +// NativetokensourceCaller is an auto generated read-only Go binding around an Ethereum contract. +type NativetokensourceCaller struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls } -// NativeTokenSourceTransactor is an auto generated write-only Go binding around an Ethereum contract. -type NativeTokenSourceTransactor struct { +// NativetokensourceTransactor is an auto generated write-only Go binding around an Ethereum contract. +type NativetokensourceTransactor struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls } -// NativeTokenSourceFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type NativeTokenSourceFilterer struct { +// NativetokensourceFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type NativetokensourceFilterer struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls } -// NativeTokenSourceSession is an auto generated Go binding around an Ethereum contract, +// NativetokensourceSession is an auto generated Go binding around an Ethereum contract, // with pre-set call and transact options. -type NativeTokenSourceSession struct { - Contract *NativeTokenSource // Generic contract binding to set the session for +type NativetokensourceSession struct { + Contract *Nativetokensource // Generic contract binding to set the session for CallOpts bind.CallOpts // Call options to use throughout this session TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session } -// NativeTokenSourceCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// NativetokensourceCallerSession is an auto generated read-only Go binding around an Ethereum contract, // with pre-set call options. -type NativeTokenSourceCallerSession struct { - Contract *NativeTokenSourceCaller // Generic contract caller binding to set the session for +type NativetokensourceCallerSession struct { + Contract *NativetokensourceCaller // Generic contract caller binding to set the session for CallOpts bind.CallOpts // Call options to use throughout this session } -// NativeTokenSourceTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// NativetokensourceTransactorSession is an auto generated write-only Go binding around an Ethereum contract, // with pre-set transact options. -type NativeTokenSourceTransactorSession struct { - Contract *NativeTokenSourceTransactor // Generic contract transactor binding to set the session for +type NativetokensourceTransactorSession struct { + Contract *NativetokensourceTransactor // Generic contract transactor binding to set the session for TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session } -// NativeTokenSourceRaw is an auto generated low-level Go binding around an Ethereum contract. -type NativeTokenSourceRaw struct { - Contract *NativeTokenSource // Generic contract binding to access the raw methods on +// NativetokensourceRaw is an auto generated low-level Go binding around an Ethereum contract. +type NativetokensourceRaw struct { + Contract *Nativetokensource // Generic contract binding to access the raw methods on } -// NativeTokenSourceCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type NativeTokenSourceCallerRaw struct { - Contract *NativeTokenSourceCaller // Generic read-only contract binding to access the raw methods on +// NativetokensourceCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type NativetokensourceCallerRaw struct { + Contract *NativetokensourceCaller // Generic read-only contract binding to access the raw methods on } -// NativeTokenSourceTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type NativeTokenSourceTransactorRaw struct { - Contract *NativeTokenSourceTransactor // Generic write-only contract binding to access the raw methods on +// NativetokensourceTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type NativetokensourceTransactorRaw struct { + Contract *NativetokensourceTransactor // Generic write-only contract binding to access the raw methods on } -// NewNativeTokenSource creates a new instance of NativeTokenSource, bound to a specific deployed contract. -func NewNativeTokenSource(address common.Address, backend bind.ContractBackend) (*NativeTokenSource, error) { - contract, err := bindNativeTokenSource(address, backend, backend, backend) +// NewNativetokensource creates a new instance of Nativetokensource, bound to a specific deployed contract. +func NewNativetokensource(address common.Address, backend bind.ContractBackend) (*Nativetokensource, error) { + contract, err := bindNativetokensource(address, backend, backend, backend) if err != nil { return nil, err } - return &NativeTokenSource{NativeTokenSourceCaller: NativeTokenSourceCaller{contract: contract}, NativeTokenSourceTransactor: NativeTokenSourceTransactor{contract: contract}, NativeTokenSourceFilterer: NativeTokenSourceFilterer{contract: contract}}, nil + return &Nativetokensource{NativetokensourceCaller: NativetokensourceCaller{contract: contract}, NativetokensourceTransactor: NativetokensourceTransactor{contract: contract}, NativetokensourceFilterer: NativetokensourceFilterer{contract: contract}}, nil } -// NewNativeTokenSourceCaller creates a new read-only instance of NativeTokenSource, bound to a specific deployed contract. -func NewNativeTokenSourceCaller(address common.Address, caller bind.ContractCaller) (*NativeTokenSourceCaller, error) { - contract, err := bindNativeTokenSource(address, caller, nil, nil) +// NewNativetokensourceCaller creates a new read-only instance of Nativetokensource, bound to a specific deployed contract. +func NewNativetokensourceCaller(address common.Address, caller bind.ContractCaller) (*NativetokensourceCaller, error) { + contract, err := bindNativetokensource(address, caller, nil, nil) if err != nil { return nil, err } - return &NativeTokenSourceCaller{contract: contract}, nil + return &NativetokensourceCaller{contract: contract}, nil } -// NewNativeTokenSourceTransactor creates a new write-only instance of NativeTokenSource, bound to a specific deployed contract. -func NewNativeTokenSourceTransactor(address common.Address, transactor bind.ContractTransactor) (*NativeTokenSourceTransactor, error) { - contract, err := bindNativeTokenSource(address, nil, transactor, nil) +// NewNativetokensourceTransactor creates a new write-only instance of Nativetokensource, bound to a specific deployed contract. +func NewNativetokensourceTransactor(address common.Address, transactor bind.ContractTransactor) (*NativetokensourceTransactor, error) { + contract, err := bindNativetokensource(address, nil, transactor, nil) if err != nil { return nil, err } - return &NativeTokenSourceTransactor{contract: contract}, nil + return &NativetokensourceTransactor{contract: contract}, nil } -// NewNativeTokenSourceFilterer creates a new log filterer instance of NativeTokenSource, bound to a specific deployed contract. -func NewNativeTokenSourceFilterer(address common.Address, filterer bind.ContractFilterer) (*NativeTokenSourceFilterer, error) { - contract, err := bindNativeTokenSource(address, nil, nil, filterer) +// NewNativetokensourceFilterer creates a new log filterer instance of Nativetokensource, bound to a specific deployed contract. +func NewNativetokensourceFilterer(address common.Address, filterer bind.ContractFilterer) (*NativetokensourceFilterer, error) { + contract, err := bindNativetokensource(address, nil, nil, filterer) if err != nil { return nil, err } - return &NativeTokenSourceFilterer{contract: contract}, nil + return &NativetokensourceFilterer{contract: contract}, nil } -// bindNativeTokenSource binds a generic wrapper to an already deployed contract. -func bindNativeTokenSource(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := NativeTokenSourceMetaData.GetAbi() +// bindNativetokensource binds a generic wrapper to an already deployed contract. +func bindNativetokensource(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := NativetokensourceMetaData.GetAbi() if err != nil { return nil, err } @@ -146,46 +146,46 @@ func bindNativeTokenSource(address common.Address, caller bind.ContractCaller, t // sets the output to result. The result type might be a single field for simple // returns, a slice of interfaces for anonymous returns and a struct for named // returns. -func (_NativeTokenSource *NativeTokenSourceRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _NativeTokenSource.Contract.NativeTokenSourceCaller.contract.Call(opts, result, method, params...) +func (_Nativetokensource *NativetokensourceRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Nativetokensource.Contract.NativetokensourceCaller.contract.Call(opts, result, method, params...) } // Transfer initiates a plain transaction to move funds to the contract, calling // its default method if one is available. -func (_NativeTokenSource *NativeTokenSourceRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _NativeTokenSource.Contract.NativeTokenSourceTransactor.contract.Transfer(opts) +func (_Nativetokensource *NativetokensourceRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Nativetokensource.Contract.NativetokensourceTransactor.contract.Transfer(opts) } // Transact invokes the (paid) contract method with params as input values. -func (_NativeTokenSource *NativeTokenSourceRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _NativeTokenSource.Contract.NativeTokenSourceTransactor.contract.Transact(opts, method, params...) +func (_Nativetokensource *NativetokensourceRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Nativetokensource.Contract.NativetokensourceTransactor.contract.Transact(opts, method, params...) } // Call invokes the (constant) contract method with params as input values and // sets the output to result. The result type might be a single field for simple // returns, a slice of interfaces for anonymous returns and a struct for named // returns. -func (_NativeTokenSource *NativeTokenSourceCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _NativeTokenSource.Contract.contract.Call(opts, result, method, params...) +func (_Nativetokensource *NativetokensourceCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Nativetokensource.Contract.contract.Call(opts, result, method, params...) } // Transfer initiates a plain transaction to move funds to the contract, calling // its default method if one is available. -func (_NativeTokenSource *NativeTokenSourceTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _NativeTokenSource.Contract.contract.Transfer(opts) +func (_Nativetokensource *NativetokensourceTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Nativetokensource.Contract.contract.Transfer(opts) } // Transact invokes the (paid) contract method with params as input values. -func (_NativeTokenSource *NativeTokenSourceTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _NativeTokenSource.Contract.contract.Transact(opts, method, params...) +func (_Nativetokensource *NativetokensourceTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Nativetokensource.Contract.contract.Transact(opts, method, params...) } // MINTNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xb6171f73. // // Solidity: function MINT_NATIVE_TOKENS_REQUIRED_GAS() view returns(uint256) -func (_NativeTokenSource *NativeTokenSourceCaller) MINTNATIVETOKENSREQUIREDGAS(opts *bind.CallOpts) (*big.Int, error) { +func (_Nativetokensource *NativetokensourceCaller) MINTNATIVETOKENSREQUIREDGAS(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _NativeTokenSource.contract.Call(opts, &out, "MINT_NATIVE_TOKENS_REQUIRED_GAS") + err := _Nativetokensource.contract.Call(opts, &out, "MINT_NATIVE_TOKENS_REQUIRED_GAS") if err != nil { return *new(*big.Int), err @@ -200,23 +200,23 @@ func (_NativeTokenSource *NativeTokenSourceCaller) MINTNATIVETOKENSREQUIREDGAS(o // MINTNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xb6171f73. // // Solidity: function MINT_NATIVE_TOKENS_REQUIRED_GAS() view returns(uint256) -func (_NativeTokenSource *NativeTokenSourceSession) MINTNATIVETOKENSREQUIREDGAS() (*big.Int, error) { - return _NativeTokenSource.Contract.MINTNATIVETOKENSREQUIREDGAS(&_NativeTokenSource.CallOpts) +func (_Nativetokensource *NativetokensourceSession) MINTNATIVETOKENSREQUIREDGAS() (*big.Int, error) { + return _Nativetokensource.Contract.MINTNATIVETOKENSREQUIREDGAS(&_Nativetokensource.CallOpts) } // MINTNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xb6171f73. // // Solidity: function MINT_NATIVE_TOKENS_REQUIRED_GAS() view returns(uint256) -func (_NativeTokenSource *NativeTokenSourceCallerSession) MINTNATIVETOKENSREQUIREDGAS() (*big.Int, error) { - return _NativeTokenSource.Contract.MINTNATIVETOKENSREQUIREDGAS(&_NativeTokenSource.CallOpts) +func (_Nativetokensource *NativetokensourceCallerSession) MINTNATIVETOKENSREQUIREDGAS() (*big.Int, error) { + return _Nativetokensource.Contract.MINTNATIVETOKENSREQUIREDGAS(&_Nativetokensource.CallOpts) } // CurrentBlockchainID is a free data retrieval call binding the contract method 0x4950d2d0. // // Solidity: function currentBlockchainID() view returns(bytes32) -func (_NativeTokenSource *NativeTokenSourceCaller) CurrentBlockchainID(opts *bind.CallOpts) ([32]byte, error) { +func (_Nativetokensource *NativetokensourceCaller) CurrentBlockchainID(opts *bind.CallOpts) ([32]byte, error) { var out []interface{} - err := _NativeTokenSource.contract.Call(opts, &out, "currentBlockchainID") + err := _Nativetokensource.contract.Call(opts, &out, "currentBlockchainID") if err != nil { return *new([32]byte), err @@ -231,23 +231,23 @@ func (_NativeTokenSource *NativeTokenSourceCaller) CurrentBlockchainID(opts *bin // CurrentBlockchainID is a free data retrieval call binding the contract method 0x4950d2d0. // // Solidity: function currentBlockchainID() view returns(bytes32) -func (_NativeTokenSource *NativeTokenSourceSession) CurrentBlockchainID() ([32]byte, error) { - return _NativeTokenSource.Contract.CurrentBlockchainID(&_NativeTokenSource.CallOpts) +func (_Nativetokensource *NativetokensourceSession) CurrentBlockchainID() ([32]byte, error) { + return _Nativetokensource.Contract.CurrentBlockchainID(&_Nativetokensource.CallOpts) } // CurrentBlockchainID is a free data retrieval call binding the contract method 0x4950d2d0. // // Solidity: function currentBlockchainID() view returns(bytes32) -func (_NativeTokenSource *NativeTokenSourceCallerSession) CurrentBlockchainID() ([32]byte, error) { - return _NativeTokenSource.Contract.CurrentBlockchainID(&_NativeTokenSource.CallOpts) +func (_Nativetokensource *NativetokensourceCallerSession) CurrentBlockchainID() ([32]byte, error) { + return _Nativetokensource.Contract.CurrentBlockchainID(&_Nativetokensource.CallOpts) } // DestinationBlockchainID is a free data retrieval call binding the contract method 0x41d3014d. // // Solidity: function destinationBlockchainID() view returns(bytes32) -func (_NativeTokenSource *NativeTokenSourceCaller) DestinationBlockchainID(opts *bind.CallOpts) ([32]byte, error) { +func (_Nativetokensource *NativetokensourceCaller) DestinationBlockchainID(opts *bind.CallOpts) ([32]byte, error) { var out []interface{} - err := _NativeTokenSource.contract.Call(opts, &out, "destinationBlockchainID") + err := _Nativetokensource.contract.Call(opts, &out, "destinationBlockchainID") if err != nil { return *new([32]byte), err @@ -262,23 +262,23 @@ func (_NativeTokenSource *NativeTokenSourceCaller) DestinationBlockchainID(opts // DestinationBlockchainID is a free data retrieval call binding the contract method 0x41d3014d. // // Solidity: function destinationBlockchainID() view returns(bytes32) -func (_NativeTokenSource *NativeTokenSourceSession) DestinationBlockchainID() ([32]byte, error) { - return _NativeTokenSource.Contract.DestinationBlockchainID(&_NativeTokenSource.CallOpts) +func (_Nativetokensource *NativetokensourceSession) DestinationBlockchainID() ([32]byte, error) { + return _Nativetokensource.Contract.DestinationBlockchainID(&_Nativetokensource.CallOpts) } // DestinationBlockchainID is a free data retrieval call binding the contract method 0x41d3014d. // // Solidity: function destinationBlockchainID() view returns(bytes32) -func (_NativeTokenSource *NativeTokenSourceCallerSession) DestinationBlockchainID() ([32]byte, error) { - return _NativeTokenSource.Contract.DestinationBlockchainID(&_NativeTokenSource.CallOpts) +func (_Nativetokensource *NativetokensourceCallerSession) DestinationBlockchainID() ([32]byte, error) { + return _Nativetokensource.Contract.DestinationBlockchainID(&_Nativetokensource.CallOpts) } // DestinationContractAddress is a free data retrieval call binding the contract method 0x04d6baf7. // // Solidity: function destinationContractAddress() view returns(address) -func (_NativeTokenSource *NativeTokenSourceCaller) DestinationContractAddress(opts *bind.CallOpts) (common.Address, error) { +func (_Nativetokensource *NativetokensourceCaller) DestinationContractAddress(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _NativeTokenSource.contract.Call(opts, &out, "destinationContractAddress") + err := _Nativetokensource.contract.Call(opts, &out, "destinationContractAddress") if err != nil { return *new(common.Address), err @@ -293,23 +293,23 @@ func (_NativeTokenSource *NativeTokenSourceCaller) DestinationContractAddress(op // DestinationContractAddress is a free data retrieval call binding the contract method 0x04d6baf7. // // Solidity: function destinationContractAddress() view returns(address) -func (_NativeTokenSource *NativeTokenSourceSession) DestinationContractAddress() (common.Address, error) { - return _NativeTokenSource.Contract.DestinationContractAddress(&_NativeTokenSource.CallOpts) +func (_Nativetokensource *NativetokensourceSession) DestinationContractAddress() (common.Address, error) { + return _Nativetokensource.Contract.DestinationContractAddress(&_Nativetokensource.CallOpts) } // DestinationContractAddress is a free data retrieval call binding the contract method 0x04d6baf7. // // Solidity: function destinationContractAddress() view returns(address) -func (_NativeTokenSource *NativeTokenSourceCallerSession) DestinationContractAddress() (common.Address, error) { - return _NativeTokenSource.Contract.DestinationContractAddress(&_NativeTokenSource.CallOpts) +func (_Nativetokensource *NativetokensourceCallerSession) DestinationContractAddress() (common.Address, error) { + return _Nativetokensource.Contract.DestinationContractAddress(&_Nativetokensource.CallOpts) } // TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. // // Solidity: function teleporterMessenger() view returns(address) -func (_NativeTokenSource *NativeTokenSourceCaller) TeleporterMessenger(opts *bind.CallOpts) (common.Address, error) { +func (_Nativetokensource *NativetokensourceCaller) TeleporterMessenger(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _NativeTokenSource.contract.Call(opts, &out, "teleporterMessenger") + err := _Nativetokensource.contract.Call(opts, &out, "teleporterMessenger") if err != nil { return *new(common.Address), err @@ -324,62 +324,62 @@ func (_NativeTokenSource *NativeTokenSourceCaller) TeleporterMessenger(opts *bin // TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. // // Solidity: function teleporterMessenger() view returns(address) -func (_NativeTokenSource *NativeTokenSourceSession) TeleporterMessenger() (common.Address, error) { - return _NativeTokenSource.Contract.TeleporterMessenger(&_NativeTokenSource.CallOpts) +func (_Nativetokensource *NativetokensourceSession) TeleporterMessenger() (common.Address, error) { + return _Nativetokensource.Contract.TeleporterMessenger(&_Nativetokensource.CallOpts) } // TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. // // Solidity: function teleporterMessenger() view returns(address) -func (_NativeTokenSource *NativeTokenSourceCallerSession) TeleporterMessenger() (common.Address, error) { - return _NativeTokenSource.Contract.TeleporterMessenger(&_NativeTokenSource.CallOpts) +func (_Nativetokensource *NativetokensourceCallerSession) TeleporterMessenger() (common.Address, error) { + return _Nativetokensource.Contract.TeleporterMessenger(&_Nativetokensource.CallOpts) } // ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. // // Solidity: function receiveTeleporterMessage(bytes32 senderBlockchainID, address senderAddress, bytes message) returns() -func (_NativeTokenSource *NativeTokenSourceTransactor) ReceiveTeleporterMessage(opts *bind.TransactOpts, senderBlockchainID [32]byte, senderAddress common.Address, message []byte) (*types.Transaction, error) { - return _NativeTokenSource.contract.Transact(opts, "receiveTeleporterMessage", senderBlockchainID, senderAddress, message) +func (_Nativetokensource *NativetokensourceTransactor) ReceiveTeleporterMessage(opts *bind.TransactOpts, senderBlockchainID [32]byte, senderAddress common.Address, message []byte) (*types.Transaction, error) { + return _Nativetokensource.contract.Transact(opts, "receiveTeleporterMessage", senderBlockchainID, senderAddress, message) } // ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. // // Solidity: function receiveTeleporterMessage(bytes32 senderBlockchainID, address senderAddress, bytes message) returns() -func (_NativeTokenSource *NativeTokenSourceSession) ReceiveTeleporterMessage(senderBlockchainID [32]byte, senderAddress common.Address, message []byte) (*types.Transaction, error) { - return _NativeTokenSource.Contract.ReceiveTeleporterMessage(&_NativeTokenSource.TransactOpts, senderBlockchainID, senderAddress, message) +func (_Nativetokensource *NativetokensourceSession) ReceiveTeleporterMessage(senderBlockchainID [32]byte, senderAddress common.Address, message []byte) (*types.Transaction, error) { + return _Nativetokensource.Contract.ReceiveTeleporterMessage(&_Nativetokensource.TransactOpts, senderBlockchainID, senderAddress, message) } // ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. // // Solidity: function receiveTeleporterMessage(bytes32 senderBlockchainID, address senderAddress, bytes message) returns() -func (_NativeTokenSource *NativeTokenSourceTransactorSession) ReceiveTeleporterMessage(senderBlockchainID [32]byte, senderAddress common.Address, message []byte) (*types.Transaction, error) { - return _NativeTokenSource.Contract.ReceiveTeleporterMessage(&_NativeTokenSource.TransactOpts, senderBlockchainID, senderAddress, message) +func (_Nativetokensource *NativetokensourceTransactorSession) ReceiveTeleporterMessage(senderBlockchainID [32]byte, senderAddress common.Address, message []byte) (*types.Transaction, error) { + return _Nativetokensource.Contract.ReceiveTeleporterMessage(&_Nativetokensource.TransactOpts, senderBlockchainID, senderAddress, message) } // TransferToDestination is a paid mutator transaction binding the contract method 0x3c7bf510. // // Solidity: function transferToDestination(address recipient, address feeContractAddress, uint256 feeAmount) payable returns() -func (_NativeTokenSource *NativeTokenSourceTransactor) TransferToDestination(opts *bind.TransactOpts, recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { - return _NativeTokenSource.contract.Transact(opts, "transferToDestination", recipient, feeContractAddress, feeAmount) +func (_Nativetokensource *NativetokensourceTransactor) TransferToDestination(opts *bind.TransactOpts, recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { + return _Nativetokensource.contract.Transact(opts, "transferToDestination", recipient, feeContractAddress, feeAmount) } // TransferToDestination is a paid mutator transaction binding the contract method 0x3c7bf510. // // Solidity: function transferToDestination(address recipient, address feeContractAddress, uint256 feeAmount) payable returns() -func (_NativeTokenSource *NativeTokenSourceSession) TransferToDestination(recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { - return _NativeTokenSource.Contract.TransferToDestination(&_NativeTokenSource.TransactOpts, recipient, feeContractAddress, feeAmount) +func (_Nativetokensource *NativetokensourceSession) TransferToDestination(recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { + return _Nativetokensource.Contract.TransferToDestination(&_Nativetokensource.TransactOpts, recipient, feeContractAddress, feeAmount) } // TransferToDestination is a paid mutator transaction binding the contract method 0x3c7bf510. // // Solidity: function transferToDestination(address recipient, address feeContractAddress, uint256 feeAmount) payable returns() -func (_NativeTokenSource *NativeTokenSourceTransactorSession) TransferToDestination(recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { - return _NativeTokenSource.Contract.TransferToDestination(&_NativeTokenSource.TransactOpts, recipient, feeContractAddress, feeAmount) +func (_Nativetokensource *NativetokensourceTransactorSession) TransferToDestination(recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { + return _Nativetokensource.Contract.TransferToDestination(&_Nativetokensource.TransactOpts, recipient, feeContractAddress, feeAmount) } -// NativeTokenSourceTransferToDestinationIterator is returned from FilterTransferToDestination and is used to iterate over the raw logs and unpacked data for TransferToDestination events raised by the NativeTokenSource contract. -type NativeTokenSourceTransferToDestinationIterator struct { - Event *NativeTokenSourceTransferToDestination // Event containing the contract specifics and raw log +// NativetokensourceTransferToDestinationIterator is returned from FilterTransferToDestination and is used to iterate over the raw logs and unpacked data for TransferToDestination events raised by the Nativetokensource contract. +type NativetokensourceTransferToDestinationIterator struct { + Event *NativetokensourceTransferToDestination // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -393,7 +393,7 @@ type NativeTokenSourceTransferToDestinationIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *NativeTokenSourceTransferToDestinationIterator) Next() bool { +func (it *NativetokensourceTransferToDestinationIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -402,7 +402,7 @@ func (it *NativeTokenSourceTransferToDestinationIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(NativeTokenSourceTransferToDestination) + it.Event = new(NativetokensourceTransferToDestination) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -417,7 +417,7 @@ func (it *NativeTokenSourceTransferToDestinationIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(NativeTokenSourceTransferToDestination) + it.Event = new(NativetokensourceTransferToDestination) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -433,19 +433,19 @@ func (it *NativeTokenSourceTransferToDestinationIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *NativeTokenSourceTransferToDestinationIterator) Error() error { +func (it *NativetokensourceTransferToDestinationIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *NativeTokenSourceTransferToDestinationIterator) Close() error { +func (it *NativetokensourceTransferToDestinationIterator) Close() error { it.sub.Unsubscribe() return nil } -// NativeTokenSourceTransferToDestination represents a TransferToDestination event raised by the NativeTokenSource contract. -type NativeTokenSourceTransferToDestination struct { +// NativetokensourceTransferToDestination represents a TransferToDestination event raised by the Nativetokensource contract. +type NativetokensourceTransferToDestination struct { Sender common.Address Recipient common.Address Amount *big.Int @@ -458,7 +458,7 @@ type NativeTokenSourceTransferToDestination struct { // FilterTransferToDestination is a free log retrieval operation binding the contract event 0x32d7e0a933e2b2b5890fd273e9ba2e9293d619805a7ca90d11f41eddc56d2b97. // // Solidity: event TransferToDestination(address indexed sender, address indexed recipient, uint256 amount, address feeContractAddress, uint256 feeAmount, uint256 teleporterMessageID) -func (_NativeTokenSource *NativeTokenSourceFilterer) FilterTransferToDestination(opts *bind.FilterOpts, sender []common.Address, recipient []common.Address) (*NativeTokenSourceTransferToDestinationIterator, error) { +func (_Nativetokensource *NativetokensourceFilterer) FilterTransferToDestination(opts *bind.FilterOpts, sender []common.Address, recipient []common.Address) (*NativetokensourceTransferToDestinationIterator, error) { var senderRule []interface{} for _, senderItem := range sender { @@ -469,17 +469,17 @@ func (_NativeTokenSource *NativeTokenSourceFilterer) FilterTransferToDestination recipientRule = append(recipientRule, recipientItem) } - logs, sub, err := _NativeTokenSource.contract.FilterLogs(opts, "TransferToDestination", senderRule, recipientRule) + logs, sub, err := _Nativetokensource.contract.FilterLogs(opts, "TransferToDestination", senderRule, recipientRule) if err != nil { return nil, err } - return &NativeTokenSourceTransferToDestinationIterator{contract: _NativeTokenSource.contract, event: "TransferToDestination", logs: logs, sub: sub}, nil + return &NativetokensourceTransferToDestinationIterator{contract: _Nativetokensource.contract, event: "TransferToDestination", logs: logs, sub: sub}, nil } // WatchTransferToDestination is a free log subscription operation binding the contract event 0x32d7e0a933e2b2b5890fd273e9ba2e9293d619805a7ca90d11f41eddc56d2b97. // // Solidity: event TransferToDestination(address indexed sender, address indexed recipient, uint256 amount, address feeContractAddress, uint256 feeAmount, uint256 teleporterMessageID) -func (_NativeTokenSource *NativeTokenSourceFilterer) WatchTransferToDestination(opts *bind.WatchOpts, sink chan<- *NativeTokenSourceTransferToDestination, sender []common.Address, recipient []common.Address) (event.Subscription, error) { +func (_Nativetokensource *NativetokensourceFilterer) WatchTransferToDestination(opts *bind.WatchOpts, sink chan<- *NativetokensourceTransferToDestination, sender []common.Address, recipient []common.Address) (event.Subscription, error) { var senderRule []interface{} for _, senderItem := range sender { @@ -490,7 +490,7 @@ func (_NativeTokenSource *NativeTokenSourceFilterer) WatchTransferToDestination( recipientRule = append(recipientRule, recipientItem) } - logs, sub, err := _NativeTokenSource.contract.WatchLogs(opts, "TransferToDestination", senderRule, recipientRule) + logs, sub, err := _Nativetokensource.contract.WatchLogs(opts, "TransferToDestination", senderRule, recipientRule) if err != nil { return nil, err } @@ -500,8 +500,8 @@ func (_NativeTokenSource *NativeTokenSourceFilterer) WatchTransferToDestination( select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(NativeTokenSourceTransferToDestination) - if err := _NativeTokenSource.contract.UnpackLog(event, "TransferToDestination", log); err != nil { + event := new(NativetokensourceTransferToDestination) + if err := _Nativetokensource.contract.UnpackLog(event, "TransferToDestination", log); err != nil { return err } event.Raw = log @@ -525,18 +525,18 @@ func (_NativeTokenSource *NativeTokenSourceFilterer) WatchTransferToDestination( // ParseTransferToDestination is a log parse operation binding the contract event 0x32d7e0a933e2b2b5890fd273e9ba2e9293d619805a7ca90d11f41eddc56d2b97. // // Solidity: event TransferToDestination(address indexed sender, address indexed recipient, uint256 amount, address feeContractAddress, uint256 feeAmount, uint256 teleporterMessageID) -func (_NativeTokenSource *NativeTokenSourceFilterer) ParseTransferToDestination(log types.Log) (*NativeTokenSourceTransferToDestination, error) { - event := new(NativeTokenSourceTransferToDestination) - if err := _NativeTokenSource.contract.UnpackLog(event, "TransferToDestination", log); err != nil { +func (_Nativetokensource *NativetokensourceFilterer) ParseTransferToDestination(log types.Log) (*NativetokensourceTransferToDestination, error) { + event := new(NativetokensourceTransferToDestination) + if err := _Nativetokensource.contract.UnpackLog(event, "TransferToDestination", log); err != nil { return nil, err } event.Raw = log return event, nil } -// NativeTokenSourceUnlockTokensIterator is returned from FilterUnlockTokens and is used to iterate over the raw logs and unpacked data for UnlockTokens events raised by the NativeTokenSource contract. -type NativeTokenSourceUnlockTokensIterator struct { - Event *NativeTokenSourceUnlockTokens // Event containing the contract specifics and raw log +// NativetokensourceUnlockTokensIterator is returned from FilterUnlockTokens and is used to iterate over the raw logs and unpacked data for UnlockTokens events raised by the Nativetokensource contract. +type NativetokensourceUnlockTokensIterator struct { + Event *NativetokensourceUnlockTokens // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -550,7 +550,7 @@ type NativeTokenSourceUnlockTokensIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *NativeTokenSourceUnlockTokensIterator) Next() bool { +func (it *NativetokensourceUnlockTokensIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -559,7 +559,7 @@ func (it *NativeTokenSourceUnlockTokensIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(NativeTokenSourceUnlockTokens) + it.Event = new(NativetokensourceUnlockTokens) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -574,7 +574,7 @@ func (it *NativeTokenSourceUnlockTokensIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(NativeTokenSourceUnlockTokens) + it.Event = new(NativetokensourceUnlockTokens) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -590,19 +590,19 @@ func (it *NativeTokenSourceUnlockTokensIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *NativeTokenSourceUnlockTokensIterator) Error() error { +func (it *NativetokensourceUnlockTokensIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *NativeTokenSourceUnlockTokensIterator) Close() error { +func (it *NativetokensourceUnlockTokensIterator) Close() error { it.sub.Unsubscribe() return nil } -// NativeTokenSourceUnlockTokens represents a UnlockTokens event raised by the NativeTokenSource contract. -type NativeTokenSourceUnlockTokens struct { +// NativetokensourceUnlockTokens represents a UnlockTokens event raised by the Nativetokensource contract. +type NativetokensourceUnlockTokens struct { Recipient common.Address Amount *big.Int Raw types.Log // Blockchain specific contextual infos @@ -611,21 +611,21 @@ type NativeTokenSourceUnlockTokens struct { // FilterUnlockTokens is a free log retrieval operation binding the contract event 0x55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407. // // Solidity: event UnlockTokens(address recipient, uint256 amount) -func (_NativeTokenSource *NativeTokenSourceFilterer) FilterUnlockTokens(opts *bind.FilterOpts) (*NativeTokenSourceUnlockTokensIterator, error) { +func (_Nativetokensource *NativetokensourceFilterer) FilterUnlockTokens(opts *bind.FilterOpts) (*NativetokensourceUnlockTokensIterator, error) { - logs, sub, err := _NativeTokenSource.contract.FilterLogs(opts, "UnlockTokens") + logs, sub, err := _Nativetokensource.contract.FilterLogs(opts, "UnlockTokens") if err != nil { return nil, err } - return &NativeTokenSourceUnlockTokensIterator{contract: _NativeTokenSource.contract, event: "UnlockTokens", logs: logs, sub: sub}, nil + return &NativetokensourceUnlockTokensIterator{contract: _Nativetokensource.contract, event: "UnlockTokens", logs: logs, sub: sub}, nil } // WatchUnlockTokens is a free log subscription operation binding the contract event 0x55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407. // // Solidity: event UnlockTokens(address recipient, uint256 amount) -func (_NativeTokenSource *NativeTokenSourceFilterer) WatchUnlockTokens(opts *bind.WatchOpts, sink chan<- *NativeTokenSourceUnlockTokens) (event.Subscription, error) { +func (_Nativetokensource *NativetokensourceFilterer) WatchUnlockTokens(opts *bind.WatchOpts, sink chan<- *NativetokensourceUnlockTokens) (event.Subscription, error) { - logs, sub, err := _NativeTokenSource.contract.WatchLogs(opts, "UnlockTokens") + logs, sub, err := _Nativetokensource.contract.WatchLogs(opts, "UnlockTokens") if err != nil { return nil, err } @@ -635,8 +635,8 @@ func (_NativeTokenSource *NativeTokenSourceFilterer) WatchUnlockTokens(opts *bin select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(NativeTokenSourceUnlockTokens) - if err := _NativeTokenSource.contract.UnpackLog(event, "UnlockTokens", log); err != nil { + event := new(NativetokensourceUnlockTokens) + if err := _Nativetokensource.contract.UnpackLog(event, "UnlockTokens", log); err != nil { return err } event.Raw = log @@ -660,9 +660,9 @@ func (_NativeTokenSource *NativeTokenSourceFilterer) WatchUnlockTokens(opts *bin // ParseUnlockTokens is a log parse operation binding the contract event 0x55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407. // // Solidity: event UnlockTokens(address recipient, uint256 amount) -func (_NativeTokenSource *NativeTokenSourceFilterer) ParseUnlockTokens(log types.Log) (*NativeTokenSourceUnlockTokens, error) { - event := new(NativeTokenSourceUnlockTokens) - if err := _NativeTokenSource.contract.UnpackLog(event, "UnlockTokens", log); err != nil { +func (_Nativetokensource *NativetokensourceFilterer) ParseUnlockTokens(log types.Log) (*NativetokensourceUnlockTokens, error) { + event := new(NativetokensourceUnlockTokens) + if err := _Nativetokensource.contract.UnpackLog(event, "UnlockTokens", log); err != nil { return nil, err } event.Raw = log diff --git a/scripts/abi_go_bindings.sh b/scripts/abi_go_bindings.sh index bf50569d1..6fe7c091f 100755 --- a/scripts/abi_go_bindings.sh +++ b/scripts/abi_go_bindings.sh @@ -13,7 +13,7 @@ TELEPORTER_PATH=$( cd .. && pwd ) -DEFAULT_CONTRACT_LIST="TeleporterMessenger ERC20Bridge ExampleCrossChainMessenger BlockHashPublisher BlockHashReceiver BridgeToken" +DEFAULT_CONTRACT_LIST="TeleporterMessenger ERC20Bridge ExampleCrossChainMessenger BlockHashPublisher BlockHashReceiver BridgeToken NativeTokenSource NativeTokenDestination" CONTRACT_LIST= HELP= From 02b9045ab3887603a1180a0a90256e66db2badf6 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Thu, 5 Oct 2023 09:25:44 -0400 Subject: [PATCH 043/183] Cleanup e2etest --- tests/e2e_test.go | 241 +--------------------------------------------- 1 file changed, 3 insertions(+), 238 deletions(-) diff --git a/tests/e2e_test.go b/tests/e2e_test.go index f18198246..d289a1daf 100644 --- a/tests/e2e_test.go +++ b/tests/e2e_test.go @@ -12,7 +12,6 @@ import ( "github.com/ethereum/go-ethereum/log" "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "github.com/onsi/gomega/format" ) const ( @@ -26,7 +25,6 @@ func TestE2E(t *testing.T) { } RegisterFailHandler(ginkgo.Fail) - format.UseStringerRepresentation = true ginkgo.RunSpecs(t, "Teleporter e2e test") } @@ -47,239 +45,6 @@ var _ = ginkgo.Describe("[Teleporter integration tests]", func() { ginkgo.It("Send a message from Subnet A to Subnet B", BasicOneWaySend) }) -var _ = ginkgo.Describe("[NativeTransfer two-way send]", ginkgo.Ordered, func() { - const ( - valueToSend = int64(1000_000_000_000_000_000) - valueToReturn = valueToSend/4 - ) - var ( - ctx = context.Background() - err error - ) - - // Send a transaction to Subnet A to issue a Warp Message from the Teleporter contract to Subnet B - ginkgo.It("Deploy Contracts on chains A and B", ginkgo.Label("NativeTransfer", "DeployContracs"), func() { - // Deploy Native Token bridge on the two subnets - nativeTokenBridgeDeployerPK, err = crypto.HexToECDSA(bridgeDeployerKeyStr) - Expect(err).Should(BeNil()) - nativeTokenBridgeContractAddress, err = deploymentUtils.DeriveEVMContractAddress(nativeTokenBridgeDeployer, 0) - Expect(err).Should(BeNil()) - fmt.Println("Native Token Bridge Contract Address: ", nativeTokenBridgeContractAddress.Hex()) - - - nativeTokenSourceBytecode, err := deploymentUtils.ExtractByteCode(NativeTokenSourceByteCodeFile) - Expect(err).Should(BeNil()) - chainATransactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, chainAIDInt) - Expect(err).Should(BeNil()) - nativeTokenSourceAbi, err := abi.NativeTokenSourceMetaData.GetAbi() - Expect(err).Should(BeNil()) - _, _, _, err = bind.DeployContract(chainATransactor, *nativeTokenSourceAbi, nativeTokenSourceBytecode, chainARPCClient, teleporterContractAddress, blockchainIDB, nativeTokenBridgeContractAddress) - Expect(err).Should(BeNil()) - - nativeTokenDestinationBytecode, err := deploymentUtils.ExtractByteCode(NativeTokenDestinationByteCodeFile) - Expect(err).Should(BeNil()) - chainBTransactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, chainBIDInt) - Expect(err).Should(BeNil()) - nativeTokenDestinationAbi, err := abi.NativeTokenDestinationMetaData.GetAbi() - Expect(err).Should(BeNil()) - _, _, _, err = bind.DeployContract(chainBTransactor, *nativeTokenDestinationAbi, nativeTokenDestinationBytecode, chainBRPCClient, teleporterContractAddress, blockchainIDA, nativeTokenBridgeContractAddress, common.Big0) - Expect(err).Should(BeNil()) - - - time.Sleep(5 * time.Second) - bridgeCodeA, err := chainARPCClient.CodeAt(ctx, nativeTokenBridgeContractAddress, nil) - Expect(err).Should(BeNil()) - Expect(len(bridgeCodeA)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode - - bridgeCodeB, err := chainBRPCClient.CodeAt(ctx, nativeTokenBridgeContractAddress, nil) - Expect(err).Should(BeNil()) - Expect(len(bridgeCodeB)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode - - log.Info("Finished deploying Bridge contracts") - }) - - ginkgo.It("Transfer tokens from A to B", ginkgo.Label("NativeTransfer", "Lock and Mint"), func() { - nativeTokenSource, err := abi.NewNativeTokenSource(nativeTokenBridgeContractAddress, chainARPCClient) - Expect(err).Should(BeNil()) - transactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, chainAIDInt) - Expect(err).Should(BeNil()) - transactor.Value = big.NewInt(valueToSend) - - subA, err := chainAWSClient.SubscribeNewHead(ctx, newHeadsA) - Expect(err).Should(BeNil()) - defer subA.Unsubscribe() - - tx, err := nativeTokenSource.TransferToDestination(transactor, tokenReceiverAddress, tokenReceiverAddress, big.NewInt(0)) - Expect(err).Should(BeNil()) - log.Info("Sent TransferToDestination transaction on source chain", "destinationChainID", blockchainIDB, "txHash", tx.Hash().Hex()) - - // Sleep to ensure the new block is published to the subscriber - time.Sleep(5 * time.Second) - receipt, err := chainARPCClient.TransactionReceipt(ctx, tx.Hash()) - Expect(err).Should(BeNil()) - Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) - }) - - ginkgo.It("Relay message to destination", ginkgo.Label("NativeTransfer", "RelayMessage A -> B"), func() { - // Get the latest block from Subnet A, and retrieve the warp message from the logs - log.Info("Waiting for new block confirmation") - newHeadA := <-newHeadsA - blockHashA := newHeadA.Hash() - - log.Info("Fetching relevant warp logs from the newly produced block") - logs, err := chainARPCClient.FilterLogs(ctx, interfaces.FilterQuery{ - BlockHash: &blockHashA, - Addresses: []common.Address{warp.Module.Address}, - }) - Expect(err).Should(BeNil()) - Expect(len(logs)).Should(Equal(1)) - - // Check for relevant warp log from subscription and ensure that it matches - // the log extracted from the last block. - txLog := logs[0] - log.Info("Parsing logData as unsigned warp message") - unsignedMsg, err := avalancheWarp.ParseUnsignedMessage(txLog.Data) - Expect(err).Should(BeNil()) - - // Set local variables for the duration of the test - unsignedWarpMessageID := unsignedMsg.ID() - unsignedWarpMsg := unsignedMsg - log.Info("Parsed unsignedWarpMsg", "unsignedWarpMessageID", unsignedWarpMessageID, "unsignedWarpMessage", unsignedWarpMsg) - - // Loop over each client on chain A to ensure they all have time to accept the block. - // Note: if we did not confirm this here, the next stage could be racy since it assumes every node - // has accepted the block. - waitForAllValidatorsToAcceptBlock(ctx, chainANodeURIs, blockchainIDA, newHeadA.Number.Uint64()) - - // Get the aggregate signature for the Warp message - log.Info("Fetching aggregate signature from the source chain validators") - warpClient, err := warpBackend.NewClient(chainANodeURIs[0], blockchainIDA.String()) - Expect(err).Should(BeNil()) - signedWarpMessageBytes, err := warpClient.GetAggregateSignature(ctx, unsignedWarpMessageID, params.WarpQuorumDenominator) - Expect(err).Should(BeNil()) - - // Check starting balance is 0 - bal, err := chainBRPCClient.BalanceAt(ctx, tokenReceiverAddress, nil) - Expect(err).Should(BeNil()) - Expect(bal.Int64()).Should(Equal(common.Big0.Int64())) - - signedTxB := constructAndSendTransaction( - ctx, - signedWarpMessageBytes, - big.NewInt(1), - teleporterContractAddress, - fundedAddress, - fundedKey, - chainBRPCClient, - chainBIDInt, - ) - - // Sleep to ensure the new block is published to the subscriber - time.Sleep(5 * time.Second) - receipt, err := chainBRPCClient.TransactionReceipt(ctx, signedTxB.Hash()) - Expect(err).Should(BeNil()) - Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) - - sendCrossChainMessageLog := receipt.Logs[2] - var event SendCrossChainMessageEvent - err = teleporter.EVMTeleporterContractABI.UnpackIntoInterface(&event, "SendCrossChainMessage", sendCrossChainMessageLog.Data) - Expect(err).Should(BeNil()) - - bal, err = chainBRPCClient.BalanceAt(ctx, tokenReceiverAddress, nil) - Expect(err).Should(BeNil()) - Expect(bal.Int64()).Should(Equal(valueToSend)) - }) - - ginkgo.It("Transfer tokens from B to A", ginkgo.Label("NativeTransfer", "Burn and Unlock"), func() { - nativeTokenDestination, err := abi.NewNativeTokenDestination(nativeTokenBridgeContractAddress, chainBRPCClient) - Expect(err).Should(BeNil()) - transactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, chainBIDInt) - Expect(err).Should(BeNil()) - transactor.Value = big.NewInt(valueToReturn) - - subB, err := chainBWSClient.SubscribeNewHead(ctx, newHeadsB) - Expect(err).Should(BeNil()) - defer subB.Unsubscribe() - - tx, err := nativeTokenDestination.TransferToSource(transactor, tokenReceiverAddress, tokenReceiverAddress, big.NewInt(0)) - Expect(err).Should(BeNil()) - log.Info("Sent TransferToSource transaction on destination chain", "sourceChainID", blockchainIDA, "txHash", tx.Hash().Hex()) - - // Sleep to ensure the new block is published to the subscriber - time.Sleep(5 * time.Second) - receipt, err := chainBRPCClient.TransactionReceipt(ctx, tx.Hash()) - Expect(err).Should(BeNil()) - Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) - }) - - ginkgo.It("Relay message to source", ginkgo.Label("NativeTransfer", "RelayMessage B -> A"), func() { - // Get the latest block from Subnet A, and retrieve the warp message from the logs - log.Info("Waiting for new block confirmation") - newHeadB := <-newHeadsB - blockHashB := newHeadB.Hash() - - log.Info("Fetching relevant warp logs from the newly produced block") - logs, err := chainBRPCClient.FilterLogs(ctx, interfaces.FilterQuery{ - BlockHash: &blockHashB, - Addresses: []common.Address{warp.Module.Address}, - }) - Expect(err).Should(BeNil()) - Expect(len(logs)).Should(Equal(1)) - - // Check for relevant warp log from subscription and ensure that it matches - // the log extracted from the last block. - txLog := logs[0] - log.Info("Parsing logData as unsigned warp message") - unsignedMsg, err := avalancheWarp.ParseUnsignedMessage(txLog.Data) - Expect(err).Should(BeNil()) - - // Set local variables for the duration of the test - unsignedWarpMessageID := unsignedMsg.ID() - unsignedWarpMsg := unsignedMsg - log.Info("Parsed unsignedWarpMsg", "unsignedWarpMessageID", unsignedWarpMessageID, "unsignedWarpMessage", unsignedWarpMsg) - - // Loop over each client on chain A to ensure they all have time to accept the block. - // Note: if we did not confirm this here, the next stage could be racy since it assumes every node - // has accepted the block. - waitForAllValidatorsToAcceptBlock(ctx, chainBNodeURIs, blockchainIDB, newHeadB.Number.Uint64()) - - // Get the aggregate signature for the Warp message - log.Info("Fetching aggregate signature from the source chain validators") - warpClient, err := warpBackend.NewClient(chainBNodeURIs[0], blockchainIDB.String()) - Expect(err).Should(BeNil()) - signedWarpMessageBytes, err := warpClient.GetAggregateSignature(ctx, unsignedWarpMessageID, params.WarpQuorumDenominator) - Expect(err).Should(BeNil()) - - // Check starting balance is 0 - bal, err := chainARPCClient.BalanceAt(ctx, tokenReceiverAddress, nil) - Expect(err).Should(BeNil()) - Expect(bal.Int64()).Should(Equal(common.Big0.Int64())) - - signedTxA := constructAndSendTransaction( - ctx, - signedWarpMessageBytes, - big.NewInt(1), - teleporterContractAddress, - fundedAddress, - fundedKey, - chainARPCClient, - chainAIDInt, - ) - - // Sleep to ensure the new block is published to the subscriber - time.Sleep(5 * time.Second) - receipt, err := chainARPCClient.TransactionReceipt(ctx, signedTxA.Hash()) - Expect(err).Should(BeNil()) - Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) - - sendCrossChainMessageLog := receipt.Logs[2] - var event SendCrossChainMessageEvent - err = teleporter.EVMTeleporterContractABI.UnpackIntoInterface(&event, "SendCrossChainMessage", sendCrossChainMessageLog.Data) - Expect(err).Should(BeNil()) - - bal, err = chainARPCClient.BalanceAt(ctx, tokenReceiverAddress, nil) - Expect(err).Should(BeNil()) - Expect(bal.Int64()).Should(Equal(valueToReturn)) - }) - -}) \ No newline at end of file +var _ = ginkgo.Describe("[Native Token Bridge integration tests]", func() { + ginkgo.It("Send tokens from subnet A to B and back", BasicOneWaySend) +}) From ce45fb4e21b9abbfa47c1c5221327d74450b71eb Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Thu, 5 Oct 2023 10:26:09 -0400 Subject: [PATCH 044/183] Refactor native token bridge test --- tests/e2e_test.go | 2 +- tests/native_token_bridge.go | 136 +++++++++++++++++++++++ tests/utils.go | 206 ----------------------------------- tests/utils/utils.go | 16 +++ 4 files changed, 153 insertions(+), 207 deletions(-) create mode 100644 tests/native_token_bridge.go delete mode 100644 tests/utils.go diff --git a/tests/e2e_test.go b/tests/e2e_test.go index d289a1daf..040e1e62c 100644 --- a/tests/e2e_test.go +++ b/tests/e2e_test.go @@ -46,5 +46,5 @@ var _ = ginkgo.Describe("[Teleporter integration tests]", func() { }) var _ = ginkgo.Describe("[Native Token Bridge integration tests]", func() { - ginkgo.It("Send tokens from subnet A to B and back", BasicOneWaySend) + ginkgo.It("Send native tokens from subnet A to B and back", NativeTokenBridge) }) diff --git a/tests/native_token_bridge.go b/tests/native_token_bridge.go new file mode 100644 index 000000000..d415057eb --- /dev/null +++ b/tests/native_token_bridge.go @@ -0,0 +1,136 @@ +package tests + +import ( + "context" + "math/big" + "time" + + "github.com/ava-labs/subnet-evm/accounts/abi/bind" + "github.com/ava-labs/subnet-evm/core/types" + nativetokendestination "github.com/ava-labs/teleporter/abis/NativeTokenDestination" + nativetokensource "github.com/ava-labs/teleporter/abis/NativeTokenSource" + deploymentUtils "github.com/ava-labs/teleporter/contract-deployment/utils" + "github.com/ava-labs/teleporter/tests/utils" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/log" + . "github.com/onsi/gomega" +) + +func NativeTokenBridge() { + const ( + valueToSend = int64(1000_000_000_000_000_000) + valueToReturn = valueToSend/4 + + bridgeDeployerKeyStr = "aad7440febfc8f9d73a58c3cb1f1754779a566978f9ebffcd4f4698e9b043985" + NativeTokenSourceByteCodeFile = "./contracts/out/NativeTokenSource.sol/NativeTokenSource.json" + NativeTokenDestinationByteCodeFile = "./contracts/out/NativeTokenDestination.sol/NativeTokenDestination.json" + ) + var ( + ctx = context.Background() + nativeTokenBridgeDeployer = common.HexToAddress("0x1337cfd2dCff6270615B90938aCB1efE79801704") + tokenReceiverAddress = common.HexToAddress("0x0123456789012345678901234567890123456789") + ) + + subnetA := utils.GetSubnetATestInfo() + subnetB := utils.GetSubnetBTestInfo() + teleporterContractAddress := utils.GetTeleporterContractAddress() + + nativeTokenBridgeDeployerPK, err := crypto.HexToECDSA(bridgeDeployerKeyStr) + Expect(err).Should(BeNil()) + nativeTokenBridgeContractAddress, err := deploymentUtils.DeriveEVMContractAddress(nativeTokenBridgeDeployer, 0) + Expect(err).Should(BeNil()) + log.Info("Native Token Bridge Contract Address: " + nativeTokenBridgeContractAddress.Hex()) + + + { // Deploy the contracts + nativeTokenSourceBytecode, err := deploymentUtils.ExtractByteCode(NativeTokenSourceByteCodeFile) + Expect(err).Should(BeNil()) + chainATransactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, subnetA.ChainIDInt) + Expect(err).Should(BeNil()) + nativeTokenSourceAbi, err := nativetokensource.NativetokensourceMetaData.GetAbi() + Expect(err).Should(BeNil()) + _, _, _, err = bind.DeployContract(chainATransactor, *nativeTokenSourceAbi, nativeTokenSourceBytecode, subnetA.ChainWSClient, teleporterContractAddress, subnetB.BlockchainID, nativeTokenBridgeContractAddress) + Expect(err).Should(BeNil()) + + nativeTokenDestinationBytecode, err := deploymentUtils.ExtractByteCode(NativeTokenDestinationByteCodeFile) + Expect(err).Should(BeNil()) + chainBTransactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, subnetB.ChainIDInt) + Expect(err).Should(BeNil()) + nativeTokenDestinationAbi, err := nativetokendestination.NativetokendestinationMetaData.GetAbi() + Expect(err).Should(BeNil()) + _, _, _, err = bind.DeployContract(chainBTransactor, *nativeTokenDestinationAbi, nativeTokenDestinationBytecode, subnetB.ChainWSClient, teleporterContractAddress, subnetA.BlockchainID, nativeTokenBridgeContractAddress, common.Big0) + Expect(err).Should(BeNil()) + + time.Sleep(5 * time.Second) + bridgeCodeA, err := subnetA.ChainWSClient.CodeAt(ctx, nativeTokenBridgeContractAddress, nil) + Expect(err).Should(BeNil()) + Expect(len(bridgeCodeA)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode + + bridgeCodeB, err := subnetB.ChainWSClient.CodeAt(ctx, nativeTokenBridgeContractAddress, nil) + Expect(err).Should(BeNil()) + Expect(len(bridgeCodeB)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode + + log.Info("Finished deploying Bridge contracts") + } + + + // Create abi objects to call the contract with + nativeTokenDestination, err := nativetokendestination.NewNativetokendestination(nativeTokenBridgeContractAddress, subnetB.ChainWSClient) + Expect(err).Should(BeNil()) + nativeTokenSource, err := nativetokensource.NewNativetokensource(nativeTokenBridgeContractAddress, subnetA.ChainWSClient) + Expect(err).Should(BeNil()) + + + // Transfer tokens A -> B + { + transactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, subnetA.ChainIDInt) + Expect(err).Should(BeNil()) + transactor.Value = big.NewInt(valueToSend) + + tx, err := nativeTokenSource.TransferToDestination(transactor, tokenReceiverAddress, tokenReceiverAddress, big.NewInt(0)) + Expect(err).Should(BeNil()) + log.Info("Sent TransferToDestination transaction on source chain", "destinationChainID", subnetB.BlockchainID, "txHash", tx.Hash().Hex()) + + receipt := utils.WaitForTransaction(ctx, tx.Hash(), subnetA.ChainWSClient) + Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + + + // Check starting balance is 0 + bal, err := subnetB.ChainWSClient.BalanceAt(ctx, tokenReceiverAddress, nil) + Expect(err).Should(BeNil()) + Expect(bal.Int64()).Should(Equal(common.Big0.Int64())) + + utils.RelayMessage(ctx, receipt.BlockHash, receipt.BlockNumber, subnetA, subnetB) + + bal, err = subnetB.ChainWSClient.BalanceAt(ctx, tokenReceiverAddress, nil) + Expect(err).Should(BeNil()) + Expect(bal.Int64()).Should(Equal(valueToSend)) + } + + // Transfer tokens B -> A + { + transactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, subnetB.ChainIDInt) + Expect(err).Should(BeNil()) + transactor.Value = big.NewInt(valueToReturn) + + tx, err := nativeTokenDestination.TransferToSource(transactor, tokenReceiverAddress, tokenReceiverAddress, big.NewInt(0)) + Expect(err).Should(BeNil()) + log.Info("Sent TransferToSource transaction on destination chain", "sourceChainID", subnetA.BlockchainID, "txHash", tx.Hash().Hex()) + + receipt := utils.WaitForTransaction(ctx, tx.Hash(), subnetB.ChainWSClient) + Expect(err).Should(BeNil()) + Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + + // Check starting balance is 0 + bal, err := subnetA.ChainWSClient.BalanceAt(ctx, tokenReceiverAddress, nil) + Expect(err).Should(BeNil()) + Expect(bal.Int64()).Should(Equal(common.Big0.Int64())) + + utils.RelayMessage(ctx, receipt.BlockHash, receipt.BlockNumber, subnetB, subnetA) + + bal, err = subnetA.ChainWSClient.BalanceAt(ctx, tokenReceiverAddress, nil) + Expect(err).Should(BeNil()) + Expect(bal.Int64()).Should(Equal(valueToReturn)) + } +} \ No newline at end of file diff --git a/tests/utils.go b/tests/utils.go deleted file mode 100644 index 192dbf1e9..000000000 --- a/tests/utils.go +++ /dev/null @@ -1,206 +0,0 @@ -// Copyright (C) 2023, Ava Labs, Inc. All rights reserved. -// See the file LICENSE for licensing terms. - -package tests - -import ( - "context" - "crypto/ecdsa" - "fmt" - "math/big" - "strconv" - "strings" - - "github.com/ava-labs/avalanchego/ids" - avalancheWarp "github.com/ava-labs/avalanchego/vms/platformvm/warp" - "github.com/ava-labs/awm-relayer/messages/teleporter" - "github.com/ava-labs/subnet-evm/core/types" - "github.com/ava-labs/subnet-evm/ethclient" - "github.com/ava-labs/subnet-evm/params" - "github.com/ava-labs/subnet-evm/tests/utils" - "github.com/ava-labs/subnet-evm/tests/utils/runner" - predicateutils "github.com/ava-labs/subnet-evm/utils/predicate" - "github.com/ava-labs/subnet-evm/x/warp" - "github.com/ethereum/go-ethereum/common" - - "github.com/ethereum/go-ethereum/log" - . "github.com/onsi/gomega" -) - -var ( - defaultTeleporterTransactionGas uint64 = 200_000 - defaultTeleporterTransactionGasFeeCap = big.NewInt(225 * params.GWei) - defaultTeleporterTransactionGasTipCap = big.NewInt(params.GWei) - defaultTeleporterTransactionValue = common.Big0 -) - -type SendCrossChainMessageEvent struct { - DestinationChainID ids.ID - MessageID *big.Int - Message teleporter.TeleporterMessage -} - -// Teleporter contract sendCrossChainMessage input type -type SendCrossChainMessageInput struct { - DestinationChainID ids.ID - DestinationAddress common.Address - FeeInfo FeeInfo - RequiredGasLimit *big.Int - Message []byte - AllowedRelayerAddresses []common.Address -} - -type FeeInfo struct { - ContractAddress common.Address - Amount *big.Int -} - -func httpToWebsocketURI(uri string, blockchainID string) string { - return fmt.Sprintf("ws://%s/ext/bc/%s/ws", strings.TrimPrefix(uri, "http://"), blockchainID) -} - -func httpToRPCURI(uri string, blockchainID string) string { - return fmt.Sprintf("http://%s/ext/bc/%s/rpc", strings.TrimPrefix(uri, "http://"), blockchainID) -} - -func getURIHostAndPort(uri string) (string, uint32, error) { - // At a minimum uri should have http:// of 7 characters - Expect(len(uri)).Should(BeNumerically(">", 7)) - if uri[:7] == "http://" { - uri = uri[7:] - } else if uri[:8] == "https://" { - uri = uri[8:] - } else { - return "", 0, fmt.Errorf("invalid uri: %s", uri) - } - - // Split the uri into host and port - hostAndPort := strings.Split(uri, ":") - Expect(len(hostAndPort)).Should(Equal(2)) - - // Parse the port - port, err := strconv.ParseUint(hostAndPort[1], 10, 32) - if err != nil { - return "", 0, fmt.Errorf("failed to parse port: %w", err) - } - - return hostAndPort[0], uint32(port), nil -} - -func newTestTeleporterTransaction(chainIDInt *big.Int, teleporterAddress common.Address, nonce uint64, data []byte) *types.Transaction { - return types.NewTx(&types.DynamicFeeTx{ - ChainID: chainIDInt, - Nonce: nonce, - To: &teleporterAddress, - Gas: defaultTeleporterTransactionGas, - GasFeeCap: defaultTeleporterTransactionGasFeeCap, - GasTipCap: defaultTeleporterTransactionGasTipCap, - Value: defaultTeleporterTransactionValue, - Data: data, - }) -} - -// Issues txs to activate the proposer VM fork on the specified subnet index in the manager -func setUpProposerVM(ctx context.Context, fundedKey *ecdsa.PrivateKey, manager *runner.NetworkManager, index int) { - subnet := manager.GetSubnets()[index] - subnetDetails, ok := manager.GetSubnet(subnet) - Expect(ok).Should(BeTrue()) - - chainID := subnetDetails.BlockchainID - uri := httpToWebsocketURI(subnetDetails.ValidatorURIs[0], chainID.String()) - - client, err := ethclient.Dial(uri) - Expect(err).Should(BeNil()) - chainIDInt, err := client.ChainID(ctx) - Expect(err).Should(BeNil()) - - err = utils.IssueTxsToActivateProposerVMFork(ctx, chainIDInt, fundedKey, client) - Expect(err).Should(BeNil()) -} - -// Blocks until all validators specified in nodeURIs have reached the specified block height -func waitForAllValidatorsToAcceptBlock(ctx context.Context, nodeURIs []string, blockchainID ids.ID, height uint64) { - for i, uri := range nodeURIs { - chainAWSURI := httpToWebsocketURI(uri, blockchainID.String()) - log.Info("Creating ethclient for blockchainA", "wsURI", chainAWSURI) - client, err := ethclient.Dial(chainAWSURI) - Expect(err).Should(BeNil()) - - // Loop until each node has advanced to >= the height of the block that emitted the warp log - for { - block, err := client.BlockByNumber(ctx, nil) - Expect(err).Should(BeNil()) - if block.NumberU64() >= height { - log.Info("client accepted the block containing SendWarpMessage", "client", i, "height", block.NumberU64()) - break - } - } - } -} - -// Constructs and sends a transaction containing a warp message for the destination chain. -// Returns the signed transaction. -func constructAndSendTransaction( - ctx context.Context, - warpMessageBytes []byte, - requiredGasLimit *big.Int, - teleporterContractAddress common.Address, - fundedAddress common.Address, - fundedKey *ecdsa.PrivateKey, - client ethclient.Client, - chainID *big.Int, -) *types.Transaction { - // Construct the transaction to send the Warp message to the destination chain - log.Info("Constructing transaction for the destination chain") - signedMessage, err := avalancheWarp.ParseMessage(warpMessageBytes) - Expect(err).Should(BeNil()) - - numSigners, err := signedMessage.Signature.NumSigners() - Expect(err).Should(BeNil()) - - gasLimit, err := teleporter.CalculateReceiveMessageGasLimit(numSigners, requiredGasLimit) - Expect(err).Should(BeNil()) - - callData, err := teleporter.PackReceiveCrossChainMessage(teleporter.ReceiveCrossChainMessageInput{ - MessageIndex: 0, - RelayerRewardAddress: fundedAddress, - }) - Expect(err).Should(BeNil()) - - baseFee, err := client.EstimateBaseFee(ctx) - Expect(err).Should(BeNil()) - - gasTipCap, err := client.SuggestGasTipCap(ctx) - Expect(err).Should(BeNil()) - - nonce, err := client.NonceAt(ctx, fundedAddress, nil) - Expect(err).Should(BeNil()) - - gasFeeCap := baseFee.Mul(baseFee, big.NewInt(2)) - gasFeeCap.Add(gasFeeCap, big.NewInt(2500000000)) - destinationTx := predicateutils.NewPredicateTx( - chainID, - nonce, - &teleporterContractAddress, - gasLimit, - gasFeeCap, - gasTipCap, - big.NewInt(0), - callData, - types.AccessList{}, - warp.ContractAddress, - signedMessage.Bytes(), - ) - - // Sign and send the transaction on the destination chain - signer := types.LatestSignerForChainID(chainID) - signedTx, err := types.SignTx(destinationTx, signer, fundedKey) - Expect(err).Should(BeNil()) - - log.Info("Sending transaction to destination chain") - err = client.SendTransaction(context.Background(), signedTx) - Expect(err).Should(BeNil()) - log.Info("Successfully sent transaction", "hash", signedTx.Hash().Hex()) - - return signedTx -} diff --git a/tests/utils/utils.go b/tests/utils/utils.go index 669d681c4..99b97c88f 100644 --- a/tests/utils/utils.go +++ b/tests/utils/utils.go @@ -249,6 +249,22 @@ func WaitForAllValidatorsToAcceptBlock(ctx context.Context, nodeURIs []string, b } } +func WaitForTransaction(ctx context.Context, txHash common.Hash, client ethclient.Client) *types.Receipt { + cctx, cancel := context.WithTimeout(ctx, 10*time.Second) + defer cancel() + + // Loop until we find the transaction or time out + for { + receipt, err := client.TransactionReceipt(cctx, txHash) + if err == nil { + return receipt + } else { + log.Info("Waiting for transaction", "hash", txHash.Hex()) + time.Sleep(100 *time.Millisecond) + } + } +} + // Constructs the aggregate signature, packs the Teleporter message, and relays to the destination // Returns the receipt on the destination chain func RelayMessage( From c135025e3672da64cfe04251dde22c50134f26c1 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Thu, 5 Oct 2023 10:30:16 -0400 Subject: [PATCH 045/183] Format --- tests/native_token_bridge.go | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/tests/native_token_bridge.go b/tests/native_token_bridge.go index d415057eb..ba1d188cb 100644 --- a/tests/native_token_bridge.go +++ b/tests/native_token_bridge.go @@ -20,16 +20,16 @@ import ( func NativeTokenBridge() { const ( valueToSend = int64(1000_000_000_000_000_000) - valueToReturn = valueToSend/4 + valueToReturn = valueToSend / 4 - bridgeDeployerKeyStr = "aad7440febfc8f9d73a58c3cb1f1754779a566978f9ebffcd4f4698e9b043985" - NativeTokenSourceByteCodeFile = "./contracts/out/NativeTokenSource.sol/NativeTokenSource.json" + bridgeDeployerKeyStr = "aad7440febfc8f9d73a58c3cb1f1754779a566978f9ebffcd4f4698e9b043985" + NativeTokenSourceByteCodeFile = "./contracts/out/NativeTokenSource.sol/NativeTokenSource.json" NativeTokenDestinationByteCodeFile = "./contracts/out/NativeTokenDestination.sol/NativeTokenDestination.json" ) var ( - ctx = context.Background() - nativeTokenBridgeDeployer = common.HexToAddress("0x1337cfd2dCff6270615B90938aCB1efE79801704") - tokenReceiverAddress = common.HexToAddress("0x0123456789012345678901234567890123456789") + ctx = context.Background() + nativeTokenBridgeDeployer = common.HexToAddress("0x1337cfd2dCff6270615B90938aCB1efE79801704") + tokenReceiverAddress = common.HexToAddress("0x0123456789012345678901234567890123456789") ) subnetA := utils.GetSubnetATestInfo() @@ -42,7 +42,6 @@ func NativeTokenBridge() { Expect(err).Should(BeNil()) log.Info("Native Token Bridge Contract Address: " + nativeTokenBridgeContractAddress.Hex()) - { // Deploy the contracts nativeTokenSourceBytecode, err := deploymentUtils.ExtractByteCode(NativeTokenSourceByteCodeFile) Expect(err).Should(BeNil()) @@ -74,14 +73,12 @@ func NativeTokenBridge() { log.Info("Finished deploying Bridge contracts") } - // Create abi objects to call the contract with nativeTokenDestination, err := nativetokendestination.NewNativetokendestination(nativeTokenBridgeContractAddress, subnetB.ChainWSClient) Expect(err).Should(BeNil()) nativeTokenSource, err := nativetokensource.NewNativetokensource(nativeTokenBridgeContractAddress, subnetA.ChainWSClient) Expect(err).Should(BeNil()) - // Transfer tokens A -> B { transactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, subnetA.ChainIDInt) @@ -95,7 +92,6 @@ func NativeTokenBridge() { receipt := utils.WaitForTransaction(ctx, tx.Hash(), subnetA.ChainWSClient) Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) - // Check starting balance is 0 bal, err := subnetB.ChainWSClient.BalanceAt(ctx, tokenReceiverAddress, nil) Expect(err).Should(BeNil()) @@ -133,4 +129,4 @@ func NativeTokenBridge() { Expect(err).Should(BeNil()) Expect(bal.Int64()).Should(Equal(valueToReturn)) } -} \ No newline at end of file +} From 7a31baaf8552d0d9296a43f6cabd5fb485e02867 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Thu, 5 Oct 2023 10:34:44 -0400 Subject: [PATCH 046/183] cleanup --- tests/native_token_bridge.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/native_token_bridge.go b/tests/native_token_bridge.go index ba1d188cb..4d4ba3892 100644 --- a/tests/native_token_bridge.go +++ b/tests/native_token_bridge.go @@ -49,7 +49,7 @@ func NativeTokenBridge() { Expect(err).Should(BeNil()) nativeTokenSourceAbi, err := nativetokensource.NativetokensourceMetaData.GetAbi() Expect(err).Should(BeNil()) - _, _, _, err = bind.DeployContract(chainATransactor, *nativeTokenSourceAbi, nativeTokenSourceBytecode, subnetA.ChainWSClient, teleporterContractAddress, subnetB.BlockchainID, nativeTokenBridgeContractAddress) + _, txA, _, err := bind.DeployContract(chainATransactor, *nativeTokenSourceAbi, nativeTokenSourceBytecode, subnetA.ChainWSClient, teleporterContractAddress, subnetB.BlockchainID, nativeTokenBridgeContractAddress) Expect(err).Should(BeNil()) nativeTokenDestinationBytecode, err := deploymentUtils.ExtractByteCode(NativeTokenDestinationByteCodeFile) @@ -58,14 +58,17 @@ func NativeTokenBridge() { Expect(err).Should(BeNil()) nativeTokenDestinationAbi, err := nativetokendestination.NativetokendestinationMetaData.GetAbi() Expect(err).Should(BeNil()) - _, _, _, err = bind.DeployContract(chainBTransactor, *nativeTokenDestinationAbi, nativeTokenDestinationBytecode, subnetB.ChainWSClient, teleporterContractAddress, subnetA.BlockchainID, nativeTokenBridgeContractAddress, common.Big0) + _, txB, _, err := bind.DeployContract(chainBTransactor, *nativeTokenDestinationAbi, nativeTokenDestinationBytecode, subnetB.ChainWSClient, teleporterContractAddress, subnetA.BlockchainID, nativeTokenBridgeContractAddress, common.Big0) Expect(err).Should(BeNil()) - time.Sleep(5 * time.Second) + // Wait for transaction, then check code was deployed + utils.WaitForTransaction(ctx, txA.Hash(), subnetA.ChainWSClient) bridgeCodeA, err := subnetA.ChainWSClient.CodeAt(ctx, nativeTokenBridgeContractAddress, nil) Expect(err).Should(BeNil()) Expect(len(bridgeCodeA)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode + // Wait for transaction, then check code was deployed + utils.WaitForTransaction(ctx, txB.Hash(), subnetB.ChainWSClient) bridgeCodeB, err := subnetB.ChainWSClient.CodeAt(ctx, nativeTokenBridgeContractAddress, nil) Expect(err).Should(BeNil()) Expect(len(bridgeCodeB)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode @@ -79,8 +82,8 @@ func NativeTokenBridge() { nativeTokenSource, err := nativetokensource.NewNativetokensource(nativeTokenBridgeContractAddress, subnetA.ChainWSClient) Expect(err).Should(BeNil()) - // Transfer tokens A -> B - { + + { // Transfer tokens A -> B transactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, subnetA.ChainIDInt) Expect(err).Should(BeNil()) transactor.Value = big.NewInt(valueToSend) @@ -99,6 +102,7 @@ func NativeTokenBridge() { utils.RelayMessage(ctx, receipt.BlockHash, receipt.BlockNumber, subnetA, subnetB) + // Check final balance bal, err = subnetB.ChainWSClient.BalanceAt(ctx, tokenReceiverAddress, nil) Expect(err).Should(BeNil()) Expect(bal.Int64()).Should(Equal(valueToSend)) @@ -125,6 +129,7 @@ func NativeTokenBridge() { utils.RelayMessage(ctx, receipt.BlockHash, receipt.BlockNumber, subnetB, subnetA) + // Check final balance bal, err = subnetA.ChainWSClient.BalanceAt(ctx, tokenReceiverAddress, nil) Expect(err).Should(BeNil()) Expect(bal.Int64()).Should(Equal(valueToReturn)) From fc73351c766d8cbcd45c8093180cbecca2688b49 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Thu, 5 Oct 2023 10:38:16 -0400 Subject: [PATCH 047/183] Rename subnet info fields --- tests/basic_one_way_send.go | 6 ++-- tests/native_token_bridge.go | 38 ++++++++++++------------- tests/utils/network_setup.go | 54 ++++++++++++++++++------------------ tests/utils/utils.go | 22 +++++++-------- 4 files changed, 59 insertions(+), 61 deletions(-) diff --git a/tests/basic_one_way_send.go b/tests/basic_one_way_send.go index 2df3f9f48..a67013f87 100644 --- a/tests/basic_one_way_send.go +++ b/tests/basic_one_way_send.go @@ -47,9 +47,9 @@ func BasicOneWaySend() { signedTx := utils.CreateSendCrossChainMessageTransaction(ctx, subnetAInfo, sendCrossChainMessageInput, fundedAddress, fundedKey, teleporterContractAddress) log.Info("Sending Teleporter transaction on source chain", "destinationChainID", subnetBInfo.BlockchainID, "txHash", signedTx.Hash()) - receipt := utils.SendTransactionAndWaitForAcceptance(ctx, subnetAInfo.ChainWSClient, signedTx) + receipt := utils.SendTransactionAndWaitForAcceptance(ctx, subnetAInfo.WSClient, signedTx) - bind, err := teleportermessenger.NewTeleportermessenger(teleporterContractAddress, subnetAInfo.ChainWSClient) + bind, err := teleportermessenger.NewTeleportermessenger(teleporterContractAddress, subnetAInfo.WSClient) Expect(err).Should(BeNil()) event, err := utils.GetSendEventFromLogs(receipt.Logs, bind) Expect(err).Should(BeNil()) @@ -75,7 +75,7 @@ func BasicOneWaySend() { To: &teleporterContractAddress, Data: data, } - result, err := subnetBInfo.ChainWSClient.CallContract(context.Background(), callMessage, nil) + result, err := subnetBInfo.WSClient.CallContract(context.Background(), callMessage, nil) Expect(err).Should(BeNil()) // check the contract call result diff --git a/tests/native_token_bridge.go b/tests/native_token_bridge.go index 4d4ba3892..a434ad51f 100644 --- a/tests/native_token_bridge.go +++ b/tests/native_token_bridge.go @@ -3,7 +3,6 @@ package tests import ( "context" "math/big" - "time" "github.com/ava-labs/subnet-evm/accounts/abi/bind" "github.com/ava-labs/subnet-evm/core/types" @@ -45,31 +44,31 @@ func NativeTokenBridge() { { // Deploy the contracts nativeTokenSourceBytecode, err := deploymentUtils.ExtractByteCode(NativeTokenSourceByteCodeFile) Expect(err).Should(BeNil()) - chainATransactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, subnetA.ChainIDInt) + chainATransactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, subnetA.ChainID) Expect(err).Should(BeNil()) nativeTokenSourceAbi, err := nativetokensource.NativetokensourceMetaData.GetAbi() Expect(err).Should(BeNil()) - _, txA, _, err := bind.DeployContract(chainATransactor, *nativeTokenSourceAbi, nativeTokenSourceBytecode, subnetA.ChainWSClient, teleporterContractAddress, subnetB.BlockchainID, nativeTokenBridgeContractAddress) + _, txA, _, err := bind.DeployContract(chainATransactor, *nativeTokenSourceAbi, nativeTokenSourceBytecode, subnetA.WSClient, teleporterContractAddress, subnetB.BlockchainID, nativeTokenBridgeContractAddress) Expect(err).Should(BeNil()) nativeTokenDestinationBytecode, err := deploymentUtils.ExtractByteCode(NativeTokenDestinationByteCodeFile) Expect(err).Should(BeNil()) - chainBTransactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, subnetB.ChainIDInt) + chainBTransactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, subnetB.ChainID) Expect(err).Should(BeNil()) nativeTokenDestinationAbi, err := nativetokendestination.NativetokendestinationMetaData.GetAbi() Expect(err).Should(BeNil()) - _, txB, _, err := bind.DeployContract(chainBTransactor, *nativeTokenDestinationAbi, nativeTokenDestinationBytecode, subnetB.ChainWSClient, teleporterContractAddress, subnetA.BlockchainID, nativeTokenBridgeContractAddress, common.Big0) + _, txB, _, err := bind.DeployContract(chainBTransactor, *nativeTokenDestinationAbi, nativeTokenDestinationBytecode, subnetB.WSClient, teleporterContractAddress, subnetA.BlockchainID, nativeTokenBridgeContractAddress, common.Big0) Expect(err).Should(BeNil()) // Wait for transaction, then check code was deployed - utils.WaitForTransaction(ctx, txA.Hash(), subnetA.ChainWSClient) - bridgeCodeA, err := subnetA.ChainWSClient.CodeAt(ctx, nativeTokenBridgeContractAddress, nil) + utils.WaitForTransaction(ctx, txA.Hash(), subnetA.WSClient) + bridgeCodeA, err := subnetA.WSClient.CodeAt(ctx, nativeTokenBridgeContractAddress, nil) Expect(err).Should(BeNil()) Expect(len(bridgeCodeA)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode // Wait for transaction, then check code was deployed - utils.WaitForTransaction(ctx, txB.Hash(), subnetB.ChainWSClient) - bridgeCodeB, err := subnetB.ChainWSClient.CodeAt(ctx, nativeTokenBridgeContractAddress, nil) + utils.WaitForTransaction(ctx, txB.Hash(), subnetB.WSClient) + bridgeCodeB, err := subnetB.WSClient.CodeAt(ctx, nativeTokenBridgeContractAddress, nil) Expect(err).Should(BeNil()) Expect(len(bridgeCodeB)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode @@ -77,14 +76,13 @@ func NativeTokenBridge() { } // Create abi objects to call the contract with - nativeTokenDestination, err := nativetokendestination.NewNativetokendestination(nativeTokenBridgeContractAddress, subnetB.ChainWSClient) + nativeTokenDestination, err := nativetokendestination.NewNativetokendestination(nativeTokenBridgeContractAddress, subnetB.WSClient) Expect(err).Should(BeNil()) - nativeTokenSource, err := nativetokensource.NewNativetokensource(nativeTokenBridgeContractAddress, subnetA.ChainWSClient) + nativeTokenSource, err := nativetokensource.NewNativetokensource(nativeTokenBridgeContractAddress, subnetA.WSClient) Expect(err).Should(BeNil()) - { // Transfer tokens A -> B - transactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, subnetA.ChainIDInt) + transactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, subnetA.ChainID) Expect(err).Should(BeNil()) transactor.Value = big.NewInt(valueToSend) @@ -92,25 +90,25 @@ func NativeTokenBridge() { Expect(err).Should(BeNil()) log.Info("Sent TransferToDestination transaction on source chain", "destinationChainID", subnetB.BlockchainID, "txHash", tx.Hash().Hex()) - receipt := utils.WaitForTransaction(ctx, tx.Hash(), subnetA.ChainWSClient) + receipt := utils.WaitForTransaction(ctx, tx.Hash(), subnetA.WSClient) Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) // Check starting balance is 0 - bal, err := subnetB.ChainWSClient.BalanceAt(ctx, tokenReceiverAddress, nil) + bal, err := subnetB.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) Expect(err).Should(BeNil()) Expect(bal.Int64()).Should(Equal(common.Big0.Int64())) utils.RelayMessage(ctx, receipt.BlockHash, receipt.BlockNumber, subnetA, subnetB) // Check final balance - bal, err = subnetB.ChainWSClient.BalanceAt(ctx, tokenReceiverAddress, nil) + bal, err = subnetB.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) Expect(err).Should(BeNil()) Expect(bal.Int64()).Should(Equal(valueToSend)) } // Transfer tokens B -> A { - transactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, subnetB.ChainIDInt) + transactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, subnetB.ChainID) Expect(err).Should(BeNil()) transactor.Value = big.NewInt(valueToReturn) @@ -118,19 +116,19 @@ func NativeTokenBridge() { Expect(err).Should(BeNil()) log.Info("Sent TransferToSource transaction on destination chain", "sourceChainID", subnetA.BlockchainID, "txHash", tx.Hash().Hex()) - receipt := utils.WaitForTransaction(ctx, tx.Hash(), subnetB.ChainWSClient) + receipt := utils.WaitForTransaction(ctx, tx.Hash(), subnetB.WSClient) Expect(err).Should(BeNil()) Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) // Check starting balance is 0 - bal, err := subnetA.ChainWSClient.BalanceAt(ctx, tokenReceiverAddress, nil) + bal, err := subnetA.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) Expect(err).Should(BeNil()) Expect(bal.Int64()).Should(Equal(common.Big0.Int64())) utils.RelayMessage(ctx, receipt.BlockHash, receipt.BlockNumber, subnetB, subnetA) // Check final balance - bal, err = subnetA.ChainWSClient.BalanceAt(ctx, tokenReceiverAddress, nil) + bal, err = subnetA.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) Expect(err).Should(BeNil()) Expect(bal.Int64()).Should(Equal(valueToReturn)) } diff --git a/tests/utils/network_setup.go b/tests/utils/network_setup.go index 1ee6b16f3..e19fd844b 100644 --- a/tests/utils/network_setup.go +++ b/tests/utils/network_setup.go @@ -35,7 +35,7 @@ var ( fundedKey *ecdsa.PrivateKey chainAWSClient, chainBWSClient ethclient.Client chainAWSURI, chainBWSURI string - chainAIDInt, chainBIDInt *big.Int + chainAID, chainBID *big.Int // Internal vars only used to set up the local network anrConfig = runner.NewDefaultANRConfig() @@ -48,12 +48,12 @@ var ( // type SubnetTestInfo struct { - SubnetID ids.ID - BlockchainID ids.ID - ChainNodeURIs []string - ChainWSClient ethclient.Client - ChainWSURI string - ChainIDInt *big.Int + SubnetID ids.ID + BlockchainID ids.ID + NodeURIs []string + WSClient ethclient.Client + WSURI string + ChainID *big.Int } func GetSubnetsInfo() []SubnetTestInfo { @@ -65,22 +65,22 @@ func GetSubnetsInfo() []SubnetTestInfo { func GetSubnetATestInfo() SubnetTestInfo { return SubnetTestInfo{ - SubnetID: subnetA, - BlockchainID: blockchainIDA, - ChainNodeURIs: chainANodeURIs, - ChainWSClient: chainAWSClient, - ChainWSURI: chainAWSURI, - ChainIDInt: big.NewInt(0).Set(chainAIDInt), + SubnetID: subnetA, + BlockchainID: blockchainIDA, + NodeURIs: chainANodeURIs, + WSClient: chainAWSClient, + WSURI: chainAWSURI, + ChainID: big.NewInt(0).Set(chainAID), } } func GetSubnetBTestInfo() SubnetTestInfo { return SubnetTestInfo{ - SubnetID: subnetB, - BlockchainID: blockchainIDB, - ChainNodeURIs: chainBNodeURIs, - ChainWSClient: chainBWSClient, - ChainWSURI: chainBWSURI, - ChainIDInt: big.NewInt(0).Set(chainBIDInt), + SubnetID: subnetB, + BlockchainID: blockchainIDB, + NodeURIs: chainBNodeURIs, + WSClient: chainBWSClient, + WSURI: chainBWSURI, + ChainID: big.NewInt(0).Set(chainBID), } } func GetTeleporterContractAddress() common.Address { @@ -187,7 +187,7 @@ func SetupNetwork(warpGenesisFile string) { chainAWSClient, err = ethclient.Dial(chainAWSURI) Expect(err).Should(BeNil()) - chainAIDInt, err = chainAWSClient.ChainID(context.Background()) + chainAID, err = chainAWSClient.ChainID(context.Background()) Expect(err).Should(BeNil()) chainBWSURI := HttpToWebsocketURI(chainBNodeURIs[0], blockchainIDB.String()) @@ -195,7 +195,7 @@ func SetupNetwork(warpGenesisFile string) { chainBWSClient, err = ethclient.Dial(chainBWSURI) Expect(err).Should(BeNil()) - chainBIDInt, err = chainBWSClient.ChainID(context.Background()) + chainBID, err = chainBWSClient.ChainID(context.Background()) Expect(err).Should(BeNil()) log.Info("Finished setting up e2e test subnet variables") @@ -214,7 +214,7 @@ func DeployTeleporterContracts(transactionBytes []byte, deployerAddress common.A ctx := context.Background() for _, subnetInfo := range subnetsInfo { - client := subnetInfo.ChainWSClient + client := subnetInfo.WSClient nonce, err := client.NonceAt(ctx, fundedAddress, nil) Expect(err).Should(BeNil()) @@ -228,7 +228,7 @@ func DeployTeleporterContracts(transactionBytes []byte, deployerAddress common.A { value := big.NewInt(0).Mul(big.NewInt(1e18), big.NewInt(10)) // 10eth txA := types.NewTx(&types.DynamicFeeTx{ - ChainID: subnetInfo.ChainIDInt, + ChainID: subnetInfo.ChainID, Nonce: nonce, To: &deployerAddress, Gas: DefaultTeleporterTransactionGas, @@ -236,22 +236,22 @@ func DeployTeleporterContracts(transactionBytes []byte, deployerAddress common.A GasTipCap: gasTipCap, Value: value, }) - txSigner := types.LatestSignerForChainID(subnetInfo.ChainIDInt) + txSigner := types.LatestSignerForChainID(subnetInfo.ChainID) triggerTx, err := types.SignTx(txA, txSigner, fundedKey) Expect(err).Should(BeNil()) - SendTransactionAndWaitForAcceptance(ctx, subnetInfo.ChainWSClient, triggerTx) + SendTransactionAndWaitForAcceptance(ctx, subnetInfo.WSClient, triggerTx) } log.Info("Finished funding Teleporter deployer") // Deploy Teleporter { - rpcClient, err := rpc.DialContext(ctx, HttpToRPCURI(subnetInfo.ChainNodeURIs[0], subnetInfo.BlockchainID.String())) + rpcClient, err := rpc.DialContext(ctx, HttpToRPCURI(subnetInfo.NodeURIs[0], subnetInfo.BlockchainID.String())) Expect(err).Should(BeNil()) defer rpcClient.Close() newHeads := make(chan *types.Header, 10) - subA, err := subnetInfo.ChainWSClient.SubscribeNewHead(ctx, newHeads) + subA, err := subnetInfo.WSClient.SubscribeNewHead(ctx, newHeads) Expect(err).Should(BeNil()) defer subA.Unsubscribe() diff --git a/tests/utils/utils.go b/tests/utils/utils.go index 99b97c88f..3c6fe5157 100644 --- a/tests/utils/utils.go +++ b/tests/utils/utils.go @@ -143,11 +143,11 @@ func CreateSendCrossChainMessageTransaction( ) Expect(err).Should(BeNil()) - gasFeeCap, gasTipCap, nonce := calculateTxParams(ctx, source.ChainWSClient, fundedAddress) + gasFeeCap, gasTipCap, nonce := calculateTxParams(ctx, source.WSClient, fundedAddress) // Send a transaction to the Teleporter contract tx := types.NewTx(&types.DynamicFeeTx{ - ChainID: source.ChainIDInt, + ChainID: source.ChainID, Nonce: nonce, To: &teleporterContractAddress, Gas: DefaultTeleporterTransactionGas, @@ -157,7 +157,7 @@ func CreateSendCrossChainMessageTransaction( Data: data, }) - return signTransaction(tx, fundedKey, source.ChainIDInt) + return signTransaction(tx, fundedKey, source.ChainID) } // Constructs a transaction to call receiveCrossChainMessage @@ -260,7 +260,7 @@ func WaitForTransaction(ctx context.Context, txHash common.Hash, client ethclien return receipt } else { log.Info("Waiting for transaction", "hash", txHash.Hex()) - time.Sleep(100 *time.Millisecond) + time.Sleep(100 * time.Millisecond) } } } @@ -275,7 +275,7 @@ func RelayMessage( destination SubnetTestInfo, ) *types.Receipt { log.Info("Fetching relevant warp logs from the newly produced block") - logs, err := source.ChainWSClient.FilterLogs(ctx, interfaces.FilterQuery{ + logs, err := source.WSClient.FilterLogs(ctx, interfaces.FilterQuery{ BlockHash: &sourceBlockHash, Addresses: []common.Address{warp.Module.Address}, }) @@ -297,11 +297,11 @@ func RelayMessage( // Loop over each client on chain A to ensure they all have time to accept the block. // Note: if we did not confirm this here, the next stage could be racy since it assumes every node // has accepted the block. - WaitForAllValidatorsToAcceptBlock(ctx, source.ChainNodeURIs, source.BlockchainID, sourceBlockNumber.Uint64()) + WaitForAllValidatorsToAcceptBlock(ctx, source.NodeURIs, source.BlockchainID, sourceBlockNumber.Uint64()) // Get the aggregate signature for the Warp message log.Info("Fetching aggregate signature from the source chain validators") - warpClient, err := warpBackend.NewClient(source.ChainNodeURIs[0], source.BlockchainID.String()) + warpClient, err := warpBackend.NewClient(source.NodeURIs[0], source.BlockchainID.String()) Expect(err).Should(BeNil()) signedWarpMessageBytes, err := warpClient.GetAggregateSignature(ctx, unsignedWarpMessageID, params.WarpQuorumDenominator) Expect(err).Should(BeNil()) @@ -314,14 +314,14 @@ func RelayMessage( teleporterContractAddress, fundedAddress, fundedKey, - destination.ChainWSClient, - destination.ChainIDInt, + destination.WSClient, + destination.ChainID, ) log.Info("Sending transaction to destination chain") - receipt := SendTransactionAndWaitForAcceptance(ctx, destination.ChainWSClient, signedTx) + receipt := SendTransactionAndWaitForAcceptance(ctx, destination.WSClient, signedTx) - bind, err := teleportermessenger.NewTeleportermessenger(teleporterContractAddress, source.ChainWSClient) + bind, err := teleportermessenger.NewTeleportermessenger(teleporterContractAddress, source.WSClient) Expect(err).Should(BeNil()) // Check the transaction logs for the ReceiveCrossChainMessage event emitted by the Teleporter contract event, err := GetReceiveEventFromLogs(receipt.Logs, bind) From 7eacec767e270009fd4567f354e8e85ba0e93067 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Thu, 5 Oct 2023 10:49:17 -0400 Subject: [PATCH 048/183] Revert go sum change --- go.sum | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.sum b/go.sum index 162127531..7fab0139c 100644 --- a/go.sum +++ b/go.sum @@ -63,7 +63,7 @@ github.com/ava-labs/avalanche-network-runner v1.7.2 h1:XFad/wZfYzDnqbLzPAPPRYU3a github.com/ava-labs/avalanche-network-runner v1.7.2/go.mod h1:naLveusSrP7YgTAqRykD1SyLOAUilCp9jGjk3MDxoPI= github.com/ava-labs/avalanchego v1.10.10 h1:EYX4LVotcfdtIQ0nJSBTcoisubx/Bzk2tM1aP3yiYiw= github.com/ava-labs/avalanchego v1.10.10/go.mod h1:6UA0nxxTvvpyuCbP2DSzx9+7uWQfQx9DPApK8JptLiE= -github.com/ava-labs/awm-relayer v0.2.2 h1:X7HAINnW6f71gCN96W9vVrSk2Ri+euOpI/zDJkLEeMY= +github.com/ava-labs/awm-relayer v0.2.2 h1:TW/cJr13bVMHL5NjBF9aTTJQTyjpwbRMH6ffX78DFmo= github.com/ava-labs/awm-relayer v0.2.2/go.mod h1:UIc0Nl/ZIRVm5fBmUWDxWahNsQWZoSfJb3ei25q5ZlQ= github.com/ava-labs/coreth v0.12.5-rc.6 h1:OajGUyKkO5Q82XSuMa8T5UD6QywtCHUiZ4Tv3RFmRBU= github.com/ava-labs/coreth v0.12.5-rc.6/go.mod h1:s5wVyy+5UCCk2m0Tq3jVmy0UqOpKBDYqRE13gInCJVs= From 24969793e15273b700101920aa89385213af650b Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Thu, 5 Oct 2023 16:57:21 -0400 Subject: [PATCH 049/183] Test token reserve --- tests/native_token_bridge.go | 95 ++++++++++++++++++++++++++---------- tests/utils/utils.go | 2 +- 2 files changed, 71 insertions(+), 26 deletions(-) diff --git a/tests/native_token_bridge.go b/tests/native_token_bridge.go index a434ad51f..de90773a5 100644 --- a/tests/native_token_bridge.go +++ b/tests/native_token_bridge.go @@ -2,6 +2,7 @@ package tests import ( "context" + "crypto/ecdsa" "math/big" "github.com/ava-labs/subnet-evm/accounts/abi/bind" @@ -18,8 +19,10 @@ import ( func NativeTokenBridge() { const ( - valueToSend = int64(1000_000_000_000_000_000) - valueToReturn = valueToSend / 4 + tokenReserve = uint64(1e15) + valueToSend1 = tokenReserve/4 + valueToSend2 = tokenReserve + valueToReturn = valueToSend1 / 4 bridgeDeployerKeyStr = "aad7440febfc8f9d73a58c3cb1f1754779a566978f9ebffcd4f4698e9b043985" NativeTokenSourceByteCodeFile = "./contracts/out/NativeTokenSource.sol/NativeTokenSource.json" @@ -35,6 +38,7 @@ func NativeTokenBridge() { subnetB := utils.GetSubnetBTestInfo() teleporterContractAddress := utils.GetTeleporterContractAddress() + // Info we need to calculate for the test nativeTokenBridgeDeployerPK, err := crypto.HexToECDSA(bridgeDeployerKeyStr) Expect(err).Should(BeNil()) nativeTokenBridgeContractAddress, err := deploymentUtils.DeriveEVMContractAddress(nativeTokenBridgeDeployer, 0) @@ -57,7 +61,7 @@ func NativeTokenBridge() { Expect(err).Should(BeNil()) nativeTokenDestinationAbi, err := nativetokendestination.NativetokendestinationMetaData.GetAbi() Expect(err).Should(BeNil()) - _, txB, _, err := bind.DeployContract(chainBTransactor, *nativeTokenDestinationAbi, nativeTokenDestinationBytecode, subnetB.WSClient, teleporterContractAddress, subnetA.BlockchainID, nativeTokenBridgeContractAddress, common.Big0) + _, txB, _, err := bind.DeployContract(chainBTransactor, *nativeTokenDestinationAbi, nativeTokenDestinationBytecode, subnetB.WSClient, teleporterContractAddress, subnetA.BlockchainID, nativeTokenBridgeContractAddress, new(big.Int).SetUint64(tokenReserve)) Expect(err).Should(BeNil()) // Wait for transaction, then check code was deployed @@ -81,55 +85,96 @@ func NativeTokenBridge() { nativeTokenSource, err := nativetokensource.NewNativetokensource(nativeTokenBridgeContractAddress, subnetA.WSClient) Expect(err).Should(BeNil()) - { // Transfer tokens A -> B - transactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, subnetA.ChainID) + // Helper function + sendTokensToSource := func(valueToSend uint64, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { + transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, subnetB.ChainID) Expect(err).Should(BeNil()) - transactor.Value = big.NewInt(valueToSend) + transactor.Value = new(big.Int).SetUint64(valueToSend) - tx, err := nativeTokenSource.TransferToDestination(transactor, tokenReceiverAddress, tokenReceiverAddress, big.NewInt(0)) + tx, err := nativeTokenDestination.TransferToSource(transactor, toAddress, common.Address{}, big.NewInt(0)) + Expect(err).Should(BeNil()) + log.Info("Sent TransferToSource transaction on destination chain", "sourceChainID", subnetA.BlockchainID, "txHash", tx.Hash().Hex()) + + receipt := utils.WaitForTransaction(ctx, tx.Hash(), subnetB.WSClient) + Expect(err).Should(BeNil()) + Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + + utils.RelayMessage(ctx, receipt.BlockHash, receipt.BlockNumber, subnetB, subnetA) + return receipt + } + + // Helper function + sendTokensToDestination := func(valueToSend uint64, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { + transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, subnetA.ChainID) + Expect(err).Should(BeNil()) + transactor.Value = new(big.Int).SetUint64(valueToSend) + + tx, err := nativeTokenSource.TransferToDestination(transactor, toAddress, common.Address{}, big.NewInt(0)) Expect(err).Should(BeNil()) log.Info("Sent TransferToDestination transaction on source chain", "destinationChainID", subnetB.BlockchainID, "txHash", tx.Hash().Hex()) receipt := utils.WaitForTransaction(ctx, tx.Hash(), subnetA.WSClient) + Expect(err).Should(BeNil()) Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + utils.RelayMessage(ctx, receipt.BlockHash, receipt.BlockNumber, subnetA, subnetB) + return receipt + } + + { // Transfer some tokens A -> B // Check starting balance is 0 bal, err := subnetB.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) Expect(err).Should(BeNil()) - Expect(bal.Int64()).Should(Equal(common.Big0.Int64())) + Expect(bal.Uint64()).Should(Equal(common.Big0.Uint64())) - utils.RelayMessage(ctx, receipt.BlockHash, receipt.BlockNumber, subnetA, subnetB) + sendTokensToDestination(valueToSend1, nativeTokenBridgeDeployerPK, tokenReceiverAddress) - // Check final balance + // Check intermediate balance, no tokens should be minted because we haven't collateralized bal, err = subnetB.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) Expect(err).Should(BeNil()) - Expect(bal.Int64()).Should(Equal(valueToSend)) + Expect(bal.Uint64()).Should(Equal(uint64(0))) } - // Transfer tokens B -> A - { - transactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, subnetB.ChainID) + { // Transfer tokens B -> A + // Check starting balance is 0 + bal, err := subnetA.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) Expect(err).Should(BeNil()) - transactor.Value = big.NewInt(valueToReturn) + Expect(bal.Uint64()).Should(Equal(common.Big0.Uint64())) - tx, err := nativeTokenDestination.TransferToSource(transactor, tokenReceiverAddress, tokenReceiverAddress, big.NewInt(0)) + transactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, subnetB.ChainID) Expect(err).Should(BeNil()) - log.Info("Sent TransferToSource transaction on destination chain", "sourceChainID", subnetA.BlockchainID, "txHash", tx.Hash().Hex()) + transactor.Value = new(big.Int).SetUint64(valueToSend1) - receipt := utils.WaitForTransaction(ctx, tx.Hash(), subnetB.WSClient) + // This transfer should revert because the bridge isn't collateralized + _, err = nativeTokenDestination.TransferToSource(transactor, tokenReceiverAddress, common.Address{}, big.NewInt(0)) + Expect(err).ShouldNot(BeNil()) + + // Check we should fail to send because we're not collateralized + bal, err = subnetA.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) Expect(err).Should(BeNil()) - Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + Expect(bal.Uint64()).Should(Equal(uint64(0))) + } + { // Transfer more tokens A -> B to collateralize the bridge // Check starting balance is 0 - bal, err := subnetA.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) + bal, err := subnetB.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) Expect(err).Should(BeNil()) - Expect(bal.Int64()).Should(Equal(common.Big0.Int64())) + Expect(bal.Uint64()).Should(Equal(common.Big0.Uint64())) - utils.RelayMessage(ctx, receipt.BlockHash, receipt.BlockNumber, subnetB, subnetA) + sendTokensToDestination(valueToSend2, nativeTokenBridgeDeployerPK, tokenReceiverAddress) - // Check final balance - bal, err = subnetA.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) + // We should have minted the excess coins after checking the collateral + bal, err = subnetB.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) + Expect(err).Should(BeNil()) + Expect(bal.Uint64()).Should(Equal(valueToSend1 + valueToSend2 - tokenReserve)) + } + + { // Transfer tokens B -> A + sendTokensToSource(valueToReturn, nativeTokenBridgeDeployerPK, tokenReceiverAddress) + + // Check we should fail to send because we're not collateralized + bal, err := subnetA.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) Expect(err).Should(BeNil()) - Expect(bal.Int64()).Should(Equal(valueToReturn)) + Expect(bal.Uint64()).Should(Equal(valueToReturn)) } } diff --git a/tests/utils/utils.go b/tests/utils/utils.go index 3c6fe5157..5ad3bb8b3 100644 --- a/tests/utils/utils.go +++ b/tests/utils/utils.go @@ -260,7 +260,7 @@ func WaitForTransaction(ctx context.Context, txHash common.Hash, client ethclien return receipt } else { log.Info("Waiting for transaction", "hash", txHash.Hex()) - time.Sleep(100 * time.Millisecond) + time.Sleep(200 * time.Millisecond) } } } From d94a73623feb6ece122e8e525e3a04883de9bc23 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Fri, 6 Oct 2023 12:17:18 -0400 Subject: [PATCH 050/183] Move go abis to correct folder --- .../NativeTokenDestination.go | 346 +++++++++--------- .../NativeTokenSource/NativeTokenSource.go | 294 +++++++-------- 2 files changed, 320 insertions(+), 320 deletions(-) rename {abis => abi-bindings/CrossChainApplications/NativeTokenBridge}/NativeTokenDestination/NativeTokenDestination.go (66%) rename {abis => abi-bindings/CrossChainApplications/NativeTokenBridge}/NativeTokenSource/NativeTokenSource.go (66%) diff --git a/abis/NativeTokenDestination/NativeTokenDestination.go b/abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go similarity index 66% rename from abis/NativeTokenDestination/NativeTokenDestination.go rename to abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go index 4d6e9b180..c9a9e3413 100644 --- a/abis/NativeTokenDestination/NativeTokenDestination.go +++ b/abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go @@ -29,113 +29,113 @@ var ( _ = abi.ConvertType ) -// NativetokendestinationMetaData contains all meta data concerning the Nativetokendestination contract. -var NativetokendestinationMetaData = &bind.MetaData{ +// NativeTokenDestinationMetaData contains all meta data concerning the NativeTokenDestination contract. +var NativeTokenDestinationMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"sourceContractAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenReserve_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"MintNativeTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tokenReserve\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", } -// NativetokendestinationABI is the input ABI used to generate the binding from. -// Deprecated: Use NativetokendestinationMetaData.ABI instead. -var NativetokendestinationABI = NativetokendestinationMetaData.ABI +// NativeTokenDestinationABI is the input ABI used to generate the binding from. +// Deprecated: Use NativeTokenDestinationMetaData.ABI instead. +var NativeTokenDestinationABI = NativeTokenDestinationMetaData.ABI -// Nativetokendestination is an auto generated Go binding around an Ethereum contract. -type Nativetokendestination struct { - NativetokendestinationCaller // Read-only binding to the contract - NativetokendestinationTransactor // Write-only binding to the contract - NativetokendestinationFilterer // Log filterer for contract events +// NativeTokenDestination is an auto generated Go binding around an Ethereum contract. +type NativeTokenDestination struct { + NativeTokenDestinationCaller // Read-only binding to the contract + NativeTokenDestinationTransactor // Write-only binding to the contract + NativeTokenDestinationFilterer // Log filterer for contract events } -// NativetokendestinationCaller is an auto generated read-only Go binding around an Ethereum contract. -type NativetokendestinationCaller struct { +// NativeTokenDestinationCaller is an auto generated read-only Go binding around an Ethereum contract. +type NativeTokenDestinationCaller struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls } -// NativetokendestinationTransactor is an auto generated write-only Go binding around an Ethereum contract. -type NativetokendestinationTransactor struct { +// NativeTokenDestinationTransactor is an auto generated write-only Go binding around an Ethereum contract. +type NativeTokenDestinationTransactor struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls } -// NativetokendestinationFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type NativetokendestinationFilterer struct { +// NativeTokenDestinationFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type NativeTokenDestinationFilterer struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls } -// NativetokendestinationSession is an auto generated Go binding around an Ethereum contract, +// NativeTokenDestinationSession is an auto generated Go binding around an Ethereum contract, // with pre-set call and transact options. -type NativetokendestinationSession struct { - Contract *Nativetokendestination // Generic contract binding to set the session for +type NativeTokenDestinationSession struct { + Contract *NativeTokenDestination // Generic contract binding to set the session for CallOpts bind.CallOpts // Call options to use throughout this session TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session } -// NativetokendestinationCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// NativeTokenDestinationCallerSession is an auto generated read-only Go binding around an Ethereum contract, // with pre-set call options. -type NativetokendestinationCallerSession struct { - Contract *NativetokendestinationCaller // Generic contract caller binding to set the session for +type NativeTokenDestinationCallerSession struct { + Contract *NativeTokenDestinationCaller // Generic contract caller binding to set the session for CallOpts bind.CallOpts // Call options to use throughout this session } -// NativetokendestinationTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// NativeTokenDestinationTransactorSession is an auto generated write-only Go binding around an Ethereum contract, // with pre-set transact options. -type NativetokendestinationTransactorSession struct { - Contract *NativetokendestinationTransactor // Generic contract transactor binding to set the session for +type NativeTokenDestinationTransactorSession struct { + Contract *NativeTokenDestinationTransactor // Generic contract transactor binding to set the session for TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session } -// NativetokendestinationRaw is an auto generated low-level Go binding around an Ethereum contract. -type NativetokendestinationRaw struct { - Contract *Nativetokendestination // Generic contract binding to access the raw methods on +// NativeTokenDestinationRaw is an auto generated low-level Go binding around an Ethereum contract. +type NativeTokenDestinationRaw struct { + Contract *NativeTokenDestination // Generic contract binding to access the raw methods on } -// NativetokendestinationCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type NativetokendestinationCallerRaw struct { - Contract *NativetokendestinationCaller // Generic read-only contract binding to access the raw methods on +// NativeTokenDestinationCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type NativeTokenDestinationCallerRaw struct { + Contract *NativeTokenDestinationCaller // Generic read-only contract binding to access the raw methods on } -// NativetokendestinationTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type NativetokendestinationTransactorRaw struct { - Contract *NativetokendestinationTransactor // Generic write-only contract binding to access the raw methods on +// NativeTokenDestinationTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type NativeTokenDestinationTransactorRaw struct { + Contract *NativeTokenDestinationTransactor // Generic write-only contract binding to access the raw methods on } -// NewNativetokendestination creates a new instance of Nativetokendestination, bound to a specific deployed contract. -func NewNativetokendestination(address common.Address, backend bind.ContractBackend) (*Nativetokendestination, error) { - contract, err := bindNativetokendestination(address, backend, backend, backend) +// NewNativeTokenDestination creates a new instance of NativeTokenDestination, bound to a specific deployed contract. +func NewNativeTokenDestination(address common.Address, backend bind.ContractBackend) (*NativeTokenDestination, error) { + contract, err := bindNativeTokenDestination(address, backend, backend, backend) if err != nil { return nil, err } - return &Nativetokendestination{NativetokendestinationCaller: NativetokendestinationCaller{contract: contract}, NativetokendestinationTransactor: NativetokendestinationTransactor{contract: contract}, NativetokendestinationFilterer: NativetokendestinationFilterer{contract: contract}}, nil + return &NativeTokenDestination{NativeTokenDestinationCaller: NativeTokenDestinationCaller{contract: contract}, NativeTokenDestinationTransactor: NativeTokenDestinationTransactor{contract: contract}, NativeTokenDestinationFilterer: NativeTokenDestinationFilterer{contract: contract}}, nil } -// NewNativetokendestinationCaller creates a new read-only instance of Nativetokendestination, bound to a specific deployed contract. -func NewNativetokendestinationCaller(address common.Address, caller bind.ContractCaller) (*NativetokendestinationCaller, error) { - contract, err := bindNativetokendestination(address, caller, nil, nil) +// NewNativeTokenDestinationCaller creates a new read-only instance of NativeTokenDestination, bound to a specific deployed contract. +func NewNativeTokenDestinationCaller(address common.Address, caller bind.ContractCaller) (*NativeTokenDestinationCaller, error) { + contract, err := bindNativeTokenDestination(address, caller, nil, nil) if err != nil { return nil, err } - return &NativetokendestinationCaller{contract: contract}, nil + return &NativeTokenDestinationCaller{contract: contract}, nil } -// NewNativetokendestinationTransactor creates a new write-only instance of Nativetokendestination, bound to a specific deployed contract. -func NewNativetokendestinationTransactor(address common.Address, transactor bind.ContractTransactor) (*NativetokendestinationTransactor, error) { - contract, err := bindNativetokendestination(address, nil, transactor, nil) +// NewNativeTokenDestinationTransactor creates a new write-only instance of NativeTokenDestination, bound to a specific deployed contract. +func NewNativeTokenDestinationTransactor(address common.Address, transactor bind.ContractTransactor) (*NativeTokenDestinationTransactor, error) { + contract, err := bindNativeTokenDestination(address, nil, transactor, nil) if err != nil { return nil, err } - return &NativetokendestinationTransactor{contract: contract}, nil + return &NativeTokenDestinationTransactor{contract: contract}, nil } -// NewNativetokendestinationFilterer creates a new log filterer instance of Nativetokendestination, bound to a specific deployed contract. -func NewNativetokendestinationFilterer(address common.Address, filterer bind.ContractFilterer) (*NativetokendestinationFilterer, error) { - contract, err := bindNativetokendestination(address, nil, nil, filterer) +// NewNativeTokenDestinationFilterer creates a new log filterer instance of NativeTokenDestination, bound to a specific deployed contract. +func NewNativeTokenDestinationFilterer(address common.Address, filterer bind.ContractFilterer) (*NativeTokenDestinationFilterer, error) { + contract, err := bindNativeTokenDestination(address, nil, nil, filterer) if err != nil { return nil, err } - return &NativetokendestinationFilterer{contract: contract}, nil + return &NativeTokenDestinationFilterer{contract: contract}, nil } -// bindNativetokendestination binds a generic wrapper to an already deployed contract. -func bindNativetokendestination(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := NativetokendestinationMetaData.GetAbi() +// bindNativeTokenDestination binds a generic wrapper to an already deployed contract. +func bindNativeTokenDestination(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := NativeTokenDestinationMetaData.GetAbi() if err != nil { return nil, err } @@ -146,46 +146,46 @@ func bindNativetokendestination(address common.Address, caller bind.ContractCall // sets the output to result. The result type might be a single field for simple // returns, a slice of interfaces for anonymous returns and a struct for named // returns. -func (_Nativetokendestination *NativetokendestinationRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _Nativetokendestination.Contract.NativetokendestinationCaller.contract.Call(opts, result, method, params...) +func (_NativeTokenDestination *NativeTokenDestinationRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _NativeTokenDestination.Contract.NativeTokenDestinationCaller.contract.Call(opts, result, method, params...) } // Transfer initiates a plain transaction to move funds to the contract, calling // its default method if one is available. -func (_Nativetokendestination *NativetokendestinationRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Nativetokendestination.Contract.NativetokendestinationTransactor.contract.Transfer(opts) +func (_NativeTokenDestination *NativeTokenDestinationRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _NativeTokenDestination.Contract.NativeTokenDestinationTransactor.contract.Transfer(opts) } // Transact invokes the (paid) contract method with params as input values. -func (_Nativetokendestination *NativetokendestinationRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _Nativetokendestination.Contract.NativetokendestinationTransactor.contract.Transact(opts, method, params...) +func (_NativeTokenDestination *NativeTokenDestinationRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _NativeTokenDestination.Contract.NativeTokenDestinationTransactor.contract.Transact(opts, method, params...) } // Call invokes the (constant) contract method with params as input values and // sets the output to result. The result type might be a single field for simple // returns, a slice of interfaces for anonymous returns and a struct for named // returns. -func (_Nativetokendestination *NativetokendestinationCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _Nativetokendestination.Contract.contract.Call(opts, result, method, params...) +func (_NativeTokenDestination *NativeTokenDestinationCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _NativeTokenDestination.Contract.contract.Call(opts, result, method, params...) } // Transfer initiates a plain transaction to move funds to the contract, calling // its default method if one is available. -func (_Nativetokendestination *NativetokendestinationTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Nativetokendestination.Contract.contract.Transfer(opts) +func (_NativeTokenDestination *NativeTokenDestinationTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _NativeTokenDestination.Contract.contract.Transfer(opts) } // Transact invokes the (paid) contract method with params as input values. -func (_Nativetokendestination *NativetokendestinationTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _Nativetokendestination.Contract.contract.Transact(opts, method, params...) +func (_NativeTokenDestination *NativeTokenDestinationTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _NativeTokenDestination.Contract.contract.Transact(opts, method, params...) } // TRANSFERNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xab285230. // // Solidity: function TRANSFER_NATIVE_TOKENS_REQUIRED_GAS() view returns(uint256) -func (_Nativetokendestination *NativetokendestinationCaller) TRANSFERNATIVETOKENSREQUIREDGAS(opts *bind.CallOpts) (*big.Int, error) { +func (_NativeTokenDestination *NativeTokenDestinationCaller) TRANSFERNATIVETOKENSREQUIREDGAS(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _Nativetokendestination.contract.Call(opts, &out, "TRANSFER_NATIVE_TOKENS_REQUIRED_GAS") + err := _NativeTokenDestination.contract.Call(opts, &out, "TRANSFER_NATIVE_TOKENS_REQUIRED_GAS") if err != nil { return *new(*big.Int), err @@ -200,23 +200,23 @@ func (_Nativetokendestination *NativetokendestinationCaller) TRANSFERNATIVETOKEN // TRANSFERNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xab285230. // // Solidity: function TRANSFER_NATIVE_TOKENS_REQUIRED_GAS() view returns(uint256) -func (_Nativetokendestination *NativetokendestinationSession) TRANSFERNATIVETOKENSREQUIREDGAS() (*big.Int, error) { - return _Nativetokendestination.Contract.TRANSFERNATIVETOKENSREQUIREDGAS(&_Nativetokendestination.CallOpts) +func (_NativeTokenDestination *NativeTokenDestinationSession) TRANSFERNATIVETOKENSREQUIREDGAS() (*big.Int, error) { + return _NativeTokenDestination.Contract.TRANSFERNATIVETOKENSREQUIREDGAS(&_NativeTokenDestination.CallOpts) } // TRANSFERNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xab285230. // // Solidity: function TRANSFER_NATIVE_TOKENS_REQUIRED_GAS() view returns(uint256) -func (_Nativetokendestination *NativetokendestinationCallerSession) TRANSFERNATIVETOKENSREQUIREDGAS() (*big.Int, error) { - return _Nativetokendestination.Contract.TRANSFERNATIVETOKENSREQUIREDGAS(&_Nativetokendestination.CallOpts) +func (_NativeTokenDestination *NativeTokenDestinationCallerSession) TRANSFERNATIVETOKENSREQUIREDGAS() (*big.Int, error) { + return _NativeTokenDestination.Contract.TRANSFERNATIVETOKENSREQUIREDGAS(&_NativeTokenDestination.CallOpts) } // CurrentBlockchainID is a free data retrieval call binding the contract method 0x4950d2d0. // // Solidity: function currentBlockchainID() view returns(bytes32) -func (_Nativetokendestination *NativetokendestinationCaller) CurrentBlockchainID(opts *bind.CallOpts) ([32]byte, error) { +func (_NativeTokenDestination *NativeTokenDestinationCaller) CurrentBlockchainID(opts *bind.CallOpts) ([32]byte, error) { var out []interface{} - err := _Nativetokendestination.contract.Call(opts, &out, "currentBlockchainID") + err := _NativeTokenDestination.contract.Call(opts, &out, "currentBlockchainID") if err != nil { return *new([32]byte), err @@ -231,23 +231,23 @@ func (_Nativetokendestination *NativetokendestinationCaller) CurrentBlockchainID // CurrentBlockchainID is a free data retrieval call binding the contract method 0x4950d2d0. // // Solidity: function currentBlockchainID() view returns(bytes32) -func (_Nativetokendestination *NativetokendestinationSession) CurrentBlockchainID() ([32]byte, error) { - return _Nativetokendestination.Contract.CurrentBlockchainID(&_Nativetokendestination.CallOpts) +func (_NativeTokenDestination *NativeTokenDestinationSession) CurrentBlockchainID() ([32]byte, error) { + return _NativeTokenDestination.Contract.CurrentBlockchainID(&_NativeTokenDestination.CallOpts) } // CurrentBlockchainID is a free data retrieval call binding the contract method 0x4950d2d0. // // Solidity: function currentBlockchainID() view returns(bytes32) -func (_Nativetokendestination *NativetokendestinationCallerSession) CurrentBlockchainID() ([32]byte, error) { - return _Nativetokendestination.Contract.CurrentBlockchainID(&_Nativetokendestination.CallOpts) +func (_NativeTokenDestination *NativeTokenDestinationCallerSession) CurrentBlockchainID() ([32]byte, error) { + return _NativeTokenDestination.Contract.CurrentBlockchainID(&_NativeTokenDestination.CallOpts) } // SourceBlockchainID is a free data retrieval call binding the contract method 0x29b7b3fd. // // Solidity: function sourceBlockchainID() view returns(bytes32) -func (_Nativetokendestination *NativetokendestinationCaller) SourceBlockchainID(opts *bind.CallOpts) ([32]byte, error) { +func (_NativeTokenDestination *NativeTokenDestinationCaller) SourceBlockchainID(opts *bind.CallOpts) ([32]byte, error) { var out []interface{} - err := _Nativetokendestination.contract.Call(opts, &out, "sourceBlockchainID") + err := _NativeTokenDestination.contract.Call(opts, &out, "sourceBlockchainID") if err != nil { return *new([32]byte), err @@ -262,23 +262,23 @@ func (_Nativetokendestination *NativetokendestinationCaller) SourceBlockchainID( // SourceBlockchainID is a free data retrieval call binding the contract method 0x29b7b3fd. // // Solidity: function sourceBlockchainID() view returns(bytes32) -func (_Nativetokendestination *NativetokendestinationSession) SourceBlockchainID() ([32]byte, error) { - return _Nativetokendestination.Contract.SourceBlockchainID(&_Nativetokendestination.CallOpts) +func (_NativeTokenDestination *NativeTokenDestinationSession) SourceBlockchainID() ([32]byte, error) { + return _NativeTokenDestination.Contract.SourceBlockchainID(&_NativeTokenDestination.CallOpts) } // SourceBlockchainID is a free data retrieval call binding the contract method 0x29b7b3fd. // // Solidity: function sourceBlockchainID() view returns(bytes32) -func (_Nativetokendestination *NativetokendestinationCallerSession) SourceBlockchainID() ([32]byte, error) { - return _Nativetokendestination.Contract.SourceBlockchainID(&_Nativetokendestination.CallOpts) +func (_NativeTokenDestination *NativeTokenDestinationCallerSession) SourceBlockchainID() ([32]byte, error) { + return _NativeTokenDestination.Contract.SourceBlockchainID(&_NativeTokenDestination.CallOpts) } // SourceContractAddress is a free data retrieval call binding the contract method 0x3a85f16a. // // Solidity: function sourceContractAddress() view returns(address) -func (_Nativetokendestination *NativetokendestinationCaller) SourceContractAddress(opts *bind.CallOpts) (common.Address, error) { +func (_NativeTokenDestination *NativeTokenDestinationCaller) SourceContractAddress(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _Nativetokendestination.contract.Call(opts, &out, "sourceContractAddress") + err := _NativeTokenDestination.contract.Call(opts, &out, "sourceContractAddress") if err != nil { return *new(common.Address), err @@ -293,23 +293,23 @@ func (_Nativetokendestination *NativetokendestinationCaller) SourceContractAddre // SourceContractAddress is a free data retrieval call binding the contract method 0x3a85f16a. // // Solidity: function sourceContractAddress() view returns(address) -func (_Nativetokendestination *NativetokendestinationSession) SourceContractAddress() (common.Address, error) { - return _Nativetokendestination.Contract.SourceContractAddress(&_Nativetokendestination.CallOpts) +func (_NativeTokenDestination *NativeTokenDestinationSession) SourceContractAddress() (common.Address, error) { + return _NativeTokenDestination.Contract.SourceContractAddress(&_NativeTokenDestination.CallOpts) } // SourceContractAddress is a free data retrieval call binding the contract method 0x3a85f16a. // // Solidity: function sourceContractAddress() view returns(address) -func (_Nativetokendestination *NativetokendestinationCallerSession) SourceContractAddress() (common.Address, error) { - return _Nativetokendestination.Contract.SourceContractAddress(&_Nativetokendestination.CallOpts) +func (_NativeTokenDestination *NativeTokenDestinationCallerSession) SourceContractAddress() (common.Address, error) { + return _NativeTokenDestination.Contract.SourceContractAddress(&_NativeTokenDestination.CallOpts) } // TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. // // Solidity: function teleporterMessenger() view returns(address) -func (_Nativetokendestination *NativetokendestinationCaller) TeleporterMessenger(opts *bind.CallOpts) (common.Address, error) { +func (_NativeTokenDestination *NativeTokenDestinationCaller) TeleporterMessenger(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _Nativetokendestination.contract.Call(opts, &out, "teleporterMessenger") + err := _NativeTokenDestination.contract.Call(opts, &out, "teleporterMessenger") if err != nil { return *new(common.Address), err @@ -324,23 +324,23 @@ func (_Nativetokendestination *NativetokendestinationCaller) TeleporterMessenger // TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. // // Solidity: function teleporterMessenger() view returns(address) -func (_Nativetokendestination *NativetokendestinationSession) TeleporterMessenger() (common.Address, error) { - return _Nativetokendestination.Contract.TeleporterMessenger(&_Nativetokendestination.CallOpts) +func (_NativeTokenDestination *NativeTokenDestinationSession) TeleporterMessenger() (common.Address, error) { + return _NativeTokenDestination.Contract.TeleporterMessenger(&_NativeTokenDestination.CallOpts) } // TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. // // Solidity: function teleporterMessenger() view returns(address) -func (_Nativetokendestination *NativetokendestinationCallerSession) TeleporterMessenger() (common.Address, error) { - return _Nativetokendestination.Contract.TeleporterMessenger(&_Nativetokendestination.CallOpts) +func (_NativeTokenDestination *NativeTokenDestinationCallerSession) TeleporterMessenger() (common.Address, error) { + return _NativeTokenDestination.Contract.TeleporterMessenger(&_NativeTokenDestination.CallOpts) } // TokenReserve is a free data retrieval call binding the contract method 0xcbcb3171. // // Solidity: function tokenReserve() view returns(uint256) -func (_Nativetokendestination *NativetokendestinationCaller) TokenReserve(opts *bind.CallOpts) (*big.Int, error) { +func (_NativeTokenDestination *NativeTokenDestinationCaller) TokenReserve(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _Nativetokendestination.contract.Call(opts, &out, "tokenReserve") + err := _NativeTokenDestination.contract.Call(opts, &out, "tokenReserve") if err != nil { return *new(*big.Int), err @@ -355,62 +355,62 @@ func (_Nativetokendestination *NativetokendestinationCaller) TokenReserve(opts * // TokenReserve is a free data retrieval call binding the contract method 0xcbcb3171. // // Solidity: function tokenReserve() view returns(uint256) -func (_Nativetokendestination *NativetokendestinationSession) TokenReserve() (*big.Int, error) { - return _Nativetokendestination.Contract.TokenReserve(&_Nativetokendestination.CallOpts) +func (_NativeTokenDestination *NativeTokenDestinationSession) TokenReserve() (*big.Int, error) { + return _NativeTokenDestination.Contract.TokenReserve(&_NativeTokenDestination.CallOpts) } // TokenReserve is a free data retrieval call binding the contract method 0xcbcb3171. // // Solidity: function tokenReserve() view returns(uint256) -func (_Nativetokendestination *NativetokendestinationCallerSession) TokenReserve() (*big.Int, error) { - return _Nativetokendestination.Contract.TokenReserve(&_Nativetokendestination.CallOpts) +func (_NativeTokenDestination *NativeTokenDestinationCallerSession) TokenReserve() (*big.Int, error) { + return _NativeTokenDestination.Contract.TokenReserve(&_NativeTokenDestination.CallOpts) } // ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. // // Solidity: function receiveTeleporterMessage(bytes32 senderBlockchainID, address senderAddress, bytes message) returns() -func (_Nativetokendestination *NativetokendestinationTransactor) ReceiveTeleporterMessage(opts *bind.TransactOpts, senderBlockchainID [32]byte, senderAddress common.Address, message []byte) (*types.Transaction, error) { - return _Nativetokendestination.contract.Transact(opts, "receiveTeleporterMessage", senderBlockchainID, senderAddress, message) +func (_NativeTokenDestination *NativeTokenDestinationTransactor) ReceiveTeleporterMessage(opts *bind.TransactOpts, senderBlockchainID [32]byte, senderAddress common.Address, message []byte) (*types.Transaction, error) { + return _NativeTokenDestination.contract.Transact(opts, "receiveTeleporterMessage", senderBlockchainID, senderAddress, message) } // ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. // // Solidity: function receiveTeleporterMessage(bytes32 senderBlockchainID, address senderAddress, bytes message) returns() -func (_Nativetokendestination *NativetokendestinationSession) ReceiveTeleporterMessage(senderBlockchainID [32]byte, senderAddress common.Address, message []byte) (*types.Transaction, error) { - return _Nativetokendestination.Contract.ReceiveTeleporterMessage(&_Nativetokendestination.TransactOpts, senderBlockchainID, senderAddress, message) +func (_NativeTokenDestination *NativeTokenDestinationSession) ReceiveTeleporterMessage(senderBlockchainID [32]byte, senderAddress common.Address, message []byte) (*types.Transaction, error) { + return _NativeTokenDestination.Contract.ReceiveTeleporterMessage(&_NativeTokenDestination.TransactOpts, senderBlockchainID, senderAddress, message) } // ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. // // Solidity: function receiveTeleporterMessage(bytes32 senderBlockchainID, address senderAddress, bytes message) returns() -func (_Nativetokendestination *NativetokendestinationTransactorSession) ReceiveTeleporterMessage(senderBlockchainID [32]byte, senderAddress common.Address, message []byte) (*types.Transaction, error) { - return _Nativetokendestination.Contract.ReceiveTeleporterMessage(&_Nativetokendestination.TransactOpts, senderBlockchainID, senderAddress, message) +func (_NativeTokenDestination *NativeTokenDestinationTransactorSession) ReceiveTeleporterMessage(senderBlockchainID [32]byte, senderAddress common.Address, message []byte) (*types.Transaction, error) { + return _NativeTokenDestination.Contract.ReceiveTeleporterMessage(&_NativeTokenDestination.TransactOpts, senderBlockchainID, senderAddress, message) } // TransferToSource is a paid mutator transaction binding the contract method 0x281c91de. // // Solidity: function transferToSource(address recipient, address feeContractAddress, uint256 feeAmount) payable returns() -func (_Nativetokendestination *NativetokendestinationTransactor) TransferToSource(opts *bind.TransactOpts, recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { - return _Nativetokendestination.contract.Transact(opts, "transferToSource", recipient, feeContractAddress, feeAmount) +func (_NativeTokenDestination *NativeTokenDestinationTransactor) TransferToSource(opts *bind.TransactOpts, recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { + return _NativeTokenDestination.contract.Transact(opts, "transferToSource", recipient, feeContractAddress, feeAmount) } // TransferToSource is a paid mutator transaction binding the contract method 0x281c91de. // // Solidity: function transferToSource(address recipient, address feeContractAddress, uint256 feeAmount) payable returns() -func (_Nativetokendestination *NativetokendestinationSession) TransferToSource(recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { - return _Nativetokendestination.Contract.TransferToSource(&_Nativetokendestination.TransactOpts, recipient, feeContractAddress, feeAmount) +func (_NativeTokenDestination *NativeTokenDestinationSession) TransferToSource(recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { + return _NativeTokenDestination.Contract.TransferToSource(&_NativeTokenDestination.TransactOpts, recipient, feeContractAddress, feeAmount) } // TransferToSource is a paid mutator transaction binding the contract method 0x281c91de. // // Solidity: function transferToSource(address recipient, address feeContractAddress, uint256 feeAmount) payable returns() -func (_Nativetokendestination *NativetokendestinationTransactorSession) TransferToSource(recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { - return _Nativetokendestination.Contract.TransferToSource(&_Nativetokendestination.TransactOpts, recipient, feeContractAddress, feeAmount) +func (_NativeTokenDestination *NativeTokenDestinationTransactorSession) TransferToSource(recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { + return _NativeTokenDestination.Contract.TransferToSource(&_NativeTokenDestination.TransactOpts, recipient, feeContractAddress, feeAmount) } -// NativetokendestinationCollateralAddedIterator is returned from FilterCollateralAdded and is used to iterate over the raw logs and unpacked data for CollateralAdded events raised by the Nativetokendestination contract. -type NativetokendestinationCollateralAddedIterator struct { - Event *NativetokendestinationCollateralAdded // Event containing the contract specifics and raw log +// NativeTokenDestinationCollateralAddedIterator is returned from FilterCollateralAdded and is used to iterate over the raw logs and unpacked data for CollateralAdded events raised by the NativeTokenDestination contract. +type NativeTokenDestinationCollateralAddedIterator struct { + Event *NativeTokenDestinationCollateralAdded // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -424,7 +424,7 @@ type NativetokendestinationCollateralAddedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *NativetokendestinationCollateralAddedIterator) Next() bool { +func (it *NativeTokenDestinationCollateralAddedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -433,7 +433,7 @@ func (it *NativetokendestinationCollateralAddedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(NativetokendestinationCollateralAdded) + it.Event = new(NativeTokenDestinationCollateralAdded) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -448,7 +448,7 @@ func (it *NativetokendestinationCollateralAddedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(NativetokendestinationCollateralAdded) + it.Event = new(NativeTokenDestinationCollateralAdded) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -464,19 +464,19 @@ func (it *NativetokendestinationCollateralAddedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *NativetokendestinationCollateralAddedIterator) Error() error { +func (it *NativeTokenDestinationCollateralAddedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *NativetokendestinationCollateralAddedIterator) Close() error { +func (it *NativeTokenDestinationCollateralAddedIterator) Close() error { it.sub.Unsubscribe() return nil } -// NativetokendestinationCollateralAdded represents a CollateralAdded event raised by the Nativetokendestination contract. -type NativetokendestinationCollateralAdded struct { +// NativeTokenDestinationCollateralAdded represents a CollateralAdded event raised by the NativeTokenDestination contract. +type NativeTokenDestinationCollateralAdded struct { Amount *big.Int Remaining *big.Int Raw types.Log // Blockchain specific contextual infos @@ -485,21 +485,21 @@ type NativetokendestinationCollateralAdded struct { // FilterCollateralAdded is a free log retrieval operation binding the contract event 0x244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449. // // Solidity: event CollateralAdded(uint256 amount, uint256 remaining) -func (_Nativetokendestination *NativetokendestinationFilterer) FilterCollateralAdded(opts *bind.FilterOpts) (*NativetokendestinationCollateralAddedIterator, error) { +func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterCollateralAdded(opts *bind.FilterOpts) (*NativeTokenDestinationCollateralAddedIterator, error) { - logs, sub, err := _Nativetokendestination.contract.FilterLogs(opts, "CollateralAdded") + logs, sub, err := _NativeTokenDestination.contract.FilterLogs(opts, "CollateralAdded") if err != nil { return nil, err } - return &NativetokendestinationCollateralAddedIterator{contract: _Nativetokendestination.contract, event: "CollateralAdded", logs: logs, sub: sub}, nil + return &NativeTokenDestinationCollateralAddedIterator{contract: _NativeTokenDestination.contract, event: "CollateralAdded", logs: logs, sub: sub}, nil } // WatchCollateralAdded is a free log subscription operation binding the contract event 0x244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449. // // Solidity: event CollateralAdded(uint256 amount, uint256 remaining) -func (_Nativetokendestination *NativetokendestinationFilterer) WatchCollateralAdded(opts *bind.WatchOpts, sink chan<- *NativetokendestinationCollateralAdded) (event.Subscription, error) { +func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchCollateralAdded(opts *bind.WatchOpts, sink chan<- *NativeTokenDestinationCollateralAdded) (event.Subscription, error) { - logs, sub, err := _Nativetokendestination.contract.WatchLogs(opts, "CollateralAdded") + logs, sub, err := _NativeTokenDestination.contract.WatchLogs(opts, "CollateralAdded") if err != nil { return nil, err } @@ -509,8 +509,8 @@ func (_Nativetokendestination *NativetokendestinationFilterer) WatchCollateralAd select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(NativetokendestinationCollateralAdded) - if err := _Nativetokendestination.contract.UnpackLog(event, "CollateralAdded", log); err != nil { + event := new(NativeTokenDestinationCollateralAdded) + if err := _NativeTokenDestination.contract.UnpackLog(event, "CollateralAdded", log); err != nil { return err } event.Raw = log @@ -534,18 +534,18 @@ func (_Nativetokendestination *NativetokendestinationFilterer) WatchCollateralAd // ParseCollateralAdded is a log parse operation binding the contract event 0x244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449. // // Solidity: event CollateralAdded(uint256 amount, uint256 remaining) -func (_Nativetokendestination *NativetokendestinationFilterer) ParseCollateralAdded(log types.Log) (*NativetokendestinationCollateralAdded, error) { - event := new(NativetokendestinationCollateralAdded) - if err := _Nativetokendestination.contract.UnpackLog(event, "CollateralAdded", log); err != nil { +func (_NativeTokenDestination *NativeTokenDestinationFilterer) ParseCollateralAdded(log types.Log) (*NativeTokenDestinationCollateralAdded, error) { + event := new(NativeTokenDestinationCollateralAdded) + if err := _NativeTokenDestination.contract.UnpackLog(event, "CollateralAdded", log); err != nil { return nil, err } event.Raw = log return event, nil } -// NativetokendestinationMintNativeTokensIterator is returned from FilterMintNativeTokens and is used to iterate over the raw logs and unpacked data for MintNativeTokens events raised by the Nativetokendestination contract. -type NativetokendestinationMintNativeTokensIterator struct { - Event *NativetokendestinationMintNativeTokens // Event containing the contract specifics and raw log +// NativeTokenDestinationMintNativeTokensIterator is returned from FilterMintNativeTokens and is used to iterate over the raw logs and unpacked data for MintNativeTokens events raised by the NativeTokenDestination contract. +type NativeTokenDestinationMintNativeTokensIterator struct { + Event *NativeTokenDestinationMintNativeTokens // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -559,7 +559,7 @@ type NativetokendestinationMintNativeTokensIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *NativetokendestinationMintNativeTokensIterator) Next() bool { +func (it *NativeTokenDestinationMintNativeTokensIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -568,7 +568,7 @@ func (it *NativetokendestinationMintNativeTokensIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(NativetokendestinationMintNativeTokens) + it.Event = new(NativeTokenDestinationMintNativeTokens) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -583,7 +583,7 @@ func (it *NativetokendestinationMintNativeTokensIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(NativetokendestinationMintNativeTokens) + it.Event = new(NativeTokenDestinationMintNativeTokens) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -599,19 +599,19 @@ func (it *NativetokendestinationMintNativeTokensIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *NativetokendestinationMintNativeTokensIterator) Error() error { +func (it *NativeTokenDestinationMintNativeTokensIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *NativetokendestinationMintNativeTokensIterator) Close() error { +func (it *NativeTokenDestinationMintNativeTokensIterator) Close() error { it.sub.Unsubscribe() return nil } -// NativetokendestinationMintNativeTokens represents a MintNativeTokens event raised by the Nativetokendestination contract. -type NativetokendestinationMintNativeTokens struct { +// NativeTokenDestinationMintNativeTokens represents a MintNativeTokens event raised by the NativeTokenDestination contract. +type NativeTokenDestinationMintNativeTokens struct { Recipient common.Address Amount *big.Int Raw types.Log // Blockchain specific contextual infos @@ -620,21 +620,21 @@ type NativetokendestinationMintNativeTokens struct { // FilterMintNativeTokens is a free log retrieval operation binding the contract event 0xe2899f7ef7618206fa13efbcde0c05cccd83f35ac3b18ef860021181d61fa680. // // Solidity: event MintNativeTokens(address recipient, uint256 amount) -func (_Nativetokendestination *NativetokendestinationFilterer) FilterMintNativeTokens(opts *bind.FilterOpts) (*NativetokendestinationMintNativeTokensIterator, error) { +func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterMintNativeTokens(opts *bind.FilterOpts) (*NativeTokenDestinationMintNativeTokensIterator, error) { - logs, sub, err := _Nativetokendestination.contract.FilterLogs(opts, "MintNativeTokens") + logs, sub, err := _NativeTokenDestination.contract.FilterLogs(opts, "MintNativeTokens") if err != nil { return nil, err } - return &NativetokendestinationMintNativeTokensIterator{contract: _Nativetokendestination.contract, event: "MintNativeTokens", logs: logs, sub: sub}, nil + return &NativeTokenDestinationMintNativeTokensIterator{contract: _NativeTokenDestination.contract, event: "MintNativeTokens", logs: logs, sub: sub}, nil } // WatchMintNativeTokens is a free log subscription operation binding the contract event 0xe2899f7ef7618206fa13efbcde0c05cccd83f35ac3b18ef860021181d61fa680. // // Solidity: event MintNativeTokens(address recipient, uint256 amount) -func (_Nativetokendestination *NativetokendestinationFilterer) WatchMintNativeTokens(opts *bind.WatchOpts, sink chan<- *NativetokendestinationMintNativeTokens) (event.Subscription, error) { +func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchMintNativeTokens(opts *bind.WatchOpts, sink chan<- *NativeTokenDestinationMintNativeTokens) (event.Subscription, error) { - logs, sub, err := _Nativetokendestination.contract.WatchLogs(opts, "MintNativeTokens") + logs, sub, err := _NativeTokenDestination.contract.WatchLogs(opts, "MintNativeTokens") if err != nil { return nil, err } @@ -644,8 +644,8 @@ func (_Nativetokendestination *NativetokendestinationFilterer) WatchMintNativeTo select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(NativetokendestinationMintNativeTokens) - if err := _Nativetokendestination.contract.UnpackLog(event, "MintNativeTokens", log); err != nil { + event := new(NativeTokenDestinationMintNativeTokens) + if err := _NativeTokenDestination.contract.UnpackLog(event, "MintNativeTokens", log); err != nil { return err } event.Raw = log @@ -669,18 +669,18 @@ func (_Nativetokendestination *NativetokendestinationFilterer) WatchMintNativeTo // ParseMintNativeTokens is a log parse operation binding the contract event 0xe2899f7ef7618206fa13efbcde0c05cccd83f35ac3b18ef860021181d61fa680. // // Solidity: event MintNativeTokens(address recipient, uint256 amount) -func (_Nativetokendestination *NativetokendestinationFilterer) ParseMintNativeTokens(log types.Log) (*NativetokendestinationMintNativeTokens, error) { - event := new(NativetokendestinationMintNativeTokens) - if err := _Nativetokendestination.contract.UnpackLog(event, "MintNativeTokens", log); err != nil { +func (_NativeTokenDestination *NativeTokenDestinationFilterer) ParseMintNativeTokens(log types.Log) (*NativeTokenDestinationMintNativeTokens, error) { + event := new(NativeTokenDestinationMintNativeTokens) + if err := _NativeTokenDestination.contract.UnpackLog(event, "MintNativeTokens", log); err != nil { return nil, err } event.Raw = log return event, nil } -// NativetokendestinationTransferToSourceIterator is returned from FilterTransferToSource and is used to iterate over the raw logs and unpacked data for TransferToSource events raised by the Nativetokendestination contract. -type NativetokendestinationTransferToSourceIterator struct { - Event *NativetokendestinationTransferToSource // Event containing the contract specifics and raw log +// NativeTokenDestinationTransferToSourceIterator is returned from FilterTransferToSource and is used to iterate over the raw logs and unpacked data for TransferToSource events raised by the NativeTokenDestination contract. +type NativeTokenDestinationTransferToSourceIterator struct { + Event *NativeTokenDestinationTransferToSource // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -694,7 +694,7 @@ type NativetokendestinationTransferToSourceIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *NativetokendestinationTransferToSourceIterator) Next() bool { +func (it *NativeTokenDestinationTransferToSourceIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -703,7 +703,7 @@ func (it *NativetokendestinationTransferToSourceIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(NativetokendestinationTransferToSource) + it.Event = new(NativeTokenDestinationTransferToSource) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -718,7 +718,7 @@ func (it *NativetokendestinationTransferToSourceIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(NativetokendestinationTransferToSource) + it.Event = new(NativeTokenDestinationTransferToSource) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -734,19 +734,19 @@ func (it *NativetokendestinationTransferToSourceIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *NativetokendestinationTransferToSourceIterator) Error() error { +func (it *NativeTokenDestinationTransferToSourceIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *NativetokendestinationTransferToSourceIterator) Close() error { +func (it *NativeTokenDestinationTransferToSourceIterator) Close() error { it.sub.Unsubscribe() return nil } -// NativetokendestinationTransferToSource represents a TransferToSource event raised by the Nativetokendestination contract. -type NativetokendestinationTransferToSource struct { +// NativeTokenDestinationTransferToSource represents a TransferToSource event raised by the NativeTokenDestination contract. +type NativeTokenDestinationTransferToSource struct { Sender common.Address Recipient common.Address Amount *big.Int @@ -759,7 +759,7 @@ type NativetokendestinationTransferToSource struct { // FilterTransferToSource is a free log retrieval operation binding the contract event 0x343e0fe771af9fa258c07a602fad6dfd80c51eda78604397e553106360933bfc. // // Solidity: event TransferToSource(address indexed sender, address indexed recipient, uint256 amount, address feeContractAddress, uint256 feeAmount, uint256 teleporterMessageID) -func (_Nativetokendestination *NativetokendestinationFilterer) FilterTransferToSource(opts *bind.FilterOpts, sender []common.Address, recipient []common.Address) (*NativetokendestinationTransferToSourceIterator, error) { +func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterTransferToSource(opts *bind.FilterOpts, sender []common.Address, recipient []common.Address) (*NativeTokenDestinationTransferToSourceIterator, error) { var senderRule []interface{} for _, senderItem := range sender { @@ -770,17 +770,17 @@ func (_Nativetokendestination *NativetokendestinationFilterer) FilterTransferToS recipientRule = append(recipientRule, recipientItem) } - logs, sub, err := _Nativetokendestination.contract.FilterLogs(opts, "TransferToSource", senderRule, recipientRule) + logs, sub, err := _NativeTokenDestination.contract.FilterLogs(opts, "TransferToSource", senderRule, recipientRule) if err != nil { return nil, err } - return &NativetokendestinationTransferToSourceIterator{contract: _Nativetokendestination.contract, event: "TransferToSource", logs: logs, sub: sub}, nil + return &NativeTokenDestinationTransferToSourceIterator{contract: _NativeTokenDestination.contract, event: "TransferToSource", logs: logs, sub: sub}, nil } // WatchTransferToSource is a free log subscription operation binding the contract event 0x343e0fe771af9fa258c07a602fad6dfd80c51eda78604397e553106360933bfc. // // Solidity: event TransferToSource(address indexed sender, address indexed recipient, uint256 amount, address feeContractAddress, uint256 feeAmount, uint256 teleporterMessageID) -func (_Nativetokendestination *NativetokendestinationFilterer) WatchTransferToSource(opts *bind.WatchOpts, sink chan<- *NativetokendestinationTransferToSource, sender []common.Address, recipient []common.Address) (event.Subscription, error) { +func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchTransferToSource(opts *bind.WatchOpts, sink chan<- *NativeTokenDestinationTransferToSource, sender []common.Address, recipient []common.Address) (event.Subscription, error) { var senderRule []interface{} for _, senderItem := range sender { @@ -791,7 +791,7 @@ func (_Nativetokendestination *NativetokendestinationFilterer) WatchTransferToSo recipientRule = append(recipientRule, recipientItem) } - logs, sub, err := _Nativetokendestination.contract.WatchLogs(opts, "TransferToSource", senderRule, recipientRule) + logs, sub, err := _NativeTokenDestination.contract.WatchLogs(opts, "TransferToSource", senderRule, recipientRule) if err != nil { return nil, err } @@ -801,8 +801,8 @@ func (_Nativetokendestination *NativetokendestinationFilterer) WatchTransferToSo select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(NativetokendestinationTransferToSource) - if err := _Nativetokendestination.contract.UnpackLog(event, "TransferToSource", log); err != nil { + event := new(NativeTokenDestinationTransferToSource) + if err := _NativeTokenDestination.contract.UnpackLog(event, "TransferToSource", log); err != nil { return err } event.Raw = log @@ -826,9 +826,9 @@ func (_Nativetokendestination *NativetokendestinationFilterer) WatchTransferToSo // ParseTransferToSource is a log parse operation binding the contract event 0x343e0fe771af9fa258c07a602fad6dfd80c51eda78604397e553106360933bfc. // // Solidity: event TransferToSource(address indexed sender, address indexed recipient, uint256 amount, address feeContractAddress, uint256 feeAmount, uint256 teleporterMessageID) -func (_Nativetokendestination *NativetokendestinationFilterer) ParseTransferToSource(log types.Log) (*NativetokendestinationTransferToSource, error) { - event := new(NativetokendestinationTransferToSource) - if err := _Nativetokendestination.contract.UnpackLog(event, "TransferToSource", log); err != nil { +func (_NativeTokenDestination *NativeTokenDestinationFilterer) ParseTransferToSource(log types.Log) (*NativeTokenDestinationTransferToSource, error) { + event := new(NativeTokenDestinationTransferToSource) + if err := _NativeTokenDestination.contract.UnpackLog(event, "TransferToSource", log); err != nil { return nil, err } event.Raw = log diff --git a/abis/NativeTokenSource/NativeTokenSource.go b/abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go similarity index 66% rename from abis/NativeTokenSource/NativeTokenSource.go rename to abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go index 425c115d9..6cdf6c3fa 100644 --- a/abis/NativeTokenSource/NativeTokenSource.go +++ b/abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go @@ -29,113 +29,113 @@ var ( _ = abi.ConvertType ) -// NativetokensourceMetaData contains all meta data concerning the Nativetokensource contract. -var NativetokensourceMetaData = &bind.MetaData{ +// NativeTokenSourceMetaData contains all meta data concerning the NativeTokenSource contract. +var NativeTokenSourceMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationContractAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", } -// NativetokensourceABI is the input ABI used to generate the binding from. -// Deprecated: Use NativetokensourceMetaData.ABI instead. -var NativetokensourceABI = NativetokensourceMetaData.ABI +// NativeTokenSourceABI is the input ABI used to generate the binding from. +// Deprecated: Use NativeTokenSourceMetaData.ABI instead. +var NativeTokenSourceABI = NativeTokenSourceMetaData.ABI -// Nativetokensource is an auto generated Go binding around an Ethereum contract. -type Nativetokensource struct { - NativetokensourceCaller // Read-only binding to the contract - NativetokensourceTransactor // Write-only binding to the contract - NativetokensourceFilterer // Log filterer for contract events +// NativeTokenSource is an auto generated Go binding around an Ethereum contract. +type NativeTokenSource struct { + NativeTokenSourceCaller // Read-only binding to the contract + NativeTokenSourceTransactor // Write-only binding to the contract + NativeTokenSourceFilterer // Log filterer for contract events } -// NativetokensourceCaller is an auto generated read-only Go binding around an Ethereum contract. -type NativetokensourceCaller struct { +// NativeTokenSourceCaller is an auto generated read-only Go binding around an Ethereum contract. +type NativeTokenSourceCaller struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls } -// NativetokensourceTransactor is an auto generated write-only Go binding around an Ethereum contract. -type NativetokensourceTransactor struct { +// NativeTokenSourceTransactor is an auto generated write-only Go binding around an Ethereum contract. +type NativeTokenSourceTransactor struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls } -// NativetokensourceFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type NativetokensourceFilterer struct { +// NativeTokenSourceFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type NativeTokenSourceFilterer struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls } -// NativetokensourceSession is an auto generated Go binding around an Ethereum contract, +// NativeTokenSourceSession is an auto generated Go binding around an Ethereum contract, // with pre-set call and transact options. -type NativetokensourceSession struct { - Contract *Nativetokensource // Generic contract binding to set the session for +type NativeTokenSourceSession struct { + Contract *NativeTokenSource // Generic contract binding to set the session for CallOpts bind.CallOpts // Call options to use throughout this session TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session } -// NativetokensourceCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// NativeTokenSourceCallerSession is an auto generated read-only Go binding around an Ethereum contract, // with pre-set call options. -type NativetokensourceCallerSession struct { - Contract *NativetokensourceCaller // Generic contract caller binding to set the session for +type NativeTokenSourceCallerSession struct { + Contract *NativeTokenSourceCaller // Generic contract caller binding to set the session for CallOpts bind.CallOpts // Call options to use throughout this session } -// NativetokensourceTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// NativeTokenSourceTransactorSession is an auto generated write-only Go binding around an Ethereum contract, // with pre-set transact options. -type NativetokensourceTransactorSession struct { - Contract *NativetokensourceTransactor // Generic contract transactor binding to set the session for +type NativeTokenSourceTransactorSession struct { + Contract *NativeTokenSourceTransactor // Generic contract transactor binding to set the session for TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session } -// NativetokensourceRaw is an auto generated low-level Go binding around an Ethereum contract. -type NativetokensourceRaw struct { - Contract *Nativetokensource // Generic contract binding to access the raw methods on +// NativeTokenSourceRaw is an auto generated low-level Go binding around an Ethereum contract. +type NativeTokenSourceRaw struct { + Contract *NativeTokenSource // Generic contract binding to access the raw methods on } -// NativetokensourceCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type NativetokensourceCallerRaw struct { - Contract *NativetokensourceCaller // Generic read-only contract binding to access the raw methods on +// NativeTokenSourceCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type NativeTokenSourceCallerRaw struct { + Contract *NativeTokenSourceCaller // Generic read-only contract binding to access the raw methods on } -// NativetokensourceTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type NativetokensourceTransactorRaw struct { - Contract *NativetokensourceTransactor // Generic write-only contract binding to access the raw methods on +// NativeTokenSourceTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type NativeTokenSourceTransactorRaw struct { + Contract *NativeTokenSourceTransactor // Generic write-only contract binding to access the raw methods on } -// NewNativetokensource creates a new instance of Nativetokensource, bound to a specific deployed contract. -func NewNativetokensource(address common.Address, backend bind.ContractBackend) (*Nativetokensource, error) { - contract, err := bindNativetokensource(address, backend, backend, backend) +// NewNativeTokenSource creates a new instance of NativeTokenSource, bound to a specific deployed contract. +func NewNativeTokenSource(address common.Address, backend bind.ContractBackend) (*NativeTokenSource, error) { + contract, err := bindNativeTokenSource(address, backend, backend, backend) if err != nil { return nil, err } - return &Nativetokensource{NativetokensourceCaller: NativetokensourceCaller{contract: contract}, NativetokensourceTransactor: NativetokensourceTransactor{contract: contract}, NativetokensourceFilterer: NativetokensourceFilterer{contract: contract}}, nil + return &NativeTokenSource{NativeTokenSourceCaller: NativeTokenSourceCaller{contract: contract}, NativeTokenSourceTransactor: NativeTokenSourceTransactor{contract: contract}, NativeTokenSourceFilterer: NativeTokenSourceFilterer{contract: contract}}, nil } -// NewNativetokensourceCaller creates a new read-only instance of Nativetokensource, bound to a specific deployed contract. -func NewNativetokensourceCaller(address common.Address, caller bind.ContractCaller) (*NativetokensourceCaller, error) { - contract, err := bindNativetokensource(address, caller, nil, nil) +// NewNativeTokenSourceCaller creates a new read-only instance of NativeTokenSource, bound to a specific deployed contract. +func NewNativeTokenSourceCaller(address common.Address, caller bind.ContractCaller) (*NativeTokenSourceCaller, error) { + contract, err := bindNativeTokenSource(address, caller, nil, nil) if err != nil { return nil, err } - return &NativetokensourceCaller{contract: contract}, nil + return &NativeTokenSourceCaller{contract: contract}, nil } -// NewNativetokensourceTransactor creates a new write-only instance of Nativetokensource, bound to a specific deployed contract. -func NewNativetokensourceTransactor(address common.Address, transactor bind.ContractTransactor) (*NativetokensourceTransactor, error) { - contract, err := bindNativetokensource(address, nil, transactor, nil) +// NewNativeTokenSourceTransactor creates a new write-only instance of NativeTokenSource, bound to a specific deployed contract. +func NewNativeTokenSourceTransactor(address common.Address, transactor bind.ContractTransactor) (*NativeTokenSourceTransactor, error) { + contract, err := bindNativeTokenSource(address, nil, transactor, nil) if err != nil { return nil, err } - return &NativetokensourceTransactor{contract: contract}, nil + return &NativeTokenSourceTransactor{contract: contract}, nil } -// NewNativetokensourceFilterer creates a new log filterer instance of Nativetokensource, bound to a specific deployed contract. -func NewNativetokensourceFilterer(address common.Address, filterer bind.ContractFilterer) (*NativetokensourceFilterer, error) { - contract, err := bindNativetokensource(address, nil, nil, filterer) +// NewNativeTokenSourceFilterer creates a new log filterer instance of NativeTokenSource, bound to a specific deployed contract. +func NewNativeTokenSourceFilterer(address common.Address, filterer bind.ContractFilterer) (*NativeTokenSourceFilterer, error) { + contract, err := bindNativeTokenSource(address, nil, nil, filterer) if err != nil { return nil, err } - return &NativetokensourceFilterer{contract: contract}, nil + return &NativeTokenSourceFilterer{contract: contract}, nil } -// bindNativetokensource binds a generic wrapper to an already deployed contract. -func bindNativetokensource(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := NativetokensourceMetaData.GetAbi() +// bindNativeTokenSource binds a generic wrapper to an already deployed contract. +func bindNativeTokenSource(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := NativeTokenSourceMetaData.GetAbi() if err != nil { return nil, err } @@ -146,46 +146,46 @@ func bindNativetokensource(address common.Address, caller bind.ContractCaller, t // sets the output to result. The result type might be a single field for simple // returns, a slice of interfaces for anonymous returns and a struct for named // returns. -func (_Nativetokensource *NativetokensourceRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _Nativetokensource.Contract.NativetokensourceCaller.contract.Call(opts, result, method, params...) +func (_NativeTokenSource *NativeTokenSourceRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _NativeTokenSource.Contract.NativeTokenSourceCaller.contract.Call(opts, result, method, params...) } // Transfer initiates a plain transaction to move funds to the contract, calling // its default method if one is available. -func (_Nativetokensource *NativetokensourceRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Nativetokensource.Contract.NativetokensourceTransactor.contract.Transfer(opts) +func (_NativeTokenSource *NativeTokenSourceRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _NativeTokenSource.Contract.NativeTokenSourceTransactor.contract.Transfer(opts) } // Transact invokes the (paid) contract method with params as input values. -func (_Nativetokensource *NativetokensourceRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _Nativetokensource.Contract.NativetokensourceTransactor.contract.Transact(opts, method, params...) +func (_NativeTokenSource *NativeTokenSourceRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _NativeTokenSource.Contract.NativeTokenSourceTransactor.contract.Transact(opts, method, params...) } // Call invokes the (constant) contract method with params as input values and // sets the output to result. The result type might be a single field for simple // returns, a slice of interfaces for anonymous returns and a struct for named // returns. -func (_Nativetokensource *NativetokensourceCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _Nativetokensource.Contract.contract.Call(opts, result, method, params...) +func (_NativeTokenSource *NativeTokenSourceCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _NativeTokenSource.Contract.contract.Call(opts, result, method, params...) } // Transfer initiates a plain transaction to move funds to the contract, calling // its default method if one is available. -func (_Nativetokensource *NativetokensourceTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Nativetokensource.Contract.contract.Transfer(opts) +func (_NativeTokenSource *NativeTokenSourceTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _NativeTokenSource.Contract.contract.Transfer(opts) } // Transact invokes the (paid) contract method with params as input values. -func (_Nativetokensource *NativetokensourceTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _Nativetokensource.Contract.contract.Transact(opts, method, params...) +func (_NativeTokenSource *NativeTokenSourceTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _NativeTokenSource.Contract.contract.Transact(opts, method, params...) } // MINTNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xb6171f73. // // Solidity: function MINT_NATIVE_TOKENS_REQUIRED_GAS() view returns(uint256) -func (_Nativetokensource *NativetokensourceCaller) MINTNATIVETOKENSREQUIREDGAS(opts *bind.CallOpts) (*big.Int, error) { +func (_NativeTokenSource *NativeTokenSourceCaller) MINTNATIVETOKENSREQUIREDGAS(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _Nativetokensource.contract.Call(opts, &out, "MINT_NATIVE_TOKENS_REQUIRED_GAS") + err := _NativeTokenSource.contract.Call(opts, &out, "MINT_NATIVE_TOKENS_REQUIRED_GAS") if err != nil { return *new(*big.Int), err @@ -200,23 +200,23 @@ func (_Nativetokensource *NativetokensourceCaller) MINTNATIVETOKENSREQUIREDGAS(o // MINTNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xb6171f73. // // Solidity: function MINT_NATIVE_TOKENS_REQUIRED_GAS() view returns(uint256) -func (_Nativetokensource *NativetokensourceSession) MINTNATIVETOKENSREQUIREDGAS() (*big.Int, error) { - return _Nativetokensource.Contract.MINTNATIVETOKENSREQUIREDGAS(&_Nativetokensource.CallOpts) +func (_NativeTokenSource *NativeTokenSourceSession) MINTNATIVETOKENSREQUIREDGAS() (*big.Int, error) { + return _NativeTokenSource.Contract.MINTNATIVETOKENSREQUIREDGAS(&_NativeTokenSource.CallOpts) } // MINTNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xb6171f73. // // Solidity: function MINT_NATIVE_TOKENS_REQUIRED_GAS() view returns(uint256) -func (_Nativetokensource *NativetokensourceCallerSession) MINTNATIVETOKENSREQUIREDGAS() (*big.Int, error) { - return _Nativetokensource.Contract.MINTNATIVETOKENSREQUIREDGAS(&_Nativetokensource.CallOpts) +func (_NativeTokenSource *NativeTokenSourceCallerSession) MINTNATIVETOKENSREQUIREDGAS() (*big.Int, error) { + return _NativeTokenSource.Contract.MINTNATIVETOKENSREQUIREDGAS(&_NativeTokenSource.CallOpts) } // CurrentBlockchainID is a free data retrieval call binding the contract method 0x4950d2d0. // // Solidity: function currentBlockchainID() view returns(bytes32) -func (_Nativetokensource *NativetokensourceCaller) CurrentBlockchainID(opts *bind.CallOpts) ([32]byte, error) { +func (_NativeTokenSource *NativeTokenSourceCaller) CurrentBlockchainID(opts *bind.CallOpts) ([32]byte, error) { var out []interface{} - err := _Nativetokensource.contract.Call(opts, &out, "currentBlockchainID") + err := _NativeTokenSource.contract.Call(opts, &out, "currentBlockchainID") if err != nil { return *new([32]byte), err @@ -231,23 +231,23 @@ func (_Nativetokensource *NativetokensourceCaller) CurrentBlockchainID(opts *bin // CurrentBlockchainID is a free data retrieval call binding the contract method 0x4950d2d0. // // Solidity: function currentBlockchainID() view returns(bytes32) -func (_Nativetokensource *NativetokensourceSession) CurrentBlockchainID() ([32]byte, error) { - return _Nativetokensource.Contract.CurrentBlockchainID(&_Nativetokensource.CallOpts) +func (_NativeTokenSource *NativeTokenSourceSession) CurrentBlockchainID() ([32]byte, error) { + return _NativeTokenSource.Contract.CurrentBlockchainID(&_NativeTokenSource.CallOpts) } // CurrentBlockchainID is a free data retrieval call binding the contract method 0x4950d2d0. // // Solidity: function currentBlockchainID() view returns(bytes32) -func (_Nativetokensource *NativetokensourceCallerSession) CurrentBlockchainID() ([32]byte, error) { - return _Nativetokensource.Contract.CurrentBlockchainID(&_Nativetokensource.CallOpts) +func (_NativeTokenSource *NativeTokenSourceCallerSession) CurrentBlockchainID() ([32]byte, error) { + return _NativeTokenSource.Contract.CurrentBlockchainID(&_NativeTokenSource.CallOpts) } // DestinationBlockchainID is a free data retrieval call binding the contract method 0x41d3014d. // // Solidity: function destinationBlockchainID() view returns(bytes32) -func (_Nativetokensource *NativetokensourceCaller) DestinationBlockchainID(opts *bind.CallOpts) ([32]byte, error) { +func (_NativeTokenSource *NativeTokenSourceCaller) DestinationBlockchainID(opts *bind.CallOpts) ([32]byte, error) { var out []interface{} - err := _Nativetokensource.contract.Call(opts, &out, "destinationBlockchainID") + err := _NativeTokenSource.contract.Call(opts, &out, "destinationBlockchainID") if err != nil { return *new([32]byte), err @@ -262,23 +262,23 @@ func (_Nativetokensource *NativetokensourceCaller) DestinationBlockchainID(opts // DestinationBlockchainID is a free data retrieval call binding the contract method 0x41d3014d. // // Solidity: function destinationBlockchainID() view returns(bytes32) -func (_Nativetokensource *NativetokensourceSession) DestinationBlockchainID() ([32]byte, error) { - return _Nativetokensource.Contract.DestinationBlockchainID(&_Nativetokensource.CallOpts) +func (_NativeTokenSource *NativeTokenSourceSession) DestinationBlockchainID() ([32]byte, error) { + return _NativeTokenSource.Contract.DestinationBlockchainID(&_NativeTokenSource.CallOpts) } // DestinationBlockchainID is a free data retrieval call binding the contract method 0x41d3014d. // // Solidity: function destinationBlockchainID() view returns(bytes32) -func (_Nativetokensource *NativetokensourceCallerSession) DestinationBlockchainID() ([32]byte, error) { - return _Nativetokensource.Contract.DestinationBlockchainID(&_Nativetokensource.CallOpts) +func (_NativeTokenSource *NativeTokenSourceCallerSession) DestinationBlockchainID() ([32]byte, error) { + return _NativeTokenSource.Contract.DestinationBlockchainID(&_NativeTokenSource.CallOpts) } // DestinationContractAddress is a free data retrieval call binding the contract method 0x04d6baf7. // // Solidity: function destinationContractAddress() view returns(address) -func (_Nativetokensource *NativetokensourceCaller) DestinationContractAddress(opts *bind.CallOpts) (common.Address, error) { +func (_NativeTokenSource *NativeTokenSourceCaller) DestinationContractAddress(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _Nativetokensource.contract.Call(opts, &out, "destinationContractAddress") + err := _NativeTokenSource.contract.Call(opts, &out, "destinationContractAddress") if err != nil { return *new(common.Address), err @@ -293,23 +293,23 @@ func (_Nativetokensource *NativetokensourceCaller) DestinationContractAddress(op // DestinationContractAddress is a free data retrieval call binding the contract method 0x04d6baf7. // // Solidity: function destinationContractAddress() view returns(address) -func (_Nativetokensource *NativetokensourceSession) DestinationContractAddress() (common.Address, error) { - return _Nativetokensource.Contract.DestinationContractAddress(&_Nativetokensource.CallOpts) +func (_NativeTokenSource *NativeTokenSourceSession) DestinationContractAddress() (common.Address, error) { + return _NativeTokenSource.Contract.DestinationContractAddress(&_NativeTokenSource.CallOpts) } // DestinationContractAddress is a free data retrieval call binding the contract method 0x04d6baf7. // // Solidity: function destinationContractAddress() view returns(address) -func (_Nativetokensource *NativetokensourceCallerSession) DestinationContractAddress() (common.Address, error) { - return _Nativetokensource.Contract.DestinationContractAddress(&_Nativetokensource.CallOpts) +func (_NativeTokenSource *NativeTokenSourceCallerSession) DestinationContractAddress() (common.Address, error) { + return _NativeTokenSource.Contract.DestinationContractAddress(&_NativeTokenSource.CallOpts) } // TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. // // Solidity: function teleporterMessenger() view returns(address) -func (_Nativetokensource *NativetokensourceCaller) TeleporterMessenger(opts *bind.CallOpts) (common.Address, error) { +func (_NativeTokenSource *NativeTokenSourceCaller) TeleporterMessenger(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _Nativetokensource.contract.Call(opts, &out, "teleporterMessenger") + err := _NativeTokenSource.contract.Call(opts, &out, "teleporterMessenger") if err != nil { return *new(common.Address), err @@ -324,62 +324,62 @@ func (_Nativetokensource *NativetokensourceCaller) TeleporterMessenger(opts *bin // TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. // // Solidity: function teleporterMessenger() view returns(address) -func (_Nativetokensource *NativetokensourceSession) TeleporterMessenger() (common.Address, error) { - return _Nativetokensource.Contract.TeleporterMessenger(&_Nativetokensource.CallOpts) +func (_NativeTokenSource *NativeTokenSourceSession) TeleporterMessenger() (common.Address, error) { + return _NativeTokenSource.Contract.TeleporterMessenger(&_NativeTokenSource.CallOpts) } // TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. // // Solidity: function teleporterMessenger() view returns(address) -func (_Nativetokensource *NativetokensourceCallerSession) TeleporterMessenger() (common.Address, error) { - return _Nativetokensource.Contract.TeleporterMessenger(&_Nativetokensource.CallOpts) +func (_NativeTokenSource *NativeTokenSourceCallerSession) TeleporterMessenger() (common.Address, error) { + return _NativeTokenSource.Contract.TeleporterMessenger(&_NativeTokenSource.CallOpts) } // ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. // // Solidity: function receiveTeleporterMessage(bytes32 senderBlockchainID, address senderAddress, bytes message) returns() -func (_Nativetokensource *NativetokensourceTransactor) ReceiveTeleporterMessage(opts *bind.TransactOpts, senderBlockchainID [32]byte, senderAddress common.Address, message []byte) (*types.Transaction, error) { - return _Nativetokensource.contract.Transact(opts, "receiveTeleporterMessage", senderBlockchainID, senderAddress, message) +func (_NativeTokenSource *NativeTokenSourceTransactor) ReceiveTeleporterMessage(opts *bind.TransactOpts, senderBlockchainID [32]byte, senderAddress common.Address, message []byte) (*types.Transaction, error) { + return _NativeTokenSource.contract.Transact(opts, "receiveTeleporterMessage", senderBlockchainID, senderAddress, message) } // ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. // // Solidity: function receiveTeleporterMessage(bytes32 senderBlockchainID, address senderAddress, bytes message) returns() -func (_Nativetokensource *NativetokensourceSession) ReceiveTeleporterMessage(senderBlockchainID [32]byte, senderAddress common.Address, message []byte) (*types.Transaction, error) { - return _Nativetokensource.Contract.ReceiveTeleporterMessage(&_Nativetokensource.TransactOpts, senderBlockchainID, senderAddress, message) +func (_NativeTokenSource *NativeTokenSourceSession) ReceiveTeleporterMessage(senderBlockchainID [32]byte, senderAddress common.Address, message []byte) (*types.Transaction, error) { + return _NativeTokenSource.Contract.ReceiveTeleporterMessage(&_NativeTokenSource.TransactOpts, senderBlockchainID, senderAddress, message) } // ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. // // Solidity: function receiveTeleporterMessage(bytes32 senderBlockchainID, address senderAddress, bytes message) returns() -func (_Nativetokensource *NativetokensourceTransactorSession) ReceiveTeleporterMessage(senderBlockchainID [32]byte, senderAddress common.Address, message []byte) (*types.Transaction, error) { - return _Nativetokensource.Contract.ReceiveTeleporterMessage(&_Nativetokensource.TransactOpts, senderBlockchainID, senderAddress, message) +func (_NativeTokenSource *NativeTokenSourceTransactorSession) ReceiveTeleporterMessage(senderBlockchainID [32]byte, senderAddress common.Address, message []byte) (*types.Transaction, error) { + return _NativeTokenSource.Contract.ReceiveTeleporterMessage(&_NativeTokenSource.TransactOpts, senderBlockchainID, senderAddress, message) } // TransferToDestination is a paid mutator transaction binding the contract method 0x3c7bf510. // // Solidity: function transferToDestination(address recipient, address feeContractAddress, uint256 feeAmount) payable returns() -func (_Nativetokensource *NativetokensourceTransactor) TransferToDestination(opts *bind.TransactOpts, recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { - return _Nativetokensource.contract.Transact(opts, "transferToDestination", recipient, feeContractAddress, feeAmount) +func (_NativeTokenSource *NativeTokenSourceTransactor) TransferToDestination(opts *bind.TransactOpts, recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { + return _NativeTokenSource.contract.Transact(opts, "transferToDestination", recipient, feeContractAddress, feeAmount) } // TransferToDestination is a paid mutator transaction binding the contract method 0x3c7bf510. // // Solidity: function transferToDestination(address recipient, address feeContractAddress, uint256 feeAmount) payable returns() -func (_Nativetokensource *NativetokensourceSession) TransferToDestination(recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { - return _Nativetokensource.Contract.TransferToDestination(&_Nativetokensource.TransactOpts, recipient, feeContractAddress, feeAmount) +func (_NativeTokenSource *NativeTokenSourceSession) TransferToDestination(recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { + return _NativeTokenSource.Contract.TransferToDestination(&_NativeTokenSource.TransactOpts, recipient, feeContractAddress, feeAmount) } // TransferToDestination is a paid mutator transaction binding the contract method 0x3c7bf510. // // Solidity: function transferToDestination(address recipient, address feeContractAddress, uint256 feeAmount) payable returns() -func (_Nativetokensource *NativetokensourceTransactorSession) TransferToDestination(recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { - return _Nativetokensource.Contract.TransferToDestination(&_Nativetokensource.TransactOpts, recipient, feeContractAddress, feeAmount) +func (_NativeTokenSource *NativeTokenSourceTransactorSession) TransferToDestination(recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { + return _NativeTokenSource.Contract.TransferToDestination(&_NativeTokenSource.TransactOpts, recipient, feeContractAddress, feeAmount) } -// NativetokensourceTransferToDestinationIterator is returned from FilterTransferToDestination and is used to iterate over the raw logs and unpacked data for TransferToDestination events raised by the Nativetokensource contract. -type NativetokensourceTransferToDestinationIterator struct { - Event *NativetokensourceTransferToDestination // Event containing the contract specifics and raw log +// NativeTokenSourceTransferToDestinationIterator is returned from FilterTransferToDestination and is used to iterate over the raw logs and unpacked data for TransferToDestination events raised by the NativeTokenSource contract. +type NativeTokenSourceTransferToDestinationIterator struct { + Event *NativeTokenSourceTransferToDestination // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -393,7 +393,7 @@ type NativetokensourceTransferToDestinationIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *NativetokensourceTransferToDestinationIterator) Next() bool { +func (it *NativeTokenSourceTransferToDestinationIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -402,7 +402,7 @@ func (it *NativetokensourceTransferToDestinationIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(NativetokensourceTransferToDestination) + it.Event = new(NativeTokenSourceTransferToDestination) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -417,7 +417,7 @@ func (it *NativetokensourceTransferToDestinationIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(NativetokensourceTransferToDestination) + it.Event = new(NativeTokenSourceTransferToDestination) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -433,19 +433,19 @@ func (it *NativetokensourceTransferToDestinationIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *NativetokensourceTransferToDestinationIterator) Error() error { +func (it *NativeTokenSourceTransferToDestinationIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *NativetokensourceTransferToDestinationIterator) Close() error { +func (it *NativeTokenSourceTransferToDestinationIterator) Close() error { it.sub.Unsubscribe() return nil } -// NativetokensourceTransferToDestination represents a TransferToDestination event raised by the Nativetokensource contract. -type NativetokensourceTransferToDestination struct { +// NativeTokenSourceTransferToDestination represents a TransferToDestination event raised by the NativeTokenSource contract. +type NativeTokenSourceTransferToDestination struct { Sender common.Address Recipient common.Address Amount *big.Int @@ -458,7 +458,7 @@ type NativetokensourceTransferToDestination struct { // FilterTransferToDestination is a free log retrieval operation binding the contract event 0x32d7e0a933e2b2b5890fd273e9ba2e9293d619805a7ca90d11f41eddc56d2b97. // // Solidity: event TransferToDestination(address indexed sender, address indexed recipient, uint256 amount, address feeContractAddress, uint256 feeAmount, uint256 teleporterMessageID) -func (_Nativetokensource *NativetokensourceFilterer) FilterTransferToDestination(opts *bind.FilterOpts, sender []common.Address, recipient []common.Address) (*NativetokensourceTransferToDestinationIterator, error) { +func (_NativeTokenSource *NativeTokenSourceFilterer) FilterTransferToDestination(opts *bind.FilterOpts, sender []common.Address, recipient []common.Address) (*NativeTokenSourceTransferToDestinationIterator, error) { var senderRule []interface{} for _, senderItem := range sender { @@ -469,17 +469,17 @@ func (_Nativetokensource *NativetokensourceFilterer) FilterTransferToDestination recipientRule = append(recipientRule, recipientItem) } - logs, sub, err := _Nativetokensource.contract.FilterLogs(opts, "TransferToDestination", senderRule, recipientRule) + logs, sub, err := _NativeTokenSource.contract.FilterLogs(opts, "TransferToDestination", senderRule, recipientRule) if err != nil { return nil, err } - return &NativetokensourceTransferToDestinationIterator{contract: _Nativetokensource.contract, event: "TransferToDestination", logs: logs, sub: sub}, nil + return &NativeTokenSourceTransferToDestinationIterator{contract: _NativeTokenSource.contract, event: "TransferToDestination", logs: logs, sub: sub}, nil } // WatchTransferToDestination is a free log subscription operation binding the contract event 0x32d7e0a933e2b2b5890fd273e9ba2e9293d619805a7ca90d11f41eddc56d2b97. // // Solidity: event TransferToDestination(address indexed sender, address indexed recipient, uint256 amount, address feeContractAddress, uint256 feeAmount, uint256 teleporterMessageID) -func (_Nativetokensource *NativetokensourceFilterer) WatchTransferToDestination(opts *bind.WatchOpts, sink chan<- *NativetokensourceTransferToDestination, sender []common.Address, recipient []common.Address) (event.Subscription, error) { +func (_NativeTokenSource *NativeTokenSourceFilterer) WatchTransferToDestination(opts *bind.WatchOpts, sink chan<- *NativeTokenSourceTransferToDestination, sender []common.Address, recipient []common.Address) (event.Subscription, error) { var senderRule []interface{} for _, senderItem := range sender { @@ -490,7 +490,7 @@ func (_Nativetokensource *NativetokensourceFilterer) WatchTransferToDestination( recipientRule = append(recipientRule, recipientItem) } - logs, sub, err := _Nativetokensource.contract.WatchLogs(opts, "TransferToDestination", senderRule, recipientRule) + logs, sub, err := _NativeTokenSource.contract.WatchLogs(opts, "TransferToDestination", senderRule, recipientRule) if err != nil { return nil, err } @@ -500,8 +500,8 @@ func (_Nativetokensource *NativetokensourceFilterer) WatchTransferToDestination( select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(NativetokensourceTransferToDestination) - if err := _Nativetokensource.contract.UnpackLog(event, "TransferToDestination", log); err != nil { + event := new(NativeTokenSourceTransferToDestination) + if err := _NativeTokenSource.contract.UnpackLog(event, "TransferToDestination", log); err != nil { return err } event.Raw = log @@ -525,18 +525,18 @@ func (_Nativetokensource *NativetokensourceFilterer) WatchTransferToDestination( // ParseTransferToDestination is a log parse operation binding the contract event 0x32d7e0a933e2b2b5890fd273e9ba2e9293d619805a7ca90d11f41eddc56d2b97. // // Solidity: event TransferToDestination(address indexed sender, address indexed recipient, uint256 amount, address feeContractAddress, uint256 feeAmount, uint256 teleporterMessageID) -func (_Nativetokensource *NativetokensourceFilterer) ParseTransferToDestination(log types.Log) (*NativetokensourceTransferToDestination, error) { - event := new(NativetokensourceTransferToDestination) - if err := _Nativetokensource.contract.UnpackLog(event, "TransferToDestination", log); err != nil { +func (_NativeTokenSource *NativeTokenSourceFilterer) ParseTransferToDestination(log types.Log) (*NativeTokenSourceTransferToDestination, error) { + event := new(NativeTokenSourceTransferToDestination) + if err := _NativeTokenSource.contract.UnpackLog(event, "TransferToDestination", log); err != nil { return nil, err } event.Raw = log return event, nil } -// NativetokensourceUnlockTokensIterator is returned from FilterUnlockTokens and is used to iterate over the raw logs and unpacked data for UnlockTokens events raised by the Nativetokensource contract. -type NativetokensourceUnlockTokensIterator struct { - Event *NativetokensourceUnlockTokens // Event containing the contract specifics and raw log +// NativeTokenSourceUnlockTokensIterator is returned from FilterUnlockTokens and is used to iterate over the raw logs and unpacked data for UnlockTokens events raised by the NativeTokenSource contract. +type NativeTokenSourceUnlockTokensIterator struct { + Event *NativeTokenSourceUnlockTokens // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -550,7 +550,7 @@ type NativetokensourceUnlockTokensIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *NativetokensourceUnlockTokensIterator) Next() bool { +func (it *NativeTokenSourceUnlockTokensIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -559,7 +559,7 @@ func (it *NativetokensourceUnlockTokensIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(NativetokensourceUnlockTokens) + it.Event = new(NativeTokenSourceUnlockTokens) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -574,7 +574,7 @@ func (it *NativetokensourceUnlockTokensIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(NativetokensourceUnlockTokens) + it.Event = new(NativeTokenSourceUnlockTokens) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -590,19 +590,19 @@ func (it *NativetokensourceUnlockTokensIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *NativetokensourceUnlockTokensIterator) Error() error { +func (it *NativeTokenSourceUnlockTokensIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *NativetokensourceUnlockTokensIterator) Close() error { +func (it *NativeTokenSourceUnlockTokensIterator) Close() error { it.sub.Unsubscribe() return nil } -// NativetokensourceUnlockTokens represents a UnlockTokens event raised by the Nativetokensource contract. -type NativetokensourceUnlockTokens struct { +// NativeTokenSourceUnlockTokens represents a UnlockTokens event raised by the NativeTokenSource contract. +type NativeTokenSourceUnlockTokens struct { Recipient common.Address Amount *big.Int Raw types.Log // Blockchain specific contextual infos @@ -611,21 +611,21 @@ type NativetokensourceUnlockTokens struct { // FilterUnlockTokens is a free log retrieval operation binding the contract event 0x55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407. // // Solidity: event UnlockTokens(address recipient, uint256 amount) -func (_Nativetokensource *NativetokensourceFilterer) FilterUnlockTokens(opts *bind.FilterOpts) (*NativetokensourceUnlockTokensIterator, error) { +func (_NativeTokenSource *NativeTokenSourceFilterer) FilterUnlockTokens(opts *bind.FilterOpts) (*NativeTokenSourceUnlockTokensIterator, error) { - logs, sub, err := _Nativetokensource.contract.FilterLogs(opts, "UnlockTokens") + logs, sub, err := _NativeTokenSource.contract.FilterLogs(opts, "UnlockTokens") if err != nil { return nil, err } - return &NativetokensourceUnlockTokensIterator{contract: _Nativetokensource.contract, event: "UnlockTokens", logs: logs, sub: sub}, nil + return &NativeTokenSourceUnlockTokensIterator{contract: _NativeTokenSource.contract, event: "UnlockTokens", logs: logs, sub: sub}, nil } // WatchUnlockTokens is a free log subscription operation binding the contract event 0x55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407. // // Solidity: event UnlockTokens(address recipient, uint256 amount) -func (_Nativetokensource *NativetokensourceFilterer) WatchUnlockTokens(opts *bind.WatchOpts, sink chan<- *NativetokensourceUnlockTokens) (event.Subscription, error) { +func (_NativeTokenSource *NativeTokenSourceFilterer) WatchUnlockTokens(opts *bind.WatchOpts, sink chan<- *NativeTokenSourceUnlockTokens) (event.Subscription, error) { - logs, sub, err := _Nativetokensource.contract.WatchLogs(opts, "UnlockTokens") + logs, sub, err := _NativeTokenSource.contract.WatchLogs(opts, "UnlockTokens") if err != nil { return nil, err } @@ -635,8 +635,8 @@ func (_Nativetokensource *NativetokensourceFilterer) WatchUnlockTokens(opts *bin select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(NativetokensourceUnlockTokens) - if err := _Nativetokensource.contract.UnpackLog(event, "UnlockTokens", log); err != nil { + event := new(NativeTokenSourceUnlockTokens) + if err := _NativeTokenSource.contract.UnpackLog(event, "UnlockTokens", log); err != nil { return err } event.Raw = log @@ -660,9 +660,9 @@ func (_Nativetokensource *NativetokensourceFilterer) WatchUnlockTokens(opts *bin // ParseUnlockTokens is a log parse operation binding the contract event 0x55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407. // // Solidity: event UnlockTokens(address recipient, uint256 amount) -func (_Nativetokensource *NativetokensourceFilterer) ParseUnlockTokens(log types.Log) (*NativetokensourceUnlockTokens, error) { - event := new(NativetokensourceUnlockTokens) - if err := _Nativetokensource.contract.UnpackLog(event, "UnlockTokens", log); err != nil { +func (_NativeTokenSource *NativeTokenSourceFilterer) ParseUnlockTokens(log types.Log) (*NativeTokenSourceUnlockTokens, error) { + event := new(NativeTokenSourceUnlockTokens) + if err := _NativeTokenSource.contract.UnpackLog(event, "UnlockTokens", log); err != nil { return nil, err } event.Raw = log From d60d97bf221320e355c00f6829d2722e2d71eb4a Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Fri, 6 Oct 2023 12:25:03 -0400 Subject: [PATCH 051/183] Fixup tests --- tests/native_token_bridge.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/native_token_bridge.go b/tests/native_token_bridge.go index de90773a5..e7178db73 100644 --- a/tests/native_token_bridge.go +++ b/tests/native_token_bridge.go @@ -7,8 +7,8 @@ import ( "github.com/ava-labs/subnet-evm/accounts/abi/bind" "github.com/ava-labs/subnet-evm/core/types" - nativetokendestination "github.com/ava-labs/teleporter/abis/NativeTokenDestination" - nativetokensource "github.com/ava-labs/teleporter/abis/NativeTokenSource" + nativetokendestination "github.com/ava-labs/teleporter/abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenDestination" + nativetokensource "github.com/ava-labs/teleporter/abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenSource" deploymentUtils "github.com/ava-labs/teleporter/contract-deployment/utils" "github.com/ava-labs/teleporter/tests/utils" "github.com/ethereum/go-ethereum/common" @@ -20,7 +20,7 @@ import ( func NativeTokenBridge() { const ( tokenReserve = uint64(1e15) - valueToSend1 = tokenReserve/4 + valueToSend1 = tokenReserve / 4 valueToSend2 = tokenReserve valueToReturn = valueToSend1 / 4 @@ -50,7 +50,7 @@ func NativeTokenBridge() { Expect(err).Should(BeNil()) chainATransactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, subnetA.ChainID) Expect(err).Should(BeNil()) - nativeTokenSourceAbi, err := nativetokensource.NativetokensourceMetaData.GetAbi() + nativeTokenSourceAbi, err := nativetokensource.NativeTokenSourceMetaData.GetAbi() Expect(err).Should(BeNil()) _, txA, _, err := bind.DeployContract(chainATransactor, *nativeTokenSourceAbi, nativeTokenSourceBytecode, subnetA.WSClient, teleporterContractAddress, subnetB.BlockchainID, nativeTokenBridgeContractAddress) Expect(err).Should(BeNil()) @@ -59,7 +59,7 @@ func NativeTokenBridge() { Expect(err).Should(BeNil()) chainBTransactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, subnetB.ChainID) Expect(err).Should(BeNil()) - nativeTokenDestinationAbi, err := nativetokendestination.NativetokendestinationMetaData.GetAbi() + nativeTokenDestinationAbi, err := nativetokendestination.NativeTokenDestinationMetaData.GetAbi() Expect(err).Should(BeNil()) _, txB, _, err := bind.DeployContract(chainBTransactor, *nativeTokenDestinationAbi, nativeTokenDestinationBytecode, subnetB.WSClient, teleporterContractAddress, subnetA.BlockchainID, nativeTokenBridgeContractAddress, new(big.Int).SetUint64(tokenReserve)) Expect(err).Should(BeNil()) @@ -80,9 +80,9 @@ func NativeTokenBridge() { } // Create abi objects to call the contract with - nativeTokenDestination, err := nativetokendestination.NewNativetokendestination(nativeTokenBridgeContractAddress, subnetB.WSClient) + nativeTokenDestination, err := nativetokendestination.NewNativeTokenDestination(nativeTokenBridgeContractAddress, subnetB.WSClient) Expect(err).Should(BeNil()) - nativeTokenSource, err := nativetokensource.NewNativetokensource(nativeTokenBridgeContractAddress, subnetA.WSClient) + nativeTokenSource, err := nativetokensource.NewNativeTokenSource(nativeTokenBridgeContractAddress, subnetA.WSClient) Expect(err).Should(BeNil()) // Helper function From 2f5f093cef7d5322a34cf58ffbc28b6665956e06 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 16 Oct 2023 10:11:22 -0400 Subject: [PATCH 052/183] Update comments --- contracts/src/Teleporter/TeleporterMessenger.sol | 2 +- scripts/local/native/native.sh | 3 +++ tests/native_token_bridge.go | 5 +++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/contracts/src/Teleporter/TeleporterMessenger.sol b/contracts/src/Teleporter/TeleporterMessenger.sol index 0183c9265..cba1df20d 100644 --- a/contracts/src/Teleporter/TeleporterMessenger.sol +++ b/contracts/src/Teleporter/TeleporterMessenger.sol @@ -164,7 +164,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { message ); - // Resubmit the message to the warp message precompile know that we know the exact message was + // Resubmit the message to the warp message precompile now that we know the exact message was // already submitted in the past. WARP_MESSENGER.sendWarpMessage( destinationChainID, diff --git a/scripts/local/native/native.sh b/scripts/local/native/native.sh index 259b9253d..162de7e54 100755 --- a/scripts/local/native/native.sh +++ b/scripts/local/native/native.sh @@ -2,6 +2,9 @@ # Copyright (C) 2023, Ava Labs, Inc. All rights reserved. # See the file LICENSE for licensing terms. +# TODO We want to run the native token bridge with our Fuji scripts. +# This file isn't compeletely set up properly yet. + set -e # Stop on first error # Variables provided by run_test.sh: diff --git a/tests/native_token_bridge.go b/tests/native_token_bridge.go index e7178db73..aa4739d0f 100644 --- a/tests/native_token_bridge.go +++ b/tests/native_token_bridge.go @@ -55,6 +55,11 @@ func NativeTokenBridge() { _, txA, _, err := bind.DeployContract(chainATransactor, *nativeTokenSourceAbi, nativeTokenSourceBytecode, subnetA.WSClient, teleporterContractAddress, subnetB.BlockchainID, nativeTokenBridgeContractAddress) Expect(err).Should(BeNil()) + // Both contracts in this test will be deployed to 0xAcB633F5B00099c7ec187eB00156c5cd9D854b5B, + // though they do not necessarily have to be deployed at the same address, each contract needs + // to know the address of the other. + // The nativeTokenDestination contract must be added to "adminAddresses" of "contractNativeMinterConfig" + // in the genesis file for the subnet. This will allow it to call the native minter precompile. nativeTokenDestinationBytecode, err := deploymentUtils.ExtractByteCode(NativeTokenDestinationByteCodeFile) Expect(err).Should(BeNil()) chainBTransactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, subnetB.ChainID) From 30be639543aa021e61eb6c06ef9e690ab30f488d Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 16 Oct 2023 10:13:57 -0400 Subject: [PATCH 053/183] Rename partner contract field --- .../NativeTokenDestination.go | 58 +++++++++---------- .../NativeTokenSource/NativeTokenSource.go | 26 ++++----- .../NativeTokenDestination.sol | 12 ++-- .../NativeTokenBridge/NativeTokenSource.sol | 12 ++-- 4 files changed, 54 insertions(+), 54 deletions(-) diff --git a/abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go b/abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go index c9a9e3413..76b3544f4 100644 --- a/abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go +++ b/abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go @@ -31,7 +31,7 @@ var ( // NativeTokenDestinationMetaData contains all meta data concerning the NativeTokenDestination contract. var NativeTokenDestinationMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"sourceContractAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenReserve_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"MintNativeTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tokenReserve\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenReserve_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"MintNativeTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tokenReserve\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", } // NativeTokenDestinationABI is the input ABI used to generate the binding from. @@ -242,66 +242,66 @@ func (_NativeTokenDestination *NativeTokenDestinationCallerSession) CurrentBlock return _NativeTokenDestination.Contract.CurrentBlockchainID(&_NativeTokenDestination.CallOpts) } -// SourceBlockchainID is a free data retrieval call binding the contract method 0x29b7b3fd. +// NativeTokenSourceAddress is a free data retrieval call binding the contract method 0x5d93f9af. // -// Solidity: function sourceBlockchainID() view returns(bytes32) -func (_NativeTokenDestination *NativeTokenDestinationCaller) SourceBlockchainID(opts *bind.CallOpts) ([32]byte, error) { +// Solidity: function nativeTokenSourceAddress() view returns(address) +func (_NativeTokenDestination *NativeTokenDestinationCaller) NativeTokenSourceAddress(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _NativeTokenDestination.contract.Call(opts, &out, "sourceBlockchainID") + err := _NativeTokenDestination.contract.Call(opts, &out, "nativeTokenSourceAddress") if err != nil { - return *new([32]byte), err + return *new(common.Address), err } - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) return out0, err } -// SourceBlockchainID is a free data retrieval call binding the contract method 0x29b7b3fd. +// NativeTokenSourceAddress is a free data retrieval call binding the contract method 0x5d93f9af. // -// Solidity: function sourceBlockchainID() view returns(bytes32) -func (_NativeTokenDestination *NativeTokenDestinationSession) SourceBlockchainID() ([32]byte, error) { - return _NativeTokenDestination.Contract.SourceBlockchainID(&_NativeTokenDestination.CallOpts) +// Solidity: function nativeTokenSourceAddress() view returns(address) +func (_NativeTokenDestination *NativeTokenDestinationSession) NativeTokenSourceAddress() (common.Address, error) { + return _NativeTokenDestination.Contract.NativeTokenSourceAddress(&_NativeTokenDestination.CallOpts) } -// SourceBlockchainID is a free data retrieval call binding the contract method 0x29b7b3fd. +// NativeTokenSourceAddress is a free data retrieval call binding the contract method 0x5d93f9af. // -// Solidity: function sourceBlockchainID() view returns(bytes32) -func (_NativeTokenDestination *NativeTokenDestinationCallerSession) SourceBlockchainID() ([32]byte, error) { - return _NativeTokenDestination.Contract.SourceBlockchainID(&_NativeTokenDestination.CallOpts) +// Solidity: function nativeTokenSourceAddress() view returns(address) +func (_NativeTokenDestination *NativeTokenDestinationCallerSession) NativeTokenSourceAddress() (common.Address, error) { + return _NativeTokenDestination.Contract.NativeTokenSourceAddress(&_NativeTokenDestination.CallOpts) } -// SourceContractAddress is a free data retrieval call binding the contract method 0x3a85f16a. +// SourceBlockchainID is a free data retrieval call binding the contract method 0x29b7b3fd. // -// Solidity: function sourceContractAddress() view returns(address) -func (_NativeTokenDestination *NativeTokenDestinationCaller) SourceContractAddress(opts *bind.CallOpts) (common.Address, error) { +// Solidity: function sourceBlockchainID() view returns(bytes32) +func (_NativeTokenDestination *NativeTokenDestinationCaller) SourceBlockchainID(opts *bind.CallOpts) ([32]byte, error) { var out []interface{} - err := _NativeTokenDestination.contract.Call(opts, &out, "sourceContractAddress") + err := _NativeTokenDestination.contract.Call(opts, &out, "sourceBlockchainID") if err != nil { - return *new(common.Address), err + return *new([32]byte), err } - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) return out0, err } -// SourceContractAddress is a free data retrieval call binding the contract method 0x3a85f16a. +// SourceBlockchainID is a free data retrieval call binding the contract method 0x29b7b3fd. // -// Solidity: function sourceContractAddress() view returns(address) -func (_NativeTokenDestination *NativeTokenDestinationSession) SourceContractAddress() (common.Address, error) { - return _NativeTokenDestination.Contract.SourceContractAddress(&_NativeTokenDestination.CallOpts) +// Solidity: function sourceBlockchainID() view returns(bytes32) +func (_NativeTokenDestination *NativeTokenDestinationSession) SourceBlockchainID() ([32]byte, error) { + return _NativeTokenDestination.Contract.SourceBlockchainID(&_NativeTokenDestination.CallOpts) } -// SourceContractAddress is a free data retrieval call binding the contract method 0x3a85f16a. +// SourceBlockchainID is a free data retrieval call binding the contract method 0x29b7b3fd. // -// Solidity: function sourceContractAddress() view returns(address) -func (_NativeTokenDestination *NativeTokenDestinationCallerSession) SourceContractAddress() (common.Address, error) { - return _NativeTokenDestination.Contract.SourceContractAddress(&_NativeTokenDestination.CallOpts) +// Solidity: function sourceBlockchainID() view returns(bytes32) +func (_NativeTokenDestination *NativeTokenDestinationCallerSession) SourceBlockchainID() ([32]byte, error) { + return _NativeTokenDestination.Contract.SourceBlockchainID(&_NativeTokenDestination.CallOpts) } // TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. diff --git a/abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go b/abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go index 6cdf6c3fa..2238a5764 100644 --- a/abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go +++ b/abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go @@ -31,7 +31,7 @@ var ( // NativeTokenSourceMetaData contains all meta data concerning the NativeTokenSource contract. var NativeTokenSourceMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationContractAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", } // NativeTokenSourceABI is the input ABI used to generate the binding from. @@ -273,12 +273,12 @@ func (_NativeTokenSource *NativeTokenSourceCallerSession) DestinationBlockchainI return _NativeTokenSource.Contract.DestinationBlockchainID(&_NativeTokenSource.CallOpts) } -// DestinationContractAddress is a free data retrieval call binding the contract method 0x04d6baf7. +// NativeTokenDestinationAddress is a free data retrieval call binding the contract method 0xb8c9091a. // -// Solidity: function destinationContractAddress() view returns(address) -func (_NativeTokenSource *NativeTokenSourceCaller) DestinationContractAddress(opts *bind.CallOpts) (common.Address, error) { +// Solidity: function nativeTokenDestinationAddress() view returns(address) +func (_NativeTokenSource *NativeTokenSourceCaller) NativeTokenDestinationAddress(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _NativeTokenSource.contract.Call(opts, &out, "destinationContractAddress") + err := _NativeTokenSource.contract.Call(opts, &out, "nativeTokenDestinationAddress") if err != nil { return *new(common.Address), err @@ -290,18 +290,18 @@ func (_NativeTokenSource *NativeTokenSourceCaller) DestinationContractAddress(op } -// DestinationContractAddress is a free data retrieval call binding the contract method 0x04d6baf7. +// NativeTokenDestinationAddress is a free data retrieval call binding the contract method 0xb8c9091a. // -// Solidity: function destinationContractAddress() view returns(address) -func (_NativeTokenSource *NativeTokenSourceSession) DestinationContractAddress() (common.Address, error) { - return _NativeTokenSource.Contract.DestinationContractAddress(&_NativeTokenSource.CallOpts) +// Solidity: function nativeTokenDestinationAddress() view returns(address) +func (_NativeTokenSource *NativeTokenSourceSession) NativeTokenDestinationAddress() (common.Address, error) { + return _NativeTokenSource.Contract.NativeTokenDestinationAddress(&_NativeTokenSource.CallOpts) } -// DestinationContractAddress is a free data retrieval call binding the contract method 0x04d6baf7. +// NativeTokenDestinationAddress is a free data retrieval call binding the contract method 0xb8c9091a. // -// Solidity: function destinationContractAddress() view returns(address) -func (_NativeTokenSource *NativeTokenSourceCallerSession) DestinationContractAddress() (common.Address, error) { - return _NativeTokenSource.Contract.DestinationContractAddress(&_NativeTokenSource.CallOpts) +// Solidity: function nativeTokenDestinationAddress() view returns(address) +func (_NativeTokenSource *NativeTokenSourceCallerSession) NativeTokenDestinationAddress() (common.Address, error) { + return _NativeTokenSource.Contract.NativeTokenDestinationAddress(&_NativeTokenSource.CallOpts) } // TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index 4a53c2ba1..9b0be99c2 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -35,7 +35,7 @@ contract NativeTokenDestination is uint256 public constant TRANSFER_NATIVE_TOKENS_REQUIRED_GAS = 150_000; // TODO this is a placeholder bytes32 public immutable currentBlockchainID; bytes32 public immutable sourceBlockchainID; - address public immutable sourceContractAddress; + address public immutable nativeTokenSourceAddress; // We will not mint the first `tokenReserve` tokens sent to this subnet. // This should be constructed to match the initial token supply of this subnet. // This will mean we will not mint tokens until the source contact is collateralized. @@ -48,7 +48,7 @@ contract NativeTokenDestination is constructor( address teleporterMessengerAddress, bytes32 sourceBlockchainID_, - address sourceContractAddress_, + address nativeTokenSourceAddress_, uint256 tokenReserve_ ) { currentBlockchainID = WarpMessenger(WARP_PRECOMPILE_ADDRESS) @@ -68,10 +68,10 @@ contract NativeTokenDestination is sourceBlockchainID = sourceBlockchainID_; require( - sourceContractAddress_ != address(0), + nativeTokenSourceAddress_ != address(0), "Invalid Source Contract Address" ); - sourceContractAddress = sourceContractAddress_; + nativeTokenSourceAddress = nativeTokenSourceAddress_; tokenReserve = tokenReserve_; } @@ -99,7 +99,7 @@ contract NativeTokenDestination is ); // Only allow the partner contract to send messages. - require(senderAddress == sourceContractAddress, "Unauthorized Sender"); + require(senderAddress == nativeTokenSourceAddress, "Unauthorized Sender"); (address recipient, uint256 amount) = abi.decode( message, @@ -165,7 +165,7 @@ contract NativeTokenDestination is uint256 messageID = teleporterMessenger.sendCrossChainMessage( TeleporterMessageInput({ destinationChainID: sourceBlockchainID, - destinationAddress: sourceContractAddress, + destinationAddress: nativeTokenSourceAddress, feeInfo: TeleporterFeeInfo({ contractAddress: feeContractAddress, amount: adjustedAmount diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index d76336ea9..0ff400f95 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -21,7 +21,7 @@ contract NativeTokenSource is uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 150_000; // TODO this is a placeholder bytes32 public immutable currentBlockchainID; bytes32 public immutable destinationBlockchainID; - address public immutable destinationContractAddress; + address public immutable nativeTokenDestinationAddress; // Used for sending an receiving Teleporter messages. ITeleporterMessenger public immutable teleporterMessenger; @@ -29,7 +29,7 @@ contract NativeTokenSource is constructor( address teleporterMessengerAddress, bytes32 destinationBlockchainID_, - address destinationContractAddress_ + address nativeTokenDestinationAddress_ ) { currentBlockchainID = WarpMessenger(WARP_PRECOMPILE_ADDRESS) .getBlockchainID(); @@ -51,10 +51,10 @@ contract NativeTokenSource is destinationBlockchainID = destinationBlockchainID_; require( - destinationContractAddress_ != address(0), + nativeTokenDestinationAddress_ != address(0), "Invalid Destination Contract Address" ); - destinationContractAddress = destinationContractAddress_; + nativeTokenDestinationAddress = nativeTokenDestinationAddress_; } /** @@ -81,7 +81,7 @@ contract NativeTokenSource is // Only allow the partner contract to send messages. require( - senderAddress == destinationContractAddress, + senderAddress == nativeTokenDestinationAddress, "Unauthorized Sender" ); @@ -129,7 +129,7 @@ contract NativeTokenSource is uint256 messageID = teleporterMessenger.sendCrossChainMessage( TeleporterMessageInput({ destinationChainID: destinationBlockchainID, - destinationAddress: destinationContractAddress, + destinationAddress: nativeTokenDestinationAddress, feeInfo: TeleporterFeeInfo({ contractAddress: feeContractAddress, amount: adjustedAmount From c1574ea3da19c4197ceff64f2c1bf794a259acc9 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 16 Oct 2023 10:53:08 -0400 Subject: [PATCH 054/183] Run tests in same describe block --- tests/e2e_test.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/e2e_test.go b/tests/e2e_test.go index 040e1e62c..6d6862454 100644 --- a/tests/e2e_test.go +++ b/tests/e2e_test.go @@ -43,8 +43,5 @@ var _ = ginkgo.AfterSuite(testUtils.TearDownNetwork) var _ = ginkgo.Describe("[Teleporter integration tests]", func() { ginkgo.It("Send a message from Subnet A to Subnet B", BasicOneWaySend) -}) - -var _ = ginkgo.Describe("[Native Token Bridge integration tests]", func() { ginkgo.It("Send native tokens from subnet A to B and back", NativeTokenBridge) }) From 45270546e010d527eda556e911db0fe33c06b182 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 16 Oct 2023 10:53:30 -0400 Subject: [PATCH 055/183] Cleanup contracts --- .../NativeTokenDestination.go | 26 +++++++++++++------ .../INativeTokenDestination.sol | 15 +++++------ .../NativeTokenBridge/INativeTokenSource.sol | 5 ++-- .../NativeTokenDestination.sol | 14 +++++----- .../NativeTokenBridge/NativeTokenSource.sol | 6 ++++- 5 files changed, 41 insertions(+), 25 deletions(-) diff --git a/abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go b/abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go index 76b3544f4..e3902e3e9 100644 --- a/abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go +++ b/abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go @@ -31,7 +31,7 @@ var ( // NativeTokenDestinationMetaData contains all meta data concerning the NativeTokenDestination contract. var NativeTokenDestinationMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenReserve_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"MintNativeTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tokenReserve\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenReserve_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"MintNativeTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tokenReserve\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", } // NativeTokenDestinationABI is the input ABI used to generate the binding from. @@ -619,10 +619,15 @@ type NativeTokenDestinationMintNativeTokens struct { // FilterMintNativeTokens is a free log retrieval operation binding the contract event 0xe2899f7ef7618206fa13efbcde0c05cccd83f35ac3b18ef860021181d61fa680. // -// Solidity: event MintNativeTokens(address recipient, uint256 amount) -func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterMintNativeTokens(opts *bind.FilterOpts) (*NativeTokenDestinationMintNativeTokensIterator, error) { +// Solidity: event MintNativeTokens(address indexed recipient, uint256 amount) +func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterMintNativeTokens(opts *bind.FilterOpts, recipient []common.Address) (*NativeTokenDestinationMintNativeTokensIterator, error) { - logs, sub, err := _NativeTokenDestination.contract.FilterLogs(opts, "MintNativeTokens") + var recipientRule []interface{} + for _, recipientItem := range recipient { + recipientRule = append(recipientRule, recipientItem) + } + + logs, sub, err := _NativeTokenDestination.contract.FilterLogs(opts, "MintNativeTokens", recipientRule) if err != nil { return nil, err } @@ -631,10 +636,15 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterMintNativeT // WatchMintNativeTokens is a free log subscription operation binding the contract event 0xe2899f7ef7618206fa13efbcde0c05cccd83f35ac3b18ef860021181d61fa680. // -// Solidity: event MintNativeTokens(address recipient, uint256 amount) -func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchMintNativeTokens(opts *bind.WatchOpts, sink chan<- *NativeTokenDestinationMintNativeTokens) (event.Subscription, error) { +// Solidity: event MintNativeTokens(address indexed recipient, uint256 amount) +func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchMintNativeTokens(opts *bind.WatchOpts, sink chan<- *NativeTokenDestinationMintNativeTokens, recipient []common.Address) (event.Subscription, error) { + + var recipientRule []interface{} + for _, recipientItem := range recipient { + recipientRule = append(recipientRule, recipientItem) + } - logs, sub, err := _NativeTokenDestination.contract.WatchLogs(opts, "MintNativeTokens") + logs, sub, err := _NativeTokenDestination.contract.WatchLogs(opts, "MintNativeTokens", recipientRule) if err != nil { return nil, err } @@ -668,7 +678,7 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchMintNativeTo // ParseMintNativeTokens is a log parse operation binding the contract event 0xe2899f7ef7618206fa13efbcde0c05cccd83f35ac3b18ef860021181d61fa680. // -// Solidity: event MintNativeTokens(address recipient, uint256 amount) +// Solidity: event MintNativeTokens(address indexed recipient, uint256 amount) func (_NativeTokenDestination *NativeTokenDestinationFilterer) ParseMintNativeTokens(log types.Log) (*NativeTokenDestinationMintNativeTokens, error) { event := new(NativeTokenDestinationMintNativeTokens) if err := _NativeTokenDestination.contract.UnpackLog(event, "MintNativeTokens", log); err != nil { diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol index 6389a0d94..51938196b 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol @@ -6,7 +6,8 @@ pragma solidity 0.8.18; /** - * @dev Interface that describes functionalities for a cross-chain native token bridge. + * @dev Interface that describes functionalities for a contract that can mint native tokens when + * paired with a "source" contract that will lock tokens on another chain. */ interface INativeTokenDestination { /** @@ -20,22 +21,20 @@ interface INativeTokenDestination { uint256 feeAmount, uint256 teleporterMessageID ); + /** * @dev Emitted when tokens are not minted in order to collateralize the source contract. */ - event CollateralAdded( - uint256 amount, - uint256 remaining - ); + event CollateralAdded(uint256 amount, uint256 remaining); /** - * @dev Emitted when minting bridge tokens. + * @dev Emitted when minting native tokens. */ - event MintNativeTokens(address recipient, uint256 amount); + event MintNativeTokens(address indexed recipient, uint256 amount); /** * @dev This burns native tokens on this chain, and sends a message to the source - * chain to mint unlock tokens there. + * chain to unlock tokens there. */ function transferToSource( address recipient, diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol index 13d2a6fde..98843a475 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol @@ -6,7 +6,8 @@ pragma solidity 0.8.18; /** - * @dev Interface that describes functionalities for a cross-chain native token bridge. + * @dev Interface that describes functionalities for a contract that will lock tokens and send a + * teleporter message to a NativeTokenDestination contract to mint native tokens on that chain. */ interface INativeTokenSource { /** @@ -27,7 +28,7 @@ interface INativeTokenSource { event UnlockTokens(address recipient, uint256 amount); /** - * @dev Transfers native tokens to the destination chain as that chain's native token. + * @dev Transfers source chain native tokens to destination chain's native tokens. */ function transferToDestination( address recipient, diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index 9b0be99c2..20ee33ad7 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -1,4 +1,8 @@ -//SPDX-License-Identifier: MIT +// (c) 2023, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +// SPDX-License-Identifier: Ecosystem + pragma solidity 0.8.18; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; @@ -10,10 +14,11 @@ import "../../Teleporter/ITeleporterMessenger.sol"; import "../../Teleporter/ITeleporterReceiver.sol"; import "../../Teleporter/SafeERC20TransferFrom.sol"; -// Precompiled Native Minter Contract Address +// Native Minter Precompile Contract Address address constant MINTER_ADDRESS = 0x0200000000000000000000000000000000000001; // This is the address where the burned base fee go. We use this to send the amount of // burned tokens back to the source chain. +// TODO implement mechanism to report burned tx fees to source chian. address constant BURNED_TX_FEES_ADDRESS = 0x0100000000000000000000000000000000000000; // Designated Blackhole Address. This is where we burn token before sending an unlock // message to the source chain. Different from the burned tx fee address so we can @@ -159,9 +164,6 @@ contract NativeTokenDestination is // Burn native token by sending to BLACKHOLE_ADDRESS payable(BLACKHOLE_ADDRESS).transfer(msg.value); - // Send Teleporter message. - bytes memory messageData = abi.encode(recipient, msg.value); - uint256 messageID = teleporterMessenger.sendCrossChainMessage( TeleporterMessageInput({ destinationChainID: sourceBlockchainID, @@ -172,7 +174,7 @@ contract NativeTokenDestination is }), requiredGasLimit: TRANSFER_NATIVE_TOKENS_REQUIRED_GAS, allowedRelayerAddresses: new address[](0), - message: messageData + message: abi.encode(recipient, msg.value) }) ); diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index 0ff400f95..6420b3649 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -1,4 +1,8 @@ -//SPDX-License-Identifier: MIT +// (c) 2023, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +// SPDX-License-Identifier: Ecosystem + pragma solidity 0.8.18; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; From 9927e9fd9aab04c15c9a70c5e4af4799d461c5b8 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 16 Oct 2023 11:07:14 -0400 Subject: [PATCH 056/183] Inline abi.encode --- .../NativeTokenBridge/NativeTokenSource.sol | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index 6420b3649..ed4cd1512 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -127,9 +127,6 @@ contract NativeTokenSource is ); } - // Send Teleporter message. - bytes memory messageData = abi.encode(recipient, msg.value); - uint256 messageID = teleporterMessenger.sendCrossChainMessage( TeleporterMessageInput({ destinationChainID: destinationBlockchainID, @@ -140,7 +137,7 @@ contract NativeTokenSource is }), requiredGasLimit: MINT_NATIVE_TOKENS_REQUIRED_GAS, allowedRelayerAddresses: new address[](0), - message: messageData + message: abi.encode(recipient, msg.value) }) ); From 4516a446fa7ab2224d80e9ce1c143852ea0ba0b7 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 16 Oct 2023 11:45:51 -0400 Subject: [PATCH 057/183] Add allowed relayers to transfer methods --- .../NativeTokenDestination.go | 26 +++++++++---------- .../NativeTokenSource/NativeTokenSource.go | 26 +++++++++---------- .../INativeTokenDestination.sol | 3 ++- .../NativeTokenBridge/INativeTokenSource.sol | 3 ++- .../NativeTokenDestination.sol | 5 ++-- .../NativeTokenBridge/NativeTokenSource.sol | 5 ++-- tests/native_token_bridge.go | 6 ++--- 7 files changed, 39 insertions(+), 35 deletions(-) diff --git a/abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go b/abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go index e3902e3e9..009254e11 100644 --- a/abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go +++ b/abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go @@ -31,7 +31,7 @@ var ( // NativeTokenDestinationMetaData contains all meta data concerning the NativeTokenDestination contract. var NativeTokenDestinationMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenReserve_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"MintNativeTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tokenReserve\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenReserve_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"MintNativeTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tokenReserve\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", } // NativeTokenDestinationABI is the input ABI used to generate the binding from. @@ -387,25 +387,25 @@ func (_NativeTokenDestination *NativeTokenDestinationTransactorSession) ReceiveT return _NativeTokenDestination.Contract.ReceiveTeleporterMessage(&_NativeTokenDestination.TransactOpts, senderBlockchainID, senderAddress, message) } -// TransferToSource is a paid mutator transaction binding the contract method 0x281c91de. +// TransferToSource is a paid mutator transaction binding the contract method 0xbdb6b283. // -// Solidity: function transferToSource(address recipient, address feeContractAddress, uint256 feeAmount) payable returns() -func (_NativeTokenDestination *NativeTokenDestinationTransactor) TransferToSource(opts *bind.TransactOpts, recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { - return _NativeTokenDestination.contract.Transact(opts, "transferToSource", recipient, feeContractAddress, feeAmount) +// Solidity: function transferToSource(address recipient, address feeContractAddress, uint256 feeAmount, address[] allowedRelayerAddresses) payable returns() +func (_NativeTokenDestination *NativeTokenDestinationTransactor) TransferToSource(opts *bind.TransactOpts, recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int, allowedRelayerAddresses []common.Address) (*types.Transaction, error) { + return _NativeTokenDestination.contract.Transact(opts, "transferToSource", recipient, feeContractAddress, feeAmount, allowedRelayerAddresses) } -// TransferToSource is a paid mutator transaction binding the contract method 0x281c91de. +// TransferToSource is a paid mutator transaction binding the contract method 0xbdb6b283. // -// Solidity: function transferToSource(address recipient, address feeContractAddress, uint256 feeAmount) payable returns() -func (_NativeTokenDestination *NativeTokenDestinationSession) TransferToSource(recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { - return _NativeTokenDestination.Contract.TransferToSource(&_NativeTokenDestination.TransactOpts, recipient, feeContractAddress, feeAmount) +// Solidity: function transferToSource(address recipient, address feeContractAddress, uint256 feeAmount, address[] allowedRelayerAddresses) payable returns() +func (_NativeTokenDestination *NativeTokenDestinationSession) TransferToSource(recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int, allowedRelayerAddresses []common.Address) (*types.Transaction, error) { + return _NativeTokenDestination.Contract.TransferToSource(&_NativeTokenDestination.TransactOpts, recipient, feeContractAddress, feeAmount, allowedRelayerAddresses) } -// TransferToSource is a paid mutator transaction binding the contract method 0x281c91de. +// TransferToSource is a paid mutator transaction binding the contract method 0xbdb6b283. // -// Solidity: function transferToSource(address recipient, address feeContractAddress, uint256 feeAmount) payable returns() -func (_NativeTokenDestination *NativeTokenDestinationTransactorSession) TransferToSource(recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { - return _NativeTokenDestination.Contract.TransferToSource(&_NativeTokenDestination.TransactOpts, recipient, feeContractAddress, feeAmount) +// Solidity: function transferToSource(address recipient, address feeContractAddress, uint256 feeAmount, address[] allowedRelayerAddresses) payable returns() +func (_NativeTokenDestination *NativeTokenDestinationTransactorSession) TransferToSource(recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int, allowedRelayerAddresses []common.Address) (*types.Transaction, error) { + return _NativeTokenDestination.Contract.TransferToSource(&_NativeTokenDestination.TransactOpts, recipient, feeContractAddress, feeAmount, allowedRelayerAddresses) } // NativeTokenDestinationCollateralAddedIterator is returned from FilterCollateralAdded and is used to iterate over the raw logs and unpacked data for CollateralAdded events raised by the NativeTokenDestination contract. diff --git a/abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go b/abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go index 2238a5764..4b5d07aaf 100644 --- a/abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go +++ b/abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go @@ -31,7 +31,7 @@ var ( // NativeTokenSourceMetaData contains all meta data concerning the NativeTokenSource contract. var NativeTokenSourceMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", } // NativeTokenSourceABI is the input ABI used to generate the binding from. @@ -356,25 +356,25 @@ func (_NativeTokenSource *NativeTokenSourceTransactorSession) ReceiveTeleporterM return _NativeTokenSource.Contract.ReceiveTeleporterMessage(&_NativeTokenSource.TransactOpts, senderBlockchainID, senderAddress, message) } -// TransferToDestination is a paid mutator transaction binding the contract method 0x3c7bf510. +// TransferToDestination is a paid mutator transaction binding the contract method 0x2268e041. // -// Solidity: function transferToDestination(address recipient, address feeContractAddress, uint256 feeAmount) payable returns() -func (_NativeTokenSource *NativeTokenSourceTransactor) TransferToDestination(opts *bind.TransactOpts, recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { - return _NativeTokenSource.contract.Transact(opts, "transferToDestination", recipient, feeContractAddress, feeAmount) +// Solidity: function transferToDestination(address recipient, address feeContractAddress, uint256 feeAmount, address[] allowedRelayerAddresses) payable returns() +func (_NativeTokenSource *NativeTokenSourceTransactor) TransferToDestination(opts *bind.TransactOpts, recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int, allowedRelayerAddresses []common.Address) (*types.Transaction, error) { + return _NativeTokenSource.contract.Transact(opts, "transferToDestination", recipient, feeContractAddress, feeAmount, allowedRelayerAddresses) } -// TransferToDestination is a paid mutator transaction binding the contract method 0x3c7bf510. +// TransferToDestination is a paid mutator transaction binding the contract method 0x2268e041. // -// Solidity: function transferToDestination(address recipient, address feeContractAddress, uint256 feeAmount) payable returns() -func (_NativeTokenSource *NativeTokenSourceSession) TransferToDestination(recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { - return _NativeTokenSource.Contract.TransferToDestination(&_NativeTokenSource.TransactOpts, recipient, feeContractAddress, feeAmount) +// Solidity: function transferToDestination(address recipient, address feeContractAddress, uint256 feeAmount, address[] allowedRelayerAddresses) payable returns() +func (_NativeTokenSource *NativeTokenSourceSession) TransferToDestination(recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int, allowedRelayerAddresses []common.Address) (*types.Transaction, error) { + return _NativeTokenSource.Contract.TransferToDestination(&_NativeTokenSource.TransactOpts, recipient, feeContractAddress, feeAmount, allowedRelayerAddresses) } -// TransferToDestination is a paid mutator transaction binding the contract method 0x3c7bf510. +// TransferToDestination is a paid mutator transaction binding the contract method 0x2268e041. // -// Solidity: function transferToDestination(address recipient, address feeContractAddress, uint256 feeAmount) payable returns() -func (_NativeTokenSource *NativeTokenSourceTransactorSession) TransferToDestination(recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int) (*types.Transaction, error) { - return _NativeTokenSource.Contract.TransferToDestination(&_NativeTokenSource.TransactOpts, recipient, feeContractAddress, feeAmount) +// Solidity: function transferToDestination(address recipient, address feeContractAddress, uint256 feeAmount, address[] allowedRelayerAddresses) payable returns() +func (_NativeTokenSource *NativeTokenSourceTransactorSession) TransferToDestination(recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int, allowedRelayerAddresses []common.Address) (*types.Transaction, error) { + return _NativeTokenSource.Contract.TransferToDestination(&_NativeTokenSource.TransactOpts, recipient, feeContractAddress, feeAmount, allowedRelayerAddresses) } // NativeTokenSourceTransferToDestinationIterator is returned from FilterTransferToDestination and is used to iterate over the raw logs and unpacked data for TransferToDestination events raised by the NativeTokenSource contract. diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol index 51938196b..3470d6968 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol @@ -39,6 +39,7 @@ interface INativeTokenDestination { function transferToSource( address recipient, address feeContractAddress, - uint256 feeAmount + uint256 feeAmount, + address[] calldata allowedRelayerAddresses ) external payable; } diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol index 98843a475..6e88fa621 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol @@ -33,6 +33,7 @@ interface INativeTokenSource { function transferToDestination( address recipient, address feeContractAddress, - uint256 feeAmount + uint256 feeAmount, + address[] calldata allowedRelayerAddresses ) external payable; } diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index 20ee33ad7..af590d312 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -136,7 +136,8 @@ contract NativeTokenDestination is function transferToSource( address recipient, address feeContractAddress, - uint256 feeAmount + uint256 feeAmount, + address[] calldata allowedRelayerAddresses ) external payable nonReentrant { // The recipient cannot be the zero address. require(recipient != address(0), "Invalid Recipient Address"); @@ -173,7 +174,7 @@ contract NativeTokenDestination is amount: adjustedAmount }), requiredGasLimit: TRANSFER_NATIVE_TOKENS_REQUIRED_GAS, - allowedRelayerAddresses: new address[](0), + allowedRelayerAddresses: allowedRelayerAddresses, message: abi.encode(recipient, msg.value) }) ); diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index ed4cd1512..1c811f30c 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -107,7 +107,8 @@ contract NativeTokenSource is function transferToDestination( address recipient, address feeContractAddress, - uint256 feeAmount + uint256 feeAmount, + address[] calldata allowedRelayerAddresses ) external payable nonReentrant { // The recipient cannot be the zero address. require(recipient != address(0), "Invalid Recipient Address"); @@ -136,7 +137,7 @@ contract NativeTokenSource is amount: adjustedAmount }), requiredGasLimit: MINT_NATIVE_TOKENS_REQUIRED_GAS, - allowedRelayerAddresses: new address[](0), + allowedRelayerAddresses: allowedRelayerAddresses, message: abi.encode(recipient, msg.value) }) ); diff --git a/tests/native_token_bridge.go b/tests/native_token_bridge.go index aa4739d0f..49bc6ff19 100644 --- a/tests/native_token_bridge.go +++ b/tests/native_token_bridge.go @@ -96,7 +96,7 @@ func NativeTokenBridge() { Expect(err).Should(BeNil()) transactor.Value = new(big.Int).SetUint64(valueToSend) - tx, err := nativeTokenDestination.TransferToSource(transactor, toAddress, common.Address{}, big.NewInt(0)) + tx, err := nativeTokenDestination.TransferToSource(transactor, toAddress, common.Address{}, big.NewInt(0), []common.Address{}) Expect(err).Should(BeNil()) log.Info("Sent TransferToSource transaction on destination chain", "sourceChainID", subnetA.BlockchainID, "txHash", tx.Hash().Hex()) @@ -114,7 +114,7 @@ func NativeTokenBridge() { Expect(err).Should(BeNil()) transactor.Value = new(big.Int).SetUint64(valueToSend) - tx, err := nativeTokenSource.TransferToDestination(transactor, toAddress, common.Address{}, big.NewInt(0)) + tx, err := nativeTokenSource.TransferToDestination(transactor, toAddress, common.Address{}, big.NewInt(0), []common.Address{}) Expect(err).Should(BeNil()) log.Info("Sent TransferToDestination transaction on source chain", "destinationChainID", subnetB.BlockchainID, "txHash", tx.Hash().Hex()) @@ -151,7 +151,7 @@ func NativeTokenBridge() { transactor.Value = new(big.Int).SetUint64(valueToSend1) // This transfer should revert because the bridge isn't collateralized - _, err = nativeTokenDestination.TransferToSource(transactor, tokenReceiverAddress, common.Address{}, big.NewInt(0)) + _, err = nativeTokenDestination.TransferToSource(transactor, tokenReceiverAddress, common.Address{}, big.NewInt(0), []common.Address{}) Expect(err).ShouldNot(BeNil()) // Check we should fail to send because we're not collateralized From f3cc0ec0403ae252fb48656661bd38f9ff3d5d67 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 23 Oct 2023 10:26:26 -0400 Subject: [PATCH 058/183] Fix import --- tests/native_token_bridge.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/native_token_bridge.go b/tests/native_token_bridge.go index 49bc6ff19..c0619521e 100644 --- a/tests/native_token_bridge.go +++ b/tests/native_token_bridge.go @@ -9,7 +9,7 @@ import ( "github.com/ava-labs/subnet-evm/core/types" nativetokendestination "github.com/ava-labs/teleporter/abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenDestination" nativetokensource "github.com/ava-labs/teleporter/abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenSource" - deploymentUtils "github.com/ava-labs/teleporter/contract-deployment/utils" + deploymentUtils "github.com/ava-labs/teleporter/utils/deployment-utils" "github.com/ava-labs/teleporter/tests/utils" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" From b6d628f25c68417a5e78f4913350d628949102e7 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 24 Oct 2023 10:17:07 -0400 Subject: [PATCH 059/183] Add README --- .../NativeTokenBridge/README.md | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 contracts/src/CrossChainApplications/NativeTokenBridge/README.md diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/README.md b/contracts/src/CrossChainApplications/NativeTokenBridge/README.md new file mode 100644 index 000000000..a307420b9 --- /dev/null +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/README.md @@ -0,0 +1,31 @@ +# Native-to-Native Token Bridge + +A pair of smart contracts built on top of Teleporter to support using the native token of any `subnet-evm` chain as the native token for a given subnet. + +## Design +The native-to-native bridge is implemented using two primary contracts. +- `NativeTokenSource` + - Lives on the `Source chain`. Pairs with exactly one `NativeTokenDestination` contract on a different chain. + - Locks and unlocks tokens on the Source chain corresponding to mints and burns on the destination chain. + - `transferToDestination`: transfers all tokens payed to this function call to `recipient` on the destination chain by locking them and instructing the destination chain to mint. Optionally takes the address of an ERC20 contract `feeContractAddress` as well as an amount `feeAmount` that will be used as the relayer-incentivisation for the teleporter cross-chain call. Also allows for the caller to specify `allowedRelayerAddresses`. + - `receiveTeleporterMessage`: unlocks tokens on the source chain when instructed to by the `NativeTokenDestination` contract. +- `NativeTokenDestination` + - Lives on the `Destination chain`. Pairs with exactly one `NativeTokenSource` contract on a different chain. + - Mints and burns tokens on the Destination chain corresponding to locks and unlocks on the source chain. + - `transferToSource`: transfers all tokens payed to this function call to `recipient` on the source chain by burning the tokens and instructing the source chain to unlock. Optionally takes the address of an ERC20 contract `feeContractAddress` as well as an amount `feeAmount` that will be used as the relayer-incentivisation for the teleporter cross-chain call. Also allows for the caller to specify `allowedRelayerAddresses`. + - `receiveTeleporterMessage`: mints tokens on the destination chain when instructed to by the `NativeTokenDestination` contract. + +- `Collateralizing the bridge` + - On initialization, the bridge will be undercollateralized by exactly the number of tokens included in genesis on the destination chain. These tokens could theoretically be sent through the bridge, with no corresponding tokens able to be unlocked on the source chain. In order to avoid this problem, the `NativeTokenDestination` contract is initialized with the value for `tokenReserve`, which should correspond to the number of tokens allocated in the genesis block for the destination chain. If this is not properly set, behaviour of this contract is undefined. The `NativeTokenDestination` contract will not mint tokens until it has received confirmation that at least `tokenReserve` tokens have been locked on the source chain. It should be up to the contract deployer to ensure that the bridge is properly collateralized. Burning/unlocking is disabled until the bridge is properly collateralized. + +- `Burning tokens spent as fees` + - As tokens are burned for transaction fees on the destination chain, we may want to relay this information to the source chain in order to burn an equivalent number of locked tokens there because these tokens will never be bridged back. + - `TODO` explain implementation. + +- `Setup` + - `Teleporter` must be deployed on both chains, and the address must be passed to the constructor of both contracts. + - `NativeTokenDestination` is meant to be deployed on a new subnet, and should be the only method for minting tokens on that subnet. The address of `NativeTokenDestination` must be included as the only entry for `adminAddresses` under `contractNativeMinterConfig` in the genesis config for the destination subnet. See `warp-genesis.json` for an example. + - Both `NativeTokenSource` and `NativeTokenDestination` need to be deployed to addresses known beforehand. Each address must be passed to the constructor of the other contract. To do this, you will need a known EOA, and preferably use the first transaction from this address (nonce 0) to deploy the contract on each chain. It is advised to allocate tokens to the EOA in the destination subnet genesis file so that it can easily deploy the contract. + - Both contracts need to be initialized with `teleporterMessengerAddress`, which is the only address they will accept function calls from. + - `NativeTokenDestination` needs to be intialized with `tokenReserve`, which should equal the number of tokens allocated in the genesis file for the destination chain. If this value is not properly set, behavior of these contracts in undefined. + - On the source chain, at least `tokenReserve` tokens need to be transfered to `NativeTokenSource` using `transferToSource` in order to properly collateralize the bridge and allow regular functionality in both directions. The first `tokenReserve` tokens will not be delivered to the recipient, but any excess will be delivered. Burning/unlocking is disabled until the bridge is fully collateralized. \ No newline at end of file From 9863960c35e98c3cf09248b6b5b0d848611b4629 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 24 Oct 2023 10:41:15 -0400 Subject: [PATCH 060/183] Review fixes --- .../NativeTokenBridge/NativeTokenDestination.sol | 1 + contracts/src/CrossChainApplications/NativeTokenBridge/README.md | 1 + 2 files changed, 2 insertions(+) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index af590d312..1b4078046 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -111,6 +111,7 @@ contract NativeTokenDestination is (address, uint256) ); require(recipient != address(0), "Invalid Recipient Address"); + require(amount != 0, "Transfer value of 0"); uint256 adjustedAmount = amount; if (tokenReserve > 0) { diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/README.md b/contracts/src/CrossChainApplications/NativeTokenBridge/README.md index a307420b9..cd6f7c6b2 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/README.md +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/README.md @@ -20,6 +20,7 @@ The native-to-native bridge is implemented using two primary contracts. - `Burning tokens spent as fees` - As tokens are burned for transaction fees on the destination chain, we may want to relay this information to the source chain in order to burn an equivalent number of locked tokens there because these tokens will never be bridged back. + - The address for burned transaction fees is `0x0100000000000000000000000000000000000000`. We will send tokens that are "burned" in order to unlock tokens on the source chain to a different address so that `0x0100000000000000000000000000000000000000` will only include burned transaction fees (or tokens others have decided to burn outside of this contract) so that we can report this number to the source chain to burn an equivalent numbers of locked tokens. - `TODO` explain implementation. - `Setup` From a29791815c22ea3b9dc2b1f8fdcdbc6883ff3787 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Thu, 26 Oct 2023 11:45:58 -0400 Subject: [PATCH 061/183] Move go abis to correct folder --- .../NativeTokenDestination/NativeTokenDestination.go | 2 +- .../NativeTokenBridge/NativeTokenSource/NativeTokenSource.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename abi-bindings/{ => go}/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go (92%) rename abi-bindings/{ => go}/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go (91%) diff --git a/abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go similarity index 92% rename from abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go rename to abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go index 009254e11..354a21fb6 100644 --- a/abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go @@ -31,7 +31,7 @@ var ( // NativeTokenDestinationMetaData contains all meta data concerning the NativeTokenDestination contract. var NativeTokenDestinationMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenReserve_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"MintNativeTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tokenReserve\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenReserve_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"MintNativeTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tokenReserve\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", } // NativeTokenDestinationABI is the input ABI used to generate the binding from. diff --git a/abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go similarity index 91% rename from abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go rename to abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go index 4b5d07aaf..051f09b09 100644 --- a/abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go @@ -31,7 +31,7 @@ var ( // NativeTokenSourceMetaData contains all meta data concerning the NativeTokenSource contract. var NativeTokenSourceMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", } // NativeTokenSourceABI is the input ABI used to generate the binding from. From 5afcbef493358ce94ecea0a4c9565afd4f28a88c Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Thu, 26 Oct 2023 13:39:55 -0400 Subject: [PATCH 062/183] Review fixes --- .../NativeTokenBridge/INativeTokenDestination.sol | 2 +- .../NativeTokenBridge/INativeTokenSource.sol | 2 +- .../NativeTokenBridge/NativeTokenDestination.sol | 4 ++-- .../NativeTokenBridge/NativeTokenSource.sol | 4 ++-- .../CrossChainApplications/NativeTokenBridge/README.md | 8 ++++---- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol index 3470d6968..221316ac6 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol @@ -7,7 +7,7 @@ pragma solidity 0.8.18; /** * @dev Interface that describes functionalities for a contract that can mint native tokens when - * paired with a "source" contract that will lock tokens on another chain. + * paired with a NativeTokenSource contract that will lock tokens on another chain. */ interface INativeTokenDestination { /** diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol index 6e88fa621..ccc52c6b9 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol @@ -7,7 +7,7 @@ pragma solidity 0.8.18; /** * @dev Interface that describes functionalities for a contract that will lock tokens and send a - * teleporter message to a NativeTokenDestination contract to mint native tokens on that chain. + * Teleporter message to a NativeTokenDestination contract to mint native tokens on that chain. */ interface INativeTokenSource { /** diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index 1b4078046..d85f170ff 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -61,7 +61,7 @@ contract NativeTokenDestination is require( teleporterMessengerAddress != address(0), - "Invalid Teleporter Messenger Address" + "Invalid TeleporterMessenger Address" ); teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); @@ -94,7 +94,7 @@ contract NativeTokenDestination is // Only allow the Teleporter messenger to deliver messages. require( msg.sender == address(teleporterMessenger), - "Unauthorized teleporter contract" + "Unauthorized TeleporterMessenger contract" ); // Only allow messages from the source chain. diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index 1c811f30c..c0006db38 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -40,7 +40,7 @@ contract NativeTokenSource is require( teleporterMessengerAddress != address(0), - "Invalid Teleporter Messenger Address" + "Invalid TeleporterMessenger Address" ); teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); @@ -74,7 +74,7 @@ contract NativeTokenSource is // Only allow the Teleporter messenger to deliver messages. require( msg.sender == address(teleporterMessenger), - "Unauthorized teleporter contract" + "Unauthorized TeleporterMessenger contract" ); // Only allow messages from the destination chain. diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/README.md b/contracts/src/CrossChainApplications/NativeTokenBridge/README.md index cd6f7c6b2..49ea9cf7f 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/README.md +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/README.md @@ -6,12 +6,12 @@ A pair of smart contracts built on top of Teleporter to support using the native The native-to-native bridge is implemented using two primary contracts. - `NativeTokenSource` - Lives on the `Source chain`. Pairs with exactly one `NativeTokenDestination` contract on a different chain. - - Locks and unlocks tokens on the Source chain corresponding to mints and burns on the destination chain. + - Locks and unlocks native tokens on the Source chain corresponding to mints and burns on the destination chain. - `transferToDestination`: transfers all tokens payed to this function call to `recipient` on the destination chain by locking them and instructing the destination chain to mint. Optionally takes the address of an ERC20 contract `feeContractAddress` as well as an amount `feeAmount` that will be used as the relayer-incentivisation for the teleporter cross-chain call. Also allows for the caller to specify `allowedRelayerAddresses`. - `receiveTeleporterMessage`: unlocks tokens on the source chain when instructed to by the `NativeTokenDestination` contract. - `NativeTokenDestination` - Lives on the `Destination chain`. Pairs with exactly one `NativeTokenSource` contract on a different chain. - - Mints and burns tokens on the Destination chain corresponding to locks and unlocks on the source chain. + - Mints and burns native tokens on the Destination chain corresponding to locks and unlocks on the source chain. - `transferToSource`: transfers all tokens payed to this function call to `recipient` on the source chain by burning the tokens and instructing the source chain to unlock. Optionally takes the address of an ERC20 contract `feeContractAddress` as well as an amount `feeAmount` that will be used as the relayer-incentivisation for the teleporter cross-chain call. Also allows for the caller to specify `allowedRelayerAddresses`. - `receiveTeleporterMessage`: mints tokens on the destination chain when instructed to by the `NativeTokenDestination` contract. @@ -24,9 +24,9 @@ The native-to-native bridge is implemented using two primary contracts. - `TODO` explain implementation. - `Setup` - - `Teleporter` must be deployed on both chains, and the address must be passed to the constructor of both contracts. + - `TeleporterMessenger` must be deployed on both chains, and the address must be passed to the constructor of both contracts. - `NativeTokenDestination` is meant to be deployed on a new subnet, and should be the only method for minting tokens on that subnet. The address of `NativeTokenDestination` must be included as the only entry for `adminAddresses` under `contractNativeMinterConfig` in the genesis config for the destination subnet. See `warp-genesis.json` for an example. - Both `NativeTokenSource` and `NativeTokenDestination` need to be deployed to addresses known beforehand. Each address must be passed to the constructor of the other contract. To do this, you will need a known EOA, and preferably use the first transaction from this address (nonce 0) to deploy the contract on each chain. It is advised to allocate tokens to the EOA in the destination subnet genesis file so that it can easily deploy the contract. - Both contracts need to be initialized with `teleporterMessengerAddress`, which is the only address they will accept function calls from. - `NativeTokenDestination` needs to be intialized with `tokenReserve`, which should equal the number of tokens allocated in the genesis file for the destination chain. If this value is not properly set, behavior of these contracts in undefined. - - On the source chain, at least `tokenReserve` tokens need to be transfered to `NativeTokenSource` using `transferToSource` in order to properly collateralize the bridge and allow regular functionality in both directions. The first `tokenReserve` tokens will not be delivered to the recipient, but any excess will be delivered. Burning/unlocking is disabled until the bridge is fully collateralized. \ No newline at end of file + - On the source chain, at least `tokenReserve` tokens need to be transferred to `NativeTokenSource` using `transferToSource` in order to properly collateralize the bridge and allow regular functionality in both directions. The first `tokenReserve` tokens will not be delivered to the recipient, but any excess will be delivered. Burning/unlocking is disabled until the bridge is fully collateralized. \ No newline at end of file From 27798b7b910197e98d8543be857a86e3a8a1afce Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Thu, 26 Oct 2023 16:13:59 -0400 Subject: [PATCH 063/183] worksum --- go.work.sum | 3 +++ 1 file changed, 3 insertions(+) diff --git a/go.work.sum b/go.work.sum index 0fe22a0d5..ba31eab35 100644 --- a/go.work.sum +++ b/go.work.sum @@ -950,6 +950,7 @@ golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.5.0/go.mod h1:9/XBHVqLaWO3/BRHs5jbpYCnOZVjj5V0ndyaAM7KB4I= golang.org/x/oauth2 v0.6.0/go.mod h1:ycmewcwgD4Rpr3eZJLSB4Kyyljb3qDh40vJ8STE5HKw= @@ -971,10 +972,12 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20220922220347-f3bd1da661af/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= From 549361ad73918a4c9f52f7762a4e31ce89af6c31 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Thu, 26 Oct 2023 16:18:11 -0400 Subject: [PATCH 064/183] Fix path for abi imports --- tests/native_token_bridge.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/native_token_bridge.go b/tests/native_token_bridge.go index c0619521e..9419e4f25 100644 --- a/tests/native_token_bridge.go +++ b/tests/native_token_bridge.go @@ -7,8 +7,8 @@ import ( "github.com/ava-labs/subnet-evm/accounts/abi/bind" "github.com/ava-labs/subnet-evm/core/types" - nativetokendestination "github.com/ava-labs/teleporter/abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenDestination" - nativetokensource "github.com/ava-labs/teleporter/abi-bindings/CrossChainApplications/NativeTokenBridge/NativeTokenSource" + nativetokendestination "github.com/ava-labs/teleporter/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination" + nativetokensource "github.com/ava-labs/teleporter/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource" deploymentUtils "github.com/ava-labs/teleporter/utils/deployment-utils" "github.com/ava-labs/teleporter/tests/utils" "github.com/ethereum/go-ethereum/common" From 80c4dbd4e823de23f19f20d9a00ac868bc2deb9a Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Fri, 27 Oct 2023 08:59:46 -0400 Subject: [PATCH 065/183] Add ERC20TokenSource --- .../NativeTokenBridge/ERC20TokenSource.sol | 164 ++++++++++++++++++ .../NativeTokenBridge/IERC20TokenSource.sol | 40 +++++ .../NativeTokenDestination.sol | 12 +- .../NativeTokenBridge/NativeTokenSource.sol | 12 +- 4 files changed, 216 insertions(+), 12 deletions(-) create mode 100644 contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol create mode 100644 contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol new file mode 100644 index 000000000..f90b92b90 --- /dev/null +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol @@ -0,0 +1,164 @@ +// (c) 2023, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +// SPDX-License-Identifier: Ecosystem + +pragma solidity 0.8.18; + +import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; +import "@subnet-evm-contracts/interfaces/IWarpMessenger.sol"; +import "./IERC20TokenSource.sol"; +import "../../Teleporter/ITeleporterMessenger.sol"; +import "../../Teleporter/ITeleporterReceiver.sol"; +import "../../Teleporter/SafeERC20TransferFrom.sol"; + +// Precompiled Warp address +address constant WARP_PRECOMPILE_ADDRESS = 0x0200000000000000000000000000000000000005; + +contract ERC20TokenSource is + ITeleporterReceiver, + IERC20TokenSource, + ReentrancyGuard +{ + using SafeERC20 for IERC20; + + uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 150_000; // TODO this is a placeholder + bytes32 public immutable currentBlockchainID; + bytes32 public immutable destinationBlockchainID; + address public immutable nativeTokenDestinationAddress; + + // Used for sending an receiving Teleporter messages. + ITeleporterMessenger public immutable teleporterMessenger; + + constructor( + address teleporterMessengerAddress, + bytes32 destinationBlockchainID_, + address nativeTokenDestinationAddress_ + ) { + currentBlockchainID = WarpMessenger(WARP_PRECOMPILE_ADDRESS) + .getBlockchainID(); + + require( + teleporterMessengerAddress != address(0), + "Invalid TeleporterMessenger Address" + ); + teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); + + require( + destinationBlockchainID_ != bytes32(0), + "Invalid Destination Chain ID" + ); + require( + destinationBlockchainID_ != currentBlockchainID, + "Cannot Bridge With Same Blockchain" + ); + destinationBlockchainID = destinationBlockchainID_; + + require( + nativeTokenDestinationAddress_ != address(0), + "Invalid Destination Contract Address" + ); + nativeTokenDestinationAddress = nativeTokenDestinationAddress_; + } + + /** + * @dev See {ITeleporterReceiver-receiveTeleporterMessage}. + * + * Receives a Teleporter message and routes to the appropriate internal function call. + */ + function receiveTeleporterMessage( + bytes32 senderBlockchainID, + address senderAddress, + bytes calldata message + ) external nonReentrant { + // Only allow the Teleporter messenger to deliver messages. + require( + msg.sender == address(teleporterMessenger), + "Unauthorized TeleporterMessenger contract" + ); + + // Only allow messages from the destination chain. + require( + senderBlockchainID == destinationBlockchainID, + "Invalid Destination Chain" + ); + + // Only allow the partner contract to send messages. + require( + senderAddress == nativeTokenDestinationAddress, + "Unauthorized Sender" + ); + + (address recipient, uint256 amount) = abi.decode( + message, + (address, uint256) + ); + require(recipient != address(0), "Invalid Recipient Address"); + + // Send to recipient + payable(recipient).transfer(amount); + + emit UnlockTokens(recipient, amount); + } + + /** + * @dev See {IERC20TokenSource-transferToDestination}. + */ + function transferToDestination( + address recipient, + address ERC20ContractAddress, + uint256 totalAmount, + uint256 feeAmount, + address[] calldata allowedRelayerAddresses + ) external nonReentrant { + // The recipient cannot be the zero address. + require(recipient != address(0), "Invalid Recipient Address"); + + // Lock tokens in this contract. Supports "fee/burn on transfer" ERC20 token + // implementations by only bridging the actual balance increase reflected by the call + // to transferFrom. + uint256 adjustedAmount = SafeERC20TransferFrom.safeTransferFrom( + IERC20(ERC20ContractAddress), + totalAmount + ); + + // Ensure that the adjusted amount is greater than the fee to be paid. + require( + adjustedAmount > feeAmount, + "ERC20TokenSource: insufficient adjusted amount" + ); + + // Allow the Teleporter messenger to spend the fee amount. + if (feeAmount > 0) { + IERC20(ERC20ContractAddress).safeIncreaseAllowance( + address(teleporterMessenger), + feeAmount + ); + } + + uint256 transferAmount = totalAmount - feeAmount; + + uint256 messageID = teleporterMessenger.sendCrossChainMessage( + TeleporterMessageInput({ + destinationChainID: destinationBlockchainID, + destinationAddress: nativeTokenDestinationAddress, + feeInfo: TeleporterFeeInfo({ + contractAddress: ERC20ContractAddress, + amount: feeAmount + }), + requiredGasLimit: MINT_NATIVE_TOKENS_REQUIRED_GAS, + allowedRelayerAddresses: allowedRelayerAddresses, + message: abi.encode(recipient, transferAmount) + }) + ); + + emit TransferToDestination({ + sender: msg.sender, + recipient: recipient, + ERC20ContractAddress: ERC20ContractAddress, + transferAmount: totalAmount, + feeAmount: feeAmount, + teleporterMessageID: messageID + }); + } +} diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol new file mode 100644 index 000000000..9e26798e3 --- /dev/null +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol @@ -0,0 +1,40 @@ +// (c) 2023, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +// SPDX-License-Identifier: Ecosystem + +pragma solidity 0.8.18; + +/** + * @dev Interface that describes functionalities for a contract that will lock tokens and send a + * Teleporter message to a NativeTokenDestination contract to mint native tokens on that chain. + */ +interface IERC20TokenSource { + /** + * @dev Emitted when tokens are locked in this bridge contract to be bridged to the destination chain. + */ + event TransferToDestination( + address indexed sender, + address indexed recipient, + address ERC20ContractAddress, + uint256 transferAmount, + uint256 feeAmount, + uint256 teleporterMessageID + ); + + /** + * @dev Emitted when tokens are unlocked on this chain. + */ + event UnlockTokens(address recipient, uint256 amount); + + /** + * @dev Transfers source chain native tokens to destination chain's native tokens. + */ + function transferToDestination( + address recipient, + address ERC20ContractAddress, + uint256 totalAmount, + uint256 feeAmount, + address[] calldata allowedRelayerAddresses + ) external; +} diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index d85f170ff..164ecc90e 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -132,7 +132,7 @@ contract NativeTokenDestination is } /** - * @dev See {INativeTokenMinter-bridgeTokens}. + * @dev See {INativeTokenDestination-transferToSource}. */ function transferToSource( address recipient, @@ -151,15 +151,15 @@ contract NativeTokenDestination is // Lock tokens in this bridge instance. Supports "fee/burn on transfer" ERC20 token // implementations by only bridging the actual balance increase reflected by the call // to transferFrom. - uint256 adjustedAmount = 0; + uint256 adjustedFeeAmount = 0; if (feeAmount > 0) { - adjustedAmount = SafeERC20TransferFrom.safeTransferFrom( + adjustedFeeAmount = SafeERC20TransferFrom.safeTransferFrom( IERC20(feeContractAddress), feeAmount ); IERC20(feeContractAddress).safeIncreaseAllowance( address(teleporterMessenger), - adjustedAmount + adjustedFeeAmount ); } @@ -172,7 +172,7 @@ contract NativeTokenDestination is destinationAddress: nativeTokenSourceAddress, feeInfo: TeleporterFeeInfo({ contractAddress: feeContractAddress, - amount: adjustedAmount + amount: adjustedFeeAmount }), requiredGasLimit: TRANSFER_NATIVE_TOKENS_REQUIRED_GAS, allowedRelayerAddresses: allowedRelayerAddresses, @@ -185,7 +185,7 @@ contract NativeTokenDestination is recipient: recipient, amount: msg.value, feeContractAddress: feeContractAddress, - feeAmount: adjustedAmount, + feeAmount: adjustedFeeAmount, teleporterMessageID: messageID }); } diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index c0006db38..fac28bfb4 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -102,7 +102,7 @@ contract NativeTokenSource is } /** - * @dev See {IERC20Bridge-bridgeTokens}. + * @dev See {INativeTokenSource-transferToDestination}. */ function transferToDestination( address recipient, @@ -116,15 +116,15 @@ contract NativeTokenSource is // Lock tokens in this bridge instance. Supports "fee/burn on transfer" ERC20 token // implementations by only bridging the actual balance increase reflected by the call // to transferFrom. - uint256 adjustedAmount = 0; + uint256 adjustedFeeAmount = 0; if (feeAmount > 0) { - adjustedAmount = SafeERC20TransferFrom.safeTransferFrom( + adjustedFeeAmount = SafeERC20TransferFrom.safeTransferFrom( IERC20(feeContractAddress), feeAmount ); IERC20(feeContractAddress).safeIncreaseAllowance( address(teleporterMessenger), - adjustedAmount + adjustedFeeAmount ); } @@ -134,7 +134,7 @@ contract NativeTokenSource is destinationAddress: nativeTokenDestinationAddress, feeInfo: TeleporterFeeInfo({ contractAddress: feeContractAddress, - amount: adjustedAmount + amount: adjustedFeeAmount }), requiredGasLimit: MINT_NATIVE_TOKENS_REQUIRED_GAS, allowedRelayerAddresses: allowedRelayerAddresses, @@ -147,7 +147,7 @@ contract NativeTokenSource is recipient: recipient, amount: msg.value, feeContractAddress: feeContractAddress, - feeAmount: adjustedAmount, + feeAmount: adjustedFeeAmount, teleporterMessageID: messageID }); } From 14b11b0889ace721a7ca10a56f2fde6206a7f6e6 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Fri, 27 Oct 2023 09:42:25 -0400 Subject: [PATCH 066/183] Add abi binding for ERCTokenSource --- .../ERC20TokenSource/ERC20TokenSource.go | 670 ++++++++++++++++++ scripts/abi_bindings.sh | 2 +- 2 files changed, 671 insertions(+), 1 deletion(-) create mode 100644 abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go new file mode 100644 index 000000000..6c32c97bd --- /dev/null +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go @@ -0,0 +1,670 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package erc20tokensource + +import ( + "errors" + "math/big" + "strings" + + "github.com/ava-labs/subnet-evm/accounts/abi" + "github.com/ava-labs/subnet-evm/accounts/abi/bind" + "github.com/ava-labs/subnet-evm/core/types" + "github.com/ava-labs/subnet-evm/interfaces" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = interfaces.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// ERC20TokenSourceMetaData contains all meta data concerning the ERC20TokenSource contract. +var ERC20TokenSourceMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"ERC20ContractAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"transferAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"ERC20ContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", +} + +// ERC20TokenSourceABI is the input ABI used to generate the binding from. +// Deprecated: Use ERC20TokenSourceMetaData.ABI instead. +var ERC20TokenSourceABI = ERC20TokenSourceMetaData.ABI + +// ERC20TokenSource is an auto generated Go binding around an Ethereum contract. +type ERC20TokenSource struct { + ERC20TokenSourceCaller // Read-only binding to the contract + ERC20TokenSourceTransactor // Write-only binding to the contract + ERC20TokenSourceFilterer // Log filterer for contract events +} + +// ERC20TokenSourceCaller is an auto generated read-only Go binding around an Ethereum contract. +type ERC20TokenSourceCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ERC20TokenSourceTransactor is an auto generated write-only Go binding around an Ethereum contract. +type ERC20TokenSourceTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ERC20TokenSourceFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type ERC20TokenSourceFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ERC20TokenSourceSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type ERC20TokenSourceSession struct { + Contract *ERC20TokenSource // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ERC20TokenSourceCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type ERC20TokenSourceCallerSession struct { + Contract *ERC20TokenSourceCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// ERC20TokenSourceTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type ERC20TokenSourceTransactorSession struct { + Contract *ERC20TokenSourceTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ERC20TokenSourceRaw is an auto generated low-level Go binding around an Ethereum contract. +type ERC20TokenSourceRaw struct { + Contract *ERC20TokenSource // Generic contract binding to access the raw methods on +} + +// ERC20TokenSourceCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type ERC20TokenSourceCallerRaw struct { + Contract *ERC20TokenSourceCaller // Generic read-only contract binding to access the raw methods on +} + +// ERC20TokenSourceTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type ERC20TokenSourceTransactorRaw struct { + Contract *ERC20TokenSourceTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewERC20TokenSource creates a new instance of ERC20TokenSource, bound to a specific deployed contract. +func NewERC20TokenSource(address common.Address, backend bind.ContractBackend) (*ERC20TokenSource, error) { + contract, err := bindERC20TokenSource(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &ERC20TokenSource{ERC20TokenSourceCaller: ERC20TokenSourceCaller{contract: contract}, ERC20TokenSourceTransactor: ERC20TokenSourceTransactor{contract: contract}, ERC20TokenSourceFilterer: ERC20TokenSourceFilterer{contract: contract}}, nil +} + +// NewERC20TokenSourceCaller creates a new read-only instance of ERC20TokenSource, bound to a specific deployed contract. +func NewERC20TokenSourceCaller(address common.Address, caller bind.ContractCaller) (*ERC20TokenSourceCaller, error) { + contract, err := bindERC20TokenSource(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &ERC20TokenSourceCaller{contract: contract}, nil +} + +// NewERC20TokenSourceTransactor creates a new write-only instance of ERC20TokenSource, bound to a specific deployed contract. +func NewERC20TokenSourceTransactor(address common.Address, transactor bind.ContractTransactor) (*ERC20TokenSourceTransactor, error) { + contract, err := bindERC20TokenSource(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &ERC20TokenSourceTransactor{contract: contract}, nil +} + +// NewERC20TokenSourceFilterer creates a new log filterer instance of ERC20TokenSource, bound to a specific deployed contract. +func NewERC20TokenSourceFilterer(address common.Address, filterer bind.ContractFilterer) (*ERC20TokenSourceFilterer, error) { + contract, err := bindERC20TokenSource(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &ERC20TokenSourceFilterer{contract: contract}, nil +} + +// bindERC20TokenSource binds a generic wrapper to an already deployed contract. +func bindERC20TokenSource(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := ERC20TokenSourceMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_ERC20TokenSource *ERC20TokenSourceRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _ERC20TokenSource.Contract.ERC20TokenSourceCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_ERC20TokenSource *ERC20TokenSourceRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ERC20TokenSource.Contract.ERC20TokenSourceTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_ERC20TokenSource *ERC20TokenSourceRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _ERC20TokenSource.Contract.ERC20TokenSourceTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_ERC20TokenSource *ERC20TokenSourceCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _ERC20TokenSource.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_ERC20TokenSource *ERC20TokenSourceTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ERC20TokenSource.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_ERC20TokenSource *ERC20TokenSourceTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _ERC20TokenSource.Contract.contract.Transact(opts, method, params...) +} + +// MINTNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xb6171f73. +// +// Solidity: function MINT_NATIVE_TOKENS_REQUIRED_GAS() view returns(uint256) +func (_ERC20TokenSource *ERC20TokenSourceCaller) MINTNATIVETOKENSREQUIREDGAS(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _ERC20TokenSource.contract.Call(opts, &out, "MINT_NATIVE_TOKENS_REQUIRED_GAS") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// MINTNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xb6171f73. +// +// Solidity: function MINT_NATIVE_TOKENS_REQUIRED_GAS() view returns(uint256) +func (_ERC20TokenSource *ERC20TokenSourceSession) MINTNATIVETOKENSREQUIREDGAS() (*big.Int, error) { + return _ERC20TokenSource.Contract.MINTNATIVETOKENSREQUIREDGAS(&_ERC20TokenSource.CallOpts) +} + +// MINTNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xb6171f73. +// +// Solidity: function MINT_NATIVE_TOKENS_REQUIRED_GAS() view returns(uint256) +func (_ERC20TokenSource *ERC20TokenSourceCallerSession) MINTNATIVETOKENSREQUIREDGAS() (*big.Int, error) { + return _ERC20TokenSource.Contract.MINTNATIVETOKENSREQUIREDGAS(&_ERC20TokenSource.CallOpts) +} + +// CurrentBlockchainID is a free data retrieval call binding the contract method 0x4950d2d0. +// +// Solidity: function currentBlockchainID() view returns(bytes32) +func (_ERC20TokenSource *ERC20TokenSourceCaller) CurrentBlockchainID(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _ERC20TokenSource.contract.Call(opts, &out, "currentBlockchainID") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// CurrentBlockchainID is a free data retrieval call binding the contract method 0x4950d2d0. +// +// Solidity: function currentBlockchainID() view returns(bytes32) +func (_ERC20TokenSource *ERC20TokenSourceSession) CurrentBlockchainID() ([32]byte, error) { + return _ERC20TokenSource.Contract.CurrentBlockchainID(&_ERC20TokenSource.CallOpts) +} + +// CurrentBlockchainID is a free data retrieval call binding the contract method 0x4950d2d0. +// +// Solidity: function currentBlockchainID() view returns(bytes32) +func (_ERC20TokenSource *ERC20TokenSourceCallerSession) CurrentBlockchainID() ([32]byte, error) { + return _ERC20TokenSource.Contract.CurrentBlockchainID(&_ERC20TokenSource.CallOpts) +} + +// DestinationBlockchainID is a free data retrieval call binding the contract method 0x41d3014d. +// +// Solidity: function destinationBlockchainID() view returns(bytes32) +func (_ERC20TokenSource *ERC20TokenSourceCaller) DestinationBlockchainID(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _ERC20TokenSource.contract.Call(opts, &out, "destinationBlockchainID") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// DestinationBlockchainID is a free data retrieval call binding the contract method 0x41d3014d. +// +// Solidity: function destinationBlockchainID() view returns(bytes32) +func (_ERC20TokenSource *ERC20TokenSourceSession) DestinationBlockchainID() ([32]byte, error) { + return _ERC20TokenSource.Contract.DestinationBlockchainID(&_ERC20TokenSource.CallOpts) +} + +// DestinationBlockchainID is a free data retrieval call binding the contract method 0x41d3014d. +// +// Solidity: function destinationBlockchainID() view returns(bytes32) +func (_ERC20TokenSource *ERC20TokenSourceCallerSession) DestinationBlockchainID() ([32]byte, error) { + return _ERC20TokenSource.Contract.DestinationBlockchainID(&_ERC20TokenSource.CallOpts) +} + +// NativeTokenDestinationAddress is a free data retrieval call binding the contract method 0xb8c9091a. +// +// Solidity: function nativeTokenDestinationAddress() view returns(address) +func (_ERC20TokenSource *ERC20TokenSourceCaller) NativeTokenDestinationAddress(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _ERC20TokenSource.contract.Call(opts, &out, "nativeTokenDestinationAddress") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// NativeTokenDestinationAddress is a free data retrieval call binding the contract method 0xb8c9091a. +// +// Solidity: function nativeTokenDestinationAddress() view returns(address) +func (_ERC20TokenSource *ERC20TokenSourceSession) NativeTokenDestinationAddress() (common.Address, error) { + return _ERC20TokenSource.Contract.NativeTokenDestinationAddress(&_ERC20TokenSource.CallOpts) +} + +// NativeTokenDestinationAddress is a free data retrieval call binding the contract method 0xb8c9091a. +// +// Solidity: function nativeTokenDestinationAddress() view returns(address) +func (_ERC20TokenSource *ERC20TokenSourceCallerSession) NativeTokenDestinationAddress() (common.Address, error) { + return _ERC20TokenSource.Contract.NativeTokenDestinationAddress(&_ERC20TokenSource.CallOpts) +} + +// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// +// Solidity: function teleporterMessenger() view returns(address) +func (_ERC20TokenSource *ERC20TokenSourceCaller) TeleporterMessenger(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _ERC20TokenSource.contract.Call(opts, &out, "teleporterMessenger") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// +// Solidity: function teleporterMessenger() view returns(address) +func (_ERC20TokenSource *ERC20TokenSourceSession) TeleporterMessenger() (common.Address, error) { + return _ERC20TokenSource.Contract.TeleporterMessenger(&_ERC20TokenSource.CallOpts) +} + +// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// +// Solidity: function teleporterMessenger() view returns(address) +func (_ERC20TokenSource *ERC20TokenSourceCallerSession) TeleporterMessenger() (common.Address, error) { + return _ERC20TokenSource.Contract.TeleporterMessenger(&_ERC20TokenSource.CallOpts) +} + +// ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. +// +// Solidity: function receiveTeleporterMessage(bytes32 senderBlockchainID, address senderAddress, bytes message) returns() +func (_ERC20TokenSource *ERC20TokenSourceTransactor) ReceiveTeleporterMessage(opts *bind.TransactOpts, senderBlockchainID [32]byte, senderAddress common.Address, message []byte) (*types.Transaction, error) { + return _ERC20TokenSource.contract.Transact(opts, "receiveTeleporterMessage", senderBlockchainID, senderAddress, message) +} + +// ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. +// +// Solidity: function receiveTeleporterMessage(bytes32 senderBlockchainID, address senderAddress, bytes message) returns() +func (_ERC20TokenSource *ERC20TokenSourceSession) ReceiveTeleporterMessage(senderBlockchainID [32]byte, senderAddress common.Address, message []byte) (*types.Transaction, error) { + return _ERC20TokenSource.Contract.ReceiveTeleporterMessage(&_ERC20TokenSource.TransactOpts, senderBlockchainID, senderAddress, message) +} + +// ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. +// +// Solidity: function receiveTeleporterMessage(bytes32 senderBlockchainID, address senderAddress, bytes message) returns() +func (_ERC20TokenSource *ERC20TokenSourceTransactorSession) ReceiveTeleporterMessage(senderBlockchainID [32]byte, senderAddress common.Address, message []byte) (*types.Transaction, error) { + return _ERC20TokenSource.Contract.ReceiveTeleporterMessage(&_ERC20TokenSource.TransactOpts, senderBlockchainID, senderAddress, message) +} + +// TransferToDestination is a paid mutator transaction binding the contract method 0x10a61f2b. +// +// Solidity: function transferToDestination(address recipient, address ERC20ContractAddress, uint256 totalAmount, uint256 feeAmount, address[] allowedRelayerAddresses) returns() +func (_ERC20TokenSource *ERC20TokenSourceTransactor) TransferToDestination(opts *bind.TransactOpts, recipient common.Address, ERC20ContractAddress common.Address, totalAmount *big.Int, feeAmount *big.Int, allowedRelayerAddresses []common.Address) (*types.Transaction, error) { + return _ERC20TokenSource.contract.Transact(opts, "transferToDestination", recipient, ERC20ContractAddress, totalAmount, feeAmount, allowedRelayerAddresses) +} + +// TransferToDestination is a paid mutator transaction binding the contract method 0x10a61f2b. +// +// Solidity: function transferToDestination(address recipient, address ERC20ContractAddress, uint256 totalAmount, uint256 feeAmount, address[] allowedRelayerAddresses) returns() +func (_ERC20TokenSource *ERC20TokenSourceSession) TransferToDestination(recipient common.Address, ERC20ContractAddress common.Address, totalAmount *big.Int, feeAmount *big.Int, allowedRelayerAddresses []common.Address) (*types.Transaction, error) { + return _ERC20TokenSource.Contract.TransferToDestination(&_ERC20TokenSource.TransactOpts, recipient, ERC20ContractAddress, totalAmount, feeAmount, allowedRelayerAddresses) +} + +// TransferToDestination is a paid mutator transaction binding the contract method 0x10a61f2b. +// +// Solidity: function transferToDestination(address recipient, address ERC20ContractAddress, uint256 totalAmount, uint256 feeAmount, address[] allowedRelayerAddresses) returns() +func (_ERC20TokenSource *ERC20TokenSourceTransactorSession) TransferToDestination(recipient common.Address, ERC20ContractAddress common.Address, totalAmount *big.Int, feeAmount *big.Int, allowedRelayerAddresses []common.Address) (*types.Transaction, error) { + return _ERC20TokenSource.Contract.TransferToDestination(&_ERC20TokenSource.TransactOpts, recipient, ERC20ContractAddress, totalAmount, feeAmount, allowedRelayerAddresses) +} + +// ERC20TokenSourceTransferToDestinationIterator is returned from FilterTransferToDestination and is used to iterate over the raw logs and unpacked data for TransferToDestination events raised by the ERC20TokenSource contract. +type ERC20TokenSourceTransferToDestinationIterator struct { + Event *ERC20TokenSourceTransferToDestination // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ERC20TokenSourceTransferToDestinationIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ERC20TokenSourceTransferToDestination) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ERC20TokenSourceTransferToDestination) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ERC20TokenSourceTransferToDestinationIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ERC20TokenSourceTransferToDestinationIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ERC20TokenSourceTransferToDestination represents a TransferToDestination event raised by the ERC20TokenSource contract. +type ERC20TokenSourceTransferToDestination struct { + Sender common.Address + Recipient common.Address + ERC20ContractAddress common.Address + TransferAmount *big.Int + FeeAmount *big.Int + TeleporterMessageID *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTransferToDestination is a free log retrieval operation binding the contract event 0x13a202fe5d8659b297514aa4630f23f3a30583706bf3aa067257552aa20e9ec3. +// +// Solidity: event TransferToDestination(address indexed sender, address indexed recipient, address ERC20ContractAddress, uint256 transferAmount, uint256 feeAmount, uint256 teleporterMessageID) +func (_ERC20TokenSource *ERC20TokenSourceFilterer) FilterTransferToDestination(opts *bind.FilterOpts, sender []common.Address, recipient []common.Address) (*ERC20TokenSourceTransferToDestinationIterator, error) { + + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + var recipientRule []interface{} + for _, recipientItem := range recipient { + recipientRule = append(recipientRule, recipientItem) + } + + logs, sub, err := _ERC20TokenSource.contract.FilterLogs(opts, "TransferToDestination", senderRule, recipientRule) + if err != nil { + return nil, err + } + return &ERC20TokenSourceTransferToDestinationIterator{contract: _ERC20TokenSource.contract, event: "TransferToDestination", logs: logs, sub: sub}, nil +} + +// WatchTransferToDestination is a free log subscription operation binding the contract event 0x13a202fe5d8659b297514aa4630f23f3a30583706bf3aa067257552aa20e9ec3. +// +// Solidity: event TransferToDestination(address indexed sender, address indexed recipient, address ERC20ContractAddress, uint256 transferAmount, uint256 feeAmount, uint256 teleporterMessageID) +func (_ERC20TokenSource *ERC20TokenSourceFilterer) WatchTransferToDestination(opts *bind.WatchOpts, sink chan<- *ERC20TokenSourceTransferToDestination, sender []common.Address, recipient []common.Address) (event.Subscription, error) { + + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + var recipientRule []interface{} + for _, recipientItem := range recipient { + recipientRule = append(recipientRule, recipientItem) + } + + logs, sub, err := _ERC20TokenSource.contract.WatchLogs(opts, "TransferToDestination", senderRule, recipientRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ERC20TokenSourceTransferToDestination) + if err := _ERC20TokenSource.contract.UnpackLog(event, "TransferToDestination", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseTransferToDestination is a log parse operation binding the contract event 0x13a202fe5d8659b297514aa4630f23f3a30583706bf3aa067257552aa20e9ec3. +// +// Solidity: event TransferToDestination(address indexed sender, address indexed recipient, address ERC20ContractAddress, uint256 transferAmount, uint256 feeAmount, uint256 teleporterMessageID) +func (_ERC20TokenSource *ERC20TokenSourceFilterer) ParseTransferToDestination(log types.Log) (*ERC20TokenSourceTransferToDestination, error) { + event := new(ERC20TokenSourceTransferToDestination) + if err := _ERC20TokenSource.contract.UnpackLog(event, "TransferToDestination", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ERC20TokenSourceUnlockTokensIterator is returned from FilterUnlockTokens and is used to iterate over the raw logs and unpacked data for UnlockTokens events raised by the ERC20TokenSource contract. +type ERC20TokenSourceUnlockTokensIterator struct { + Event *ERC20TokenSourceUnlockTokens // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ERC20TokenSourceUnlockTokensIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ERC20TokenSourceUnlockTokens) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ERC20TokenSourceUnlockTokens) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ERC20TokenSourceUnlockTokensIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ERC20TokenSourceUnlockTokensIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ERC20TokenSourceUnlockTokens represents a UnlockTokens event raised by the ERC20TokenSource contract. +type ERC20TokenSourceUnlockTokens struct { + Recipient common.Address + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterUnlockTokens is a free log retrieval operation binding the contract event 0x55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407. +// +// Solidity: event UnlockTokens(address recipient, uint256 amount) +func (_ERC20TokenSource *ERC20TokenSourceFilterer) FilterUnlockTokens(opts *bind.FilterOpts) (*ERC20TokenSourceUnlockTokensIterator, error) { + + logs, sub, err := _ERC20TokenSource.contract.FilterLogs(opts, "UnlockTokens") + if err != nil { + return nil, err + } + return &ERC20TokenSourceUnlockTokensIterator{contract: _ERC20TokenSource.contract, event: "UnlockTokens", logs: logs, sub: sub}, nil +} + +// WatchUnlockTokens is a free log subscription operation binding the contract event 0x55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407. +// +// Solidity: event UnlockTokens(address recipient, uint256 amount) +func (_ERC20TokenSource *ERC20TokenSourceFilterer) WatchUnlockTokens(opts *bind.WatchOpts, sink chan<- *ERC20TokenSourceUnlockTokens) (event.Subscription, error) { + + logs, sub, err := _ERC20TokenSource.contract.WatchLogs(opts, "UnlockTokens") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ERC20TokenSourceUnlockTokens) + if err := _ERC20TokenSource.contract.UnpackLog(event, "UnlockTokens", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseUnlockTokens is a log parse operation binding the contract event 0x55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407. +// +// Solidity: event UnlockTokens(address recipient, uint256 amount) +func (_ERC20TokenSource *ERC20TokenSourceFilterer) ParseUnlockTokens(log types.Log) (*ERC20TokenSourceUnlockTokens, error) { + event := new(ERC20TokenSourceUnlockTokens) + if err := _ERC20TokenSource.contract.UnpackLog(event, "UnlockTokens", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/scripts/abi_bindings.sh b/scripts/abi_bindings.sh index ccd307f27..307a9c113 100755 --- a/scripts/abi_bindings.sh +++ b/scripts/abi_bindings.sh @@ -13,7 +13,7 @@ TELEPORTER_PATH=$( cd .. && pwd ) -DEFAULT_CONTRACT_LIST="TeleporterMessenger ERC20Bridge ExampleCrossChainMessenger BlockHashPublisher BlockHashReceiver BridgeToken NativeTokenSource NativeTokenDestination" +DEFAULT_CONTRACT_LIST="TeleporterMessenger ERC20Bridge ExampleCrossChainMessenger BlockHashPublisher BlockHashReceiver BridgeToken NativeTokenSource NativeTokenDestination ERC20TokenSource" CONTRACT_LIST= HELP= From 06aee492678275320cc5ca8dbceccc4e078c0d0d Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Fri, 27 Oct 2023 11:14:04 -0400 Subject: [PATCH 067/183] Add ExampleERC20 to abi bindings --- .../go/Mocks/ExampleERC20/ExampleERC20.go | 843 ++++++++++++++++++ scripts/abi_bindings.sh | 2 +- 2 files changed, 844 insertions(+), 1 deletion(-) create mode 100644 abi-bindings/go/Mocks/ExampleERC20/ExampleERC20.go diff --git a/abi-bindings/go/Mocks/ExampleERC20/ExampleERC20.go b/abi-bindings/go/Mocks/ExampleERC20/ExampleERC20.go new file mode 100644 index 000000000..f47659f75 --- /dev/null +++ b/abi-bindings/go/Mocks/ExampleERC20/ExampleERC20.go @@ -0,0 +1,843 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package exampleerc20 + +import ( + "errors" + "math/big" + "strings" + + "github.com/ava-labs/subnet-evm/accounts/abi" + "github.com/ava-labs/subnet-evm/accounts/abi/bind" + "github.com/ava-labs/subnet-evm/core/types" + "github.com/ava-labs/subnet-evm/interfaces" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = interfaces.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// ExampleERC20MetaData contains all meta data concerning the ExampleERC20 contract. +var ExampleERC20MetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"burnFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"subtractedValue\",\"type\":\"uint256\"}],\"name\":\"decreaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"addedValue\",\"type\":\"uint256\"}],\"name\":\"increaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"mint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", +} + +// ExampleERC20ABI is the input ABI used to generate the binding from. +// Deprecated: Use ExampleERC20MetaData.ABI instead. +var ExampleERC20ABI = ExampleERC20MetaData.ABI + +// ExampleERC20 is an auto generated Go binding around an Ethereum contract. +type ExampleERC20 struct { + ExampleERC20Caller // Read-only binding to the contract + ExampleERC20Transactor // Write-only binding to the contract + ExampleERC20Filterer // Log filterer for contract events +} + +// ExampleERC20Caller is an auto generated read-only Go binding around an Ethereum contract. +type ExampleERC20Caller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ExampleERC20Transactor is an auto generated write-only Go binding around an Ethereum contract. +type ExampleERC20Transactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ExampleERC20Filterer is an auto generated log filtering Go binding around an Ethereum contract events. +type ExampleERC20Filterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ExampleERC20Session is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type ExampleERC20Session struct { + Contract *ExampleERC20 // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ExampleERC20CallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type ExampleERC20CallerSession struct { + Contract *ExampleERC20Caller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// ExampleERC20TransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type ExampleERC20TransactorSession struct { + Contract *ExampleERC20Transactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ExampleERC20Raw is an auto generated low-level Go binding around an Ethereum contract. +type ExampleERC20Raw struct { + Contract *ExampleERC20 // Generic contract binding to access the raw methods on +} + +// ExampleERC20CallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type ExampleERC20CallerRaw struct { + Contract *ExampleERC20Caller // Generic read-only contract binding to access the raw methods on +} + +// ExampleERC20TransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type ExampleERC20TransactorRaw struct { + Contract *ExampleERC20Transactor // Generic write-only contract binding to access the raw methods on +} + +// NewExampleERC20 creates a new instance of ExampleERC20, bound to a specific deployed contract. +func NewExampleERC20(address common.Address, backend bind.ContractBackend) (*ExampleERC20, error) { + contract, err := bindExampleERC20(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &ExampleERC20{ExampleERC20Caller: ExampleERC20Caller{contract: contract}, ExampleERC20Transactor: ExampleERC20Transactor{contract: contract}, ExampleERC20Filterer: ExampleERC20Filterer{contract: contract}}, nil +} + +// NewExampleERC20Caller creates a new read-only instance of ExampleERC20, bound to a specific deployed contract. +func NewExampleERC20Caller(address common.Address, caller bind.ContractCaller) (*ExampleERC20Caller, error) { + contract, err := bindExampleERC20(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &ExampleERC20Caller{contract: contract}, nil +} + +// NewExampleERC20Transactor creates a new write-only instance of ExampleERC20, bound to a specific deployed contract. +func NewExampleERC20Transactor(address common.Address, transactor bind.ContractTransactor) (*ExampleERC20Transactor, error) { + contract, err := bindExampleERC20(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &ExampleERC20Transactor{contract: contract}, nil +} + +// NewExampleERC20Filterer creates a new log filterer instance of ExampleERC20, bound to a specific deployed contract. +func NewExampleERC20Filterer(address common.Address, filterer bind.ContractFilterer) (*ExampleERC20Filterer, error) { + contract, err := bindExampleERC20(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &ExampleERC20Filterer{contract: contract}, nil +} + +// bindExampleERC20 binds a generic wrapper to an already deployed contract. +func bindExampleERC20(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := ExampleERC20MetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_ExampleERC20 *ExampleERC20Raw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _ExampleERC20.Contract.ExampleERC20Caller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_ExampleERC20 *ExampleERC20Raw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ExampleERC20.Contract.ExampleERC20Transactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_ExampleERC20 *ExampleERC20Raw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _ExampleERC20.Contract.ExampleERC20Transactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_ExampleERC20 *ExampleERC20CallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _ExampleERC20.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_ExampleERC20 *ExampleERC20TransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ExampleERC20.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_ExampleERC20 *ExampleERC20TransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _ExampleERC20.Contract.contract.Transact(opts, method, params...) +} + +// Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. +// +// Solidity: function allowance(address owner, address spender) view returns(uint256) +func (_ExampleERC20 *ExampleERC20Caller) Allowance(opts *bind.CallOpts, owner common.Address, spender common.Address) (*big.Int, error) { + var out []interface{} + err := _ExampleERC20.contract.Call(opts, &out, "allowance", owner, spender) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. +// +// Solidity: function allowance(address owner, address spender) view returns(uint256) +func (_ExampleERC20 *ExampleERC20Session) Allowance(owner common.Address, spender common.Address) (*big.Int, error) { + return _ExampleERC20.Contract.Allowance(&_ExampleERC20.CallOpts, owner, spender) +} + +// Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. +// +// Solidity: function allowance(address owner, address spender) view returns(uint256) +func (_ExampleERC20 *ExampleERC20CallerSession) Allowance(owner common.Address, spender common.Address) (*big.Int, error) { + return _ExampleERC20.Contract.Allowance(&_ExampleERC20.CallOpts, owner, spender) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address account) view returns(uint256) +func (_ExampleERC20 *ExampleERC20Caller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) { + var out []interface{} + err := _ExampleERC20.contract.Call(opts, &out, "balanceOf", account) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address account) view returns(uint256) +func (_ExampleERC20 *ExampleERC20Session) BalanceOf(account common.Address) (*big.Int, error) { + return _ExampleERC20.Contract.BalanceOf(&_ExampleERC20.CallOpts, account) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address account) view returns(uint256) +func (_ExampleERC20 *ExampleERC20CallerSession) BalanceOf(account common.Address) (*big.Int, error) { + return _ExampleERC20.Contract.BalanceOf(&_ExampleERC20.CallOpts, account) +} + +// Decimals is a free data retrieval call binding the contract method 0x313ce567. +// +// Solidity: function decimals() view returns(uint8) +func (_ExampleERC20 *ExampleERC20Caller) Decimals(opts *bind.CallOpts) (uint8, error) { + var out []interface{} + err := _ExampleERC20.contract.Call(opts, &out, "decimals") + + if err != nil { + return *new(uint8), err + } + + out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) + + return out0, err + +} + +// Decimals is a free data retrieval call binding the contract method 0x313ce567. +// +// Solidity: function decimals() view returns(uint8) +func (_ExampleERC20 *ExampleERC20Session) Decimals() (uint8, error) { + return _ExampleERC20.Contract.Decimals(&_ExampleERC20.CallOpts) +} + +// Decimals is a free data retrieval call binding the contract method 0x313ce567. +// +// Solidity: function decimals() view returns(uint8) +func (_ExampleERC20 *ExampleERC20CallerSession) Decimals() (uint8, error) { + return _ExampleERC20.Contract.Decimals(&_ExampleERC20.CallOpts) +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_ExampleERC20 *ExampleERC20Caller) Name(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _ExampleERC20.contract.Call(opts, &out, "name") + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_ExampleERC20 *ExampleERC20Session) Name() (string, error) { + return _ExampleERC20.Contract.Name(&_ExampleERC20.CallOpts) +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_ExampleERC20 *ExampleERC20CallerSession) Name() (string, error) { + return _ExampleERC20.Contract.Name(&_ExampleERC20.CallOpts) +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_ExampleERC20 *ExampleERC20Caller) Symbol(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _ExampleERC20.contract.Call(opts, &out, "symbol") + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_ExampleERC20 *ExampleERC20Session) Symbol() (string, error) { + return _ExampleERC20.Contract.Symbol(&_ExampleERC20.CallOpts) +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_ExampleERC20 *ExampleERC20CallerSession) Symbol() (string, error) { + return _ExampleERC20.Contract.Symbol(&_ExampleERC20.CallOpts) +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_ExampleERC20 *ExampleERC20Caller) TotalSupply(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _ExampleERC20.contract.Call(opts, &out, "totalSupply") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_ExampleERC20 *ExampleERC20Session) TotalSupply() (*big.Int, error) { + return _ExampleERC20.Contract.TotalSupply(&_ExampleERC20.CallOpts) +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_ExampleERC20 *ExampleERC20CallerSession) TotalSupply() (*big.Int, error) { + return _ExampleERC20.Contract.TotalSupply(&_ExampleERC20.CallOpts) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address spender, uint256 amount) returns(bool) +func (_ExampleERC20 *ExampleERC20Transactor) Approve(opts *bind.TransactOpts, spender common.Address, amount *big.Int) (*types.Transaction, error) { + return _ExampleERC20.contract.Transact(opts, "approve", spender, amount) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address spender, uint256 amount) returns(bool) +func (_ExampleERC20 *ExampleERC20Session) Approve(spender common.Address, amount *big.Int) (*types.Transaction, error) { + return _ExampleERC20.Contract.Approve(&_ExampleERC20.TransactOpts, spender, amount) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address spender, uint256 amount) returns(bool) +func (_ExampleERC20 *ExampleERC20TransactorSession) Approve(spender common.Address, amount *big.Int) (*types.Transaction, error) { + return _ExampleERC20.Contract.Approve(&_ExampleERC20.TransactOpts, spender, amount) +} + +// Burn is a paid mutator transaction binding the contract method 0x42966c68. +// +// Solidity: function burn(uint256 amount) returns() +func (_ExampleERC20 *ExampleERC20Transactor) Burn(opts *bind.TransactOpts, amount *big.Int) (*types.Transaction, error) { + return _ExampleERC20.contract.Transact(opts, "burn", amount) +} + +// Burn is a paid mutator transaction binding the contract method 0x42966c68. +// +// Solidity: function burn(uint256 amount) returns() +func (_ExampleERC20 *ExampleERC20Session) Burn(amount *big.Int) (*types.Transaction, error) { + return _ExampleERC20.Contract.Burn(&_ExampleERC20.TransactOpts, amount) +} + +// Burn is a paid mutator transaction binding the contract method 0x42966c68. +// +// Solidity: function burn(uint256 amount) returns() +func (_ExampleERC20 *ExampleERC20TransactorSession) Burn(amount *big.Int) (*types.Transaction, error) { + return _ExampleERC20.Contract.Burn(&_ExampleERC20.TransactOpts, amount) +} + +// BurnFrom is a paid mutator transaction binding the contract method 0x79cc6790. +// +// Solidity: function burnFrom(address account, uint256 amount) returns() +func (_ExampleERC20 *ExampleERC20Transactor) BurnFrom(opts *bind.TransactOpts, account common.Address, amount *big.Int) (*types.Transaction, error) { + return _ExampleERC20.contract.Transact(opts, "burnFrom", account, amount) +} + +// BurnFrom is a paid mutator transaction binding the contract method 0x79cc6790. +// +// Solidity: function burnFrom(address account, uint256 amount) returns() +func (_ExampleERC20 *ExampleERC20Session) BurnFrom(account common.Address, amount *big.Int) (*types.Transaction, error) { + return _ExampleERC20.Contract.BurnFrom(&_ExampleERC20.TransactOpts, account, amount) +} + +// BurnFrom is a paid mutator transaction binding the contract method 0x79cc6790. +// +// Solidity: function burnFrom(address account, uint256 amount) returns() +func (_ExampleERC20 *ExampleERC20TransactorSession) BurnFrom(account common.Address, amount *big.Int) (*types.Transaction, error) { + return _ExampleERC20.Contract.BurnFrom(&_ExampleERC20.TransactOpts, account, amount) +} + +// DecreaseAllowance is a paid mutator transaction binding the contract method 0xa457c2d7. +// +// Solidity: function decreaseAllowance(address spender, uint256 subtractedValue) returns(bool) +func (_ExampleERC20 *ExampleERC20Transactor) DecreaseAllowance(opts *bind.TransactOpts, spender common.Address, subtractedValue *big.Int) (*types.Transaction, error) { + return _ExampleERC20.contract.Transact(opts, "decreaseAllowance", spender, subtractedValue) +} + +// DecreaseAllowance is a paid mutator transaction binding the contract method 0xa457c2d7. +// +// Solidity: function decreaseAllowance(address spender, uint256 subtractedValue) returns(bool) +func (_ExampleERC20 *ExampleERC20Session) DecreaseAllowance(spender common.Address, subtractedValue *big.Int) (*types.Transaction, error) { + return _ExampleERC20.Contract.DecreaseAllowance(&_ExampleERC20.TransactOpts, spender, subtractedValue) +} + +// DecreaseAllowance is a paid mutator transaction binding the contract method 0xa457c2d7. +// +// Solidity: function decreaseAllowance(address spender, uint256 subtractedValue) returns(bool) +func (_ExampleERC20 *ExampleERC20TransactorSession) DecreaseAllowance(spender common.Address, subtractedValue *big.Int) (*types.Transaction, error) { + return _ExampleERC20.Contract.DecreaseAllowance(&_ExampleERC20.TransactOpts, spender, subtractedValue) +} + +// IncreaseAllowance is a paid mutator transaction binding the contract method 0x39509351. +// +// Solidity: function increaseAllowance(address spender, uint256 addedValue) returns(bool) +func (_ExampleERC20 *ExampleERC20Transactor) IncreaseAllowance(opts *bind.TransactOpts, spender common.Address, addedValue *big.Int) (*types.Transaction, error) { + return _ExampleERC20.contract.Transact(opts, "increaseAllowance", spender, addedValue) +} + +// IncreaseAllowance is a paid mutator transaction binding the contract method 0x39509351. +// +// Solidity: function increaseAllowance(address spender, uint256 addedValue) returns(bool) +func (_ExampleERC20 *ExampleERC20Session) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error) { + return _ExampleERC20.Contract.IncreaseAllowance(&_ExampleERC20.TransactOpts, spender, addedValue) +} + +// IncreaseAllowance is a paid mutator transaction binding the contract method 0x39509351. +// +// Solidity: function increaseAllowance(address spender, uint256 addedValue) returns(bool) +func (_ExampleERC20 *ExampleERC20TransactorSession) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error) { + return _ExampleERC20.Contract.IncreaseAllowance(&_ExampleERC20.TransactOpts, spender, addedValue) +} + +// Mint is a paid mutator transaction binding the contract method 0xa0712d68. +// +// Solidity: function mint(uint256 amount) returns() +func (_ExampleERC20 *ExampleERC20Transactor) Mint(opts *bind.TransactOpts, amount *big.Int) (*types.Transaction, error) { + return _ExampleERC20.contract.Transact(opts, "mint", amount) +} + +// Mint is a paid mutator transaction binding the contract method 0xa0712d68. +// +// Solidity: function mint(uint256 amount) returns() +func (_ExampleERC20 *ExampleERC20Session) Mint(amount *big.Int) (*types.Transaction, error) { + return _ExampleERC20.Contract.Mint(&_ExampleERC20.TransactOpts, amount) +} + +// Mint is a paid mutator transaction binding the contract method 0xa0712d68. +// +// Solidity: function mint(uint256 amount) returns() +func (_ExampleERC20 *ExampleERC20TransactorSession) Mint(amount *big.Int) (*types.Transaction, error) { + return _ExampleERC20.Contract.Mint(&_ExampleERC20.TransactOpts, amount) +} + +// Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. +// +// Solidity: function transfer(address to, uint256 amount) returns(bool) +func (_ExampleERC20 *ExampleERC20Transactor) Transfer(opts *bind.TransactOpts, to common.Address, amount *big.Int) (*types.Transaction, error) { + return _ExampleERC20.contract.Transact(opts, "transfer", to, amount) +} + +// Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. +// +// Solidity: function transfer(address to, uint256 amount) returns(bool) +func (_ExampleERC20 *ExampleERC20Session) Transfer(to common.Address, amount *big.Int) (*types.Transaction, error) { + return _ExampleERC20.Contract.Transfer(&_ExampleERC20.TransactOpts, to, amount) +} + +// Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. +// +// Solidity: function transfer(address to, uint256 amount) returns(bool) +func (_ExampleERC20 *ExampleERC20TransactorSession) Transfer(to common.Address, amount *big.Int) (*types.Transaction, error) { + return _ExampleERC20.Contract.Transfer(&_ExampleERC20.TransactOpts, to, amount) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 amount) returns(bool) +func (_ExampleERC20 *ExampleERC20Transactor) TransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, amount *big.Int) (*types.Transaction, error) { + return _ExampleERC20.contract.Transact(opts, "transferFrom", from, to, amount) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 amount) returns(bool) +func (_ExampleERC20 *ExampleERC20Session) TransferFrom(from common.Address, to common.Address, amount *big.Int) (*types.Transaction, error) { + return _ExampleERC20.Contract.TransferFrom(&_ExampleERC20.TransactOpts, from, to, amount) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 amount) returns(bool) +func (_ExampleERC20 *ExampleERC20TransactorSession) TransferFrom(from common.Address, to common.Address, amount *big.Int) (*types.Transaction, error) { + return _ExampleERC20.Contract.TransferFrom(&_ExampleERC20.TransactOpts, from, to, amount) +} + +// ExampleERC20ApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the ExampleERC20 contract. +type ExampleERC20ApprovalIterator struct { + Event *ExampleERC20Approval // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ExampleERC20ApprovalIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ExampleERC20Approval) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ExampleERC20Approval) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ExampleERC20ApprovalIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ExampleERC20ApprovalIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ExampleERC20Approval represents a Approval event raised by the ExampleERC20 contract. +type ExampleERC20Approval struct { + Owner common.Address + Spender common.Address + Value *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterApproval is a free log retrieval operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) +func (_ExampleERC20 *ExampleERC20Filterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, spender []common.Address) (*ExampleERC20ApprovalIterator, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var spenderRule []interface{} + for _, spenderItem := range spender { + spenderRule = append(spenderRule, spenderItem) + } + + logs, sub, err := _ExampleERC20.contract.FilterLogs(opts, "Approval", ownerRule, spenderRule) + if err != nil { + return nil, err + } + return &ExampleERC20ApprovalIterator{contract: _ExampleERC20.contract, event: "Approval", logs: logs, sub: sub}, nil +} + +// WatchApproval is a free log subscription operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) +func (_ExampleERC20 *ExampleERC20Filterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *ExampleERC20Approval, owner []common.Address, spender []common.Address) (event.Subscription, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var spenderRule []interface{} + for _, spenderItem := range spender { + spenderRule = append(spenderRule, spenderItem) + } + + logs, sub, err := _ExampleERC20.contract.WatchLogs(opts, "Approval", ownerRule, spenderRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ExampleERC20Approval) + if err := _ExampleERC20.contract.UnpackLog(event, "Approval", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseApproval is a log parse operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) +func (_ExampleERC20 *ExampleERC20Filterer) ParseApproval(log types.Log) (*ExampleERC20Approval, error) { + event := new(ExampleERC20Approval) + if err := _ExampleERC20.contract.UnpackLog(event, "Approval", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ExampleERC20TransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the ExampleERC20 contract. +type ExampleERC20TransferIterator struct { + Event *ExampleERC20Transfer // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ExampleERC20TransferIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ExampleERC20Transfer) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ExampleERC20Transfer) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ExampleERC20TransferIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ExampleERC20TransferIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ExampleERC20Transfer represents a Transfer event raised by the ExampleERC20 contract. +type ExampleERC20Transfer struct { + From common.Address + To common.Address + Value *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTransfer is a free log retrieval operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 value) +func (_ExampleERC20 *ExampleERC20Filterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*ExampleERC20TransferIterator, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + + logs, sub, err := _ExampleERC20.contract.FilterLogs(opts, "Transfer", fromRule, toRule) + if err != nil { + return nil, err + } + return &ExampleERC20TransferIterator{contract: _ExampleERC20.contract, event: "Transfer", logs: logs, sub: sub}, nil +} + +// WatchTransfer is a free log subscription operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 value) +func (_ExampleERC20 *ExampleERC20Filterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *ExampleERC20Transfer, from []common.Address, to []common.Address) (event.Subscription, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + + logs, sub, err := _ExampleERC20.contract.WatchLogs(opts, "Transfer", fromRule, toRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ExampleERC20Transfer) + if err := _ExampleERC20.contract.UnpackLog(event, "Transfer", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseTransfer is a log parse operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 value) +func (_ExampleERC20 *ExampleERC20Filterer) ParseTransfer(log types.Log) (*ExampleERC20Transfer, error) { + event := new(ExampleERC20Transfer) + if err := _ExampleERC20.contract.UnpackLog(event, "Transfer", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/scripts/abi_bindings.sh b/scripts/abi_bindings.sh index 307a9c113..3e77891d9 100755 --- a/scripts/abi_bindings.sh +++ b/scripts/abi_bindings.sh @@ -13,7 +13,7 @@ TELEPORTER_PATH=$( cd .. && pwd ) -DEFAULT_CONTRACT_LIST="TeleporterMessenger ERC20Bridge ExampleCrossChainMessenger BlockHashPublisher BlockHashReceiver BridgeToken NativeTokenSource NativeTokenDestination ERC20TokenSource" +DEFAULT_CONTRACT_LIST="TeleporterMessenger ERC20Bridge ExampleCrossChainMessenger BlockHashPublisher BlockHashReceiver BridgeToken NativeTokenSource NativeTokenDestination ERC20TokenSource ExampleERC20" CONTRACT_LIST= HELP= From ea0ed4ceaa3698260b6f15ad21973f0e1a56012c Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Fri, 27 Oct 2023 11:46:13 -0400 Subject: [PATCH 068/183] Add ERC20 to native bridge test --- tests/e2e_test.go | 1 + tests/erc20_to_native_token_bridge.go | 203 ++++++++++++++++++++++++++ tests/native_token_bridge.go | 10 +- 3 files changed, 209 insertions(+), 5 deletions(-) create mode 100644 tests/erc20_to_native_token_bridge.go diff --git a/tests/e2e_test.go b/tests/e2e_test.go index ea838d4b3..cd095786e 100644 --- a/tests/e2e_test.go +++ b/tests/e2e_test.go @@ -44,4 +44,5 @@ var _ = ginkgo.AfterSuite(testUtils.TearDownNetwork) var _ = ginkgo.Describe("[Teleporter integration tests]", func() { ginkgo.It("Send a message from Subnet A to Subnet B", BasicOneWaySend) ginkgo.It("Send native tokens from subnet A to B and back", NativeTokenBridge) + ginkgo.It("Send ERC20 tokens from subnet A to Native tokens on subnet B and back", ERC20ToNativeTokenBridge) }) diff --git a/tests/erc20_to_native_token_bridge.go b/tests/erc20_to_native_token_bridge.go new file mode 100644 index 000000000..e5aef0789 --- /dev/null +++ b/tests/erc20_to_native_token_bridge.go @@ -0,0 +1,203 @@ +package tests + +import ( + "context" + "crypto/ecdsa" + "math/big" + + "github.com/ava-labs/subnet-evm/accounts/abi/bind" + "github.com/ava-labs/subnet-evm/core/types" + erc20tokensource "github.com/ava-labs/teleporter/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource" + exampleerc20 "github.com/ava-labs/teleporter/abi-bindings/go/Mocks/ExampleERC20" + nativetokendestination "github.com/ava-labs/teleporter/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination" + "github.com/ava-labs/teleporter/tests/utils" + deploymentUtils "github.com/ava-labs/teleporter/utils/deployment-utils" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/log" + . "github.com/onsi/gomega" +) + +func ERC20ToNativeTokenBridge() { + const ( + tokenReserve = uint64(1e15) + valueToSend1 = tokenReserve / 4 + valueToSend2 = tokenReserve + valueToReturn = valueToSend1 / 4 + + bridgeDeployerKeyStr = "aad7440febfc8f9d73a58c3cb1f1754779a566978f9ebffcd4f4698e9b043985" + ExampleERC20ByteCodeFile = "./contracts/out/ExampleERC20.sol/ExampleERC20.json" + ERC20TokenSourceByteCodeFile = "./contracts/out/ERC20TokenSource.sol/ERC20TokenSource.json" + NativeTokenDestinationByteCodeFile = "./contracts/out/NativeTokenDestination.sol/NativeTokenDestination.json" + ) + var ( + ctx = context.Background() + nativeTokenBridgeDeployer = common.HexToAddress("0x1337cfd2dCff6270615B90938aCB1efE79801704") + tokenReceiverAddress = common.HexToAddress("0x0123456789012345678901234567890123456789") + ) + + subnetA := utils.GetSubnetATestInfo() + subnetB := utils.GetSubnetBTestInfo() + teleporterContractAddress := utils.GetTeleporterContractAddress() + + // Info we need to calculate for the test + nativeTokenBridgeDeployerPK, err := crypto.HexToECDSA(bridgeDeployerKeyStr) + Expect(err).Should(BeNil()) + nativeTokenBridgeContractAddress, err := deploymentUtils.DeriveEVMContractAddress(nativeTokenBridgeDeployer, 0) + Expect(err).Should(BeNil()) + log.Info("Native Token Bridge Contract Address: " + nativeTokenBridgeContractAddress.Hex()) + var exampleERC20ContractAddress common.Address + + { // Deploy the contracts + erc20TokenSourceBytecode, err := deploymentUtils.ExtractByteCode(ERC20TokenSourceByteCodeFile) + Expect(err).Should(BeNil()) + chainATransactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, subnetA.ChainID) + Expect(err).Should(BeNil()) + erc20TokenSourceAbi, err := erc20tokensource.ERC20TokenSourceMetaData.GetAbi() + Expect(err).Should(BeNil()) + _, txA, _, err := bind.DeployContract(chainATransactor, *erc20TokenSourceAbi, erc20TokenSourceBytecode, subnetA.WSClient, teleporterContractAddress, subnetB.BlockchainID, nativeTokenBridgeContractAddress) + Expect(err).Should(BeNil()) + + // Both contracts in this test will be deployed to 0xAcB633F5B00099c7ec187eB00156c5cd9D854b5B, + // though they do not necessarily have to be deployed at the same address, each contract needs + // to know the address of the other. + // The nativeTokenDestination contract must be added to "adminAddresses" of "contractNativeMinterConfig" + // in the genesis file for the subnet. This will allow it to call the native minter precompile. + nativeTokenDestinationBytecode, err := deploymentUtils.ExtractByteCode(NativeTokenDestinationByteCodeFile) + Expect(err).Should(BeNil()) + chainBTransactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, subnetB.ChainID) + Expect(err).Should(BeNil()) + nativeTokenDestinationAbi, err := nativetokendestination.NativeTokenDestinationMetaData.GetAbi() + Expect(err).Should(BeNil()) + _, txB, _, err := bind.DeployContract(chainBTransactor, *nativeTokenDestinationAbi, nativeTokenDestinationBytecode, subnetB.WSClient, teleporterContractAddress, subnetA.BlockchainID, nativeTokenBridgeContractAddress, new(big.Int).SetUint64(tokenReserve)) + Expect(err).Should(BeNil()) + + // Deploy an example ERC20 contract to be used as the source token + exampleERC20Bytecode, err := deploymentUtils.ExtractByteCode(ExampleERC20ByteCodeFile) + Expect(err).Should(BeNil()) + exampleERC20Abi, err := exampleerc20.ExampleERC20MetaData.GetAbi() + Expect(err).Should(BeNil()) + exampleERC20ContractAddress, txExampleERC20, _, err := bind.DeployContract(chainATransactor, *exampleERC20Abi, exampleERC20Bytecode, subnetA.WSClient, "Ignored", "Params") + Expect(err).Should(BeNil()) + + // Wait for transaction, then check code was deployed + utils.WaitForTransaction(ctx, txA.Hash(), subnetA.WSClient) + bridgeCodeA, err := subnetA.WSClient.CodeAt(ctx, nativeTokenBridgeContractAddress, nil) + Expect(err).Should(BeNil()) + Expect(len(bridgeCodeA)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode + + // Wait for transaction, then check code was deployed + utils.WaitForTransaction(ctx, txB.Hash(), subnetB.WSClient) + bridgeCodeB, err := subnetB.WSClient.CodeAt(ctx, nativeTokenBridgeContractAddress, nil) + Expect(err).Should(BeNil()) + Expect(len(bridgeCodeB)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode + + // Wait for transaction, then check code was deployed + utils.WaitForTransaction(ctx, txExampleERC20.Hash(), subnetA.WSClient) + exampleERC20Code, err := subnetB.WSClient.CodeAt(ctx, exampleERC20ContractAddress, nil) + Expect(err).Should(BeNil()) + Expect(len(exampleERC20Code)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode + + log.Info("Finished deploying contracts") + } + + // Create abi objects to call the contract with + nativeTokenDestination, err := nativetokendestination.NewNativeTokenDestination(nativeTokenBridgeContractAddress, subnetB.WSClient) + Expect(err).Should(BeNil()) + erc20TokenSource, err := erc20tokensource.NewERC20TokenSource(nativeTokenBridgeContractAddress, subnetA.WSClient) + Expect(err).Should(BeNil()) + exampleERC20, err := exampleerc20.NewExampleERC20(exampleERC20ContractAddress, subnetA.WSClient) + Expect(err).Should(BeNil()) + + // Helper function + sendTokensToSource := func(valueToSend uint64, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { + transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, subnetB.ChainID) + Expect(err).Should(BeNil()) + transactor.Value = new(big.Int).SetUint64(valueToSend) + + tx, err := nativeTokenDestination.TransferToSource(transactor, toAddress, common.Address{}, big.NewInt(0), []common.Address{}) + Expect(err).Should(BeNil()) + log.Info("Sent TransferToSource transaction on destination chain", "sourceChainID", subnetA.BlockchainID, "txHash", tx.Hash().Hex()) + + receipt := utils.WaitForTransaction(ctx, tx.Hash(), subnetB.WSClient) + Expect(err).Should(BeNil()) + Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + + utils.RelayMessage(ctx, receipt.BlockHash, receipt.BlockNumber, subnetB, subnetA) + return receipt + } + + // Helper function + sendTokensToDestination := func(valueToSend uint64, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { + transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, subnetA.ChainID) + Expect(err).Should(BeNil()) + + tx, err := erc20TokenSource.TransferToDestination(transactor, toAddress, exampleERC20ContractAddress, new(big.Int).SetUint64(valueToSend), big.NewInt(0), []common.Address{}) + Expect(err).Should(BeNil()) + log.Info("Sent TransferToDestination transaction on source chain", "destinationChainID", subnetB.BlockchainID, "txHash", tx.Hash().Hex()) + + receipt := utils.WaitForTransaction(ctx, tx.Hash(), subnetA.WSClient) + Expect(err).Should(BeNil()) + Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + + utils.RelayMessage(ctx, receipt.BlockHash, receipt.BlockNumber, subnetA, subnetB) + return receipt + } + + { // Transfer some tokens A -> B + // Check starting balance is 0 + bal, err := exampleERC20.BalanceOf(&bind.CallOpts{ Accepted: true }, tokenReceiverAddress) + Expect(err).Should(BeNil()) + Expect(bal.Uint64()).Should(BeZero()) + + sendTokensToDestination(valueToSend1, nativeTokenBridgeDeployerPK, tokenReceiverAddress) + + // Check intermediate balance, no tokens should be minted because we haven't collateralized + bal, err = subnetB.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) + Expect(err).Should(BeNil()) + Expect(bal.Uint64()).Should(BeZero()) + } + + { // Fail to Transfer tokens B -> A because bridge is not collateralized + // Check starting balance is 0 + bal, err := exampleERC20.BalanceOf(&bind.CallOpts{ Accepted: true }, tokenReceiverAddress) + Expect(err).Should(BeNil()) + Expect(bal.Cmp(common.Big0)).Should(BeZero()) + + transactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, subnetB.ChainID) + Expect(err).Should(BeNil()) + transactor.Value = new(big.Int).SetUint64(valueToSend1) + + // This transfer should revert because the bridge isn't collateralized + _, err = nativeTokenDestination.TransferToSource(transactor, tokenReceiverAddress, common.Address{}, big.NewInt(0), []common.Address{}) + Expect(err).ShouldNot(BeNil()) + + // Check we should fail to send because we're not collateralized + bal, err = exampleERC20.BalanceOf(&bind.CallOpts{ Accepted: true }, tokenReceiverAddress) + Expect(err).Should(BeNil()) + Expect(bal.Uint64()).Should(BeZero()) + } + + { // Transfer more tokens A -> B to collateralize the bridge + // Check starting balance is 0 + bal, err := subnetB.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) + Expect(err).Should(BeNil()) + Expect(bal.Uint64()).Should(BeZero()) + + sendTokensToDestination(valueToSend2, nativeTokenBridgeDeployerPK, tokenReceiverAddress) + + // We should have minted the excess coins after checking the collateral + bal, err = subnetB.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) + Expect(err).Should(BeNil()) + Expect(bal.Uint64()).Should(Equal(valueToSend1 + valueToSend2 - tokenReserve)) + } + + { // Transfer tokens B -> A + sendTokensToSource(valueToReturn, nativeTokenBridgeDeployerPK, tokenReceiverAddress) + + // Check we should fail to send because we're not collateralized + bal, err := exampleERC20.BalanceOf(&bind.CallOpts{ Accepted: true }, tokenReceiverAddress) + Expect(err).Should(BeNil()) + Expect(bal.Uint64()).Should(Equal(valueToReturn)) + } +} diff --git a/tests/native_token_bridge.go b/tests/native_token_bridge.go index 9419e4f25..f40d8562d 100644 --- a/tests/native_token_bridge.go +++ b/tests/native_token_bridge.go @@ -137,14 +137,14 @@ func NativeTokenBridge() { // Check intermediate balance, no tokens should be minted because we haven't collateralized bal, err = subnetB.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) Expect(err).Should(BeNil()) - Expect(bal.Uint64()).Should(Equal(uint64(0))) + Expect(bal.Uint64()).Should(BeZero()) } - { // Transfer tokens B -> A + { // Fail to Transfer tokens B -> A because bridge is not collateralized // Check starting balance is 0 bal, err := subnetA.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) Expect(err).Should(BeNil()) - Expect(bal.Uint64()).Should(Equal(common.Big0.Uint64())) + Expect(bal.Uint64()).Should(BeZero()) transactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, subnetB.ChainID) Expect(err).Should(BeNil()) @@ -157,14 +157,14 @@ func NativeTokenBridge() { // Check we should fail to send because we're not collateralized bal, err = subnetA.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) Expect(err).Should(BeNil()) - Expect(bal.Uint64()).Should(Equal(uint64(0))) + Expect(bal.Uint64()).Should(BeZero()) } { // Transfer more tokens A -> B to collateralize the bridge // Check starting balance is 0 bal, err := subnetB.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) Expect(err).Should(BeNil()) - Expect(bal.Uint64()).Should(Equal(common.Big0.Uint64())) + Expect(bal.Uint64()).Should(BeZero()) sendTokensToDestination(valueToSend2, nativeTokenBridgeDeployerPK, tokenReceiverAddress) From 3ccf5e35083ba45dd5deea03d47de51ec0763a49 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Fri, 27 Oct 2023 12:06:10 -0400 Subject: [PATCH 069/183] Review fixes --- .../INativeTokenDestination.sol | 4 +- .../NativeTokenBridge/INativeTokenSource.sol | 2 - .../NativeTokenDestination.sol | 18 +- .../NativeTokenBridge/NativeTokenSource.sol | 2 - .../NativeTokenBridge/README.md | 10 +- scripts/local/native/native.sh | 192 ------------------ tests/erc20_to_native_token_bridge.go | 2 +- 7 files changed, 14 insertions(+), 216 deletions(-) delete mode 100755 scripts/local/native/native.sh diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol index 221316ac6..04e02ba4c 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol @@ -17,8 +17,6 @@ interface INativeTokenDestination { address indexed sender, address indexed recipient, uint256 amount, - address feeContractAddress, - uint256 feeAmount, uint256 teleporterMessageID ); @@ -30,7 +28,7 @@ interface INativeTokenDestination { /** * @dev Emitted when minting native tokens. */ - event MintNativeTokens(address indexed recipient, uint256 amount); + event NativeTokensMinted(address indexed recipient, uint256 amount); /** * @dev This burns native tokens on this chain, and sends a message to the source diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol index ccc52c6b9..8ecd09d2a 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol @@ -17,8 +17,6 @@ interface INativeTokenSource { address indexed sender, address indexed recipient, uint256 amount, - address feeContractAddress, - uint256 feeAmount, uint256 teleporterMessageID ); diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index 164ecc90e..ebe78ae6f 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -16,13 +16,12 @@ import "../../Teleporter/SafeERC20TransferFrom.sol"; // Native Minter Precompile Contract Address address constant MINTER_ADDRESS = 0x0200000000000000000000000000000000000001; -// This is the address where the burned base fee go. We use this to send the amount of -// burned tokens back to the source chain. +// The address where the burned transaction fees are credited. // TODO implement mechanism to report burned tx fees to source chian. address constant BURNED_TX_FEES_ADDRESS = 0x0100000000000000000000000000000000000000; -// Designated Blackhole Address. This is where we burn token before sending an unlock -// message to the source chain. Different from the burned tx fee address so we can -// track each separately. +// Designated Blackhole Address. Tokens are sent here to be "burned" before sending an unlock +// message to the source chain. Different from the burned tx fee address so they can be +// tracked separately. address constant BLACKHOLE_ADDRESS = 0x0100000000000000000000000000000000000001; // Precompiled Warp address address constant WARP_PRECOMPILE_ADDRESS = 0x0200000000000000000000000000000000000005; @@ -41,15 +40,14 @@ contract NativeTokenDestination is bytes32 public immutable currentBlockchainID; bytes32 public immutable sourceBlockchainID; address public immutable nativeTokenSourceAddress; - // We will not mint the first `tokenReserve` tokens sent to this subnet. + // The first `tokenReserve` tokens sent to this subnet will not be minted. // This should be constructed to match the initial token supply of this subnet. - // This will mean we will not mint tokens until the source contact is collateralized. + // This means tokens will not be minted until the source contact is collateralized. uint256 public tokenReserve; // Used for sending an receiving Teleporter messages. ITeleporterMessenger public immutable teleporterMessenger; - // TODO we probably want to add the original token supply from this chain to the constructor. constructor( address teleporterMessengerAddress, bytes32 sourceBlockchainID_, @@ -128,7 +126,7 @@ contract NativeTokenDestination is // Calls NativeMinter precompile through INativeMinter interface. _nativeMinter.mintNativeCoin(recipient, adjustedAmount); - emit MintNativeTokens(recipient, adjustedAmount); + emit NativeTokensMinted(recipient, adjustedAmount); } /** @@ -184,8 +182,6 @@ contract NativeTokenDestination is sender: msg.sender, recipient: recipient, amount: msg.value, - feeContractAddress: feeContractAddress, - feeAmount: adjustedFeeAmount, teleporterMessageID: messageID }); } diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index fac28bfb4..bbacc3341 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -146,8 +146,6 @@ contract NativeTokenSource is sender: msg.sender, recipient: recipient, amount: msg.value, - feeContractAddress: feeContractAddress, - feeAmount: adjustedFeeAmount, teleporterMessageID: messageID }); } diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/README.md b/contracts/src/CrossChainApplications/NativeTokenBridge/README.md index 49ea9cf7f..1276b04f0 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/README.md +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/README.md @@ -16,17 +16,17 @@ The native-to-native bridge is implemented using two primary contracts. - `receiveTeleporterMessage`: mints tokens on the destination chain when instructed to by the `NativeTokenDestination` contract. - `Collateralizing the bridge` - - On initialization, the bridge will be undercollateralized by exactly the number of tokens included in genesis on the destination chain. These tokens could theoretically be sent through the bridge, with no corresponding tokens able to be unlocked on the source chain. In order to avoid this problem, the `NativeTokenDestination` contract is initialized with the value for `tokenReserve`, which should correspond to the number of tokens allocated in the genesis block for the destination chain. If this is not properly set, behaviour of this contract is undefined. The `NativeTokenDestination` contract will not mint tokens until it has received confirmation that at least `tokenReserve` tokens have been locked on the source chain. It should be up to the contract deployer to ensure that the bridge is properly collateralized. Burning/unlocking is disabled until the bridge is properly collateralized. + - On initialization, the bridge will be undercollateralized by exactly the number of tokens included in genesis on the destination chain. These tokens could theoretically be sent through the bridge, with no corresponding tokens able to be unlocked on the source chain. In order to avoid this problem, the `NativeTokenDestination` contract is initialized with the value for `tokenReserve`, which should correspond to the number of tokens allocated in the genesis block for the destination chain. If `tokenReserve` is not properly set, behaviour of this contract is undefined. The `NativeTokenDestination` contract will not mint tokens until it has received confirmation that at least `tokenReserve` tokens have been locked on the source chain. It should be up to the contract deployer to ensure that the bridge is properly collateralized. Burning/unlocking is disabled until the bridge is properly collateralized. - `Burning tokens spent as fees` - - As tokens are burned for transaction fees on the destination chain, we may want to relay this information to the source chain in order to burn an equivalent number of locked tokens there because these tokens will never be bridged back. - - The address for burned transaction fees is `0x0100000000000000000000000000000000000000`. We will send tokens that are "burned" in order to unlock tokens on the source chain to a different address so that `0x0100000000000000000000000000000000000000` will only include burned transaction fees (or tokens others have decided to burn outside of this contract) so that we can report this number to the source chain to burn an equivalent numbers of locked tokens. + - As tokens are burned for transaction fees on the destination chain, contract owners may want to relay this information to the source chain in order to burn an equivalent number of locked tokens there because these tokens will never be bridged back. + - The address for burned transaction fees is `0x0100000000000000000000000000000000000000`. When transferring token to the source chain, the "burned" tokens are sent here so that `0x0100000000000000000000000000000000000000` will only include burned transaction fees (or tokens others have decided to burn outside of this contract) so that this number can be reported to the source chain to burn an equivalent numbers of locked tokens. - `TODO` explain implementation. - `Setup` - `TeleporterMessenger` must be deployed on both chains, and the address must be passed to the constructor of both contracts. - `NativeTokenDestination` is meant to be deployed on a new subnet, and should be the only method for minting tokens on that subnet. The address of `NativeTokenDestination` must be included as the only entry for `adminAddresses` under `contractNativeMinterConfig` in the genesis config for the destination subnet. See `warp-genesis.json` for an example. - - Both `NativeTokenSource` and `NativeTokenDestination` need to be deployed to addresses known beforehand. Each address must be passed to the constructor of the other contract. To do this, you will need a known EOA, and preferably use the first transaction from this address (nonce 0) to deploy the contract on each chain. It is advised to allocate tokens to the EOA in the destination subnet genesis file so that it can easily deploy the contract. + - Both `NativeTokenSource` and `NativeTokenDestination` need to be deployed to addresses known beforehand. Each address must be passed to the constructor of the other contract. To do this, you will need a known EOA, and preferably use the first transaction from the EOA (nonce 0) to deploy the contract on each chain. It is advised to allocate tokens to the EOA in the destination subnet genesis file so that it can easily deploy the contract. - Both contracts need to be initialized with `teleporterMessengerAddress`, which is the only address they will accept function calls from. - - `NativeTokenDestination` needs to be intialized with `tokenReserve`, which should equal the number of tokens allocated in the genesis file for the destination chain. If this value is not properly set, behavior of these contracts in undefined. + - `NativeTokenDestination` needs to be intialized with `tokenReserve`, which should equal the number of tokens allocated in the genesis file for the destination chain. If `tokenReserve` is not properly set, behavior of these contracts in undefined. - On the source chain, at least `tokenReserve` tokens need to be transferred to `NativeTokenSource` using `transferToSource` in order to properly collateralize the bridge and allow regular functionality in both directions. The first `tokenReserve` tokens will not be delivered to the recipient, but any excess will be delivered. Burning/unlocking is disabled until the bridge is fully collateralized. \ No newline at end of file diff --git a/scripts/local/native/native.sh b/scripts/local/native/native.sh deleted file mode 100755 index 162de7e54..000000000 --- a/scripts/local/native/native.sh +++ /dev/null @@ -1,192 +0,0 @@ -#!/usr/bin/env bash -# Copyright (C) 2023, Ava Labs, Inc. All rights reserved. -# See the file LICENSE for licensing terms. - -# TODO We want to run the native token bridge with our Fuji scripts. -# This file isn't compeletely set up properly yet. - -set -e # Stop on first error - -# Variables provided by run_test.sh: -# c_chain_url -# user_private_key -# user_address_bytes -# user_address -# relayer_address -# subnet_a_chain_id -# subnet_a_subnet_id -# subnet_a_url -# subnet_a_chain_id_hex -# subnet_a_subnet_id_hex -# teleporter_contract_address - -# Test covers: -# - Creating bridged tokens on subnets different from the original subnet with the native token asset. -# - Bridging directly from token native subnet to a subnet with its bridged token -# - Bridging a wrapped token of one subnet to another subnet's bridged token of the same native token asset, through unwrapping then wrapping. -# - Unwrap bridged token back to origin subnet with native token asset. - -# Deploy the ERC20 bridge contract to both chains. -bridge_a_deploy_result=$(forge create --private-key $user_private_key --constructor-args $teleporter_contract_address \ - --rpc-url $subnet_a_url src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol:ERC20Bridge) -ntm_a_address=$(parseContractAddress "$bridge_a_deploy_result") -echo "Native token minting contract deployed to subnet A at $ntm_a_address." - -c_chain_deploy_result=$(forge create --private-key $user_private_key --constructor-args $teleporter_contract_address \ - --rpc-url $c_chain_url src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol:ERC20Bridge) -c_chain_ntr_address=$(parseContractAddress "$c_chain_deploy_result") -echo ""Native token bridge contract deployed to C Chain at $c_chain_ntr_address." - -cd .. - -# Send a transaction that initiates the ERC20 token being added to be bridged to subnet B -# Function signature for submitCreateBridgeToken includes an ERC20 type parameter, but we can pass in address -# since the contract solidity type gets mapped to address abi type https://docs.soliditylang.org/en/latest/abi-spec.html#mapping-solidity-to-abi-types. -create_bridge_token_message_fee=1000000000000000000 -cast send $bridge_a_address "submitCreateBridgeToken(bytes32,address,address,address,uint256)" \ - $subnet_b_chain_id_hex \ - $ntm_b_address \ - $native_erc20_contract_address \ - $native_erc20_contract_address \ - $create_bridge_token_message_fee \ - --private-key $user_private_key --rpc-url $subnet_a_url -echo "Sent a transaction on Subnet A to add support for the the ERC20 token to the bridge on Subnet B." - - -# Wait for the cross chain message to be delivered by a relayer. -sleep 10 - -# Check that the bridge token was added on Subnet B -bridge_token_subnet_b_contract_address=$(cast call $ntm_b_address "nativeToWrappedTokens(bytes32,address,address)(address)" \ - $subnet_a_chain_id_hex \ - $bridge_a_address \ - $native_erc20_contract_address \ - --rpc-url $subnet_b_url) -echo "The bridge token contract address on Subnet B is $bridge_token_subnet_b_contract_address" -if [[ "$bridge_token_subnet_b_contract_address" == "0x0000000000000000000000000000000000000000" ]]; then - echo "Bridge token contract was not created on Subnet B." - exit 1 -fi - -# Now that the bridge token has been added, send a bridge transfer for the newly added token from subnet A to subnet B. -total_amount=13000000000000000000 -primary_fee_amount=1000000000000000000 -secondary_fee_amount=0 -cast send $bridge_a_address "bridgeTokens(bytes32,address,address,address,uint256,uint256,uint256)" \ - $subnet_b_chain_id_hex \ - $bridge_b_address \ - $native_erc20_contract_address \ - $user_address \ - $total_amount \ - $primary_fee_amount \ - $secondary_fee_amount \ - --private-key $user_private_key --rpc-url $subnet_a_url -echo "Sent a transaction to bridgeTokens from Subnet A to Subnet B." - -# Wait for the cross chain message to be processed by a relayer. -sleep 10 - -# Check that all the settings of the new bridge token are correct. -actual_native_chain_id=$(cast call $bridge_token_subnet_b_contract_address "nativeChainID()(bytes32)" --rpc-url $subnet_b_url) -echo "Bridge token native chain ID: $actual_native_chain_id" -actual_native_bridge=$(cast call $bridge_token_subnet_b_contract_address "nativeBridge()(address)" --rpc-url $subnet_b_url) -echo "Bridge token native bridge address: $actual_native_bridge" -actual_native_asset=$(cast call $bridge_token_subnet_b_contract_address "nativeAsset()(address)" --rpc-url $subnet_b_url) -echo "Bridge token native asset: $actual_native_asset" -actual_name=$(cast call $bridge_token_subnet_b_contract_address "name()(string)" --rpc-url $subnet_b_url) -echo "Bridge token name: $actual_name" -actual_symbol=$(cast call $bridge_token_subnet_b_contract_address "symbol()(string)" --rpc-url $subnet_b_url) -echo "Bridge token symbol: $actual_symbol" -actual_decimals=$(cast call $bridge_token_subnet_b_contract_address "decimals()(uint8)" --rpc-url $subnet_b_url) -echo "Bridge token decimals: $actual_decimals" -if [[ "$actual_native_chain_id" != "0x$subnet_a_chain_id_hex" || - "$actual_native_bridge" != "$bridge_a_address" || - "$actual_native_asset" != "$native_erc20_contract_address" || - "$actual_name" != "Mock Token" || - "$actual_symbol" != "EXMP" || - "$actual_decimals" != "18" ]]; then - echo "Bridge token contract was not created or did not have expected values." - echo "Actual native chain ID: $actual_native_chain_id, Expected: $subnet_a_chain_id_hex" - echo "Actual native bridge: $actual_native_bridge, Expected: $bridge_a_address" - echo "Actual native asset: $actual_native_asset, Expected: $native_erc20_contract_address" - echo "Actual name: $actual_name, Expected: Mock Token" - echo "Actual symbol: $actual_symbol, Expected: EXMP" - echo "Actual decimals: $actual_decimals, Expected: 18" - exit 1 -fi - -# Check the recipient balance of the new bridge token. -actual_bridge_token_balance=$(cast call $bridge_token_subnet_b_contract_address "balanceOf(address)(uint256)" $user_address --rpc-url $subnet_b_url) -echo "Bridge token balance is $actual_bridge_token_balance" - -if [[ "$actual_bridge_token_balance" != "12000000000000000000" ]]; then - echo "Bridge token balance for $user_address did not match expected." - echo "Actual balance: $actual_bridge_token_balance, Expected: 12000000000000000000" - exit 1 -fi -echo "Bridge token balance matches expected." - -# Approve the bridge contract on subnet B to spent the wrapped tokens in the user account. -cast send $bridge_token_subnet_b_contract_address "approve(address,uint256)(bool)" $bridge_b_address 000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFF --private-key $user_private_key --rpc-url $subnet_b_url -result=$(cast call $bridge_token_subnet_b_contract_address "allowance(address,address)(uint256)" $user_address $bridge_b_address --rpc-url $subnet_b_url) -if [[ $result != 309485009821345068724781055 ]]; then # FFFFFFFFFFFFFFFFFFFFFF in decimal form is 309485009821345068724781055 - echo $result - echo "Error approving bridge contract on subnet B to spend bridged ERC20 from user account." - exit 1 -fi -echo "Approved the subnet B bridge contract to spend the bridged ERC20 token from the user account." - -# Unwrap bridged tokens back to subnet A. -total_amount=11000000000000000000 -primary_fee_amount=1000000000000000000 -secondary_fee_amount=1000000000000000000 -cast send $bridge_b_address "bridgeTokens(bytes32,address,address,address,uint256,uint256,uint256)" \ - $subnet_a_chain_id_hex \ - $bridge_a_address \ - $bridge_token_subnet_b_contract_address \ - $user_address \ - $total_amount \ - $primary_fee_amount \ - $secondary_fee_amount \ - --private-key $user_private_key --rpc-url $subnet_b_url -echo "Sent a transaction to bridge tokens from Subnet B to Subnet A." - -# Wait for the cross chain message to be delivered by a relayer. -sleep 10 - -# Check the redeemable reward balance of the relayer if the relayer address was set. -if [ ! -z "$relayer_address" ]; then - actual_relayer_redeemable_balance=$(cast call $teleporter_contract_address "checkRelayerRewardAmount(address,address)(uint256)" $relayer_address $native_erc20_contract_address --rpc-url $subnet_a_url) - echo "Native ERC20 token balance for relayer account is $actual_relayer_redeemable_balance" - if [[ "$actual_relayer_redeemable_balance" != "2000000000000000000" ]]; then - echo "Redeemable rewards for relayer account ($relayer_address) did not match expected." - echo "Actual balance: $actual_relayer_redeemable_balance, Expected: 2000000000000000000" - exit 1 - fi - echo "Redeemable rewards balance matches expected for relayer on Subnet A." -fi - -# Check the balance of the native token after the unwrap -actual_native_token_default_account_balance=$(cast call $native_erc20_contract_address "balanceOf(address)(uint256)" $user_address --rpc-url $subnet_a_url) -echo "Native ERC20 token balance for user account is $actual_native_token_default_account_balance" -if [[ "$actual_native_token_default_account_balance" != "9999999996000000000000000000" ]]; then - echo "Native token balance for $user_address did not match expected." - echo "Actual balance: $actual_native_token_default_account_balance, Expected: 9999999996000000000000000000" - exit 1 -fi -echo "Native token balance matches expected for user account." - -# Check the balance of the native token for the relayer, which should have received the fee rewards -if [ ! -z "$relayer_address" ]; then - actual_relayer_redeemable_balance=$(cast call $teleporter_contract_address "checkRelayerRewardAmount(address,address)(uint256)" $relayer_address $native_erc20_contract_address --rpc-url $subnet_a_url) - echo "Redeemable ERC20 token reward balance for relayer account is $actual_relayer_redeemable_balance" - if [[ "$actual_relayer_redeemable_balance" != "2000000000000000000" ]]; then - echo "Redeemable reward balance for relayer account ($relayer_address) did not match expected." - echo "Actual balance: $actual_relayer_redeemable_balance, Expected: 2000000000000000000" - exit 1 - fi - echo "Redeemable rewards balance matches expected for relayer on Subnet A." -fi - - -exit 0 \ No newline at end of file diff --git a/tests/erc20_to_native_token_bridge.go b/tests/erc20_to_native_token_bridge.go index e5aef0789..1d75739f4 100644 --- a/tests/erc20_to_native_token_bridge.go +++ b/tests/erc20_to_native_token_bridge.go @@ -77,7 +77,7 @@ func ERC20ToNativeTokenBridge() { Expect(err).Should(BeNil()) exampleERC20Abi, err := exampleerc20.ExampleERC20MetaData.GetAbi() Expect(err).Should(BeNil()) - exampleERC20ContractAddress, txExampleERC20, _, err := bind.DeployContract(chainATransactor, *exampleERC20Abi, exampleERC20Bytecode, subnetA.WSClient, "Ignored", "Params") + exampleERC20ContractAddress, txExampleERC20, _, err := bind.DeployContract(chainATransactor, *exampleERC20Abi, exampleERC20Bytecode, subnetA.WSClient) Expect(err).Should(BeNil()) // Wait for transaction, then check code was deployed From 28adeb3cf6ac49d70db4ca24c430b1bf6bca0483 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Fri, 27 Oct 2023 13:20:24 -0400 Subject: [PATCH 070/183] Update contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol Co-authored-by: minghinmatthewlam Signed-off-by: Geoff Stuart --- .../NativeTokenBridge/INativeTokenDestination.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol index 04e02ba4c..1448c79ec 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol @@ -11,7 +11,7 @@ pragma solidity 0.8.18; */ interface INativeTokenDestination { /** - * @dev Emitted when tokens are burned in this bridge contract to be bridged to the source chain. + * @dev Emitted when tokens are burned in the destination contract and to be unlocked on the source contract. */ event TransferToSource( address indexed sender, From af1007afeb14c840b7a4defd70c5d129e2c56c20 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Sun, 29 Oct 2023 18:05:33 -0400 Subject: [PATCH 071/183] Cleanup merge --- tests/utils/network_setup.go | 2 +- tests/utils/utils.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/utils/network_setup.go b/tests/utils/network_setup.go index a25379ee6..39c2fa3bb 100644 --- a/tests/utils/network_setup.go +++ b/tests/utils/network_setup.go @@ -219,7 +219,7 @@ func DeployTeleporterContracts(transactionBytes []byte, deployerAddress common.A { fundAmount := big.NewInt(0).Mul(big.NewInt(1e18), big.NewInt(10)) // 10eth fundDeployerTx := createNativeTransferTransaction(ctx, subnetInfo, fundedAddress, fundedKey, deployerAddress, fundAmount) - SendTransactionAndWaitForAcceptance(ctx, subnetInfo.ChainWSClient, fundDeployerTx) + SendTransactionAndWaitForAcceptance(ctx, subnetInfo.WSClient, fundDeployerTx) } log.Info("Finished funding Teleporter deployer", "blockchainID", subnetInfo.BlockchainID.Hex()) diff --git a/tests/utils/utils.go b/tests/utils/utils.go index f3a15f4b9..5fc017d4b 100644 --- a/tests/utils/utils.go +++ b/tests/utils/utils.go @@ -358,10 +358,10 @@ func createNativeTransferTransaction( recipient common.Address, amount *big.Int, ) *types.Transaction { - gasFeeCap, gasTipCap, nonce := calculateTxParams(ctx, network.ChainWSClient, fundedAddress) + gasFeeCap, gasTipCap, nonce := calculateTxParams(ctx, network.WSClient, fundedAddress) tx := types.NewTx(&types.DynamicFeeTx{ - ChainID: network.ChainIDInt, + ChainID: network.ChainID, Nonce: nonce, To: &recipient, Gas: NativeTransferGas, @@ -370,5 +370,5 @@ func createNativeTransferTransaction( Value: amount, }) - return signTransaction(tx, fundedKey, network.ChainIDInt) + return signTransaction(tx, fundedKey, network.ChainID) } From 72d42e4510b8892705c761463aaa2d5cfe87169f Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Sun, 29 Oct 2023 18:22:54 -0400 Subject: [PATCH 072/183] Pin foundry to most recent long-term nightly release --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index c60b4b563..f67fd49e4 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -42,7 +42,7 @@ RUN curl -L https://raw.githubusercontent.com/foundry-rs/foundry/70d00222c2ef74f echo "export PATH=\"$PATH:/$HOME/.foundry/bin\"">> ~/.bashrc && \ source ~/.bashrc && \ export PATH=$PATH:$HOME/.foundry/bin:$HOME/.cargo/bin && \ - foundryup --version nightly-70d00222c2ef74fc484b8d98c5705d131ab31871 + foundryup --version nightly-5be158ba6dc7c798a6f032026fe60fc01686b33bg # Install python base58 decode library RUN apt-get update && \ From b51443f96f3435ee0f634c4e98bf0c265296ce6e Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Sun, 29 Oct 2023 18:30:54 -0400 Subject: [PATCH 073/183] Update abi bindings --- .../NativeTokenDestination.go | 68 +++++++++---------- .../NativeTokenSource/NativeTokenSource.go | 16 ++--- 2 files changed, 40 insertions(+), 44 deletions(-) diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go index 354a21fb6..29a7710b7 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go @@ -31,7 +31,7 @@ var ( // NativeTokenDestinationMetaData contains all meta data concerning the NativeTokenDestination contract. var NativeTokenDestinationMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenReserve_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"MintNativeTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tokenReserve\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenReserve_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tokenReserve\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", } // NativeTokenDestinationABI is the input ABI used to generate the binding from. @@ -543,9 +543,9 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) ParseCollateralAd return event, nil } -// NativeTokenDestinationMintNativeTokensIterator is returned from FilterMintNativeTokens and is used to iterate over the raw logs and unpacked data for MintNativeTokens events raised by the NativeTokenDestination contract. -type NativeTokenDestinationMintNativeTokensIterator struct { - Event *NativeTokenDestinationMintNativeTokens // Event containing the contract specifics and raw log +// NativeTokenDestinationNativeTokensMintedIterator is returned from FilterNativeTokensMinted and is used to iterate over the raw logs and unpacked data for NativeTokensMinted events raised by the NativeTokenDestination contract. +type NativeTokenDestinationNativeTokensMintedIterator struct { + Event *NativeTokenDestinationNativeTokensMinted // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -559,7 +559,7 @@ type NativeTokenDestinationMintNativeTokensIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *NativeTokenDestinationMintNativeTokensIterator) Next() bool { +func (it *NativeTokenDestinationNativeTokensMintedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -568,7 +568,7 @@ func (it *NativeTokenDestinationMintNativeTokensIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(NativeTokenDestinationMintNativeTokens) + it.Event = new(NativeTokenDestinationNativeTokensMinted) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -583,7 +583,7 @@ func (it *NativeTokenDestinationMintNativeTokensIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(NativeTokenDestinationMintNativeTokens) + it.Event = new(NativeTokenDestinationNativeTokensMinted) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -599,52 +599,52 @@ func (it *NativeTokenDestinationMintNativeTokensIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *NativeTokenDestinationMintNativeTokensIterator) Error() error { +func (it *NativeTokenDestinationNativeTokensMintedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *NativeTokenDestinationMintNativeTokensIterator) Close() error { +func (it *NativeTokenDestinationNativeTokensMintedIterator) Close() error { it.sub.Unsubscribe() return nil } -// NativeTokenDestinationMintNativeTokens represents a MintNativeTokens event raised by the NativeTokenDestination contract. -type NativeTokenDestinationMintNativeTokens struct { +// NativeTokenDestinationNativeTokensMinted represents a NativeTokensMinted event raised by the NativeTokenDestination contract. +type NativeTokenDestinationNativeTokensMinted struct { Recipient common.Address Amount *big.Int Raw types.Log // Blockchain specific contextual infos } -// FilterMintNativeTokens is a free log retrieval operation binding the contract event 0xe2899f7ef7618206fa13efbcde0c05cccd83f35ac3b18ef860021181d61fa680. +// FilterNativeTokensMinted is a free log retrieval operation binding the contract event 0xd949ea0e9d5db53492d77f28fd5467fb2f6c4f5b88e3350e3c36729b76e99cf2. // -// Solidity: event MintNativeTokens(address indexed recipient, uint256 amount) -func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterMintNativeTokens(opts *bind.FilterOpts, recipient []common.Address) (*NativeTokenDestinationMintNativeTokensIterator, error) { +// Solidity: event NativeTokensMinted(address indexed recipient, uint256 amount) +func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterNativeTokensMinted(opts *bind.FilterOpts, recipient []common.Address) (*NativeTokenDestinationNativeTokensMintedIterator, error) { var recipientRule []interface{} for _, recipientItem := range recipient { recipientRule = append(recipientRule, recipientItem) } - logs, sub, err := _NativeTokenDestination.contract.FilterLogs(opts, "MintNativeTokens", recipientRule) + logs, sub, err := _NativeTokenDestination.contract.FilterLogs(opts, "NativeTokensMinted", recipientRule) if err != nil { return nil, err } - return &NativeTokenDestinationMintNativeTokensIterator{contract: _NativeTokenDestination.contract, event: "MintNativeTokens", logs: logs, sub: sub}, nil + return &NativeTokenDestinationNativeTokensMintedIterator{contract: _NativeTokenDestination.contract, event: "NativeTokensMinted", logs: logs, sub: sub}, nil } -// WatchMintNativeTokens is a free log subscription operation binding the contract event 0xe2899f7ef7618206fa13efbcde0c05cccd83f35ac3b18ef860021181d61fa680. +// WatchNativeTokensMinted is a free log subscription operation binding the contract event 0xd949ea0e9d5db53492d77f28fd5467fb2f6c4f5b88e3350e3c36729b76e99cf2. // -// Solidity: event MintNativeTokens(address indexed recipient, uint256 amount) -func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchMintNativeTokens(opts *bind.WatchOpts, sink chan<- *NativeTokenDestinationMintNativeTokens, recipient []common.Address) (event.Subscription, error) { +// Solidity: event NativeTokensMinted(address indexed recipient, uint256 amount) +func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchNativeTokensMinted(opts *bind.WatchOpts, sink chan<- *NativeTokenDestinationNativeTokensMinted, recipient []common.Address) (event.Subscription, error) { var recipientRule []interface{} for _, recipientItem := range recipient { recipientRule = append(recipientRule, recipientItem) } - logs, sub, err := _NativeTokenDestination.contract.WatchLogs(opts, "MintNativeTokens", recipientRule) + logs, sub, err := _NativeTokenDestination.contract.WatchLogs(opts, "NativeTokensMinted", recipientRule) if err != nil { return nil, err } @@ -654,8 +654,8 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchMintNativeTo select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(NativeTokenDestinationMintNativeTokens) - if err := _NativeTokenDestination.contract.UnpackLog(event, "MintNativeTokens", log); err != nil { + event := new(NativeTokenDestinationNativeTokensMinted) + if err := _NativeTokenDestination.contract.UnpackLog(event, "NativeTokensMinted", log); err != nil { return err } event.Raw = log @@ -676,12 +676,12 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchMintNativeTo }), nil } -// ParseMintNativeTokens is a log parse operation binding the contract event 0xe2899f7ef7618206fa13efbcde0c05cccd83f35ac3b18ef860021181d61fa680. +// ParseNativeTokensMinted is a log parse operation binding the contract event 0xd949ea0e9d5db53492d77f28fd5467fb2f6c4f5b88e3350e3c36729b76e99cf2. // -// Solidity: event MintNativeTokens(address indexed recipient, uint256 amount) -func (_NativeTokenDestination *NativeTokenDestinationFilterer) ParseMintNativeTokens(log types.Log) (*NativeTokenDestinationMintNativeTokens, error) { - event := new(NativeTokenDestinationMintNativeTokens) - if err := _NativeTokenDestination.contract.UnpackLog(event, "MintNativeTokens", log); err != nil { +// Solidity: event NativeTokensMinted(address indexed recipient, uint256 amount) +func (_NativeTokenDestination *NativeTokenDestinationFilterer) ParseNativeTokensMinted(log types.Log) (*NativeTokenDestinationNativeTokensMinted, error) { + event := new(NativeTokenDestinationNativeTokensMinted) + if err := _NativeTokenDestination.contract.UnpackLog(event, "NativeTokensMinted", log); err != nil { return nil, err } event.Raw = log @@ -760,15 +760,13 @@ type NativeTokenDestinationTransferToSource struct { Sender common.Address Recipient common.Address Amount *big.Int - FeeContractAddress common.Address - FeeAmount *big.Int TeleporterMessageID *big.Int Raw types.Log // Blockchain specific contextual infos } -// FilterTransferToSource is a free log retrieval operation binding the contract event 0x343e0fe771af9fa258c07a602fad6dfd80c51eda78604397e553106360933bfc. +// FilterTransferToSource is a free log retrieval operation binding the contract event 0x0322cbb1d3c23f6dbf1deddb3b4ef3ce0f93ae6eec7b44e4f395804104466d14. // -// Solidity: event TransferToSource(address indexed sender, address indexed recipient, uint256 amount, address feeContractAddress, uint256 feeAmount, uint256 teleporterMessageID) +// Solidity: event TransferToSource(address indexed sender, address indexed recipient, uint256 amount, uint256 teleporterMessageID) func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterTransferToSource(opts *bind.FilterOpts, sender []common.Address, recipient []common.Address) (*NativeTokenDestinationTransferToSourceIterator, error) { var senderRule []interface{} @@ -787,9 +785,9 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterTransferToS return &NativeTokenDestinationTransferToSourceIterator{contract: _NativeTokenDestination.contract, event: "TransferToSource", logs: logs, sub: sub}, nil } -// WatchTransferToSource is a free log subscription operation binding the contract event 0x343e0fe771af9fa258c07a602fad6dfd80c51eda78604397e553106360933bfc. +// WatchTransferToSource is a free log subscription operation binding the contract event 0x0322cbb1d3c23f6dbf1deddb3b4ef3ce0f93ae6eec7b44e4f395804104466d14. // -// Solidity: event TransferToSource(address indexed sender, address indexed recipient, uint256 amount, address feeContractAddress, uint256 feeAmount, uint256 teleporterMessageID) +// Solidity: event TransferToSource(address indexed sender, address indexed recipient, uint256 amount, uint256 teleporterMessageID) func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchTransferToSource(opts *bind.WatchOpts, sink chan<- *NativeTokenDestinationTransferToSource, sender []common.Address, recipient []common.Address) (event.Subscription, error) { var senderRule []interface{} @@ -833,9 +831,9 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchTransferToSo }), nil } -// ParseTransferToSource is a log parse operation binding the contract event 0x343e0fe771af9fa258c07a602fad6dfd80c51eda78604397e553106360933bfc. +// ParseTransferToSource is a log parse operation binding the contract event 0x0322cbb1d3c23f6dbf1deddb3b4ef3ce0f93ae6eec7b44e4f395804104466d14. // -// Solidity: event TransferToSource(address indexed sender, address indexed recipient, uint256 amount, address feeContractAddress, uint256 feeAmount, uint256 teleporterMessageID) +// Solidity: event TransferToSource(address indexed sender, address indexed recipient, uint256 amount, uint256 teleporterMessageID) func (_NativeTokenDestination *NativeTokenDestinationFilterer) ParseTransferToSource(log types.Log) (*NativeTokenDestinationTransferToSource, error) { event := new(NativeTokenDestinationTransferToSource) if err := _NativeTokenDestination.contract.UnpackLog(event, "TransferToSource", log); err != nil { diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go index 051f09b09..0843297d5 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go @@ -31,7 +31,7 @@ var ( // NativeTokenSourceMetaData contains all meta data concerning the NativeTokenSource contract. var NativeTokenSourceMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", } // NativeTokenSourceABI is the input ABI used to generate the binding from. @@ -449,15 +449,13 @@ type NativeTokenSourceTransferToDestination struct { Sender common.Address Recipient common.Address Amount *big.Int - FeeContractAddress common.Address - FeeAmount *big.Int TeleporterMessageID *big.Int Raw types.Log // Blockchain specific contextual infos } -// FilterTransferToDestination is a free log retrieval operation binding the contract event 0x32d7e0a933e2b2b5890fd273e9ba2e9293d619805a7ca90d11f41eddc56d2b97. +// FilterTransferToDestination is a free log retrieval operation binding the contract event 0x2b4e8f08417773e367064a6aea9ca2df303a60876676f70b6c3c5e66b314ca5a. // -// Solidity: event TransferToDestination(address indexed sender, address indexed recipient, uint256 amount, address feeContractAddress, uint256 feeAmount, uint256 teleporterMessageID) +// Solidity: event TransferToDestination(address indexed sender, address indexed recipient, uint256 amount, uint256 teleporterMessageID) func (_NativeTokenSource *NativeTokenSourceFilterer) FilterTransferToDestination(opts *bind.FilterOpts, sender []common.Address, recipient []common.Address) (*NativeTokenSourceTransferToDestinationIterator, error) { var senderRule []interface{} @@ -476,9 +474,9 @@ func (_NativeTokenSource *NativeTokenSourceFilterer) FilterTransferToDestination return &NativeTokenSourceTransferToDestinationIterator{contract: _NativeTokenSource.contract, event: "TransferToDestination", logs: logs, sub: sub}, nil } -// WatchTransferToDestination is a free log subscription operation binding the contract event 0x32d7e0a933e2b2b5890fd273e9ba2e9293d619805a7ca90d11f41eddc56d2b97. +// WatchTransferToDestination is a free log subscription operation binding the contract event 0x2b4e8f08417773e367064a6aea9ca2df303a60876676f70b6c3c5e66b314ca5a. // -// Solidity: event TransferToDestination(address indexed sender, address indexed recipient, uint256 amount, address feeContractAddress, uint256 feeAmount, uint256 teleporterMessageID) +// Solidity: event TransferToDestination(address indexed sender, address indexed recipient, uint256 amount, uint256 teleporterMessageID) func (_NativeTokenSource *NativeTokenSourceFilterer) WatchTransferToDestination(opts *bind.WatchOpts, sink chan<- *NativeTokenSourceTransferToDestination, sender []common.Address, recipient []common.Address) (event.Subscription, error) { var senderRule []interface{} @@ -522,9 +520,9 @@ func (_NativeTokenSource *NativeTokenSourceFilterer) WatchTransferToDestination( }), nil } -// ParseTransferToDestination is a log parse operation binding the contract event 0x32d7e0a933e2b2b5890fd273e9ba2e9293d619805a7ca90d11f41eddc56d2b97. +// ParseTransferToDestination is a log parse operation binding the contract event 0x2b4e8f08417773e367064a6aea9ca2df303a60876676f70b6c3c5e66b314ca5a. // -// Solidity: event TransferToDestination(address indexed sender, address indexed recipient, uint256 amount, address feeContractAddress, uint256 feeAmount, uint256 teleporterMessageID) +// Solidity: event TransferToDestination(address indexed sender, address indexed recipient, uint256 amount, uint256 teleporterMessageID) func (_NativeTokenSource *NativeTokenSourceFilterer) ParseTransferToDestination(log types.Log) (*NativeTokenSourceTransferToDestination, error) { event := new(NativeTokenSourceTransferToDestination) if err := _NativeTokenSource.contract.UnpackLog(event, "TransferToDestination", log); err != nil { From 228646bbcc22c4ce43b4fcda8fa377b497638776 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Sun, 29 Oct 2023 18:34:22 -0400 Subject: [PATCH 074/183] New transactor for new transaction --- tests/erc20_to_native_token_bridge.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/erc20_to_native_token_bridge.go b/tests/erc20_to_native_token_bridge.go index 1d75739f4..bda635893 100644 --- a/tests/erc20_to_native_token_bridge.go +++ b/tests/erc20_to_native_token_bridge.go @@ -75,9 +75,11 @@ func ERC20ToNativeTokenBridge() { // Deploy an example ERC20 contract to be used as the source token exampleERC20Bytecode, err := deploymentUtils.ExtractByteCode(ExampleERC20ByteCodeFile) Expect(err).Should(BeNil()) + chainATransactor2, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, subnetA.ChainID) + Expect(err).Should(BeNil()) exampleERC20Abi, err := exampleerc20.ExampleERC20MetaData.GetAbi() Expect(err).Should(BeNil()) - exampleERC20ContractAddress, txExampleERC20, _, err := bind.DeployContract(chainATransactor, *exampleERC20Abi, exampleERC20Bytecode, subnetA.WSClient) + exampleERC20ContractAddress, txExampleERC20, _, err := bind.DeployContract(chainATransactor2, *exampleERC20Abi, exampleERC20Bytecode, subnetA.WSClient) Expect(err).Should(BeNil()) // Wait for transaction, then check code was deployed From ada88f2172ec25056c4dfd3f1e1728f9b1a84126 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Sun, 29 Oct 2023 18:43:36 -0400 Subject: [PATCH 075/183] Update contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol Co-authored-by: minghinmatthewlam Signed-off-by: Geoff Stuart --- .../NativeTokenBridge/INativeTokenDestination.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol index 1448c79ec..2f94b041a 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol @@ -31,8 +31,8 @@ interface INativeTokenDestination { event NativeTokensMinted(address indexed recipient, uint256 amount); /** - * @dev This burns native tokens on this chain, and sends a message to the source - * chain to unlock tokens there. + * @dev Burns native tokens on the destination contract chain, and sends a message to the source + * contract to unlock corresponding tokens. */ function transferToSource( address recipient, From 271a8a7d5662097bb76912a20f87a9433e215ffc Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Sun, 29 Oct 2023 18:43:48 -0400 Subject: [PATCH 076/183] Update contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol Co-authored-by: minghinmatthewlam Signed-off-by: Geoff Stuart --- .../NativeTokenBridge/INativeTokenDestination.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol index 2f94b041a..e51ebcbe1 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol @@ -7,7 +7,7 @@ pragma solidity 0.8.18; /** * @dev Interface that describes functionalities for a contract that can mint native tokens when - * paired with a NativeTokenSource contract that will lock tokens on another chain. + * paired with a {INativeTokenSource} contract that will lock tokens on another chain. */ interface INativeTokenDestination { /** From 293570c62a1ad73c656acfee598189e6554254b6 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Sun, 29 Oct 2023 18:43:59 -0400 Subject: [PATCH 077/183] Update contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol Co-authored-by: minghinmatthewlam Signed-off-by: Geoff Stuart --- .../NativeTokenBridge/INativeTokenSource.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol index 8ecd09d2a..0549341d5 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol @@ -7,7 +7,7 @@ pragma solidity 0.8.18; /** * @dev Interface that describes functionalities for a contract that will lock tokens and send a - * Teleporter message to a NativeTokenDestination contract to mint native tokens on that chain. + * Teleporter message to a {INativeTokenDestination} contract to mint native tokens on the destination chain. */ interface INativeTokenSource { /** From 88f7e844d9fac5cf9ba4ccb468db7530b0eaaf0e Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Sun, 29 Oct 2023 18:44:15 -0400 Subject: [PATCH 078/183] Update contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol Co-authored-by: minghinmatthewlam Signed-off-by: Geoff Stuart --- .../NativeTokenBridge/INativeTokenSource.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol index 0549341d5..ba3457a10 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol @@ -11,7 +11,7 @@ pragma solidity 0.8.18; */ interface INativeTokenSource { /** - * @dev Emitted when tokens are locked in this bridge contract to be bridged to the destination chain. + * @dev Emitted when tokens are locked in the source contract to be transferred to the destination chain. */ event TransferToDestination( address indexed sender, From 9e8ac53a8261c284434d8ec59536a50134142eba Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Sun, 29 Oct 2023 18:44:26 -0400 Subject: [PATCH 079/183] Update contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol Co-authored-by: minghinmatthewlam Signed-off-by: Geoff Stuart --- .../NativeTokenBridge/NativeTokenDestination.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index ebe78ae6f..c2063b9ff 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -45,7 +45,7 @@ contract NativeTokenDestination is // This means tokens will not be minted until the source contact is collateralized. uint256 public tokenReserve; - // Used for sending an receiving Teleporter messages. + // Used for sending and receiving Teleporter messages. ITeleporterMessenger public immutable teleporterMessenger; constructor( From 2e9c6e1c19498bb16c99015c5dc50b697f221866 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Sun, 29 Oct 2023 18:55:04 -0400 Subject: [PATCH 080/183] Grab foundryup from same version --- docker/Dockerfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index f67fd49e4..2715c139c 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -36,13 +36,14 @@ ENV LANG en_US.utf8 # Install foundry from specific commit SHELL ["/bin/bash", "-c"] -RUN curl -L https://raw.githubusercontent.com/foundry-rs/foundry/70d00222c2ef74fc484b8d98c5705d131ab31871/foundryup/install > /tmp/foundry-install-script && \ - sed -i 's/\/foundry-rs\/foundry\/master\/foundryup/\/foundry-rs\/foundry\/70d00222c2ef74fc484b8d98c5705d131ab31871\/foundryup/g' /tmp/foundry-install-script && \ +RUN FOUNDRY_VERSION=5be158ba6dc7c798a6f032026fe60fc01686b33b \ + curl -L https://raw.githubusercontent.com/foundry-rs/foundry/${FOUNDRY_VERSION}/foundryup/install > /tmp/foundry-install-script && \ + sed -i 's/\/foundry-rs\/foundry\/master\/foundryup/\/foundry-rs\/foundry\/${FOUNDRY_VERSION}\/foundryup/g' /tmp/foundry-install-script && \ cat /tmp/foundry-install-script | bash && \ echo "export PATH=\"$PATH:/$HOME/.foundry/bin\"">> ~/.bashrc && \ source ~/.bashrc && \ export PATH=$PATH:$HOME/.foundry/bin:$HOME/.cargo/bin && \ - foundryup --version nightly-5be158ba6dc7c798a6f032026fe60fc01686b33bg + foundryup --version nightly-${FOUNDRY_VERSION} # Install python base58 decode library RUN apt-get update && \ From 809f344c3cd3018c21f92bdeb8e71efbe3fd51c2 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Fri, 27 Oct 2023 09:22:46 -0400 Subject: [PATCH 081/183] Exit on error in dockerfile --- docker/Dockerfile | 2 ++ scripts/local/test.sh | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/docker/Dockerfile b/docker/Dockerfile index 2715c139c..9e15c3b37 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -3,6 +3,8 @@ FROM ubuntu:20.04 +RUN set -e + ARG DEBIAN_FRONTEND=noninteractive # defaults to amd64. needs to be arm64 for Macos M1 diff --git a/scripts/local/test.sh b/scripts/local/test.sh index 296f52eb8..bd5e2b8bb 100755 --- a/scripts/local/test.sh +++ b/scripts/local/test.sh @@ -50,6 +50,7 @@ setARCH if [ -z "$LOCAL_RELAYER_IMAGE" ]; then echo "Using published awm-relayer image" docker compose -f docker/docker-compose-test.yml --project-directory ./ up --build & + dockerPid=$! else echo "Using local awm-relayer image: $LOCAL_RELAYER_IMAGE" if [[ "$(docker images -q awm-relayer:$LOCAL_RELAYER_IMAGE 2> /dev/null)" == "" ]]; then @@ -59,11 +60,18 @@ else rm -f docker/docker-compose-test-local.yml sed "s//$LOCAL_RELAYER_IMAGE/g" docker/docker-compose-test-local-template.yml > docker/docker-compose-test-local.yml docker compose -f docker/docker-compose-test-local.yml --project-directory ./ up --build & + dockerPid=$! fi # Wait for the containers to start up until [ "$( docker container inspect --format '{{.State.Running}}' test_runner )" == "true" ] do + if ! ps -p $dockerPid > /dev/null + then + echo "Docker process is dead" + exit 1 + fi + echo "Waiting for containers to start..." sleep 1 done From 072a6972c721c3a1391a275459db2609cd631253 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Sun, 29 Oct 2023 19:22:24 -0400 Subject: [PATCH 082/183] Fix foundry version --- docker/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 9e15c3b37..ef8b56114 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -38,8 +38,8 @@ ENV LANG en_US.utf8 # Install foundry from specific commit SHELL ["/bin/bash", "-c"] -RUN FOUNDRY_VERSION=5be158ba6dc7c798a6f032026fe60fc01686b33b \ - curl -L https://raw.githubusercontent.com/foundry-rs/foundry/${FOUNDRY_VERSION}/foundryup/install > /tmp/foundry-install-script && \ +ENV FOUNDRY_VERSION 5be158ba6dc7c798a6f032026fe60fc01686b33b +RUN curl -L https://raw.githubusercontent.com/foundry-rs/foundry/${FOUNDRY_VERSION}/foundryup/install > /tmp/foundry-install-script && \ sed -i 's/\/foundry-rs\/foundry\/master\/foundryup/\/foundry-rs\/foundry\/${FOUNDRY_VERSION}\/foundryup/g' /tmp/foundry-install-script && \ cat /tmp/foundry-install-script | bash && \ echo "export PATH=\"$PATH:/$HOME/.foundry/bin\"">> ~/.bashrc && \ From 7187ac2ce283139f64c7adb7eb1b1a74478bfdc7 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Sun, 29 Oct 2023 19:40:02 -0400 Subject: [PATCH 083/183] Review fixes --- .../NativeTokenBridge/ERC20TokenSource.sol | 8 +++---- .../NativeTokenDestination.sol | 18 +++++++------- .../NativeTokenBridge/NativeTokenSource.sol | 8 +++---- tests/erc20_to_native_token_bridge.go | 24 +++++++++---------- 4 files changed, 27 insertions(+), 31 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol index f90b92b90..3f25d96cd 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol @@ -12,9 +12,6 @@ import "../../Teleporter/ITeleporterMessenger.sol"; import "../../Teleporter/ITeleporterReceiver.sol"; import "../../Teleporter/SafeERC20TransferFrom.sol"; -// Precompiled Warp address -address constant WARP_PRECOMPILE_ADDRESS = 0x0200000000000000000000000000000000000005; - contract ERC20TokenSource is ITeleporterReceiver, IERC20TokenSource, @@ -35,8 +32,9 @@ contract ERC20TokenSource is bytes32 destinationBlockchainID_, address nativeTokenDestinationAddress_ ) { - currentBlockchainID = WarpMessenger(WARP_PRECOMPILE_ADDRESS) - .getBlockchainID(); + currentBlockchainID = WarpMessenger( + 0x0200000000000000000000000000000000000005 + ).getBlockchainID(); require( teleporterMessengerAddress != address(0), diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index c2063b9ff..fc6e49b21 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -14,8 +14,6 @@ import "../../Teleporter/ITeleporterMessenger.sol"; import "../../Teleporter/ITeleporterReceiver.sol"; import "../../Teleporter/SafeERC20TransferFrom.sol"; -// Native Minter Precompile Contract Address -address constant MINTER_ADDRESS = 0x0200000000000000000000000000000000000001; // The address where the burned transaction fees are credited. // TODO implement mechanism to report burned tx fees to source chian. address constant BURNED_TX_FEES_ADDRESS = 0x0100000000000000000000000000000000000000; @@ -23,8 +21,6 @@ address constant BURNED_TX_FEES_ADDRESS = 0x010000000000000000000000000000000000 // message to the source chain. Different from the burned tx fee address so they can be // tracked separately. address constant BLACKHOLE_ADDRESS = 0x0100000000000000000000000000000000000001; -// Precompiled Warp address -address constant WARP_PRECOMPILE_ADDRESS = 0x0200000000000000000000000000000000000005; contract NativeTokenDestination is ITeleporterReceiver, @@ -34,14 +30,14 @@ contract NativeTokenDestination is using SafeERC20 for IERC20; INativeMinter private immutable _nativeMinter = - INativeMinter(MINTER_ADDRESS); + INativeMinter(0x0200000000000000000000000000000000000001); uint256 public constant TRANSFER_NATIVE_TOKENS_REQUIRED_GAS = 150_000; // TODO this is a placeholder bytes32 public immutable currentBlockchainID; bytes32 public immutable sourceBlockchainID; address public immutable nativeTokenSourceAddress; // The first `tokenReserve` tokens sent to this subnet will not be minted. - // This should be constructed to match the initial token supply of this subnet. + // `tokenReserve` should be constructed to match the initial token supply of this subnet. // This means tokens will not be minted until the source contact is collateralized. uint256 public tokenReserve; @@ -54,8 +50,9 @@ contract NativeTokenDestination is address nativeTokenSourceAddress_, uint256 tokenReserve_ ) { - currentBlockchainID = WarpMessenger(WARP_PRECOMPILE_ADDRESS) - .getBlockchainID(); + currentBlockchainID = WarpMessenger( + 0x0200000000000000000000000000000000000005 + ).getBlockchainID(); require( teleporterMessengerAddress != address(0), @@ -102,7 +99,10 @@ contract NativeTokenDestination is ); // Only allow the partner contract to send messages. - require(senderAddress == nativeTokenSourceAddress, "Unauthorized Sender"); + require( + senderAddress == nativeTokenSourceAddress, + "Unauthorized Sender" + ); (address recipient, uint256 amount) = abi.decode( message, diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index bbacc3341..bb9d58dca 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -12,9 +12,6 @@ import "../../Teleporter/ITeleporterMessenger.sol"; import "../../Teleporter/ITeleporterReceiver.sol"; import "../../Teleporter/SafeERC20TransferFrom.sol"; -// Precompiled Warp address -address constant WARP_PRECOMPILE_ADDRESS = 0x0200000000000000000000000000000000000005; - contract NativeTokenSource is ITeleporterReceiver, INativeTokenSource, @@ -35,8 +32,9 @@ contract NativeTokenSource is bytes32 destinationBlockchainID_, address nativeTokenDestinationAddress_ ) { - currentBlockchainID = WarpMessenger(WARP_PRECOMPILE_ADDRESS) - .getBlockchainID(); + currentBlockchainID = WarpMessenger( + 0x0200000000000000000000000000000000000005 + ).getBlockchainID(); require( teleporterMessengerAddress != address(0), diff --git a/tests/erc20_to_native_token_bridge.go b/tests/erc20_to_native_token_bridge.go index bda635893..59bb012e3 100644 --- a/tests/erc20_to_native_token_bridge.go +++ b/tests/erc20_to_native_token_bridge.go @@ -58,6 +58,12 @@ func ERC20ToNativeTokenBridge() { _, txA, _, err := bind.DeployContract(chainATransactor, *erc20TokenSourceAbi, erc20TokenSourceBytecode, subnetA.WSClient, teleporterContractAddress, subnetB.BlockchainID, nativeTokenBridgeContractAddress) Expect(err).Should(BeNil()) + // Wait for transaction, then check code was deployed + utils.WaitForTransaction(ctx, txA.Hash(), subnetA.WSClient) + bridgeCodeA, err := subnetA.WSClient.CodeAt(ctx, nativeTokenBridgeContractAddress, nil) + Expect(err).Should(BeNil()) + Expect(len(bridgeCodeA)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode + // Both contracts in this test will be deployed to 0xAcB633F5B00099c7ec187eB00156c5cd9D854b5B, // though they do not necessarily have to be deployed at the same address, each contract needs // to know the address of the other. @@ -72,6 +78,12 @@ func ERC20ToNativeTokenBridge() { _, txB, _, err := bind.DeployContract(chainBTransactor, *nativeTokenDestinationAbi, nativeTokenDestinationBytecode, subnetB.WSClient, teleporterContractAddress, subnetA.BlockchainID, nativeTokenBridgeContractAddress, new(big.Int).SetUint64(tokenReserve)) Expect(err).Should(BeNil()) + // Wait for transaction, then check code was deployed + utils.WaitForTransaction(ctx, txB.Hash(), subnetB.WSClient) + bridgeCodeB, err := subnetB.WSClient.CodeAt(ctx, nativeTokenBridgeContractAddress, nil) + Expect(err).Should(BeNil()) + Expect(len(bridgeCodeB)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode + // Deploy an example ERC20 contract to be used as the source token exampleERC20Bytecode, err := deploymentUtils.ExtractByteCode(ExampleERC20ByteCodeFile) Expect(err).Should(BeNil()) @@ -82,18 +94,6 @@ func ERC20ToNativeTokenBridge() { exampleERC20ContractAddress, txExampleERC20, _, err := bind.DeployContract(chainATransactor2, *exampleERC20Abi, exampleERC20Bytecode, subnetA.WSClient) Expect(err).Should(BeNil()) - // Wait for transaction, then check code was deployed - utils.WaitForTransaction(ctx, txA.Hash(), subnetA.WSClient) - bridgeCodeA, err := subnetA.WSClient.CodeAt(ctx, nativeTokenBridgeContractAddress, nil) - Expect(err).Should(BeNil()) - Expect(len(bridgeCodeA)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode - - // Wait for transaction, then check code was deployed - utils.WaitForTransaction(ctx, txB.Hash(), subnetB.WSClient) - bridgeCodeB, err := subnetB.WSClient.CodeAt(ctx, nativeTokenBridgeContractAddress, nil) - Expect(err).Should(BeNil()) - Expect(len(bridgeCodeB)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode - // Wait for transaction, then check code was deployed utils.WaitForTransaction(ctx, txExampleERC20.Hash(), subnetA.WSClient) exampleERC20Code, err := subnetB.WSClient.CodeAt(ctx, exampleERC20ContractAddress, nil) From 14d3b695f6f851b079c3665df16be6740ad7022e Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Sun, 29 Oct 2023 19:44:33 -0400 Subject: [PATCH 084/183] Try to fix test --- scripts/local/integration-tests/erc20_bridge_multihop.sh | 4 ++-- scripts/local/integration-tests/example_messenger.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/local/integration-tests/erc20_bridge_multihop.sh b/scripts/local/integration-tests/erc20_bridge_multihop.sh index 6c2b0ca7f..38fd67b38 100755 --- a/scripts/local/integration-tests/erc20_bridge_multihop.sh +++ b/scripts/local/integration-tests/erc20_bridge_multihop.sh @@ -162,12 +162,12 @@ if [[ "$actual_native_asset" != "$native_erc20_contract_address" ]]; then exit 1 fi -if [[ $actual_name != "\"Mock Token\"" ]]; then +if [[ $actual_name != "Mock Token" ]]; then echo "Actual name: $actual_name, Expected: Mock Token" exit 1 fi -if [[ $actual_symbol != "\"EXMP\"" ]]; then +if [[ $actual_symbol != "EXMP" ]]; then echo "Actual symbol: $actual_symbol, Expected: EXMP" exit 1 fi diff --git a/scripts/local/integration-tests/example_messenger.sh b/scripts/local/integration-tests/example_messenger.sh index d4a6ba9b3..239aab64b 100755 --- a/scripts/local/integration-tests/example_messenger.sh +++ b/scripts/local/integration-tests/example_messenger.sh @@ -89,7 +89,7 @@ if [[ $(stringToLower $actual_sender_address) != $origin_contract_address_lower fi # Check that the message matched the one submitted to subnet A. # The message "hello world!" is returned without quotations, so it is split up as two different values by bash across indices 1 and 2 of the result. -if [[ "${result_arr[1]} ${result_arr[2]}" != "\"$send_cross_chain_message_message_string\"" ]]; then +if [[ "${result_arr[1]} ${result_arr[2]}" != "$send_cross_chain_message_message_string" ]]; then echo "Get current message returned unexpected message." echo "Actual: ${result_arr[1]} ${result_arr[2]}" echo "Expected: $send_cross_chain_message_message_string" From 6111e86f0f7ad08872ecd0afdedec814efcea4db Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 30 Oct 2023 01:43:26 -0400 Subject: [PATCH 085/183] Fix test --- .../ERC20TokenSource/ERC20TokenSource.go | 82 +++++++++++------ .../NativeTokenBridge/ERC20TokenSource.sol | 19 ++-- .../NativeTokenBridge/IERC20TokenSource.sol | 2 - scripts/local/e2e_test.sh | 1 + tests/e2e_test.go | 4 +- tests/erc20_to_native_token_bridge.go | 88 +++++++++++-------- tests/native_token_bridge.go | 28 +++--- 7 files changed, 137 insertions(+), 87 deletions(-) diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go index 6c32c97bd..c1f09f792 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go @@ -31,7 +31,7 @@ var ( // ERC20TokenSourceMetaData contains all meta data concerning the ERC20TokenSource contract. var ERC20TokenSourceMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"ERC20ContractAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"transferAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"ERC20ContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"erc20ContractAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"transferAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"erc20ContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // ERC20TokenSourceABI is the input ABI used to generate the binding from. @@ -273,6 +273,37 @@ func (_ERC20TokenSource *ERC20TokenSourceCallerSession) DestinationBlockchainID( return _ERC20TokenSource.Contract.DestinationBlockchainID(&_ERC20TokenSource.CallOpts) } +// Erc20ContractAddress is a free data retrieval call binding the contract method 0xe486df15. +// +// Solidity: function erc20ContractAddress() view returns(address) +func (_ERC20TokenSource *ERC20TokenSourceCaller) Erc20ContractAddress(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _ERC20TokenSource.contract.Call(opts, &out, "erc20ContractAddress") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Erc20ContractAddress is a free data retrieval call binding the contract method 0xe486df15. +// +// Solidity: function erc20ContractAddress() view returns(address) +func (_ERC20TokenSource *ERC20TokenSourceSession) Erc20ContractAddress() (common.Address, error) { + return _ERC20TokenSource.Contract.Erc20ContractAddress(&_ERC20TokenSource.CallOpts) +} + +// Erc20ContractAddress is a free data retrieval call binding the contract method 0xe486df15. +// +// Solidity: function erc20ContractAddress() view returns(address) +func (_ERC20TokenSource *ERC20TokenSourceCallerSession) Erc20ContractAddress() (common.Address, error) { + return _ERC20TokenSource.Contract.Erc20ContractAddress(&_ERC20TokenSource.CallOpts) +} + // NativeTokenDestinationAddress is a free data retrieval call binding the contract method 0xb8c9091a. // // Solidity: function nativeTokenDestinationAddress() view returns(address) @@ -356,25 +387,25 @@ func (_ERC20TokenSource *ERC20TokenSourceTransactorSession) ReceiveTeleporterMes return _ERC20TokenSource.Contract.ReceiveTeleporterMessage(&_ERC20TokenSource.TransactOpts, senderBlockchainID, senderAddress, message) } -// TransferToDestination is a paid mutator transaction binding the contract method 0x10a61f2b. +// TransferToDestination is a paid mutator transaction binding the contract method 0x87a2edba. // -// Solidity: function transferToDestination(address recipient, address ERC20ContractAddress, uint256 totalAmount, uint256 feeAmount, address[] allowedRelayerAddresses) returns() -func (_ERC20TokenSource *ERC20TokenSourceTransactor) TransferToDestination(opts *bind.TransactOpts, recipient common.Address, ERC20ContractAddress common.Address, totalAmount *big.Int, feeAmount *big.Int, allowedRelayerAddresses []common.Address) (*types.Transaction, error) { - return _ERC20TokenSource.contract.Transact(opts, "transferToDestination", recipient, ERC20ContractAddress, totalAmount, feeAmount, allowedRelayerAddresses) +// Solidity: function transferToDestination(address recipient, uint256 totalAmount, uint256 feeAmount, address[] allowedRelayerAddresses) returns() +func (_ERC20TokenSource *ERC20TokenSourceTransactor) TransferToDestination(opts *bind.TransactOpts, recipient common.Address, totalAmount *big.Int, feeAmount *big.Int, allowedRelayerAddresses []common.Address) (*types.Transaction, error) { + return _ERC20TokenSource.contract.Transact(opts, "transferToDestination", recipient, totalAmount, feeAmount, allowedRelayerAddresses) } -// TransferToDestination is a paid mutator transaction binding the contract method 0x10a61f2b. +// TransferToDestination is a paid mutator transaction binding the contract method 0x87a2edba. // -// Solidity: function transferToDestination(address recipient, address ERC20ContractAddress, uint256 totalAmount, uint256 feeAmount, address[] allowedRelayerAddresses) returns() -func (_ERC20TokenSource *ERC20TokenSourceSession) TransferToDestination(recipient common.Address, ERC20ContractAddress common.Address, totalAmount *big.Int, feeAmount *big.Int, allowedRelayerAddresses []common.Address) (*types.Transaction, error) { - return _ERC20TokenSource.Contract.TransferToDestination(&_ERC20TokenSource.TransactOpts, recipient, ERC20ContractAddress, totalAmount, feeAmount, allowedRelayerAddresses) +// Solidity: function transferToDestination(address recipient, uint256 totalAmount, uint256 feeAmount, address[] allowedRelayerAddresses) returns() +func (_ERC20TokenSource *ERC20TokenSourceSession) TransferToDestination(recipient common.Address, totalAmount *big.Int, feeAmount *big.Int, allowedRelayerAddresses []common.Address) (*types.Transaction, error) { + return _ERC20TokenSource.Contract.TransferToDestination(&_ERC20TokenSource.TransactOpts, recipient, totalAmount, feeAmount, allowedRelayerAddresses) } -// TransferToDestination is a paid mutator transaction binding the contract method 0x10a61f2b. +// TransferToDestination is a paid mutator transaction binding the contract method 0x87a2edba. // -// Solidity: function transferToDestination(address recipient, address ERC20ContractAddress, uint256 totalAmount, uint256 feeAmount, address[] allowedRelayerAddresses) returns() -func (_ERC20TokenSource *ERC20TokenSourceTransactorSession) TransferToDestination(recipient common.Address, ERC20ContractAddress common.Address, totalAmount *big.Int, feeAmount *big.Int, allowedRelayerAddresses []common.Address) (*types.Transaction, error) { - return _ERC20TokenSource.Contract.TransferToDestination(&_ERC20TokenSource.TransactOpts, recipient, ERC20ContractAddress, totalAmount, feeAmount, allowedRelayerAddresses) +// Solidity: function transferToDestination(address recipient, uint256 totalAmount, uint256 feeAmount, address[] allowedRelayerAddresses) returns() +func (_ERC20TokenSource *ERC20TokenSourceTransactorSession) TransferToDestination(recipient common.Address, totalAmount *big.Int, feeAmount *big.Int, allowedRelayerAddresses []common.Address) (*types.Transaction, error) { + return _ERC20TokenSource.Contract.TransferToDestination(&_ERC20TokenSource.TransactOpts, recipient, totalAmount, feeAmount, allowedRelayerAddresses) } // ERC20TokenSourceTransferToDestinationIterator is returned from FilterTransferToDestination and is used to iterate over the raw logs and unpacked data for TransferToDestination events raised by the ERC20TokenSource contract. @@ -446,18 +477,17 @@ func (it *ERC20TokenSourceTransferToDestinationIterator) Close() error { // ERC20TokenSourceTransferToDestination represents a TransferToDestination event raised by the ERC20TokenSource contract. type ERC20TokenSourceTransferToDestination struct { - Sender common.Address - Recipient common.Address - ERC20ContractAddress common.Address - TransferAmount *big.Int - FeeAmount *big.Int - TeleporterMessageID *big.Int - Raw types.Log // Blockchain specific contextual infos + Sender common.Address + Recipient common.Address + TransferAmount *big.Int + FeeAmount *big.Int + TeleporterMessageID *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterTransferToDestination is a free log retrieval operation binding the contract event 0x13a202fe5d8659b297514aa4630f23f3a30583706bf3aa067257552aa20e9ec3. +// FilterTransferToDestination is a free log retrieval operation binding the contract event 0x51f5c55ca5f8f5fde6736f19d1d035a8c67fe18c30d445cea44c4816c6a525a0. // -// Solidity: event TransferToDestination(address indexed sender, address indexed recipient, address ERC20ContractAddress, uint256 transferAmount, uint256 feeAmount, uint256 teleporterMessageID) +// Solidity: event TransferToDestination(address indexed sender, address indexed recipient, uint256 transferAmount, uint256 feeAmount, uint256 teleporterMessageID) func (_ERC20TokenSource *ERC20TokenSourceFilterer) FilterTransferToDestination(opts *bind.FilterOpts, sender []common.Address, recipient []common.Address) (*ERC20TokenSourceTransferToDestinationIterator, error) { var senderRule []interface{} @@ -476,9 +506,9 @@ func (_ERC20TokenSource *ERC20TokenSourceFilterer) FilterTransferToDestination(o return &ERC20TokenSourceTransferToDestinationIterator{contract: _ERC20TokenSource.contract, event: "TransferToDestination", logs: logs, sub: sub}, nil } -// WatchTransferToDestination is a free log subscription operation binding the contract event 0x13a202fe5d8659b297514aa4630f23f3a30583706bf3aa067257552aa20e9ec3. +// WatchTransferToDestination is a free log subscription operation binding the contract event 0x51f5c55ca5f8f5fde6736f19d1d035a8c67fe18c30d445cea44c4816c6a525a0. // -// Solidity: event TransferToDestination(address indexed sender, address indexed recipient, address ERC20ContractAddress, uint256 transferAmount, uint256 feeAmount, uint256 teleporterMessageID) +// Solidity: event TransferToDestination(address indexed sender, address indexed recipient, uint256 transferAmount, uint256 feeAmount, uint256 teleporterMessageID) func (_ERC20TokenSource *ERC20TokenSourceFilterer) WatchTransferToDestination(opts *bind.WatchOpts, sink chan<- *ERC20TokenSourceTransferToDestination, sender []common.Address, recipient []common.Address) (event.Subscription, error) { var senderRule []interface{} @@ -522,9 +552,9 @@ func (_ERC20TokenSource *ERC20TokenSourceFilterer) WatchTransferToDestination(op }), nil } -// ParseTransferToDestination is a log parse operation binding the contract event 0x13a202fe5d8659b297514aa4630f23f3a30583706bf3aa067257552aa20e9ec3. +// ParseTransferToDestination is a log parse operation binding the contract event 0x51f5c55ca5f8f5fde6736f19d1d035a8c67fe18c30d445cea44c4816c6a525a0. // -// Solidity: event TransferToDestination(address indexed sender, address indexed recipient, address ERC20ContractAddress, uint256 transferAmount, uint256 feeAmount, uint256 teleporterMessageID) +// Solidity: event TransferToDestination(address indexed sender, address indexed recipient, uint256 transferAmount, uint256 feeAmount, uint256 teleporterMessageID) func (_ERC20TokenSource *ERC20TokenSourceFilterer) ParseTransferToDestination(log types.Log) (*ERC20TokenSourceTransferToDestination, error) { event := new(ERC20TokenSourceTransferToDestination) if err := _ERC20TokenSource.contract.UnpackLog(event, "TransferToDestination", log); err != nil { diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol index 3f25d96cd..e5d198459 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol @@ -23,6 +23,7 @@ contract ERC20TokenSource is bytes32 public immutable currentBlockchainID; bytes32 public immutable destinationBlockchainID; address public immutable nativeTokenDestinationAddress; + address public immutable erc20ContractAddress; // Used for sending an receiving Teleporter messages. ITeleporterMessenger public immutable teleporterMessenger; @@ -30,7 +31,8 @@ contract ERC20TokenSource is constructor( address teleporterMessengerAddress, bytes32 destinationBlockchainID_, - address nativeTokenDestinationAddress_ + address nativeTokenDestinationAddress_, + address erc20ContractAddress_ ) { currentBlockchainID = WarpMessenger( 0x0200000000000000000000000000000000000005 @@ -57,6 +59,9 @@ contract ERC20TokenSource is "Invalid Destination Contract Address" ); nativeTokenDestinationAddress = nativeTokenDestinationAddress_; + + require(erc20ContractAddress_ != address(0), "Invalid ERC20 Contract Address"); + erc20ContractAddress = erc20ContractAddress_; } /** @@ -93,8 +98,8 @@ contract ERC20TokenSource is ); require(recipient != address(0), "Invalid Recipient Address"); - // Send to recipient - payable(recipient).transfer(amount); + // Transfer to recipient + IERC20(erc20ContractAddress).safeTransfer(recipient, amount); emit UnlockTokens(recipient, amount); } @@ -104,7 +109,6 @@ contract ERC20TokenSource is */ function transferToDestination( address recipient, - address ERC20ContractAddress, uint256 totalAmount, uint256 feeAmount, address[] calldata allowedRelayerAddresses @@ -116,7 +120,7 @@ contract ERC20TokenSource is // implementations by only bridging the actual balance increase reflected by the call // to transferFrom. uint256 adjustedAmount = SafeERC20TransferFrom.safeTransferFrom( - IERC20(ERC20ContractAddress), + IERC20(erc20ContractAddress), totalAmount ); @@ -128,7 +132,7 @@ contract ERC20TokenSource is // Allow the Teleporter messenger to spend the fee amount. if (feeAmount > 0) { - IERC20(ERC20ContractAddress).safeIncreaseAllowance( + IERC20(erc20ContractAddress).safeIncreaseAllowance( address(teleporterMessenger), feeAmount ); @@ -141,7 +145,7 @@ contract ERC20TokenSource is destinationChainID: destinationBlockchainID, destinationAddress: nativeTokenDestinationAddress, feeInfo: TeleporterFeeInfo({ - contractAddress: ERC20ContractAddress, + contractAddress: erc20ContractAddress, amount: feeAmount }), requiredGasLimit: MINT_NATIVE_TOKENS_REQUIRED_GAS, @@ -153,7 +157,6 @@ contract ERC20TokenSource is emit TransferToDestination({ sender: msg.sender, recipient: recipient, - ERC20ContractAddress: ERC20ContractAddress, transferAmount: totalAmount, feeAmount: feeAmount, teleporterMessageID: messageID diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol index 9e26798e3..726a6ba31 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol @@ -16,7 +16,6 @@ interface IERC20TokenSource { event TransferToDestination( address indexed sender, address indexed recipient, - address ERC20ContractAddress, uint256 transferAmount, uint256 feeAmount, uint256 teleporterMessageID @@ -32,7 +31,6 @@ interface IERC20TokenSource { */ function transferToDestination( address recipient, - address ERC20ContractAddress, uint256 totalAmount, uint256 feeAmount, address[] calldata allowedRelayerAddresses diff --git a/scripts/local/e2e_test.sh b/scripts/local/e2e_test.sh index 204169de3..ff9907e82 100755 --- a/scripts/local/e2e_test.sh +++ b/scripts/local/e2e_test.sh @@ -80,6 +80,7 @@ ginkgo build ./tests/ echo "Running e2e tests $RUN_E2E" RUN_E2E=true ./tests/tests.test \ --ginkgo.vv \ + --ginkgo.trace \ --ginkgo.label-filter=${GINKGO_LABEL_FILTER:-""} echo "e2e tests passed" diff --git a/tests/e2e_test.go b/tests/e2e_test.go index cd095786e..211122ebe 100644 --- a/tests/e2e_test.go +++ b/tests/e2e_test.go @@ -42,7 +42,7 @@ var _ = ginkgo.BeforeSuite(func() { var _ = ginkgo.AfterSuite(testUtils.TearDownNetwork) var _ = ginkgo.Describe("[Teleporter integration tests]", func() { - ginkgo.It("Send a message from Subnet A to Subnet B", BasicOneWaySend) - ginkgo.It("Send native tokens from subnet A to B and back", NativeTokenBridge) + // ginkgo.It("Send a message from Subnet A to Subnet B", BasicOneWaySend) + // ginkgo.It("Send native tokens from subnet A to B and back", NativeTokenBridge) ginkgo.It("Send ERC20 tokens from subnet A to Native tokens on subnet B and back", ERC20ToNativeTokenBridge) }) diff --git a/tests/erc20_to_native_token_bridge.go b/tests/erc20_to_native_token_bridge.go index 59bb012e3..8b9b111a6 100644 --- a/tests/erc20_to_native_token_bridge.go +++ b/tests/erc20_to_native_token_bridge.go @@ -8,8 +8,8 @@ import ( "github.com/ava-labs/subnet-evm/accounts/abi/bind" "github.com/ava-labs/subnet-evm/core/types" erc20tokensource "github.com/ava-labs/teleporter/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource" - exampleerc20 "github.com/ava-labs/teleporter/abi-bindings/go/Mocks/ExampleERC20" nativetokendestination "github.com/ava-labs/teleporter/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination" + exampleerc20 "github.com/ava-labs/teleporter/abi-bindings/go/Mocks/ExampleERC20" "github.com/ava-labs/teleporter/tests/utils" deploymentUtils "github.com/ava-labs/teleporter/utils/deployment-utils" "github.com/ethereum/go-ethereum/common" @@ -25,15 +25,15 @@ func ERC20ToNativeTokenBridge() { valueToSend2 = tokenReserve valueToReturn = valueToSend1 / 4 - bridgeDeployerKeyStr = "aad7440febfc8f9d73a58c3cb1f1754779a566978f9ebffcd4f4698e9b043985" + bridge = "aad7440febfc8f9d73a58c3cb1f1754779a566978f9ebffcd4f4698e9b043985" ExampleERC20ByteCodeFile = "./contracts/out/ExampleERC20.sol/ExampleERC20.json" ERC20TokenSourceByteCodeFile = "./contracts/out/ERC20TokenSource.sol/ERC20TokenSource.json" NativeTokenDestinationByteCodeFile = "./contracts/out/NativeTokenDestination.sol/NativeTokenDestination.json" ) var ( - ctx = context.Background() - nativeTokenBridgeDeployer = common.HexToAddress("0x1337cfd2dCff6270615B90938aCB1efE79801704") - tokenReceiverAddress = common.HexToAddress("0x0123456789012345678901234567890123456789") + ctx = context.Background() + deployerAddress = common.HexToAddress("0x1337cfd2dCff6270615B90938aCB1efE79801704") + tokenReceiverAddress = common.HexToAddress("0x0123456789012345678901234567890123456789") ) subnetA := utils.GetSubnetATestInfo() @@ -41,62 +41,66 @@ func ERC20ToNativeTokenBridge() { teleporterContractAddress := utils.GetTeleporterContractAddress() // Info we need to calculate for the test - nativeTokenBridgeDeployerPK, err := crypto.HexToECDSA(bridgeDeployerKeyStr) + deployerPK, err := crypto.HexToECDSA(bridge) Expect(err).Should(BeNil()) - nativeTokenBridgeContractAddress, err := deploymentUtils.DeriveEVMContractAddress(nativeTokenBridgeDeployer, 0) + bridgeContractAddress, err := deploymentUtils.DeriveEVMContractAddress(deployerAddress, 0) Expect(err).Should(BeNil()) - log.Info("Native Token Bridge Contract Address: " + nativeTokenBridgeContractAddress.Hex()) - var exampleERC20ContractAddress common.Address + exampleERC20ContractAddress, err := deploymentUtils.DeriveEVMContractAddress(deployerAddress, 1) + Expect(err).Should(BeNil()) + log.Info("Native Token Bridge Contract Address: " + bridgeContractAddress.Hex()) { // Deploy the contracts + // Both contracts in this test will be deployed to 0xAcB633F5B00099c7ec187eB00156c5cd9D854b5B, + // though they do not necessarily have to be deployed at the same address, each contract needs + // to know the address of the other. + // The nativeTokenDestination contract must be added to "adminAddresses" of "contractNativeMinterConfig" + // in the genesis file for the subnet. This will allow it to call the native minter precompile. erc20TokenSourceBytecode, err := deploymentUtils.ExtractByteCode(ERC20TokenSourceByteCodeFile) Expect(err).Should(BeNil()) - chainATransactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, subnetA.ChainID) + Expect(len(erc20TokenSourceBytecode) > 0).Should(BeTrue()) + chainATransactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetA.ChainID) Expect(err).Should(BeNil()) erc20TokenSourceAbi, err := erc20tokensource.ERC20TokenSourceMetaData.GetAbi() Expect(err).Should(BeNil()) - _, txA, _, err := bind.DeployContract(chainATransactor, *erc20TokenSourceAbi, erc20TokenSourceBytecode, subnetA.WSClient, teleporterContractAddress, subnetB.BlockchainID, nativeTokenBridgeContractAddress) + _, txA, _, err := bind.DeployContract(chainATransactor, *erc20TokenSourceAbi, erc20TokenSourceBytecode, subnetA.WSClient, teleporterContractAddress, subnetB.BlockchainID, bridgeContractAddress, exampleERC20ContractAddress) Expect(err).Should(BeNil()) // Wait for transaction, then check code was deployed utils.WaitForTransaction(ctx, txA.Hash(), subnetA.WSClient) - bridgeCodeA, err := subnetA.WSClient.CodeAt(ctx, nativeTokenBridgeContractAddress, nil) + bridgeCodeA, err := subnetA.WSClient.CodeAt(ctx, bridgeContractAddress, nil) Expect(err).Should(BeNil()) Expect(len(bridgeCodeA)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode - // Both contracts in this test will be deployed to 0xAcB633F5B00099c7ec187eB00156c5cd9D854b5B, - // though they do not necessarily have to be deployed at the same address, each contract needs - // to know the address of the other. - // The nativeTokenDestination contract must be added to "adminAddresses" of "contractNativeMinterConfig" - // in the genesis file for the subnet. This will allow it to call the native minter precompile. nativeTokenDestinationBytecode, err := deploymentUtils.ExtractByteCode(NativeTokenDestinationByteCodeFile) Expect(err).Should(BeNil()) - chainBTransactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, subnetB.ChainID) + Expect(len(nativeTokenDestinationBytecode) > 0).Should(BeTrue()) + chainBTransactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetB.ChainID) Expect(err).Should(BeNil()) nativeTokenDestinationAbi, err := nativetokendestination.NativeTokenDestinationMetaData.GetAbi() Expect(err).Should(BeNil()) - _, txB, _, err := bind.DeployContract(chainBTransactor, *nativeTokenDestinationAbi, nativeTokenDestinationBytecode, subnetB.WSClient, teleporterContractAddress, subnetA.BlockchainID, nativeTokenBridgeContractAddress, new(big.Int).SetUint64(tokenReserve)) + _, txB, _, err := bind.DeployContract(chainBTransactor, *nativeTokenDestinationAbi, nativeTokenDestinationBytecode, subnetB.WSClient, teleporterContractAddress, subnetA.BlockchainID, bridgeContractAddress, new(big.Int).SetUint64(tokenReserve)) Expect(err).Should(BeNil()) // Wait for transaction, then check code was deployed utils.WaitForTransaction(ctx, txB.Hash(), subnetB.WSClient) - bridgeCodeB, err := subnetB.WSClient.CodeAt(ctx, nativeTokenBridgeContractAddress, nil) + bridgeCodeB, err := subnetB.WSClient.CodeAt(ctx, bridgeContractAddress, nil) Expect(err).Should(BeNil()) Expect(len(bridgeCodeB)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode // Deploy an example ERC20 contract to be used as the source token exampleERC20Bytecode, err := deploymentUtils.ExtractByteCode(ExampleERC20ByteCodeFile) Expect(err).Should(BeNil()) - chainATransactor2, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, subnetA.ChainID) - Expect(err).Should(BeNil()) + Expect(len(exampleERC20Bytecode) > 0).Should(BeTrue()) exampleERC20Abi, err := exampleerc20.ExampleERC20MetaData.GetAbi() Expect(err).Should(BeNil()) - exampleERC20ContractAddress, txExampleERC20, _, err := bind.DeployContract(chainATransactor2, *exampleERC20Abi, exampleERC20Bytecode, subnetA.WSClient) + chainATransactor2, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetA.ChainID) + Expect(err).Should(BeNil()) + _, txExampleERC20, _, err := bind.DeployContract(chainATransactor2, *exampleERC20Abi, exampleERC20Bytecode, subnetA.WSClient) Expect(err).Should(BeNil()) // Wait for transaction, then check code was deployed utils.WaitForTransaction(ctx, txExampleERC20.Hash(), subnetA.WSClient) - exampleERC20Code, err := subnetB.WSClient.CodeAt(ctx, exampleERC20ContractAddress, nil) + exampleERC20Code, err := subnetA.WSClient.CodeAt(ctx, exampleERC20ContractAddress, nil) Expect(err).Should(BeNil()) Expect(len(exampleERC20Code)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode @@ -104,9 +108,9 @@ func ERC20ToNativeTokenBridge() { } // Create abi objects to call the contract with - nativeTokenDestination, err := nativetokendestination.NewNativeTokenDestination(nativeTokenBridgeContractAddress, subnetB.WSClient) + nativeTokenDestination, err := nativetokendestination.NewNativeTokenDestination(bridgeContractAddress, subnetB.WSClient) Expect(err).Should(BeNil()) - erc20TokenSource, err := erc20tokensource.NewERC20TokenSource(nativeTokenBridgeContractAddress, subnetA.WSClient) + erc20TokenSource, err := erc20tokensource.NewERC20TokenSource(bridgeContractAddress, subnetA.WSClient) Expect(err).Should(BeNil()) exampleERC20, err := exampleerc20.NewExampleERC20(exampleERC20ContractAddress, subnetA.WSClient) Expect(err).Should(BeNil()) @@ -134,7 +138,7 @@ func ERC20ToNativeTokenBridge() { transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, subnetA.ChainID) Expect(err).Should(BeNil()) - tx, err := erc20TokenSource.TransferToDestination(transactor, toAddress, exampleERC20ContractAddress, new(big.Int).SetUint64(valueToSend), big.NewInt(0), []common.Address{}) + tx, err := erc20TokenSource.TransferToDestination(transactor, toAddress, new(big.Int).SetUint64(valueToSend), big.NewInt(0), []common.Address{}) Expect(err).Should(BeNil()) log.Info("Sent TransferToDestination transaction on source chain", "destinationChainID", subnetB.BlockchainID, "txHash", tx.Hash().Hex()) @@ -146,13 +150,27 @@ func ERC20ToNativeTokenBridge() { return receipt } + { // Give erc20TokenSource allowance to spend all of the deployer's ERC20 Tokens + bal, err := exampleERC20.BalanceOf(nil, deployerAddress) + Expect(err).Should(BeNil()) + + transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetA.ChainID) + Expect(err).Should(BeNil()) + tx, err := exampleERC20.Approve(transactor, bridgeContractAddress, bal) + Expect(err).Should(BeNil()) + + receipt := utils.WaitForTransaction(ctx, tx.Hash(), subnetA.WSClient) + Expect(err).Should(BeNil()) + Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + } + { // Transfer some tokens A -> B // Check starting balance is 0 - bal, err := exampleERC20.BalanceOf(&bind.CallOpts{ Accepted: true }, tokenReceiverAddress) + bal, err := exampleERC20.BalanceOf(nil, tokenReceiverAddress) Expect(err).Should(BeNil()) Expect(bal.Uint64()).Should(BeZero()) - sendTokensToDestination(valueToSend1, nativeTokenBridgeDeployerPK, tokenReceiverAddress) + sendTokensToDestination(valueToSend1, deployerPK, tokenReceiverAddress) // Check intermediate balance, no tokens should be minted because we haven't collateralized bal, err = subnetB.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) @@ -162,11 +180,11 @@ func ERC20ToNativeTokenBridge() { { // Fail to Transfer tokens B -> A because bridge is not collateralized // Check starting balance is 0 - bal, err := exampleERC20.BalanceOf(&bind.CallOpts{ Accepted: true }, tokenReceiverAddress) + bal, err := exampleERC20.BalanceOf(&bind.CallOpts{Accepted: true}, tokenReceiverAddress) Expect(err).Should(BeNil()) Expect(bal.Cmp(common.Big0)).Should(BeZero()) - transactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, subnetB.ChainID) + transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetB.ChainID) Expect(err).Should(BeNil()) transactor.Value = new(big.Int).SetUint64(valueToSend1) @@ -175,7 +193,7 @@ func ERC20ToNativeTokenBridge() { Expect(err).ShouldNot(BeNil()) // Check we should fail to send because we're not collateralized - bal, err = exampleERC20.BalanceOf(&bind.CallOpts{ Accepted: true }, tokenReceiverAddress) + bal, err = exampleERC20.BalanceOf(&bind.CallOpts{Accepted: true}, tokenReceiverAddress) Expect(err).Should(BeNil()) Expect(bal.Uint64()).Should(BeZero()) } @@ -186,7 +204,7 @@ func ERC20ToNativeTokenBridge() { Expect(err).Should(BeNil()) Expect(bal.Uint64()).Should(BeZero()) - sendTokensToDestination(valueToSend2, nativeTokenBridgeDeployerPK, tokenReceiverAddress) + sendTokensToDestination(valueToSend2, deployerPK, tokenReceiverAddress) // We should have minted the excess coins after checking the collateral bal, err = subnetB.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) @@ -195,10 +213,10 @@ func ERC20ToNativeTokenBridge() { } { // Transfer tokens B -> A - sendTokensToSource(valueToReturn, nativeTokenBridgeDeployerPK, tokenReceiverAddress) + sendTokensToSource(valueToReturn, deployerPK, tokenReceiverAddress) // Check we should fail to send because we're not collateralized - bal, err := exampleERC20.BalanceOf(&bind.CallOpts{ Accepted: true }, tokenReceiverAddress) + bal, err := exampleERC20.BalanceOf(nil, tokenReceiverAddress) Expect(err).Should(BeNil()) Expect(bal.Uint64()).Should(Equal(valueToReturn)) } diff --git a/tests/native_token_bridge.go b/tests/native_token_bridge.go index f40d8562d..6a8ef6149 100644 --- a/tests/native_token_bridge.go +++ b/tests/native_token_bridge.go @@ -9,8 +9,8 @@ import ( "github.com/ava-labs/subnet-evm/core/types" nativetokendestination "github.com/ava-labs/teleporter/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination" nativetokensource "github.com/ava-labs/teleporter/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource" - deploymentUtils "github.com/ava-labs/teleporter/utils/deployment-utils" "github.com/ava-labs/teleporter/tests/utils" + deploymentUtils "github.com/ava-labs/teleporter/utils/deployment-utils" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/log" @@ -24,14 +24,14 @@ func NativeTokenBridge() { valueToSend2 = tokenReserve valueToReturn = valueToSend1 / 4 - bridgeDeployerKeyStr = "aad7440febfc8f9d73a58c3cb1f1754779a566978f9ebffcd4f4698e9b043985" + deployerKeyStr = "aad7440febfc8f9d73a58c3cb1f1754779a566978f9ebffcd4f4698e9b043985" NativeTokenSourceByteCodeFile = "./contracts/out/NativeTokenSource.sol/NativeTokenSource.json" NativeTokenDestinationByteCodeFile = "./contracts/out/NativeTokenDestination.sol/NativeTokenDestination.json" ) var ( - ctx = context.Background() - nativeTokenBridgeDeployer = common.HexToAddress("0x1337cfd2dCff6270615B90938aCB1efE79801704") - tokenReceiverAddress = common.HexToAddress("0x0123456789012345678901234567890123456789") + ctx = context.Background() + deployerAddress = common.HexToAddress("0x1337cfd2dCff6270615B90938aCB1efE79801704") + tokenReceiverAddress = common.HexToAddress("0x0123456789012345678901234567890123456789") ) subnetA := utils.GetSubnetATestInfo() @@ -39,16 +39,16 @@ func NativeTokenBridge() { teleporterContractAddress := utils.GetTeleporterContractAddress() // Info we need to calculate for the test - nativeTokenBridgeDeployerPK, err := crypto.HexToECDSA(bridgeDeployerKeyStr) + deployerPK, err := crypto.HexToECDSA(deployerKeyStr) Expect(err).Should(BeNil()) - nativeTokenBridgeContractAddress, err := deploymentUtils.DeriveEVMContractAddress(nativeTokenBridgeDeployer, 0) + nativeTokenBridgeContractAddress, err := deploymentUtils.DeriveEVMContractAddress(deployerAddress, 0) Expect(err).Should(BeNil()) log.Info("Native Token Bridge Contract Address: " + nativeTokenBridgeContractAddress.Hex()) { // Deploy the contracts nativeTokenSourceBytecode, err := deploymentUtils.ExtractByteCode(NativeTokenSourceByteCodeFile) Expect(err).Should(BeNil()) - chainATransactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, subnetA.ChainID) + chainATransactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetA.ChainID) Expect(err).Should(BeNil()) nativeTokenSourceAbi, err := nativetokensource.NativeTokenSourceMetaData.GetAbi() Expect(err).Should(BeNil()) @@ -62,7 +62,7 @@ func NativeTokenBridge() { // in the genesis file for the subnet. This will allow it to call the native minter precompile. nativeTokenDestinationBytecode, err := deploymentUtils.ExtractByteCode(NativeTokenDestinationByteCodeFile) Expect(err).Should(BeNil()) - chainBTransactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, subnetB.ChainID) + chainBTransactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetB.ChainID) Expect(err).Should(BeNil()) nativeTokenDestinationAbi, err := nativetokendestination.NativeTokenDestinationMetaData.GetAbi() Expect(err).Should(BeNil()) @@ -132,7 +132,7 @@ func NativeTokenBridge() { Expect(err).Should(BeNil()) Expect(bal.Uint64()).Should(Equal(common.Big0.Uint64())) - sendTokensToDestination(valueToSend1, nativeTokenBridgeDeployerPK, tokenReceiverAddress) + sendTokensToDestination(valueToSend1, deployerPK, tokenReceiverAddress) // Check intermediate balance, no tokens should be minted because we haven't collateralized bal, err = subnetB.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) @@ -140,13 +140,13 @@ func NativeTokenBridge() { Expect(bal.Uint64()).Should(BeZero()) } - { // Fail to Transfer tokens B -> A because bridge is not collateralized + { // Fail to Transfer tokens B -> A because bridge is not collateralized // Check starting balance is 0 bal, err := subnetA.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) Expect(err).Should(BeNil()) Expect(bal.Uint64()).Should(BeZero()) - transactor, err := bind.NewKeyedTransactorWithChainID(nativeTokenBridgeDeployerPK, subnetB.ChainID) + transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetB.ChainID) Expect(err).Should(BeNil()) transactor.Value = new(big.Int).SetUint64(valueToSend1) @@ -166,7 +166,7 @@ func NativeTokenBridge() { Expect(err).Should(BeNil()) Expect(bal.Uint64()).Should(BeZero()) - sendTokensToDestination(valueToSend2, nativeTokenBridgeDeployerPK, tokenReceiverAddress) + sendTokensToDestination(valueToSend2, deployerPK, tokenReceiverAddress) // We should have minted the excess coins after checking the collateral bal, err = subnetB.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) @@ -175,7 +175,7 @@ func NativeTokenBridge() { } { // Transfer tokens B -> A - sendTokensToSource(valueToReturn, nativeTokenBridgeDeployerPK, tokenReceiverAddress) + sendTokensToSource(valueToReturn, deployerPK, tokenReceiverAddress) // Check we should fail to send because we're not collateralized bal, err := subnetA.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) From 993447845af0729e12cb7a780bd95c6b00a34c1c Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 30 Oct 2023 02:02:45 -0400 Subject: [PATCH 086/183] Refactor contract deployment --- tests/e2e_test.go | 4 +- tests/erc20_to_native_token_bridge.go | 63 ++++++++++----------------- tests/native_token_bridge.go | 36 ++++----------- 3 files changed, 34 insertions(+), 69 deletions(-) diff --git a/tests/e2e_test.go b/tests/e2e_test.go index 211122ebe..cd095786e 100644 --- a/tests/e2e_test.go +++ b/tests/e2e_test.go @@ -42,7 +42,7 @@ var _ = ginkgo.BeforeSuite(func() { var _ = ginkgo.AfterSuite(testUtils.TearDownNetwork) var _ = ginkgo.Describe("[Teleporter integration tests]", func() { - // ginkgo.It("Send a message from Subnet A to Subnet B", BasicOneWaySend) - // ginkgo.It("Send native tokens from subnet A to B and back", NativeTokenBridge) + ginkgo.It("Send a message from Subnet A to Subnet B", BasicOneWaySend) + ginkgo.It("Send native tokens from subnet A to B and back", NativeTokenBridge) ginkgo.It("Send ERC20 tokens from subnet A to Native tokens on subnet B and back", ERC20ToNativeTokenBridge) }) diff --git a/tests/erc20_to_native_token_bridge.go b/tests/erc20_to_native_token_bridge.go index 8b9b111a6..f8941c5b7 100644 --- a/tests/erc20_to_native_token_bridge.go +++ b/tests/erc20_to_native_token_bridge.go @@ -5,6 +5,7 @@ import ( "crypto/ecdsa" "math/big" + "github.com/ava-labs/subnet-evm/accounts/abi" "github.com/ava-labs/subnet-evm/accounts/abi/bind" "github.com/ava-labs/subnet-evm/core/types" erc20tokensource "github.com/ava-labs/teleporter/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource" @@ -18,6 +19,9 @@ import ( . "github.com/onsi/gomega" ) + + + func ERC20ToNativeTokenBridge() { const ( tokenReserve = uint64(1e15) @@ -55,54 +59,18 @@ func ERC20ToNativeTokenBridge() { // to know the address of the other. // The nativeTokenDestination contract must be added to "adminAddresses" of "contractNativeMinterConfig" // in the genesis file for the subnet. This will allow it to call the native minter precompile. - erc20TokenSourceBytecode, err := deploymentUtils.ExtractByteCode(ERC20TokenSourceByteCodeFile) - Expect(err).Should(BeNil()) - Expect(len(erc20TokenSourceBytecode) > 0).Should(BeTrue()) - chainATransactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetA.ChainID) - Expect(err).Should(BeNil()) erc20TokenSourceAbi, err := erc20tokensource.ERC20TokenSourceMetaData.GetAbi() Expect(err).Should(BeNil()) - _, txA, _, err := bind.DeployContract(chainATransactor, *erc20TokenSourceAbi, erc20TokenSourceBytecode, subnetA.WSClient, teleporterContractAddress, subnetB.BlockchainID, bridgeContractAddress, exampleERC20ContractAddress) - Expect(err).Should(BeNil()) - - // Wait for transaction, then check code was deployed - utils.WaitForTransaction(ctx, txA.Hash(), subnetA.WSClient) - bridgeCodeA, err := subnetA.WSClient.CodeAt(ctx, bridgeContractAddress, nil) + DeployContract(ctx, ERC20TokenSourceByteCodeFile, deployerPK, subnetA, erc20TokenSourceAbi, teleporterContractAddress, subnetB.BlockchainID, bridgeContractAddress, exampleERC20ContractAddress) Expect(err).Should(BeNil()) - Expect(len(bridgeCodeA)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode - nativeTokenDestinationBytecode, err := deploymentUtils.ExtractByteCode(NativeTokenDestinationByteCodeFile) - Expect(err).Should(BeNil()) - Expect(len(nativeTokenDestinationBytecode) > 0).Should(BeTrue()) - chainBTransactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetB.ChainID) - Expect(err).Should(BeNil()) nativeTokenDestinationAbi, err := nativetokendestination.NativeTokenDestinationMetaData.GetAbi() Expect(err).Should(BeNil()) - _, txB, _, err := bind.DeployContract(chainBTransactor, *nativeTokenDestinationAbi, nativeTokenDestinationBytecode, subnetB.WSClient, teleporterContractAddress, subnetA.BlockchainID, bridgeContractAddress, new(big.Int).SetUint64(tokenReserve)) - Expect(err).Should(BeNil()) - - // Wait for transaction, then check code was deployed - utils.WaitForTransaction(ctx, txB.Hash(), subnetB.WSClient) - bridgeCodeB, err := subnetB.WSClient.CodeAt(ctx, bridgeContractAddress, nil) - Expect(err).Should(BeNil()) - Expect(len(bridgeCodeB)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode + DeployContract(ctx, NativeTokenDestinationByteCodeFile, deployerPK, subnetB, nativeTokenDestinationAbi, teleporterContractAddress, subnetA.BlockchainID, bridgeContractAddress, new(big.Int).SetUint64(tokenReserve)) - // Deploy an example ERC20 contract to be used as the source token - exampleERC20Bytecode, err := deploymentUtils.ExtractByteCode(ExampleERC20ByteCodeFile) - Expect(err).Should(BeNil()) - Expect(len(exampleERC20Bytecode) > 0).Should(BeTrue()) exampleERC20Abi, err := exampleerc20.ExampleERC20MetaData.GetAbi() Expect(err).Should(BeNil()) - chainATransactor2, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetA.ChainID) - Expect(err).Should(BeNil()) - _, txExampleERC20, _, err := bind.DeployContract(chainATransactor2, *exampleERC20Abi, exampleERC20Bytecode, subnetA.WSClient) - Expect(err).Should(BeNil()) - - // Wait for transaction, then check code was deployed - utils.WaitForTransaction(ctx, txExampleERC20.Hash(), subnetA.WSClient) - exampleERC20Code, err := subnetA.WSClient.CodeAt(ctx, exampleERC20ContractAddress, nil) - Expect(err).Should(BeNil()) - Expect(len(exampleERC20Code)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode + DeployContract(ctx, ExampleERC20ByteCodeFile, deployerPK, subnetA, exampleERC20Abi) log.Info("Finished deploying contracts") } @@ -221,3 +189,20 @@ func ERC20ToNativeTokenBridge() { Expect(bal.Uint64()).Should(Equal(valueToReturn)) } } + +func DeployContract(ctx context.Context, byteCodeFileName string, deployerPK *ecdsa.PrivateKey, subnetInfo utils.SubnetTestInfo, abi *abi.ABI, constructorArgs ...interface{}) { + // Deploy an example ERC20 contract to be used as the source token + byteCode, err := deploymentUtils.ExtractByteCode(byteCodeFileName) + Expect(err).Should(BeNil()) + Expect(len(byteCode) > 0).Should(BeTrue()) + chainATransactor2, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetInfo.ChainID) + Expect(err).Should(BeNil()) + contractAddress, tx, _, err := bind.DeployContract(chainATransactor2, *abi, byteCode, subnetInfo.WSClient, constructorArgs...) + Expect(err).Should(BeNil()) + + // Wait for transaction, then check code was deployed + utils.WaitForTransaction(ctx, tx.Hash(), subnetInfo.WSClient) + code, err := subnetInfo.WSClient.CodeAt(ctx, contractAddress, nil) + Expect(err).Should(BeNil()) + Expect(len(code)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode +} \ No newline at end of file diff --git a/tests/native_token_bridge.go b/tests/native_token_bridge.go index 6a8ef6149..de837962a 100644 --- a/tests/native_token_bridge.go +++ b/tests/native_token_bridge.go @@ -41,53 +41,33 @@ func NativeTokenBridge() { // Info we need to calculate for the test deployerPK, err := crypto.HexToECDSA(deployerKeyStr) Expect(err).Should(BeNil()) - nativeTokenBridgeContractAddress, err := deploymentUtils.DeriveEVMContractAddress(deployerAddress, 0) + bridgeContractAddress, err := deploymentUtils.DeriveEVMContractAddress(deployerAddress, 0) Expect(err).Should(BeNil()) - log.Info("Native Token Bridge Contract Address: " + nativeTokenBridgeContractAddress.Hex()) + log.Info("Native Token Bridge Contract Address: " + bridgeContractAddress.Hex()) { // Deploy the contracts - nativeTokenSourceBytecode, err := deploymentUtils.ExtractByteCode(NativeTokenSourceByteCodeFile) - Expect(err).Should(BeNil()) - chainATransactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetA.ChainID) - Expect(err).Should(BeNil()) - nativeTokenSourceAbi, err := nativetokensource.NativeTokenSourceMetaData.GetAbi() - Expect(err).Should(BeNil()) - _, txA, _, err := bind.DeployContract(chainATransactor, *nativeTokenSourceAbi, nativeTokenSourceBytecode, subnetA.WSClient, teleporterContractAddress, subnetB.BlockchainID, nativeTokenBridgeContractAddress) - Expect(err).Should(BeNil()) - // Both contracts in this test will be deployed to 0xAcB633F5B00099c7ec187eB00156c5cd9D854b5B, // though they do not necessarily have to be deployed at the same address, each contract needs // to know the address of the other. // The nativeTokenDestination contract must be added to "adminAddresses" of "contractNativeMinterConfig" // in the genesis file for the subnet. This will allow it to call the native minter precompile. - nativeTokenDestinationBytecode, err := deploymentUtils.ExtractByteCode(NativeTokenDestinationByteCodeFile) + erc20TokenSourceAbi, err := nativetokensource.NativeTokenSourceMetaData.GetAbi() Expect(err).Should(BeNil()) - chainBTransactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetB.ChainID) - Expect(err).Should(BeNil()) - nativeTokenDestinationAbi, err := nativetokendestination.NativeTokenDestinationMetaData.GetAbi() - Expect(err).Should(BeNil()) - _, txB, _, err := bind.DeployContract(chainBTransactor, *nativeTokenDestinationAbi, nativeTokenDestinationBytecode, subnetB.WSClient, teleporterContractAddress, subnetA.BlockchainID, nativeTokenBridgeContractAddress, new(big.Int).SetUint64(tokenReserve)) + DeployContract(ctx, NativeTokenSourceByteCodeFile, deployerPK, subnetA, erc20TokenSourceAbi, teleporterContractAddress, subnetB.BlockchainID, bridgeContractAddress) Expect(err).Should(BeNil()) - // Wait for transaction, then check code was deployed - utils.WaitForTransaction(ctx, txA.Hash(), subnetA.WSClient) - bridgeCodeA, err := subnetA.WSClient.CodeAt(ctx, nativeTokenBridgeContractAddress, nil) + nativeTokenDestinationAbi, err := nativetokendestination.NativeTokenDestinationMetaData.GetAbi() Expect(err).Should(BeNil()) - Expect(len(bridgeCodeA)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode + DeployContract(ctx, NativeTokenDestinationByteCodeFile, deployerPK, subnetB, nativeTokenDestinationAbi, teleporterContractAddress, subnetA.BlockchainID, bridgeContractAddress, new(big.Int).SetUint64(tokenReserve)) - // Wait for transaction, then check code was deployed - utils.WaitForTransaction(ctx, txB.Hash(), subnetB.WSClient) - bridgeCodeB, err := subnetB.WSClient.CodeAt(ctx, nativeTokenBridgeContractAddress, nil) - Expect(err).Should(BeNil()) - Expect(len(bridgeCodeB)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode log.Info("Finished deploying Bridge contracts") } // Create abi objects to call the contract with - nativeTokenDestination, err := nativetokendestination.NewNativeTokenDestination(nativeTokenBridgeContractAddress, subnetB.WSClient) + nativeTokenDestination, err := nativetokendestination.NewNativeTokenDestination(bridgeContractAddress, subnetB.WSClient) Expect(err).Should(BeNil()) - nativeTokenSource, err := nativetokensource.NewNativeTokenSource(nativeTokenBridgeContractAddress, subnetA.WSClient) + nativeTokenSource, err := nativetokensource.NewNativeTokenSource(bridgeContractAddress, subnetA.WSClient) Expect(err).Should(BeNil()) // Helper function From 12adf80d06fddb994d66fcfa751249cc3c56ea50 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 30 Oct 2023 02:10:02 -0400 Subject: [PATCH 087/183] review fixes --- .../NativeTokenBridge/ERC20TokenSource.sol | 29 +++++++++++------ .../NativeTokenDestination.sol | 31 ++++++++++++------- .../NativeTokenBridge/NativeTokenSource.sol | 24 ++++++++------ 3 files changed, 54 insertions(+), 30 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol index e5d198459..603aebf08 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol @@ -40,27 +40,30 @@ contract ERC20TokenSource is require( teleporterMessengerAddress != address(0), - "Invalid TeleporterMessenger Address" + "ERC20TokenSource: zero TeleporterMessenger Address" ); teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); require( destinationBlockchainID_ != bytes32(0), - "Invalid Destination Chain ID" + "ERC20TokenSource: zero Destination Chain ID" ); require( destinationBlockchainID_ != currentBlockchainID, - "Cannot Bridge With Same Blockchain" + "ERC20TokenSource: Cannot Bridge With Same Blockchain" ); destinationBlockchainID = destinationBlockchainID_; require( nativeTokenDestinationAddress_ != address(0), - "Invalid Destination Contract Address" + "ERC20TokenSource: zero Destination Contract Address" ); nativeTokenDestinationAddress = nativeTokenDestinationAddress_; - require(erc20ContractAddress_ != address(0), "Invalid ERC20 Contract Address"); + require( + erc20ContractAddress_ != address(0), + "ERC20TokenSource: Invalid ERC20 Contract Address" + ); erc20ContractAddress = erc20ContractAddress_; } @@ -77,26 +80,29 @@ contract ERC20TokenSource is // Only allow the Teleporter messenger to deliver messages. require( msg.sender == address(teleporterMessenger), - "Unauthorized TeleporterMessenger contract" + "ERC20TokenSource: Unauthorized TeleporterMessenger contract" ); // Only allow messages from the destination chain. require( senderBlockchainID == destinationBlockchainID, - "Invalid Destination Chain" + "ERC20TokenSource: Invalid Destination Chain" ); // Only allow the partner contract to send messages. require( senderAddress == nativeTokenDestinationAddress, - "Unauthorized Sender" + "ERC20TokenSource: Unauthorized Sender" ); (address recipient, uint256 amount) = abi.decode( message, (address, uint256) ); - require(recipient != address(0), "Invalid Recipient Address"); + require( + recipient != address(0), + "ERC20TokenSource: zero Recipient Address" + ); // Transfer to recipient IERC20(erc20ContractAddress).safeTransfer(recipient, amount); @@ -114,7 +120,10 @@ contract ERC20TokenSource is address[] calldata allowedRelayerAddresses ) external nonReentrant { // The recipient cannot be the zero address. - require(recipient != address(0), "Invalid Recipient Address"); + require( + recipient != address(0), + "ERC20TokenSource: zero Recipient Address" + ); // Lock tokens in this contract. Supports "fee/burn on transfer" ERC20 token // implementations by only bridging the actual balance increase reflected by the call diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index fc6e49b21..dbdc3e721 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -56,20 +56,23 @@ contract NativeTokenDestination is require( teleporterMessengerAddress != address(0), - "Invalid TeleporterMessenger Address" + "NativeTokenDestination: zero TeleporterMessenger Address" ); teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); - require(sourceBlockchainID_ != bytes32(0), "Invalid Source Chain ID"); + require( + sourceBlockchainID_ != bytes32(0), + "NativeTokenDestination: zero Source Chain ID" + ); require( sourceBlockchainID_ != currentBlockchainID, - "Cannot Bridge With Same Blockchain" + "NativeTokenDestination: Cannot Bridge With Same Blockchain" ); sourceBlockchainID = sourceBlockchainID_; require( nativeTokenSourceAddress_ != address(0), - "Invalid Source Contract Address" + "NativeTokenDestination: zero Source Contract Address" ); nativeTokenSourceAddress = nativeTokenSourceAddress_; @@ -89,27 +92,30 @@ contract NativeTokenDestination is // Only allow the Teleporter messenger to deliver messages. require( msg.sender == address(teleporterMessenger), - "Unauthorized TeleporterMessenger contract" + "NativeTokenDestination: Unauthorized TeleporterMessenger contract" ); // Only allow messages from the source chain. require( senderBlockchainID == sourceBlockchainID, - "Invalid Source Chain" + "NativeTokenDestination: Invalid Source Chain" ); // Only allow the partner contract to send messages. require( senderAddress == nativeTokenSourceAddress, - "Unauthorized Sender" + "NativeTokenDestination: Unauthorized Sender" ); (address recipient, uint256 amount) = abi.decode( message, (address, uint256) ); - require(recipient != address(0), "Invalid Recipient Address"); - require(amount != 0, "Transfer value of 0"); + require( + recipient != address(0), + "NativeTokenDestination: zero Recipient Address" + ); + require(amount != 0, "NativeTokenDestination: Transfer value of 0"); uint256 adjustedAmount = amount; if (tokenReserve > 0) { @@ -139,11 +145,14 @@ contract NativeTokenDestination is address[] calldata allowedRelayerAddresses ) external payable nonReentrant { // The recipient cannot be the zero address. - require(recipient != address(0), "Invalid Recipient Address"); + require( + recipient != address(0), + "NativeTokenDestination: zero Recipient Address" + ); require( tokenReserve == 0, - "Cannot release tokens until source contract is collateralized" + "NativeTokenDestination: Cannot release tokens until source contract is collateralized" ); // Lock tokens in this bridge instance. Supports "fee/burn on transfer" ERC20 token diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index bb9d58dca..8fcba98a7 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -38,23 +38,23 @@ contract NativeTokenSource is require( teleporterMessengerAddress != address(0), - "Invalid TeleporterMessenger Address" + "NativeTokenSource: zero TeleporterMessenger Address" ); teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); require( destinationBlockchainID_ != bytes32(0), - "Invalid Destination Chain ID" + "NativeTokenSource: zero Destination Chain ID" ); require( destinationBlockchainID_ != currentBlockchainID, - "Cannot Bridge With Same Blockchain" + "NativeTokenSource: Cannot Bridge With Same Blockchain" ); destinationBlockchainID = destinationBlockchainID_; require( nativeTokenDestinationAddress_ != address(0), - "Invalid Destination Contract Address" + "NativeTokenSource: zero Destination Contract Address" ); nativeTokenDestinationAddress = nativeTokenDestinationAddress_; } @@ -72,26 +72,29 @@ contract NativeTokenSource is // Only allow the Teleporter messenger to deliver messages. require( msg.sender == address(teleporterMessenger), - "Unauthorized TeleporterMessenger contract" + "NativeTokenSource: Unauthorized TeleporterMessenger contract" ); // Only allow messages from the destination chain. require( senderBlockchainID == destinationBlockchainID, - "Invalid Destination Chain" + "NativeTokenSource: Invalid Destination Chain" ); // Only allow the partner contract to send messages. require( senderAddress == nativeTokenDestinationAddress, - "Unauthorized Sender" + "NativeTokenSource: Unauthorized Sender" ); (address recipient, uint256 amount) = abi.decode( message, (address, uint256) ); - require(recipient != address(0), "Invalid Recipient Address"); + require( + recipient != address(0), + "NativeTokenSource: zero Recipient Address" + ); // Send to recipient payable(recipient).transfer(amount); @@ -109,7 +112,10 @@ contract NativeTokenSource is address[] calldata allowedRelayerAddresses ) external payable nonReentrant { // The recipient cannot be the zero address. - require(recipient != address(0), "Invalid Recipient Address"); + require( + recipient != address(0), + "NativeTokenSource: zero Recipient Address" + ); // Lock tokens in this bridge instance. Supports "fee/burn on transfer" ERC20 token // implementations by only bridging the actual balance increase reflected by the call From 3bc64c0d0cf5a8c2c017f1c7c078f994e2846ed1 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 30 Oct 2023 02:18:22 -0400 Subject: [PATCH 088/183] Rename tokenReserve to initialTokenImbalance --- .../NativeTokenDestination.go | 126 +++++++++++++----- .../NativeTokenDestination.sol | 32 +++-- .../NativeTokenBridge/README.md | 6 +- tests/erc20_to_native_token_bridge.go | 10 +- tests/native_token_bridge.go | 10 +- 5 files changed, 126 insertions(+), 58 deletions(-) diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go index 29a7710b7..d24bef098 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go @@ -31,7 +31,7 @@ var ( // NativeTokenDestinationMetaData contains all meta data concerning the NativeTokenDestination contract. var NativeTokenDestinationMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenReserve_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tokenReserve\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialReserveImbalance_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", } // NativeTokenDestinationABI is the input ABI used to generate the binding from. @@ -242,6 +242,99 @@ func (_NativeTokenDestination *NativeTokenDestinationCallerSession) CurrentBlock return _NativeTokenDestination.Contract.CurrentBlockchainID(&_NativeTokenDestination.CallOpts) } +// CurrentReserveImbalance is a free data retrieval call binding the contract method 0x00d872ae. +// +// Solidity: function currentReserveImbalance() view returns(uint256) +func (_NativeTokenDestination *NativeTokenDestinationCaller) CurrentReserveImbalance(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _NativeTokenDestination.contract.Call(opts, &out, "currentReserveImbalance") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// CurrentReserveImbalance is a free data retrieval call binding the contract method 0x00d872ae. +// +// Solidity: function currentReserveImbalance() view returns(uint256) +func (_NativeTokenDestination *NativeTokenDestinationSession) CurrentReserveImbalance() (*big.Int, error) { + return _NativeTokenDestination.Contract.CurrentReserveImbalance(&_NativeTokenDestination.CallOpts) +} + +// CurrentReserveImbalance is a free data retrieval call binding the contract method 0x00d872ae. +// +// Solidity: function currentReserveImbalance() view returns(uint256) +func (_NativeTokenDestination *NativeTokenDestinationCallerSession) CurrentReserveImbalance() (*big.Int, error) { + return _NativeTokenDestination.Contract.CurrentReserveImbalance(&_NativeTokenDestination.CallOpts) +} + +// InitialReserveImbalance is a free data retrieval call binding the contract method 0x8ac7dd20. +// +// Solidity: function initialReserveImbalance() view returns(uint256) +func (_NativeTokenDestination *NativeTokenDestinationCaller) InitialReserveImbalance(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _NativeTokenDestination.contract.Call(opts, &out, "initialReserveImbalance") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// InitialReserveImbalance is a free data retrieval call binding the contract method 0x8ac7dd20. +// +// Solidity: function initialReserveImbalance() view returns(uint256) +func (_NativeTokenDestination *NativeTokenDestinationSession) InitialReserveImbalance() (*big.Int, error) { + return _NativeTokenDestination.Contract.InitialReserveImbalance(&_NativeTokenDestination.CallOpts) +} + +// InitialReserveImbalance is a free data retrieval call binding the contract method 0x8ac7dd20. +// +// Solidity: function initialReserveImbalance() view returns(uint256) +func (_NativeTokenDestination *NativeTokenDestinationCallerSession) InitialReserveImbalance() (*big.Int, error) { + return _NativeTokenDestination.Contract.InitialReserveImbalance(&_NativeTokenDestination.CallOpts) +} + +// IsCollateralized is a free data retrieval call binding the contract method 0x49e3284e. +// +// Solidity: function isCollateralized() view returns(bool) +func (_NativeTokenDestination *NativeTokenDestinationCaller) IsCollateralized(opts *bind.CallOpts) (bool, error) { + var out []interface{} + err := _NativeTokenDestination.contract.Call(opts, &out, "isCollateralized") + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsCollateralized is a free data retrieval call binding the contract method 0x49e3284e. +// +// Solidity: function isCollateralized() view returns(bool) +func (_NativeTokenDestination *NativeTokenDestinationSession) IsCollateralized() (bool, error) { + return _NativeTokenDestination.Contract.IsCollateralized(&_NativeTokenDestination.CallOpts) +} + +// IsCollateralized is a free data retrieval call binding the contract method 0x49e3284e. +// +// Solidity: function isCollateralized() view returns(bool) +func (_NativeTokenDestination *NativeTokenDestinationCallerSession) IsCollateralized() (bool, error) { + return _NativeTokenDestination.Contract.IsCollateralized(&_NativeTokenDestination.CallOpts) +} + // NativeTokenSourceAddress is a free data retrieval call binding the contract method 0x5d93f9af. // // Solidity: function nativeTokenSourceAddress() view returns(address) @@ -335,37 +428,6 @@ func (_NativeTokenDestination *NativeTokenDestinationCallerSession) TeleporterMe return _NativeTokenDestination.Contract.TeleporterMessenger(&_NativeTokenDestination.CallOpts) } -// TokenReserve is a free data retrieval call binding the contract method 0xcbcb3171. -// -// Solidity: function tokenReserve() view returns(uint256) -func (_NativeTokenDestination *NativeTokenDestinationCaller) TokenReserve(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _NativeTokenDestination.contract.Call(opts, &out, "tokenReserve") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// TokenReserve is a free data retrieval call binding the contract method 0xcbcb3171. -// -// Solidity: function tokenReserve() view returns(uint256) -func (_NativeTokenDestination *NativeTokenDestinationSession) TokenReserve() (*big.Int, error) { - return _NativeTokenDestination.Contract.TokenReserve(&_NativeTokenDestination.CallOpts) -} - -// TokenReserve is a free data retrieval call binding the contract method 0xcbcb3171. -// -// Solidity: function tokenReserve() view returns(uint256) -func (_NativeTokenDestination *NativeTokenDestinationCallerSession) TokenReserve() (*big.Int, error) { - return _NativeTokenDestination.Contract.TokenReserve(&_NativeTokenDestination.CallOpts) -} - // ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. // // Solidity: function receiveTeleporterMessage(bytes32 senderBlockchainID, address senderAddress, bytes message) returns() diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index dbdc3e721..cb65f97b5 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -36,10 +36,11 @@ contract NativeTokenDestination is bytes32 public immutable currentBlockchainID; bytes32 public immutable sourceBlockchainID; address public immutable nativeTokenSourceAddress; - // The first `tokenReserve` tokens sent to this subnet will not be minted. - // `tokenReserve` should be constructed to match the initial token supply of this subnet. + // The first `initialReserveImbalance` tokens sent to this subnet will not be minted. + // `initialReserveImbalance` should be constructed to match the initial token supply of this subnet. // This means tokens will not be minted until the source contact is collateralized. - uint256 public tokenReserve; + uint256 public immutable initialReserveImbalance; + uint256 public currentReserveImbalance; // Used for sending and receiving Teleporter messages. ITeleporterMessenger public immutable teleporterMessenger; @@ -48,7 +49,7 @@ contract NativeTokenDestination is address teleporterMessengerAddress, bytes32 sourceBlockchainID_, address nativeTokenSourceAddress_, - uint256 tokenReserve_ + uint256 initialReserveImbalance_ ) { currentBlockchainID = WarpMessenger( 0x0200000000000000000000000000000000000005 @@ -76,7 +77,8 @@ contract NativeTokenDestination is ); nativeTokenSourceAddress = nativeTokenSourceAddress_; - tokenReserve = tokenReserve_; + initialReserveImbalance = initialReserveImbalance_; + currentReserveImbalance = initialReserveImbalance_; } /** @@ -118,14 +120,14 @@ contract NativeTokenDestination is require(amount != 0, "NativeTokenDestination: Transfer value of 0"); uint256 adjustedAmount = amount; - if (tokenReserve > 0) { - if (amount > tokenReserve) { - emit CollateralAdded({amount: tokenReserve, remaining: 0}); - adjustedAmount = amount - tokenReserve; - tokenReserve = 0; + if (currentReserveImbalance > 0) { + if (amount > currentReserveImbalance) { + emit CollateralAdded({amount: currentReserveImbalance, remaining: 0}); + adjustedAmount = amount - currentReserveImbalance; + currentReserveImbalance = 0; } else { - tokenReserve -= amount; - emit CollateralAdded({amount: amount, remaining: tokenReserve}); + currentReserveImbalance -= amount; + emit CollateralAdded({amount: amount, remaining: currentReserveImbalance}); return; } } @@ -151,7 +153,7 @@ contract NativeTokenDestination is ); require( - tokenReserve == 0, + currentReserveImbalance == 0, "NativeTokenDestination: Cannot release tokens until source contract is collateralized" ); @@ -194,4 +196,8 @@ contract NativeTokenDestination is teleporterMessageID: messageID }); } + + function isCollateralized() public view returns (bool) { + return currentReserveImbalance == 0; + } } diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/README.md b/contracts/src/CrossChainApplications/NativeTokenBridge/README.md index 1276b04f0..a7fca5df4 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/README.md +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/README.md @@ -16,7 +16,7 @@ The native-to-native bridge is implemented using two primary contracts. - `receiveTeleporterMessage`: mints tokens on the destination chain when instructed to by the `NativeTokenDestination` contract. - `Collateralizing the bridge` - - On initialization, the bridge will be undercollateralized by exactly the number of tokens included in genesis on the destination chain. These tokens could theoretically be sent through the bridge, with no corresponding tokens able to be unlocked on the source chain. In order to avoid this problem, the `NativeTokenDestination` contract is initialized with the value for `tokenReserve`, which should correspond to the number of tokens allocated in the genesis block for the destination chain. If `tokenReserve` is not properly set, behaviour of this contract is undefined. The `NativeTokenDestination` contract will not mint tokens until it has received confirmation that at least `tokenReserve` tokens have been locked on the source chain. It should be up to the contract deployer to ensure that the bridge is properly collateralized. Burning/unlocking is disabled until the bridge is properly collateralized. + - On initialization, the bridge will be undercollateralized by exactly the number of tokens included in genesis on the destination chain. These tokens could theoretically be sent through the bridge, with no corresponding tokens able to be unlocked on the source chain. In order to avoid this problem, the `NativeTokenDestination` contract is initialized with the value for `initialReserveImbalance`, which should correspond to the number of tokens allocated in the genesis block for the destination chain. If `initialReserveImbalance` is not properly set, behaviour of this contract is undefined. The `NativeTokenDestination` contract will not mint tokens until it has received confirmation that at least `initialReserveImbalance` tokens have been locked on the source chain. It should be up to the contract deployer to ensure that the bridge is properly collateralized. Burning/unlocking is disabled until the bridge is properly collateralized. - `Burning tokens spent as fees` - As tokens are burned for transaction fees on the destination chain, contract owners may want to relay this information to the source chain in order to burn an equivalent number of locked tokens there because these tokens will never be bridged back. @@ -28,5 +28,5 @@ The native-to-native bridge is implemented using two primary contracts. - `NativeTokenDestination` is meant to be deployed on a new subnet, and should be the only method for minting tokens on that subnet. The address of `NativeTokenDestination` must be included as the only entry for `adminAddresses` under `contractNativeMinterConfig` in the genesis config for the destination subnet. See `warp-genesis.json` for an example. - Both `NativeTokenSource` and `NativeTokenDestination` need to be deployed to addresses known beforehand. Each address must be passed to the constructor of the other contract. To do this, you will need a known EOA, and preferably use the first transaction from the EOA (nonce 0) to deploy the contract on each chain. It is advised to allocate tokens to the EOA in the destination subnet genesis file so that it can easily deploy the contract. - Both contracts need to be initialized with `teleporterMessengerAddress`, which is the only address they will accept function calls from. - - `NativeTokenDestination` needs to be intialized with `tokenReserve`, which should equal the number of tokens allocated in the genesis file for the destination chain. If `tokenReserve` is not properly set, behavior of these contracts in undefined. - - On the source chain, at least `tokenReserve` tokens need to be transferred to `NativeTokenSource` using `transferToSource` in order to properly collateralize the bridge and allow regular functionality in both directions. The first `tokenReserve` tokens will not be delivered to the recipient, but any excess will be delivered. Burning/unlocking is disabled until the bridge is fully collateralized. \ No newline at end of file + - `NativeTokenDestination` needs to be intialized with `initialReserveImbalance`, which should equal the number of tokens allocated in the genesis file for the destination chain. If `initialReserveImbalance` is not properly set, behavior of these contracts in undefined. + - On the source chain, at least `initialReserveImbalance` tokens need to be transferred to `NativeTokenSource` using `transferToSource` in order to properly collateralize the bridge and allow regular functionality in both directions. The first `initialReserveImbalance` tokens will not be delivered to the recipient, but any excess will be delivered. Burning/unlocking is disabled until the bridge is fully collateralized. \ No newline at end of file diff --git a/tests/erc20_to_native_token_bridge.go b/tests/erc20_to_native_token_bridge.go index f8941c5b7..b7d78360a 100644 --- a/tests/erc20_to_native_token_bridge.go +++ b/tests/erc20_to_native_token_bridge.go @@ -24,9 +24,9 @@ import ( func ERC20ToNativeTokenBridge() { const ( - tokenReserve = uint64(1e15) - valueToSend1 = tokenReserve / 4 - valueToSend2 = tokenReserve + initialReserveImbalance = uint64(1e15) + valueToSend1 = initialReserveImbalance / 4 + valueToSend2 = initialReserveImbalance valueToReturn = valueToSend1 / 4 bridge = "aad7440febfc8f9d73a58c3cb1f1754779a566978f9ebffcd4f4698e9b043985" @@ -66,7 +66,7 @@ func ERC20ToNativeTokenBridge() { nativeTokenDestinationAbi, err := nativetokendestination.NativeTokenDestinationMetaData.GetAbi() Expect(err).Should(BeNil()) - DeployContract(ctx, NativeTokenDestinationByteCodeFile, deployerPK, subnetB, nativeTokenDestinationAbi, teleporterContractAddress, subnetA.BlockchainID, bridgeContractAddress, new(big.Int).SetUint64(tokenReserve)) + DeployContract(ctx, NativeTokenDestinationByteCodeFile, deployerPK, subnetB, nativeTokenDestinationAbi, teleporterContractAddress, subnetA.BlockchainID, bridgeContractAddress, new(big.Int).SetUint64(initialReserveImbalance)) exampleERC20Abi, err := exampleerc20.ExampleERC20MetaData.GetAbi() Expect(err).Should(BeNil()) @@ -177,7 +177,7 @@ func ERC20ToNativeTokenBridge() { // We should have minted the excess coins after checking the collateral bal, err = subnetB.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) Expect(err).Should(BeNil()) - Expect(bal.Uint64()).Should(Equal(valueToSend1 + valueToSend2 - tokenReserve)) + Expect(bal.Uint64()).Should(Equal(valueToSend1 + valueToSend2 - initialReserveImbalance)) } { // Transfer tokens B -> A diff --git a/tests/native_token_bridge.go b/tests/native_token_bridge.go index de837962a..365445667 100644 --- a/tests/native_token_bridge.go +++ b/tests/native_token_bridge.go @@ -19,9 +19,9 @@ import ( func NativeTokenBridge() { const ( - tokenReserve = uint64(1e15) - valueToSend1 = tokenReserve / 4 - valueToSend2 = tokenReserve + initialReserveImbalance = uint64(1e15) + valueToSend1 = initialReserveImbalance / 4 + valueToSend2 = initialReserveImbalance valueToReturn = valueToSend1 / 4 deployerKeyStr = "aad7440febfc8f9d73a58c3cb1f1754779a566978f9ebffcd4f4698e9b043985" @@ -58,7 +58,7 @@ func NativeTokenBridge() { nativeTokenDestinationAbi, err := nativetokendestination.NativeTokenDestinationMetaData.GetAbi() Expect(err).Should(BeNil()) - DeployContract(ctx, NativeTokenDestinationByteCodeFile, deployerPK, subnetB, nativeTokenDestinationAbi, teleporterContractAddress, subnetA.BlockchainID, bridgeContractAddress, new(big.Int).SetUint64(tokenReserve)) + DeployContract(ctx, NativeTokenDestinationByteCodeFile, deployerPK, subnetB, nativeTokenDestinationAbi, teleporterContractAddress, subnetA.BlockchainID, bridgeContractAddress, new(big.Int).SetUint64(initialReserveImbalance)) log.Info("Finished deploying Bridge contracts") @@ -151,7 +151,7 @@ func NativeTokenBridge() { // We should have minted the excess coins after checking the collateral bal, err = subnetB.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) Expect(err).Should(BeNil()) - Expect(bal.Uint64()).Should(Equal(valueToSend1 + valueToSend2 - tokenReserve)) + Expect(bal.Uint64()).Should(Equal(valueToSend1 + valueToSend2 - initialReserveImbalance)) } { // Transfer tokens B -> A From 4e809957fb1fb967486ec05010edc80c2aa51363 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 30 Oct 2023 02:45:11 -0400 Subject: [PATCH 089/183] Add totalSupply and isCollateralized --- .../NativeTokenDestination.go | 94 ++++++++++++++++--- .../NativeTokenSource/NativeTokenSource.go | 32 ++++--- .../NativeTokenBridge/IERC20TokenSource.sol | 3 +- .../INativeTokenDestination.sol | 18 +++- .../NativeTokenBridge/INativeTokenSource.sol | 8 +- .../NativeTokenDestination.sol | 26 ++--- .../NativeTokenBridge/NativeTokenSource.sol | 16 ++-- 7 files changed, 144 insertions(+), 53 deletions(-) diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go index d24bef098..53ced56b1 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go @@ -29,9 +29,15 @@ var ( _ = abi.ConvertType ) +// TeleporterFeeInfo is an auto generated low-level Go binding around an user-defined struct. +type TeleporterFeeInfo struct { + ContractAddress common.Address + Amount *big.Int +} + // NativeTokenDestinationMetaData contains all meta data concerning the NativeTokenDestination contract. var NativeTokenDestinationMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialReserveImbalance_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialReserveImbalance_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalMinted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", } // NativeTokenDestinationABI is the input ABI used to generate the binding from. @@ -428,6 +434,68 @@ func (_NativeTokenDestination *NativeTokenDestinationCallerSession) TeleporterMe return _NativeTokenDestination.Contract.TeleporterMessenger(&_NativeTokenDestination.CallOpts) } +// TotalMinted is a free data retrieval call binding the contract method 0xa2309ff8. +// +// Solidity: function totalMinted() view returns(uint256) +func (_NativeTokenDestination *NativeTokenDestinationCaller) TotalMinted(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _NativeTokenDestination.contract.Call(opts, &out, "totalMinted") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TotalMinted is a free data retrieval call binding the contract method 0xa2309ff8. +// +// Solidity: function totalMinted() view returns(uint256) +func (_NativeTokenDestination *NativeTokenDestinationSession) TotalMinted() (*big.Int, error) { + return _NativeTokenDestination.Contract.TotalMinted(&_NativeTokenDestination.CallOpts) +} + +// TotalMinted is a free data retrieval call binding the contract method 0xa2309ff8. +// +// Solidity: function totalMinted() view returns(uint256) +func (_NativeTokenDestination *NativeTokenDestinationCallerSession) TotalMinted() (*big.Int, error) { + return _NativeTokenDestination.Contract.TotalMinted(&_NativeTokenDestination.CallOpts) +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_NativeTokenDestination *NativeTokenDestinationCaller) TotalSupply(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _NativeTokenDestination.contract.Call(opts, &out, "totalSupply") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_NativeTokenDestination *NativeTokenDestinationSession) TotalSupply() (*big.Int, error) { + return _NativeTokenDestination.Contract.TotalSupply(&_NativeTokenDestination.CallOpts) +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_NativeTokenDestination *NativeTokenDestinationCallerSession) TotalSupply() (*big.Int, error) { + return _NativeTokenDestination.Contract.TotalSupply(&_NativeTokenDestination.CallOpts) +} + // ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. // // Solidity: function receiveTeleporterMessage(bytes32 senderBlockchainID, address senderAddress, bytes message) returns() @@ -449,25 +517,25 @@ func (_NativeTokenDestination *NativeTokenDestinationTransactorSession) ReceiveT return _NativeTokenDestination.Contract.ReceiveTeleporterMessage(&_NativeTokenDestination.TransactOpts, senderBlockchainID, senderAddress, message) } -// TransferToSource is a paid mutator transaction binding the contract method 0xbdb6b283. +// TransferToSource is a paid mutator transaction binding the contract method 0x75846562. // -// Solidity: function transferToSource(address recipient, address feeContractAddress, uint256 feeAmount, address[] allowedRelayerAddresses) payable returns() -func (_NativeTokenDestination *NativeTokenDestinationTransactor) TransferToSource(opts *bind.TransactOpts, recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int, allowedRelayerAddresses []common.Address) (*types.Transaction, error) { - return _NativeTokenDestination.contract.Transact(opts, "transferToSource", recipient, feeContractAddress, feeAmount, allowedRelayerAddresses) +// Solidity: function transferToSource(address recipient, (address,uint256) feeInfo, address[] allowedRelayerAddresses) payable returns() +func (_NativeTokenDestination *NativeTokenDestinationTransactor) TransferToSource(opts *bind.TransactOpts, recipient common.Address, feeInfo TeleporterFeeInfo, allowedRelayerAddresses []common.Address) (*types.Transaction, error) { + return _NativeTokenDestination.contract.Transact(opts, "transferToSource", recipient, feeInfo, allowedRelayerAddresses) } -// TransferToSource is a paid mutator transaction binding the contract method 0xbdb6b283. +// TransferToSource is a paid mutator transaction binding the contract method 0x75846562. // -// Solidity: function transferToSource(address recipient, address feeContractAddress, uint256 feeAmount, address[] allowedRelayerAddresses) payable returns() -func (_NativeTokenDestination *NativeTokenDestinationSession) TransferToSource(recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int, allowedRelayerAddresses []common.Address) (*types.Transaction, error) { - return _NativeTokenDestination.Contract.TransferToSource(&_NativeTokenDestination.TransactOpts, recipient, feeContractAddress, feeAmount, allowedRelayerAddresses) +// Solidity: function transferToSource(address recipient, (address,uint256) feeInfo, address[] allowedRelayerAddresses) payable returns() +func (_NativeTokenDestination *NativeTokenDestinationSession) TransferToSource(recipient common.Address, feeInfo TeleporterFeeInfo, allowedRelayerAddresses []common.Address) (*types.Transaction, error) { + return _NativeTokenDestination.Contract.TransferToSource(&_NativeTokenDestination.TransactOpts, recipient, feeInfo, allowedRelayerAddresses) } -// TransferToSource is a paid mutator transaction binding the contract method 0xbdb6b283. +// TransferToSource is a paid mutator transaction binding the contract method 0x75846562. // -// Solidity: function transferToSource(address recipient, address feeContractAddress, uint256 feeAmount, address[] allowedRelayerAddresses) payable returns() -func (_NativeTokenDestination *NativeTokenDestinationTransactorSession) TransferToSource(recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int, allowedRelayerAddresses []common.Address) (*types.Transaction, error) { - return _NativeTokenDestination.Contract.TransferToSource(&_NativeTokenDestination.TransactOpts, recipient, feeContractAddress, feeAmount, allowedRelayerAddresses) +// Solidity: function transferToSource(address recipient, (address,uint256) feeInfo, address[] allowedRelayerAddresses) payable returns() +func (_NativeTokenDestination *NativeTokenDestinationTransactorSession) TransferToSource(recipient common.Address, feeInfo TeleporterFeeInfo, allowedRelayerAddresses []common.Address) (*types.Transaction, error) { + return _NativeTokenDestination.Contract.TransferToSource(&_NativeTokenDestination.TransactOpts, recipient, feeInfo, allowedRelayerAddresses) } // NativeTokenDestinationCollateralAddedIterator is returned from FilterCollateralAdded and is used to iterate over the raw logs and unpacked data for CollateralAdded events raised by the NativeTokenDestination contract. diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go index 0843297d5..fbaae4cd7 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go @@ -29,9 +29,15 @@ var ( _ = abi.ConvertType ) +// TeleporterFeeInfo is an auto generated low-level Go binding around an user-defined struct. +type TeleporterFeeInfo struct { + ContractAddress common.Address + Amount *big.Int +} + // NativeTokenSourceMetaData contains all meta data concerning the NativeTokenSource contract. var NativeTokenSourceMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", } // NativeTokenSourceABI is the input ABI used to generate the binding from. @@ -356,25 +362,25 @@ func (_NativeTokenSource *NativeTokenSourceTransactorSession) ReceiveTeleporterM return _NativeTokenSource.Contract.ReceiveTeleporterMessage(&_NativeTokenSource.TransactOpts, senderBlockchainID, senderAddress, message) } -// TransferToDestination is a paid mutator transaction binding the contract method 0x2268e041. +// TransferToDestination is a paid mutator transaction binding the contract method 0xad0aee25. // -// Solidity: function transferToDestination(address recipient, address feeContractAddress, uint256 feeAmount, address[] allowedRelayerAddresses) payable returns() -func (_NativeTokenSource *NativeTokenSourceTransactor) TransferToDestination(opts *bind.TransactOpts, recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int, allowedRelayerAddresses []common.Address) (*types.Transaction, error) { - return _NativeTokenSource.contract.Transact(opts, "transferToDestination", recipient, feeContractAddress, feeAmount, allowedRelayerAddresses) +// Solidity: function transferToDestination(address recipient, (address,uint256) feeInfo, address[] allowedRelayerAddresses) payable returns() +func (_NativeTokenSource *NativeTokenSourceTransactor) TransferToDestination(opts *bind.TransactOpts, recipient common.Address, feeInfo TeleporterFeeInfo, allowedRelayerAddresses []common.Address) (*types.Transaction, error) { + return _NativeTokenSource.contract.Transact(opts, "transferToDestination", recipient, feeInfo, allowedRelayerAddresses) } -// TransferToDestination is a paid mutator transaction binding the contract method 0x2268e041. +// TransferToDestination is a paid mutator transaction binding the contract method 0xad0aee25. // -// Solidity: function transferToDestination(address recipient, address feeContractAddress, uint256 feeAmount, address[] allowedRelayerAddresses) payable returns() -func (_NativeTokenSource *NativeTokenSourceSession) TransferToDestination(recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int, allowedRelayerAddresses []common.Address) (*types.Transaction, error) { - return _NativeTokenSource.Contract.TransferToDestination(&_NativeTokenSource.TransactOpts, recipient, feeContractAddress, feeAmount, allowedRelayerAddresses) +// Solidity: function transferToDestination(address recipient, (address,uint256) feeInfo, address[] allowedRelayerAddresses) payable returns() +func (_NativeTokenSource *NativeTokenSourceSession) TransferToDestination(recipient common.Address, feeInfo TeleporterFeeInfo, allowedRelayerAddresses []common.Address) (*types.Transaction, error) { + return _NativeTokenSource.Contract.TransferToDestination(&_NativeTokenSource.TransactOpts, recipient, feeInfo, allowedRelayerAddresses) } -// TransferToDestination is a paid mutator transaction binding the contract method 0x2268e041. +// TransferToDestination is a paid mutator transaction binding the contract method 0xad0aee25. // -// Solidity: function transferToDestination(address recipient, address feeContractAddress, uint256 feeAmount, address[] allowedRelayerAddresses) payable returns() -func (_NativeTokenSource *NativeTokenSourceTransactorSession) TransferToDestination(recipient common.Address, feeContractAddress common.Address, feeAmount *big.Int, allowedRelayerAddresses []common.Address) (*types.Transaction, error) { - return _NativeTokenSource.Contract.TransferToDestination(&_NativeTokenSource.TransactOpts, recipient, feeContractAddress, feeAmount, allowedRelayerAddresses) +// Solidity: function transferToDestination(address recipient, (address,uint256) feeInfo, address[] allowedRelayerAddresses) payable returns() +func (_NativeTokenSource *NativeTokenSourceTransactorSession) TransferToDestination(recipient common.Address, feeInfo TeleporterFeeInfo, allowedRelayerAddresses []common.Address) (*types.Transaction, error) { + return _NativeTokenSource.Contract.TransferToDestination(&_NativeTokenSource.TransactOpts, recipient, feeInfo, allowedRelayerAddresses) } // NativeTokenSourceTransferToDestinationIterator is returned from FilterTransferToDestination and is used to iterate over the raw logs and unpacked data for TransferToDestination events raised by the NativeTokenSource contract. diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol index 726a6ba31..f101676c7 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol @@ -27,7 +27,8 @@ interface IERC20TokenSource { event UnlockTokens(address recipient, uint256 amount); /** - * @dev Transfers source chain native tokens to destination chain's native tokens. + * @dev Locks ERC20 tokens on the source contract chain, and sends a message to the destination + * contract to mint corresponding tokens. */ function transferToDestination( address recipient, diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol index e51ebcbe1..505cdadae 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol @@ -5,6 +5,8 @@ pragma solidity 0.8.18; +import "../../Teleporter/ITeleporterMessenger.sol"; + /** * @dev Interface that describes functionalities for a contract that can mint native tokens when * paired with a {INativeTokenSource} contract that will lock tokens on another chain. @@ -36,8 +38,20 @@ interface INativeTokenDestination { */ function transferToSource( address recipient, - address feeContractAddress, - uint256 feeAmount, + TeleporterFeeInfo calldata feeInfo, address[] calldata allowedRelayerAddresses ) external payable; + + /** + * @dev Returns true if currentTokenImbalance is 0. When this is true, all tokens sent to + * this chain will be minted, and sending tokens to the source chain is allowed. + */ + function isCollateralized() external view returns (bool); + + /** + * @dev Returns the total number of tokens minted + initialReserveImbalance - + * total tokens burned through fees and transferring back to the source chain. + */ + function totalSupply() external view returns (uint256); } + diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol index ba3457a10..bdb41ab52 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol @@ -5,6 +5,8 @@ pragma solidity 0.8.18; +import "../../Teleporter/ITeleporterMessenger.sol"; + /** * @dev Interface that describes functionalities for a contract that will lock tokens and send a * Teleporter message to a {INativeTokenDestination} contract to mint native tokens on the destination chain. @@ -26,12 +28,12 @@ interface INativeTokenSource { event UnlockTokens(address recipient, uint256 amount); /** - * @dev Transfers source chain native tokens to destination chain's native tokens. + * @dev Locks native tokens on the source contract chain, and sends a message to the destination + * contract to mint corresponding tokens. */ function transferToDestination( address recipient, - address feeContractAddress, - uint256 feeAmount, + TeleporterFeeInfo calldata feeInfo, address[] calldata allowedRelayerAddresses ) external payable; } diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index cb65f97b5..11991c2a8 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -41,6 +41,7 @@ contract NativeTokenDestination is // This means tokens will not be minted until the source contact is collateralized. uint256 public immutable initialReserveImbalance; uint256 public currentReserveImbalance; + uint256 public totalMinted = 0; // Used for sending and receiving Teleporter messages. ITeleporterMessenger public immutable teleporterMessenger; @@ -134,6 +135,7 @@ contract NativeTokenDestination is // Calls NativeMinter precompile through INativeMinter interface. _nativeMinter.mintNativeCoin(recipient, adjustedAmount); + totalMinted += adjustedAmount; emit NativeTokensMinted(recipient, adjustedAmount); } @@ -142,8 +144,7 @@ contract NativeTokenDestination is */ function transferToSource( address recipient, - address feeContractAddress, - uint256 feeAmount, + TeleporterFeeInfo calldata feeInfo, address[] calldata allowedRelayerAddresses ) external payable nonReentrant { // The recipient cannot be the zero address. @@ -161,12 +162,12 @@ contract NativeTokenDestination is // implementations by only bridging the actual balance increase reflected by the call // to transferFrom. uint256 adjustedFeeAmount = 0; - if (feeAmount > 0) { + if (feeInfo.amount > 0) { adjustedFeeAmount = SafeERC20TransferFrom.safeTransferFrom( - IERC20(feeContractAddress), - feeAmount + IERC20(feeInfo.contractAddress), + feeInfo.amount ); - IERC20(feeContractAddress).safeIncreaseAllowance( + IERC20(feeInfo.contractAddress).safeIncreaseAllowance( address(teleporterMessenger), adjustedFeeAmount ); @@ -179,10 +180,7 @@ contract NativeTokenDestination is TeleporterMessageInput({ destinationChainID: sourceBlockchainID, destinationAddress: nativeTokenSourceAddress, - feeInfo: TeleporterFeeInfo({ - contractAddress: feeContractAddress, - amount: adjustedFeeAmount - }), + feeInfo: feeInfo, requiredGasLimit: TRANSFER_NATIVE_TOKENS_REQUIRED_GAS, allowedRelayerAddresses: allowedRelayerAddresses, message: abi.encode(recipient, msg.value) @@ -197,7 +195,13 @@ contract NativeTokenDestination is }); } - function isCollateralized() public view returns (bool) { + function isCollateralized() external view returns (bool) { return currentReserveImbalance == 0; } + + function totalSupply() external view returns (uint256) { + uint256 burned = address(BURNED_TX_FEES_ADDRESS).balance - address(BLACKHOLE_ADDRESS).balance; + require(burned > totalMinted + initialReserveImbalance, "NativeTokenDestination: FATAL - Contract has tokens unaccounted for"); + return totalMinted + initialReserveImbalance - burned; + } } diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index 8fcba98a7..cb404a84b 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -107,8 +107,7 @@ contract NativeTokenSource is */ function transferToDestination( address recipient, - address feeContractAddress, - uint256 feeAmount, + TeleporterFeeInfo calldata feeInfo, address[] calldata allowedRelayerAddresses ) external payable nonReentrant { // The recipient cannot be the zero address. @@ -121,12 +120,12 @@ contract NativeTokenSource is // implementations by only bridging the actual balance increase reflected by the call // to transferFrom. uint256 adjustedFeeAmount = 0; - if (feeAmount > 0) { + if (feeInfo.amount > 0) { adjustedFeeAmount = SafeERC20TransferFrom.safeTransferFrom( - IERC20(feeContractAddress), - feeAmount + IERC20(feeInfo.contractAddress), + feeInfo.amount ); - IERC20(feeContractAddress).safeIncreaseAllowance( + IERC20(feeInfo.contractAddress).safeIncreaseAllowance( address(teleporterMessenger), adjustedFeeAmount ); @@ -136,10 +135,7 @@ contract NativeTokenSource is TeleporterMessageInput({ destinationChainID: destinationBlockchainID, destinationAddress: nativeTokenDestinationAddress, - feeInfo: TeleporterFeeInfo({ - contractAddress: feeContractAddress, - amount: adjustedFeeAmount - }), + feeInfo: feeInfo, requiredGasLimit: MINT_NATIVE_TOKENS_REQUIRED_GAS, allowedRelayerAddresses: allowedRelayerAddresses, message: abi.encode(recipient, msg.value) From 027106179c1a1a2595cf8cd702aca478306aac02 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 30 Oct 2023 02:51:01 -0400 Subject: [PATCH 090/183] Fix tests --- tests/erc20_to_native_token_bridge.go | 4 ++-- tests/native_token_bridge.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/erc20_to_native_token_bridge.go b/tests/erc20_to_native_token_bridge.go index b7d78360a..409cf2894 100644 --- a/tests/erc20_to_native_token_bridge.go +++ b/tests/erc20_to_native_token_bridge.go @@ -89,7 +89,7 @@ func ERC20ToNativeTokenBridge() { Expect(err).Should(BeNil()) transactor.Value = new(big.Int).SetUint64(valueToSend) - tx, err := nativeTokenDestination.TransferToSource(transactor, toAddress, common.Address{}, big.NewInt(0), []common.Address{}) + tx, err := nativeTokenDestination.TransferToSource(transactor, toAddress, nativetokendestination.TeleporterFeeInfo{}, []common.Address{}) Expect(err).Should(BeNil()) log.Info("Sent TransferToSource transaction on destination chain", "sourceChainID", subnetA.BlockchainID, "txHash", tx.Hash().Hex()) @@ -157,7 +157,7 @@ func ERC20ToNativeTokenBridge() { transactor.Value = new(big.Int).SetUint64(valueToSend1) // This transfer should revert because the bridge isn't collateralized - _, err = nativeTokenDestination.TransferToSource(transactor, tokenReceiverAddress, common.Address{}, big.NewInt(0), []common.Address{}) + _, err = nativeTokenDestination.TransferToSource(transactor, tokenReceiverAddress, nativetokendestination.TeleporterFeeInfo{}, []common.Address{}) Expect(err).ShouldNot(BeNil()) // Check we should fail to send because we're not collateralized diff --git a/tests/native_token_bridge.go b/tests/native_token_bridge.go index 365445667..2bf2d51c4 100644 --- a/tests/native_token_bridge.go +++ b/tests/native_token_bridge.go @@ -76,7 +76,7 @@ func NativeTokenBridge() { Expect(err).Should(BeNil()) transactor.Value = new(big.Int).SetUint64(valueToSend) - tx, err := nativeTokenDestination.TransferToSource(transactor, toAddress, common.Address{}, big.NewInt(0), []common.Address{}) + tx, err := nativeTokenDestination.TransferToSource(transactor, toAddress, nativetokendestination.TeleporterFeeInfo{},[]common.Address{}) Expect(err).Should(BeNil()) log.Info("Sent TransferToSource transaction on destination chain", "sourceChainID", subnetA.BlockchainID, "txHash", tx.Hash().Hex()) @@ -94,7 +94,7 @@ func NativeTokenBridge() { Expect(err).Should(BeNil()) transactor.Value = new(big.Int).SetUint64(valueToSend) - tx, err := nativeTokenSource.TransferToDestination(transactor, toAddress, common.Address{}, big.NewInt(0), []common.Address{}) + tx, err := nativeTokenSource.TransferToDestination(transactor, toAddress, nativetokensource.TeleporterFeeInfo{}, []common.Address{}) Expect(err).Should(BeNil()) log.Info("Sent TransferToDestination transaction on source chain", "destinationChainID", subnetB.BlockchainID, "txHash", tx.Hash().Hex()) @@ -131,7 +131,7 @@ func NativeTokenBridge() { transactor.Value = new(big.Int).SetUint64(valueToSend1) // This transfer should revert because the bridge isn't collateralized - _, err = nativeTokenDestination.TransferToSource(transactor, tokenReceiverAddress, common.Address{}, big.NewInt(0), []common.Address{}) + _, err = nativeTokenDestination.TransferToSource(transactor, tokenReceiverAddress, nativetokendestination.TeleporterFeeInfo{}, []common.Address{}) Expect(err).ShouldNot(BeNil()) // Check we should fail to send because we're not collateralized From d784d24788829d67dbb3536bb771addc7a4fa833 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 30 Oct 2023 03:14:45 -0400 Subject: [PATCH 091/183] Uncouple tests --- tests/erc20_to_native_token_bridge.go | 65 +++++++++++++-------------- tests/native_token_bridge.go | 12 ++--- tests/utils/warp-genesis.json | 2 +- 3 files changed, 38 insertions(+), 41 deletions(-) diff --git a/tests/erc20_to_native_token_bridge.go b/tests/erc20_to_native_token_bridge.go index 409cf2894..28ccca9db 100644 --- a/tests/erc20_to_native_token_bridge.go +++ b/tests/erc20_to_native_token_bridge.go @@ -19,25 +19,23 @@ import ( . "github.com/onsi/gomega" ) - - - func ERC20ToNativeTokenBridge() { const ( - initialReserveImbalance = uint64(1e15) - valueToSend1 = initialReserveImbalance / 4 - valueToSend2 = initialReserveImbalance - valueToReturn = valueToSend1 / 4 + initialReserveImbalance = uint64(1e15) + valueToSend1 = initialReserveImbalance / 4 + valueToSend2 = initialReserveImbalance + valueToReturn = valueToSend1 / 4 - bridge = "aad7440febfc8f9d73a58c3cb1f1754779a566978f9ebffcd4f4698e9b043985" + // TODO use a unique deployer for each test file + deployerKeyStr = "ca7269c1fe2a5b86884a119aa516b8d5b641670b83aac0ebf9f2d71affcc12e4" ExampleERC20ByteCodeFile = "./contracts/out/ExampleERC20.sol/ExampleERC20.json" ERC20TokenSourceByteCodeFile = "./contracts/out/ERC20TokenSource.sol/ERC20TokenSource.json" NativeTokenDestinationByteCodeFile = "./contracts/out/NativeTokenDestination.sol/NativeTokenDestination.json" ) var ( ctx = context.Background() - deployerAddress = common.HexToAddress("0x1337cfd2dCff6270615B90938aCB1efE79801704") - tokenReceiverAddress = common.HexToAddress("0x0123456789012345678901234567890123456789") + deployerAddress = common.HexToAddress("0x539447ab8Be7e927bE8E005663C81ff2AE951337") + tokenReceiverAddress = common.HexToAddress("0x4444444444444444444444444444444444444444") ) subnetA := utils.GetSubnetATestInfo() @@ -45,35 +43,34 @@ func ERC20ToNativeTokenBridge() { teleporterContractAddress := utils.GetTeleporterContractAddress() // Info we need to calculate for the test - deployerPK, err := crypto.HexToECDSA(bridge) + deployerPK, err := crypto.HexToECDSA(deployerKeyStr) Expect(err).Should(BeNil()) bridgeContractAddress, err := deploymentUtils.DeriveEVMContractAddress(deployerAddress, 0) Expect(err).Should(BeNil()) + log.Info("Native Token Bridge Contract Address: " + bridgeContractAddress.Hex()) exampleERC20ContractAddress, err := deploymentUtils.DeriveEVMContractAddress(deployerAddress, 1) Expect(err).Should(BeNil()) - log.Info("Native Token Bridge Contract Address: " + bridgeContractAddress.Hex()) - - { // Deploy the contracts - // Both contracts in this test will be deployed to 0xAcB633F5B00099c7ec187eB00156c5cd9D854b5B, - // though they do not necessarily have to be deployed at the same address, each contract needs - // to know the address of the other. - // The nativeTokenDestination contract must be added to "adminAddresses" of "contractNativeMinterConfig" - // in the genesis file for the subnet. This will allow it to call the native minter precompile. - erc20TokenSourceAbi, err := erc20tokensource.ERC20TokenSourceMetaData.GetAbi() - Expect(err).Should(BeNil()) - DeployContract(ctx, ERC20TokenSourceByteCodeFile, deployerPK, subnetA, erc20TokenSourceAbi, teleporterContractAddress, subnetB.BlockchainID, bridgeContractAddress, exampleERC20ContractAddress) - Expect(err).Should(BeNil()) + log.Info("Example ERC20 Contract Address: " + exampleERC20ContractAddress.Hex()) + + // Deploy the contracts + // Both contracts in this test will be deployed to 0xAcB633F5B00099c7ec187eB00156c5cd9D854b5B, + // though they do not necessarily have to be deployed at the same address, each contract needs + // to know the address of the other. + // The nativeTokenDestination contract must be added to "adminAddresses" of "contractNativeMinterConfig" + // in the genesis file for the subnet. This will allow it to call the native minter precompile. + erc20TokenSourceAbi, err := erc20tokensource.ERC20TokenSourceMetaData.GetAbi() + Expect(err).Should(BeNil()) + DeployContract(ctx, ERC20TokenSourceByteCodeFile, deployerPK, subnetA, erc20TokenSourceAbi, teleporterContractAddress, subnetB.BlockchainID, bridgeContractAddress, exampleERC20ContractAddress) - nativeTokenDestinationAbi, err := nativetokendestination.NativeTokenDestinationMetaData.GetAbi() - Expect(err).Should(BeNil()) - DeployContract(ctx, NativeTokenDestinationByteCodeFile, deployerPK, subnetB, nativeTokenDestinationAbi, teleporterContractAddress, subnetA.BlockchainID, bridgeContractAddress, new(big.Int).SetUint64(initialReserveImbalance)) + nativeTokenDestinationAbi, err := nativetokendestination.NativeTokenDestinationMetaData.GetAbi() + Expect(err).Should(BeNil()) + DeployContract(ctx, NativeTokenDestinationByteCodeFile, deployerPK, subnetB, nativeTokenDestinationAbi, teleporterContractAddress, subnetA.BlockchainID, bridgeContractAddress, new(big.Int).SetUint64(initialReserveImbalance)) - exampleERC20Abi, err := exampleerc20.ExampleERC20MetaData.GetAbi() - Expect(err).Should(BeNil()) - DeployContract(ctx, ExampleERC20ByteCodeFile, deployerPK, subnetA, exampleERC20Abi) + exampleERC20Abi, err := exampleerc20.ExampleERC20MetaData.GetAbi() + Expect(err).Should(BeNil()) + DeployContract(ctx, ExampleERC20ByteCodeFile, deployerPK, subnetA, exampleERC20Abi) - log.Info("Finished deploying contracts") - } + log.Info("Finished deploying contracts") // Create abi objects to call the contract with nativeTokenDestination, err := nativetokendestination.NewNativeTokenDestination(bridgeContractAddress, subnetB.WSClient) @@ -195,9 +192,9 @@ func DeployContract(ctx context.Context, byteCodeFileName string, deployerPK *ec byteCode, err := deploymentUtils.ExtractByteCode(byteCodeFileName) Expect(err).Should(BeNil()) Expect(len(byteCode) > 0).Should(BeTrue()) - chainATransactor2, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetInfo.ChainID) + transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetInfo.ChainID) Expect(err).Should(BeNil()) - contractAddress, tx, _, err := bind.DeployContract(chainATransactor2, *abi, byteCode, subnetInfo.WSClient, constructorArgs...) + contractAddress, tx, _, err := bind.DeployContract(transactor, *abi, byteCode, subnetInfo.WSClient, constructorArgs...) Expect(err).Should(BeNil()) // Wait for transaction, then check code was deployed @@ -205,4 +202,4 @@ func DeployContract(ctx context.Context, byteCodeFileName string, deployerPK *ec code, err := subnetInfo.WSClient.CodeAt(ctx, contractAddress, nil) Expect(err).Should(BeNil()) Expect(len(code)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode -} \ No newline at end of file +} diff --git a/tests/native_token_bridge.go b/tests/native_token_bridge.go index 2bf2d51c4..37a32b9c7 100644 --- a/tests/native_token_bridge.go +++ b/tests/native_token_bridge.go @@ -19,11 +19,12 @@ import ( func NativeTokenBridge() { const ( - initialReserveImbalance = uint64(1e15) - valueToSend1 = initialReserveImbalance / 4 - valueToSend2 = initialReserveImbalance - valueToReturn = valueToSend1 / 4 + initialReserveImbalance = uint64(1e15) + valueToSend1 = initialReserveImbalance / 4 + valueToSend2 = initialReserveImbalance + valueToReturn = valueToSend1 / 4 + // TODO use a unique deployer for each test file deployerKeyStr = "aad7440febfc8f9d73a58c3cb1f1754779a566978f9ebffcd4f4698e9b043985" NativeTokenSourceByteCodeFile = "./contracts/out/NativeTokenSource.sol/NativeTokenSource.json" NativeTokenDestinationByteCodeFile = "./contracts/out/NativeTokenDestination.sol/NativeTokenDestination.json" @@ -60,7 +61,6 @@ func NativeTokenBridge() { Expect(err).Should(BeNil()) DeployContract(ctx, NativeTokenDestinationByteCodeFile, deployerPK, subnetB, nativeTokenDestinationAbi, teleporterContractAddress, subnetA.BlockchainID, bridgeContractAddress, new(big.Int).SetUint64(initialReserveImbalance)) - log.Info("Finished deploying Bridge contracts") } @@ -76,7 +76,7 @@ func NativeTokenBridge() { Expect(err).Should(BeNil()) transactor.Value = new(big.Int).SetUint64(valueToSend) - tx, err := nativeTokenDestination.TransferToSource(transactor, toAddress, nativetokendestination.TeleporterFeeInfo{},[]common.Address{}) + tx, err := nativeTokenDestination.TransferToSource(transactor, toAddress, nativetokendestination.TeleporterFeeInfo{}, []common.Address{}) Expect(err).Should(BeNil()) log.Info("Sent TransferToSource transaction on destination chain", "sourceChainID", subnetA.BlockchainID, "txHash", tx.Hash().Hex()) diff --git a/tests/utils/warp-genesis.json b/tests/utils/warp-genesis.json index 5bae402e9..7c074e807 100644 --- a/tests/utils/warp-genesis.json +++ b/tests/utils/warp-genesis.json @@ -40,7 +40,7 @@ "0x1337cfd2dCff6270615B90938aCB1efE79801704": { "balance": "0x52B7D2DCC80CD2E4000000" }, - "0x1dD31B5351e76d51F4B152ce64fE5cf594694De5": { + "0x539447ab8Be7e927bE8E005663C81ff2AE951337": { "balance": "0x52B7D2DCC80CD2E4000000" } }, From 672dc88d14c14caeded5157b69c0c909e52b8eec Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 7 Nov 2023 13:31:14 -0500 Subject: [PATCH 092/183] Appease solhint linter --- contracts/src/.solhint.json | 5 ++--- .../NativeTokenBridge/NativeTokenDestination.sol | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/contracts/src/.solhint.json b/contracts/src/.solhint.json index fc43a4a07..59986d470 100644 --- a/contracts/src/.solhint.json +++ b/contracts/src/.solhint.json @@ -15,7 +15,7 @@ "strict": true } ], - "reason-string": ["warn", { "maxLength": 60 }], + "reason-string": ["warn", { "maxLength": 75 }], "custom-errors": "off", "ordering": "error", "immutable-vars-naming": [ @@ -26,7 +26,6 @@ ], "func-named-parameters": ["error", 5], "no-global-import": "off", - "one-contract-per-file": "off", - "custom-errors": "off" + "one-contract-per-file": "off" } } diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index 11991c2a8..8152020e1 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -155,7 +155,7 @@ contract NativeTokenDestination is require( currentReserveImbalance == 0, - "NativeTokenDestination: Cannot release tokens until source contract is collateralized" + "NativeTokenDestination: Contract Undercollateralized" ); // Lock tokens in this bridge instance. Supports "fee/burn on transfer" ERC20 token From b5356d63b76158485d80cf8cbfeebdc8a09ec7a1 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 7 Nov 2023 13:31:49 -0500 Subject: [PATCH 093/183] Safe requires check --- .../NativeTokenBridge/NativeTokenDestination.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index 8152020e1..40760f3b9 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -154,7 +154,7 @@ contract NativeTokenDestination is ); require( - currentReserveImbalance == 0, + currentReserveImbalance <= 0, "NativeTokenDestination: Contract Undercollateralized" ); From 48490eafc33c8e22e0e5453f079df6e4e362aec8 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 13 Nov 2023 08:28:14 -0500 Subject: [PATCH 094/183] Update go.work.sum and bindings --- .../NativeTokenBridge/ERC20TokenSource.sol | 2 +- .../NativeTokenBridge/NativeTokenDestination.sol | 2 +- .../NativeTokenBridge/NativeTokenSource.sol | 2 +- go.work.sum | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol index 603aebf08..3d37b6fd6 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol @@ -34,7 +34,7 @@ contract ERC20TokenSource is address nativeTokenDestinationAddress_, address erc20ContractAddress_ ) { - currentBlockchainID = WarpMessenger( + currentBlockchainID = IWarpMessenger( 0x0200000000000000000000000000000000000005 ).getBlockchainID(); diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index 40760f3b9..256d60d42 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -52,7 +52,7 @@ contract NativeTokenDestination is address nativeTokenSourceAddress_, uint256 initialReserveImbalance_ ) { - currentBlockchainID = WarpMessenger( + currentBlockchainID = IWarpMessenger( 0x0200000000000000000000000000000000000005 ).getBlockchainID(); diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index cb404a84b..3ab5e4fd5 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -32,7 +32,7 @@ contract NativeTokenSource is bytes32 destinationBlockchainID_, address nativeTokenDestinationAddress_ ) { - currentBlockchainID = WarpMessenger( + currentBlockchainID = IWarpMessenger( 0x0200000000000000000000000000000000000005 ).getBlockchainID(); diff --git a/go.work.sum b/go.work.sum index f39484c39..2296609fa 100644 --- a/go.work.sum +++ b/go.work.sum @@ -1052,6 +1052,7 @@ golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.5.0/go.mod h1:9/XBHVqLaWO3/BRHs5jbpYCnOZVjj5V0ndyaAM7KB4I= From 4c8d7d3834ebb725000bc732720b995b47f82fb8 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 13 Nov 2023 09:17:26 -0500 Subject: [PATCH 095/183] WIP --- tests/erc20_to_native_token_bridge.go | 9 +++++++-- tests/native_token_bridge.go | 15 ++++++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/tests/erc20_to_native_token_bridge.go b/tests/erc20_to_native_token_bridge.go index 28ccca9db..cba2f7d45 100644 --- a/tests/erc20_to_native_token_bridge.go +++ b/tests/erc20_to_native_token_bridge.go @@ -36,6 +36,11 @@ func ERC20ToNativeTokenBridge() { ctx = context.Background() deployerAddress = common.HexToAddress("0x539447ab8Be7e927bE8E005663C81ff2AE951337") tokenReceiverAddress = common.HexToAddress("0x4444444444444444444444444444444444444444") + + emptyDestFeeInfo = nativetokendestination.TeleporterFeeInfo{ + ContractAddress: common.Address{}, + Amount: common.Big0, + } ) subnetA := utils.GetSubnetATestInfo() @@ -86,7 +91,7 @@ func ERC20ToNativeTokenBridge() { Expect(err).Should(BeNil()) transactor.Value = new(big.Int).SetUint64(valueToSend) - tx, err := nativeTokenDestination.TransferToSource(transactor, toAddress, nativetokendestination.TeleporterFeeInfo{}, []common.Address{}) + tx, err := nativeTokenDestination.TransferToSource(transactor, toAddress, emptyDestFeeInfo, []common.Address{}) Expect(err).Should(BeNil()) log.Info("Sent TransferToSource transaction on destination chain", "sourceChainID", subnetA.BlockchainID, "txHash", tx.Hash().Hex()) @@ -154,7 +159,7 @@ func ERC20ToNativeTokenBridge() { transactor.Value = new(big.Int).SetUint64(valueToSend1) // This transfer should revert because the bridge isn't collateralized - _, err = nativeTokenDestination.TransferToSource(transactor, tokenReceiverAddress, nativetokendestination.TeleporterFeeInfo{}, []common.Address{}) + _, err = nativeTokenDestination.TransferToSource(transactor, tokenReceiverAddress, emptyDestFeeInfo, []common.Address{}) Expect(err).ShouldNot(BeNil()) // Check we should fail to send because we're not collateralized diff --git a/tests/native_token_bridge.go b/tests/native_token_bridge.go index 37a32b9c7..19cd1b5a5 100644 --- a/tests/native_token_bridge.go +++ b/tests/native_token_bridge.go @@ -33,6 +33,15 @@ func NativeTokenBridge() { ctx = context.Background() deployerAddress = common.HexToAddress("0x1337cfd2dCff6270615B90938aCB1efE79801704") tokenReceiverAddress = common.HexToAddress("0x0123456789012345678901234567890123456789") + + emptyDestFeeInfo = nativetokendestination.TeleporterFeeInfo{ + ContractAddress: common.Address{}, + Amount: common.Big0, + } + emptySourceFeeInfo = nativetokensource.TeleporterFeeInfo{ + ContractAddress: common.Address{}, + Amount: common.Big0, + } ) subnetA := utils.GetSubnetATestInfo() @@ -76,7 +85,7 @@ func NativeTokenBridge() { Expect(err).Should(BeNil()) transactor.Value = new(big.Int).SetUint64(valueToSend) - tx, err := nativeTokenDestination.TransferToSource(transactor, toAddress, nativetokendestination.TeleporterFeeInfo{}, []common.Address{}) + tx, err := nativeTokenDestination.TransferToSource(transactor, toAddress, emptyDestFeeInfo, []common.Address{}) Expect(err).Should(BeNil()) log.Info("Sent TransferToSource transaction on destination chain", "sourceChainID", subnetA.BlockchainID, "txHash", tx.Hash().Hex()) @@ -94,7 +103,7 @@ func NativeTokenBridge() { Expect(err).Should(BeNil()) transactor.Value = new(big.Int).SetUint64(valueToSend) - tx, err := nativeTokenSource.TransferToDestination(transactor, toAddress, nativetokensource.TeleporterFeeInfo{}, []common.Address{}) + tx, err := nativeTokenSource.TransferToDestination(transactor, toAddress, emptySourceFeeInfo, []common.Address{}) Expect(err).Should(BeNil()) log.Info("Sent TransferToDestination transaction on source chain", "destinationChainID", subnetB.BlockchainID, "txHash", tx.Hash().Hex()) @@ -131,7 +140,7 @@ func NativeTokenBridge() { transactor.Value = new(big.Int).SetUint64(valueToSend1) // This transfer should revert because the bridge isn't collateralized - _, err = nativeTokenDestination.TransferToSource(transactor, tokenReceiverAddress, nativetokendestination.TeleporterFeeInfo{}, []common.Address{}) + _, err = nativeTokenDestination.TransferToSource(transactor, tokenReceiverAddress, emptyDestFeeInfo, []common.Address{}) Expect(err).ShouldNot(BeNil()) // Check we should fail to send because we're not collateralized From aad437325d386e3add012c90041ddd39d7ff719f Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 13 Nov 2023 11:15:43 -0500 Subject: [PATCH 096/183] Review fixes --- .../ERC20TokenSource/ERC20TokenSource.go | 33 +------- .../NativeTokenDestination.go | 33 +------- .../NativeTokenSource/NativeTokenSource.go | 33 +------- .../NativeTokenBridge/ERC20TokenSource.sol | 56 +++++++------- .../NativeTokenBridge/IERC20TokenSource.sol | 4 +- .../INativeTokenDestination.sol | 4 +- .../NativeTokenBridge/INativeTokenSource.sol | 2 +- .../NativeTokenDestination.sol | 76 ++++++++++--------- .../NativeTokenBridge/NativeTokenSource.sol | 51 ++++++------- tests/erc20_to_native_token_bridge.go | 21 ++++- 10 files changed, 116 insertions(+), 197 deletions(-) diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go index c1f09f792..04e3c48d1 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go @@ -31,7 +31,7 @@ var ( // ERC20TokenSourceMetaData contains all meta data concerning the ERC20TokenSource contract. var ERC20TokenSourceMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"erc20ContractAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"transferAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"erc20ContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"erc20ContractAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"transferAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"erc20ContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // ERC20TokenSourceABI is the input ABI used to generate the binding from. @@ -211,37 +211,6 @@ func (_ERC20TokenSource *ERC20TokenSourceCallerSession) MINTNATIVETOKENSREQUIRED return _ERC20TokenSource.Contract.MINTNATIVETOKENSREQUIREDGAS(&_ERC20TokenSource.CallOpts) } -// CurrentBlockchainID is a free data retrieval call binding the contract method 0x4950d2d0. -// -// Solidity: function currentBlockchainID() view returns(bytes32) -func (_ERC20TokenSource *ERC20TokenSourceCaller) CurrentBlockchainID(opts *bind.CallOpts) ([32]byte, error) { - var out []interface{} - err := _ERC20TokenSource.contract.Call(opts, &out, "currentBlockchainID") - - if err != nil { - return *new([32]byte), err - } - - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - - return out0, err - -} - -// CurrentBlockchainID is a free data retrieval call binding the contract method 0x4950d2d0. -// -// Solidity: function currentBlockchainID() view returns(bytes32) -func (_ERC20TokenSource *ERC20TokenSourceSession) CurrentBlockchainID() ([32]byte, error) { - return _ERC20TokenSource.Contract.CurrentBlockchainID(&_ERC20TokenSource.CallOpts) -} - -// CurrentBlockchainID is a free data retrieval call binding the contract method 0x4950d2d0. -// -// Solidity: function currentBlockchainID() view returns(bytes32) -func (_ERC20TokenSource *ERC20TokenSourceCallerSession) CurrentBlockchainID() ([32]byte, error) { - return _ERC20TokenSource.Contract.CurrentBlockchainID(&_ERC20TokenSource.CallOpts) -} - // DestinationBlockchainID is a free data retrieval call binding the contract method 0x41d3014d. // // Solidity: function destinationBlockchainID() view returns(bytes32) diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go index 53ced56b1..28f8cd23f 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go @@ -37,7 +37,7 @@ type TeleporterFeeInfo struct { // NativeTokenDestinationMetaData contains all meta data concerning the NativeTokenDestination contract. var NativeTokenDestinationMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialReserveImbalance_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalMinted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialReserveImbalance_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalMinted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", } // NativeTokenDestinationABI is the input ABI used to generate the binding from. @@ -217,37 +217,6 @@ func (_NativeTokenDestination *NativeTokenDestinationCallerSession) TRANSFERNATI return _NativeTokenDestination.Contract.TRANSFERNATIVETOKENSREQUIREDGAS(&_NativeTokenDestination.CallOpts) } -// CurrentBlockchainID is a free data retrieval call binding the contract method 0x4950d2d0. -// -// Solidity: function currentBlockchainID() view returns(bytes32) -func (_NativeTokenDestination *NativeTokenDestinationCaller) CurrentBlockchainID(opts *bind.CallOpts) ([32]byte, error) { - var out []interface{} - err := _NativeTokenDestination.contract.Call(opts, &out, "currentBlockchainID") - - if err != nil { - return *new([32]byte), err - } - - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - - return out0, err - -} - -// CurrentBlockchainID is a free data retrieval call binding the contract method 0x4950d2d0. -// -// Solidity: function currentBlockchainID() view returns(bytes32) -func (_NativeTokenDestination *NativeTokenDestinationSession) CurrentBlockchainID() ([32]byte, error) { - return _NativeTokenDestination.Contract.CurrentBlockchainID(&_NativeTokenDestination.CallOpts) -} - -// CurrentBlockchainID is a free data retrieval call binding the contract method 0x4950d2d0. -// -// Solidity: function currentBlockchainID() view returns(bytes32) -func (_NativeTokenDestination *NativeTokenDestinationCallerSession) CurrentBlockchainID() ([32]byte, error) { - return _NativeTokenDestination.Contract.CurrentBlockchainID(&_NativeTokenDestination.CallOpts) -} - // CurrentReserveImbalance is a free data retrieval call binding the contract method 0x00d872ae. // // Solidity: function currentReserveImbalance() view returns(uint256) diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go index fbaae4cd7..acdea7305 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go @@ -37,7 +37,7 @@ type TeleporterFeeInfo struct { // NativeTokenSourceMetaData contains all meta data concerning the NativeTokenSource contract. var NativeTokenSourceMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", } // NativeTokenSourceABI is the input ABI used to generate the binding from. @@ -217,37 +217,6 @@ func (_NativeTokenSource *NativeTokenSourceCallerSession) MINTNATIVETOKENSREQUIR return _NativeTokenSource.Contract.MINTNATIVETOKENSREQUIREDGAS(&_NativeTokenSource.CallOpts) } -// CurrentBlockchainID is a free data retrieval call binding the contract method 0x4950d2d0. -// -// Solidity: function currentBlockchainID() view returns(bytes32) -func (_NativeTokenSource *NativeTokenSourceCaller) CurrentBlockchainID(opts *bind.CallOpts) ([32]byte, error) { - var out []interface{} - err := _NativeTokenSource.contract.Call(opts, &out, "currentBlockchainID") - - if err != nil { - return *new([32]byte), err - } - - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - - return out0, err - -} - -// CurrentBlockchainID is a free data retrieval call binding the contract method 0x4950d2d0. -// -// Solidity: function currentBlockchainID() view returns(bytes32) -func (_NativeTokenSource *NativeTokenSourceSession) CurrentBlockchainID() ([32]byte, error) { - return _NativeTokenSource.Contract.CurrentBlockchainID(&_NativeTokenSource.CallOpts) -} - -// CurrentBlockchainID is a free data retrieval call binding the contract method 0x4950d2d0. -// -// Solidity: function currentBlockchainID() view returns(bytes32) -func (_NativeTokenSource *NativeTokenSourceCallerSession) CurrentBlockchainID() ([32]byte, error) { - return _NativeTokenSource.Contract.CurrentBlockchainID(&_NativeTokenSource.CallOpts) -} - // DestinationBlockchainID is a free data retrieval call binding the contract method 0x41d3014d. // // Solidity: function destinationBlockchainID() view returns(bytes32) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol index 3d37b6fd6..bbbc41114 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol @@ -5,27 +5,26 @@ pragma solidity 0.8.18; -import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; -import "@subnet-evm-contracts/interfaces/IWarpMessenger.sol"; -import "./IERC20TokenSource.sol"; -import "../../Teleporter/ITeleporterMessenger.sol"; -import "../../Teleporter/ITeleporterReceiver.sol"; -import "../../Teleporter/SafeERC20TransferFrom.sol"; +import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol"; +import {IWarpMessenger} from "@subnet-evm-contracts/interfaces/IWarpMessenger.sol"; +import {IERC20TokenSource} from "./IERC20TokenSource.sol"; +import {ITeleporterMessenger, TeleporterMessageInput, TeleporterFeeInfo} from "../../Teleporter/ITeleporterMessenger.sol"; +import {ITeleporterReceiver} from "../../Teleporter/ITeleporterReceiver.sol"; +import {SafeERC20TransferFrom} from "../../Teleporter/SafeERC20TransferFrom.sol"; +import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; contract ERC20TokenSource is ITeleporterReceiver, IERC20TokenSource, ReentrancyGuard { - using SafeERC20 for IERC20; - uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 150_000; // TODO this is a placeholder - bytes32 public immutable currentBlockchainID; bytes32 public immutable destinationBlockchainID; address public immutable nativeTokenDestinationAddress; address public immutable erc20ContractAddress; - // Used for sending an receiving Teleporter messages. + // Used for sending and receiving Teleporter messages. ITeleporterMessenger public immutable teleporterMessenger; constructor( @@ -34,35 +33,33 @@ contract ERC20TokenSource is address nativeTokenDestinationAddress_, address erc20ContractAddress_ ) { - currentBlockchainID = IWarpMessenger( - 0x0200000000000000000000000000000000000005 - ).getBlockchainID(); - require( teleporterMessengerAddress != address(0), - "ERC20TokenSource: zero TeleporterMessenger Address" + "ERC20TokenSource: zero TeleporterMessenger address" ); teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); require( destinationBlockchainID_ != bytes32(0), - "ERC20TokenSource: zero Destination Chain ID" + "ERC20TokenSource: zero destination chain ID" ); require( - destinationBlockchainID_ != currentBlockchainID, - "ERC20TokenSource: Cannot Bridge With Same Blockchain" + destinationBlockchainID_ != + IWarpMessenger(0x0200000000000000000000000000000000000005) + .getBlockchainID(), + "ERC20TokenSource: cannot bridge with same blockchain" ); destinationBlockchainID = destinationBlockchainID_; require( nativeTokenDestinationAddress_ != address(0), - "ERC20TokenSource: zero Destination Contract Address" + "ERC20TokenSource: zero destination contract address" ); nativeTokenDestinationAddress = nativeTokenDestinationAddress_; require( erc20ContractAddress_ != address(0), - "ERC20TokenSource: Invalid ERC20 Contract Address" + "ERC20TokenSource: invalid ERC20 contract address" ); erc20ContractAddress = erc20ContractAddress_; } @@ -80,19 +77,19 @@ contract ERC20TokenSource is // Only allow the Teleporter messenger to deliver messages. require( msg.sender == address(teleporterMessenger), - "ERC20TokenSource: Unauthorized TeleporterMessenger contract" + "ERC20TokenSource: unauthorized TeleporterMessenger contract" ); // Only allow messages from the destination chain. require( senderBlockchainID == destinationBlockchainID, - "ERC20TokenSource: Invalid Destination Chain" + "ERC20TokenSource: invalid destination chain" ); // Only allow the partner contract to send messages. require( senderAddress == nativeTokenDestinationAddress, - "ERC20TokenSource: Unauthorized Sender" + "ERC20TokenSource: unauthorized sender" ); (address recipient, uint256 amount) = abi.decode( @@ -101,11 +98,11 @@ contract ERC20TokenSource is ); require( recipient != address(0), - "ERC20TokenSource: zero Recipient Address" + "ERC20TokenSource: zero recipient address" ); // Transfer to recipient - IERC20(erc20ContractAddress).safeTransfer(recipient, amount); + SafeERC20.safeTransfer(IERC20(erc20ContractAddress), recipient, amount); emit UnlockTokens(recipient, amount); } @@ -122,7 +119,7 @@ contract ERC20TokenSource is // The recipient cannot be the zero address. require( recipient != address(0), - "ERC20TokenSource: zero Recipient Address" + "ERC20TokenSource: zero recipient address" ); // Lock tokens in this contract. Supports "fee/burn on transfer" ERC20 token @@ -141,13 +138,14 @@ contract ERC20TokenSource is // Allow the Teleporter messenger to spend the fee amount. if (feeAmount > 0) { - IERC20(erc20ContractAddress).safeIncreaseAllowance( + SafeERC20.safeIncreaseAllowance( + IERC20(erc20ContractAddress), address(teleporterMessenger), feeAmount ); } - uint256 transferAmount = totalAmount - feeAmount; + uint256 transferAmount = adjustedAmount - feeAmount; uint256 messageID = teleporterMessenger.sendCrossChainMessage( TeleporterMessageInput({ @@ -166,7 +164,7 @@ contract ERC20TokenSource is emit TransferToDestination({ sender: msg.sender, recipient: recipient, - transferAmount: totalAmount, + transferAmount: transferAmount, feeAmount: feeAmount, teleporterMessageID: messageID }); diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol index f101676c7..44aa4f911 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol @@ -6,12 +6,12 @@ pragma solidity 0.8.18; /** - * @dev Interface that describes functionalities for a contract that will lock tokens and send a + * @dev Interface that describes functionalities for a contract that will lock ERC20 tokens and send a * Teleporter message to a NativeTokenDestination contract to mint native tokens on that chain. */ interface IERC20TokenSource { /** - * @dev Emitted when tokens are locked in this bridge contract to be bridged to the destination chain. + * @dev Emitted when ERC20 tokens are locked in this bridge contract to be bridged to the destination chain. */ event TransferToDestination( address indexed sender, diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol index 505cdadae..e34b1394e 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol @@ -5,11 +5,11 @@ pragma solidity 0.8.18; -import "../../Teleporter/ITeleporterMessenger.sol"; +import {ITeleporterMessenger, TeleporterFeeInfo} from "../../Teleporter/ITeleporterMessenger.sol"; /** * @dev Interface that describes functionalities for a contract that can mint native tokens when - * paired with a {INativeTokenSource} contract that will lock tokens on another chain. + * paired with a {INativeTokenSource} or {IERC20TokenSource} contract that will lock tokens on another chain. */ interface INativeTokenDestination { /** diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol index bdb41ab52..5b89baaef 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol @@ -5,7 +5,7 @@ pragma solidity 0.8.18; -import "../../Teleporter/ITeleporterMessenger.sol"; +import {ITeleporterMessenger, TeleporterFeeInfo} from "../../Teleporter/ITeleporterMessenger.sol"; /** * @dev Interface that describes functionalities for a contract that will lock tokens and send a diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index 256d60d42..e9a4829e8 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -5,14 +5,16 @@ pragma solidity 0.8.18; -import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; -import "@subnet-evm-contracts/interfaces/IWarpMessenger.sol"; -import "@subnet-evm-contracts/interfaces/IAllowList.sol"; -import "@subnet-evm-contracts/interfaces/INativeMinter.sol"; -import "./INativeTokenDestination.sol"; -import "../../Teleporter/ITeleporterMessenger.sol"; -import "../../Teleporter/ITeleporterReceiver.sol"; -import "../../Teleporter/SafeERC20TransferFrom.sol"; +import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol"; +import {IWarpMessenger} from "@subnet-evm-contracts/interfaces/IWarpMessenger.sol"; +import {IAllowList} from "@subnet-evm-contracts/interfaces/IAllowList.sol"; +import {INativeMinter} from "@subnet-evm-contracts/interfaces/INativeMinter.sol"; +import {INativeTokenDestination} from "./INativeTokenDestination.sol"; +import {ITeleporterMessenger, TeleporterFeeInfo, TeleporterMessageInput} from "../../Teleporter/ITeleporterMessenger.sol"; +import {ITeleporterReceiver} from "../../Teleporter/ITeleporterReceiver.sol"; +import {SafeERC20TransferFrom} from "../../Teleporter/SafeERC20TransferFrom.sol"; +import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; // The address where the burned transaction fees are credited. // TODO implement mechanism to report burned tx fees to source chian. @@ -27,13 +29,10 @@ contract NativeTokenDestination is INativeTokenDestination, ReentrancyGuard { - using SafeERC20 for IERC20; - INativeMinter private immutable _nativeMinter = INativeMinter(0x0200000000000000000000000000000000000001); uint256 public constant TRANSFER_NATIVE_TOKENS_REQUIRED_GAS = 150_000; // TODO this is a placeholder - bytes32 public immutable currentBlockchainID; bytes32 public immutable sourceBlockchainID; address public immutable nativeTokenSourceAddress; // The first `initialReserveImbalance` tokens sent to this subnet will not be minted. @@ -52,29 +51,27 @@ contract NativeTokenDestination is address nativeTokenSourceAddress_, uint256 initialReserveImbalance_ ) { - currentBlockchainID = IWarpMessenger( - 0x0200000000000000000000000000000000000005 - ).getBlockchainID(); - require( teleporterMessengerAddress != address(0), - "NativeTokenDestination: zero TeleporterMessenger Address" + "NativeTokenDestination: zero TeleporterMessenger address" ); teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); require( sourceBlockchainID_ != bytes32(0), - "NativeTokenDestination: zero Source Chain ID" + "NativeTokenDestination: zero source chain ID" ); require( - sourceBlockchainID_ != currentBlockchainID, - "NativeTokenDestination: Cannot Bridge With Same Blockchain" + sourceBlockchainID_ != + IWarpMessenger(0x0200000000000000000000000000000000000005) + .getBlockchainID(), + "NativeTokenDestination: cannot bridge with same blockchain" ); sourceBlockchainID = sourceBlockchainID_; require( nativeTokenSourceAddress_ != address(0), - "NativeTokenDestination: zero Source Contract Address" + "NativeTokenDestination: zero source contract address" ); nativeTokenSourceAddress = nativeTokenSourceAddress_; @@ -95,19 +92,19 @@ contract NativeTokenDestination is // Only allow the Teleporter messenger to deliver messages. require( msg.sender == address(teleporterMessenger), - "NativeTokenDestination: Unauthorized TeleporterMessenger contract" + "NativeTokenDestination: unauthorized TeleporterMessenger contract" ); // Only allow messages from the source chain. require( senderBlockchainID == sourceBlockchainID, - "NativeTokenDestination: Invalid Source Chain" + "NativeTokenDestination: invalid source chain" ); // Only allow the partner contract to send messages. require( senderAddress == nativeTokenSourceAddress, - "NativeTokenDestination: Unauthorized Sender" + "NativeTokenDestination: unauthorized sender" ); (address recipient, uint256 amount) = abi.decode( @@ -116,19 +113,25 @@ contract NativeTokenDestination is ); require( recipient != address(0), - "NativeTokenDestination: zero Recipient Address" + "NativeTokenDestination: zero recipient address" ); - require(amount != 0, "NativeTokenDestination: Transfer value of 0"); + require(amount != 0, "NativeTokenDestination: zero transfer value"); uint256 adjustedAmount = amount; if (currentReserveImbalance > 0) { if (amount > currentReserveImbalance) { - emit CollateralAdded({amount: currentReserveImbalance, remaining: 0}); + emit CollateralAdded({ + amount: currentReserveImbalance, + remaining: 0 + }); adjustedAmount = amount - currentReserveImbalance; currentReserveImbalance = 0; } else { currentReserveImbalance -= amount; - emit CollateralAdded({amount: amount, remaining: currentReserveImbalance}); + emit CollateralAdded({ + amount: amount, + remaining: currentReserveImbalance + }); return; } } @@ -150,12 +153,12 @@ contract NativeTokenDestination is // The recipient cannot be the zero address. require( recipient != address(0), - "NativeTokenDestination: zero Recipient Address" + "NativeTokenDestination: zero recipient address" ); require( - currentReserveImbalance <= 0, - "NativeTokenDestination: Contract Undercollateralized" + currentReserveImbalance == 0, + "NativeTokenDestination: contract undercollateralized" ); // Lock tokens in this bridge instance. Supports "fee/burn on transfer" ERC20 token @@ -167,10 +170,7 @@ contract NativeTokenDestination is IERC20(feeInfo.contractAddress), feeInfo.amount ); - IERC20(feeInfo.contractAddress).safeIncreaseAllowance( - address(teleporterMessenger), - adjustedFeeAmount - ); + SafeERC20.safeIncreaseAllowance(IERC20(feeInfo.contractAddress), address(teleporterMessenger), adjustedFeeAmount); } // Burn native token by sending to BLACKHOLE_ADDRESS @@ -200,8 +200,12 @@ contract NativeTokenDestination is } function totalSupply() external view returns (uint256) { - uint256 burned = address(BURNED_TX_FEES_ADDRESS).balance - address(BLACKHOLE_ADDRESS).balance; - require(burned > totalMinted + initialReserveImbalance, "NativeTokenDestination: FATAL - Contract has tokens unaccounted for"); + uint256 burned = address(BURNED_TX_FEES_ADDRESS).balance - + address(BLACKHOLE_ADDRESS).balance; + require( + burned <= totalMinted + initialReserveImbalance, + "NativeTokenDestination: FATAL - contract has tokens unaccounted for" + ); return totalMinted + initialReserveImbalance - burned; } } diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index 3ab5e4fd5..d1e799191 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -5,26 +5,26 @@ pragma solidity 0.8.18; -import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; -import "@subnet-evm-contracts/interfaces/IWarpMessenger.sol"; -import "./INativeTokenSource.sol"; -import "../../Teleporter/ITeleporterMessenger.sol"; -import "../../Teleporter/ITeleporterReceiver.sol"; -import "../../Teleporter/SafeERC20TransferFrom.sol"; +import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol"; +import {IWarpMessenger} from "@subnet-evm-contracts/interfaces/IWarpMessenger.sol"; +import {INativeTokenSource} from "./INativeTokenSource.sol"; +import {ITeleporterMessenger, TeleporterFeeInfo, TeleporterMessageInput} from "../../Teleporter/ITeleporterMessenger.sol"; +import {ITeleporterReceiver} from "../../Teleporter/ITeleporterReceiver.sol"; +import {SafeERC20TransferFrom} from "../../Teleporter/SafeERC20TransferFrom.sol"; +import {SafeERC20TransferFrom} from "../../Teleporter/SafeERC20TransferFrom.sol"; +import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; contract NativeTokenSource is ITeleporterReceiver, INativeTokenSource, ReentrancyGuard { - using SafeERC20 for IERC20; - uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 150_000; // TODO this is a placeholder - bytes32 public immutable currentBlockchainID; bytes32 public immutable destinationBlockchainID; address public immutable nativeTokenDestinationAddress; - // Used for sending an receiving Teleporter messages. + // Used for sending and receiving Teleporter messages. ITeleporterMessenger public immutable teleporterMessenger; constructor( @@ -32,29 +32,27 @@ contract NativeTokenSource is bytes32 destinationBlockchainID_, address nativeTokenDestinationAddress_ ) { - currentBlockchainID = IWarpMessenger( - 0x0200000000000000000000000000000000000005 - ).getBlockchainID(); - require( teleporterMessengerAddress != address(0), - "NativeTokenSource: zero TeleporterMessenger Address" + "NativeTokenSource: zero TeleporterMessenger address" ); teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); require( destinationBlockchainID_ != bytes32(0), - "NativeTokenSource: zero Destination Chain ID" + "NativeTokenSource: zero destination chain ID" ); require( - destinationBlockchainID_ != currentBlockchainID, - "NativeTokenSource: Cannot Bridge With Same Blockchain" + destinationBlockchainID_ != + IWarpMessenger(0x0200000000000000000000000000000000000005) + .getBlockchainID(), + "NativeTokenSource: cannot bridge with same blockchain" ); destinationBlockchainID = destinationBlockchainID_; require( nativeTokenDestinationAddress_ != address(0), - "NativeTokenSource: zero Destination Contract Address" + "NativeTokenSource: zero destination contract address" ); nativeTokenDestinationAddress = nativeTokenDestinationAddress_; } @@ -72,19 +70,19 @@ contract NativeTokenSource is // Only allow the Teleporter messenger to deliver messages. require( msg.sender == address(teleporterMessenger), - "NativeTokenSource: Unauthorized TeleporterMessenger contract" + "NativeTokenSource: unauthorized teleporterMessenger contract" ); // Only allow messages from the destination chain. require( senderBlockchainID == destinationBlockchainID, - "NativeTokenSource: Invalid Destination Chain" + "NativeTokenSource: invalid destination chain" ); // Only allow the partner contract to send messages. require( senderAddress == nativeTokenDestinationAddress, - "NativeTokenSource: Unauthorized Sender" + "NativeTokenSource: unauthorized sender" ); (address recipient, uint256 amount) = abi.decode( @@ -93,7 +91,7 @@ contract NativeTokenSource is ); require( recipient != address(0), - "NativeTokenSource: zero Recipient Address" + "NativeTokenSource: zero recipient address" ); // Send to recipient @@ -113,7 +111,7 @@ contract NativeTokenSource is // The recipient cannot be the zero address. require( recipient != address(0), - "NativeTokenSource: zero Recipient Address" + "NativeTokenSource: zero ercipient address" ); // Lock tokens in this bridge instance. Supports "fee/burn on transfer" ERC20 token @@ -125,10 +123,7 @@ contract NativeTokenSource is IERC20(feeInfo.contractAddress), feeInfo.amount ); - IERC20(feeInfo.contractAddress).safeIncreaseAllowance( - address(teleporterMessenger), - adjustedFeeAmount - ); + SafeERC20.safeIncreaseAllowance(IERC20(feeInfo.contractAddress), address(teleporterMessenger), adjustedFeeAmount); } uint256 messageID = teleporterMessenger.sendCrossChainMessage( diff --git a/tests/erc20_to_native_token_bridge.go b/tests/erc20_to_native_token_bridge.go index cba2f7d45..67cc15689 100644 --- a/tests/erc20_to_native_token_bridge.go +++ b/tests/erc20_to_native_token_bridge.go @@ -123,6 +123,7 @@ func ERC20ToNativeTokenBridge() { { // Give erc20TokenSource allowance to spend all of the deployer's ERC20 Tokens bal, err := exampleERC20.BalanceOf(nil, deployerAddress) Expect(err).Should(BeNil()) + Expect(bal.Div(bal, big.NewInt(10)).Uint64() > initialReserveImbalance).Should(BeTrue()) transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetA.ChainID) Expect(err).Should(BeNil()) @@ -140,8 +141,12 @@ func ERC20ToNativeTokenBridge() { Expect(err).Should(BeNil()) Expect(bal.Uint64()).Should(BeZero()) + CheckReserveImbalance(initialReserveImbalance, nativeTokenDestination) + sendTokensToDestination(valueToSend1, deployerPK, tokenReceiverAddress) + CheckReserveImbalance(initialReserveImbalance - valueToSend1, nativeTokenDestination) + // Check intermediate balance, no tokens should be minted because we haven't collateralized bal, err = subnetB.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) Expect(err).Should(BeNil()) @@ -150,9 +155,9 @@ func ERC20ToNativeTokenBridge() { { // Fail to Transfer tokens B -> A because bridge is not collateralized // Check starting balance is 0 - bal, err := exampleERC20.BalanceOf(&bind.CallOpts{Accepted: true}, tokenReceiverAddress) + bal, err := exampleERC20.BalanceOf(&bind.CallOpts{}, tokenReceiverAddress) Expect(err).Should(BeNil()) - Expect(bal.Cmp(common.Big0)).Should(BeZero()) + Expect(bal.Uint64()).Should(BeZero()) transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetB.ChainID) Expect(err).Should(BeNil()) @@ -162,8 +167,10 @@ func ERC20ToNativeTokenBridge() { _, err = nativeTokenDestination.TransferToSource(transactor, tokenReceiverAddress, emptyDestFeeInfo, []common.Address{}) Expect(err).ShouldNot(BeNil()) + CheckReserveImbalance(initialReserveImbalance - valueToSend1, nativeTokenDestination) + // Check we should fail to send because we're not collateralized - bal, err = exampleERC20.BalanceOf(&bind.CallOpts{Accepted: true}, tokenReceiverAddress) + bal, err = exampleERC20.BalanceOf(&bind.CallOpts{}, tokenReceiverAddress) Expect(err).Should(BeNil()) Expect(bal.Uint64()).Should(BeZero()) } @@ -176,6 +183,8 @@ func ERC20ToNativeTokenBridge() { sendTokensToDestination(valueToSend2, deployerPK, tokenReceiverAddress) + CheckReserveImbalance(0, nativeTokenDestination) + // We should have minted the excess coins after checking the collateral bal, err = subnetB.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) Expect(err).Should(BeNil()) @@ -208,3 +217,9 @@ func DeployContract(ctx context.Context, byteCodeFileName string, deployerPK *ec Expect(err).Should(BeNil()) Expect(len(code)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode } + +func CheckReserveImbalance(value uint64, nativeTokenDestination *nativetokendestination.NativeTokenDestination) { + imbalance, err := nativeTokenDestination.CurrentReserveImbalance(&bind.CallOpts{}) + Expect(err).Should(BeNil()) + Expect(imbalance.Uint64()).Should(Equal(value)) +} From 720a2d84f8e3b80df6619d790d079c8454fef8d4 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 13 Nov 2023 11:28:15 -0500 Subject: [PATCH 097/183] Fix lint --- .../NativeTokenBridge/INativeTokenDestination.sol | 2 +- .../NativeTokenBridge/INativeTokenSource.sol | 2 +- .../NativeTokenBridge/NativeTokenDestination.sol | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol index e34b1394e..519be7083 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol @@ -5,7 +5,7 @@ pragma solidity 0.8.18; -import {ITeleporterMessenger, TeleporterFeeInfo} from "../../Teleporter/ITeleporterMessenger.sol"; +import {TeleporterFeeInfo} from "../../Teleporter/ITeleporterMessenger.sol"; /** * @dev Interface that describes functionalities for a contract that can mint native tokens when diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol index 5b89baaef..c7fb8c41c 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol @@ -5,7 +5,7 @@ pragma solidity 0.8.18; -import {ITeleporterMessenger, TeleporterFeeInfo} from "../../Teleporter/ITeleporterMessenger.sol"; +import {TeleporterFeeInfo} from "../../Teleporter/ITeleporterMessenger.sol"; /** * @dev Interface that describes functionalities for a contract that will lock tokens and send a diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index e9a4829e8..e8fe9b99a 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -7,7 +7,6 @@ pragma solidity 0.8.18; import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import {IWarpMessenger} from "@subnet-evm-contracts/interfaces/IWarpMessenger.sol"; -import {IAllowList} from "@subnet-evm-contracts/interfaces/IAllowList.sol"; import {INativeMinter} from "@subnet-evm-contracts/interfaces/INativeMinter.sol"; import {INativeTokenDestination} from "./INativeTokenDestination.sol"; import {ITeleporterMessenger, TeleporterFeeInfo, TeleporterMessageInput} from "../../Teleporter/ITeleporterMessenger.sol"; From 40ebc58151f484ec4f12c8ac8e8e0813c1f7c782 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 13 Nov 2023 11:47:26 -0500 Subject: [PATCH 098/183] Fix lint --- .../NativeTokenBridge/NativeTokenDestination.sol | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index e8fe9b99a..aba615391 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -14,6 +14,9 @@ import {ITeleporterReceiver} from "../../Teleporter/ITeleporterReceiver.sol"; import {SafeERC20TransferFrom} from "../../Teleporter/SafeERC20TransferFrom.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; +// We need IAllowList is an indirect dependency in order to compile. +// solhint-disable-next-line +import {IAllowList} from "@subnet-evm-contracts/interfaces/IAllowList.sol"; // The address where the burned transaction fees are credited. // TODO implement mechanism to report burned tx fees to source chian. From 849e9383f0a724c4f11137353d67d6a2bd546901 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 13 Nov 2023 11:59:42 -0500 Subject: [PATCH 099/183] Update README --- .../src/CrossChainApplications/NativeTokenBridge/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/README.md b/contracts/src/CrossChainApplications/NativeTokenBridge/README.md index a7fca5df4..c363f44a1 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/README.md +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/README.md @@ -1,6 +1,6 @@ # Native-to-Native Token Bridge -A pair of smart contracts built on top of Teleporter to support using the native token of any `subnet-evm` chain as the native token for a given subnet. +A pair of smart contracts built on top of Teleporter to support using an ERC20 token or the native token of any `subnet-evm` chain as the native token for a given subnet. ## Design The native-to-native bridge is implemented using two primary contracts. @@ -14,6 +14,8 @@ The native-to-native bridge is implemented using two primary contracts. - Mints and burns native tokens on the Destination chain corresponding to locks and unlocks on the source chain. - `transferToSource`: transfers all tokens payed to this function call to `recipient` on the source chain by burning the tokens and instructing the source chain to unlock. Optionally takes the address of an ERC20 contract `feeContractAddress` as well as an amount `feeAmount` that will be used as the relayer-incentivisation for the teleporter cross-chain call. Also allows for the caller to specify `allowedRelayerAddresses`. - `receiveTeleporterMessage`: mints tokens on the destination chain when instructed to by the `NativeTokenDestination` contract. + - `isCollateralized`: returns true if `currentReserveImbalance == 0`, meaning that enough tokens have been sent from the source chain to offset the `initialReserveImbalance`. If true, all tokens sent to the destination chain will be minted, and burning/unlocking tokens will be enabled. + - `totalSupply`: Returns the best estimate of available native tokens on this chain. Equal to the `initialReserveImbalance` + `all tokens minted` - `all tokens in known burn address`. Known burn addresses include the burn address for this contract used when burning/unlocking, and the address for burned transaction fees. - `Collateralizing the bridge` - On initialization, the bridge will be undercollateralized by exactly the number of tokens included in genesis on the destination chain. These tokens could theoretically be sent through the bridge, with no corresponding tokens able to be unlocked on the source chain. In order to avoid this problem, the `NativeTokenDestination` contract is initialized with the value for `initialReserveImbalance`, which should correspond to the number of tokens allocated in the genesis block for the destination chain. If `initialReserveImbalance` is not properly set, behaviour of this contract is undefined. The `NativeTokenDestination` contract will not mint tokens until it has received confirmation that at least `initialReserveImbalance` tokens have been locked on the source chain. It should be up to the contract deployer to ensure that the bridge is properly collateralized. Burning/unlocking is disabled until the bridge is properly collateralized. From 472f62e38cfba0222a49aa13743e1cdd8066ff06 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 13 Nov 2023 12:26:26 -0500 Subject: [PATCH 100/183] WIP --- tests/erc20_to_native_token_bridge.go | 26 +++++++++++++++++++------- tests/utils/utils.go | 3 +-- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/tests/erc20_to_native_token_bridge.go b/tests/erc20_to_native_token_bridge.go index 67cc15689..3e54c175a 100644 --- a/tests/erc20_to_native_token_bridge.go +++ b/tests/erc20_to_native_token_bridge.go @@ -3,6 +3,7 @@ package tests import ( "context" "crypto/ecdsa" + "fmt" "math/big" "github.com/ava-labs/subnet-evm/accounts/abi" @@ -104,7 +105,7 @@ func ERC20ToNativeTokenBridge() { } // Helper function - sendTokensToDestination := func(valueToSend uint64, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { + sendTokensToDestination := func(valueToSend uint64, fromKey *ecdsa.PrivateKey, toAddress common.Address) (*types.Receipt, *types.Receipt) { transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, subnetA.ChainID) Expect(err).Should(BeNil()) @@ -112,12 +113,12 @@ func ERC20ToNativeTokenBridge() { Expect(err).Should(BeNil()) log.Info("Sent TransferToDestination transaction on source chain", "destinationChainID", subnetB.BlockchainID, "txHash", tx.Hash().Hex()) - receipt := utils.WaitForTransaction(ctx, tx.Hash(), subnetA.WSClient) + sourceChainReceipt := utils.WaitForTransaction(ctx, tx.Hash(), subnetA.WSClient) Expect(err).Should(BeNil()) - Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + Expect(sourceChainReceipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) - utils.RelayMessage(ctx, receipt.BlockHash, receipt.BlockNumber, subnetA, subnetB) - return receipt + destChainReceipt := utils.RelayMessage(ctx, sourceChainReceipt.BlockHash, sourceChainReceipt.BlockNumber, subnetA, subnetB) + return sourceChainReceipt, destChainReceipt } { // Give erc20TokenSource allowance to spend all of the deployer's ERC20 Tokens @@ -143,7 +144,8 @@ func ERC20ToNativeTokenBridge() { CheckReserveImbalance(initialReserveImbalance, nativeTokenDestination) - sendTokensToDestination(valueToSend1, deployerPK, tokenReceiverAddress) + sourceChainReceipt, destChainReceipt := sendTokensToDestination(valueToSend1, deployerPK, tokenReceiverAddress) + CheckReserveImbalance(initialReserveImbalance - valueToSend1, nativeTokenDestination) @@ -181,7 +183,7 @@ func ERC20ToNativeTokenBridge() { Expect(err).Should(BeNil()) Expect(bal.Uint64()).Should(BeZero()) - sendTokensToDestination(valueToSend2, deployerPK, tokenReceiverAddress) + sourceChainReceipt, destChainReceipt := sendTokensToDestination(valueToSend2, deployerPK, tokenReceiverAddress) CheckReserveImbalance(0, nativeTokenDestination) @@ -223,3 +225,13 @@ func CheckReserveImbalance(value uint64, nativeTokenDestination *nativetokendest Expect(err).Should(BeNil()) Expect(imbalance.Uint64()).Should(Equal(value)) } + +func GetEventFromLogs[T any](logs []*types.Log, parser func(log types.Log) (T, error)) (T, error) { + for _, log := range logs { + event, err :=parser(*log) + if err == nil { + return event, nil + } + } + return *new(T), fmt.Errorf("failed to find SendCrossChainMessage event in receipt logs") +} diff --git a/tests/utils/utils.go b/tests/utils/utils.go index a018685f6..2c59c43f4 100644 --- a/tests/utils/utils.go +++ b/tests/utils/utils.go @@ -295,7 +295,7 @@ func RelayMessage( event, err := GetReceiveEventFromLogs(receipt.Logs, bind) Expect(err).Should(BeNil()) Expect(event.OriginChainID[:]).Should(Equal(source.BlockchainID[:])) - return nil + return receipt } func GetReceiveEventFromLogs(logs []*types.Log, bind *teleportermessenger.TeleporterMessenger) (*teleportermessenger.TeleporterMessengerReceiveCrossChainMessage, error) { @@ -314,7 +314,6 @@ func GetSendEventFromLogs(logs []*types.Log, bind *teleportermessenger.Teleporte event, err := bind.ParseSendCrossChainMessage(*log) if err == nil { return event, nil - } } return nil, fmt.Errorf("failed to find SendCrossChainMessage event in receipt logs") From 01860a5d23413fa01558be59f174e285a67d6451 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Wed, 15 Nov 2023 09:39:38 -0500 Subject: [PATCH 101/183] Fix ERC20 test --- go.work.sum | 1 + tests/basic_one_way_send.go | 26 +++--- tests/erc20_to_native_token_bridge.go | 121 ++++++++++++-------------- tests/native_token_bridge.go | 93 ++++++++++++-------- tests/utils/network_setup.go | 4 +- tests/utils/utils.go | 112 ++++++++++++++++++------ tests/utils/warp-genesis.json | 3 +- 7 files changed, 215 insertions(+), 145 deletions(-) diff --git a/go.work.sum b/go.work.sum index 2296609fa..a7cf6f9f9 100644 --- a/go.work.sum +++ b/go.work.sum @@ -948,6 +948,7 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pty v1.1.1 h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= diff --git a/tests/basic_one_way_send.go b/tests/basic_one_way_send.go index e5fca62a8..39c136894 100644 --- a/tests/basic_one_way_send.go +++ b/tests/basic_one_way_send.go @@ -4,9 +4,9 @@ import ( "context" "math/big" - "github.com/ava-labs/subnet-evm/interfaces" teleportermessenger "github.com/ava-labs/teleporter/abi-bindings/go/Teleporter/TeleporterMessenger" "github.com/ava-labs/teleporter/tests/utils" + "github.com/ava-labs/subnet-evm/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/log" . "github.com/onsi/gomega" @@ -43,14 +43,14 @@ func BasicOneWaySend() { AllowedRelayerAddresses: []common.Address{}, Message: []byte{1, 2, 3, 4}, } - signedTx := utils.CreateSendCrossChainMessageTransaction(ctx, subnetAInfo, sendCrossChainMessageInput, fundedAddress, fundedKey, teleporterContractAddress) + signedTx := utils.CreateSendCrossChainMessageTransaction(ctx, subnetAInfo, sendCrossChainMessageInput, fundedKey, teleporterContractAddress) log.Info("Sending Teleporter transaction on source chain", "destinationChainID", subnetBInfo.BlockchainID, "txHash", signedTx.Hash()) - receipt := utils.SendTransactionAndWaitForAcceptance(ctx, subnetAInfo.WSClient, signedTx) + receipt := utils.SendAndWaitForTransaction(ctx, signedTx, subnetAInfo.WSClient) - bind, err := teleportermessenger.NewTeleporterMessenger(teleporterContractAddress, subnetAInfo.WSClient) + teleporterMessengerA, err := teleportermessenger.NewTeleporterMessenger(teleporterContractAddress, subnetAInfo.WSClient) Expect(err).Should(BeNil()) - event, err := utils.GetEventFromLogs(receipt.Logs, bind.ParseSendCrossChainMessage) + event, err := utils.GetEventFromLogs(receipt.Logs, teleporterMessengerA.ParseSendCrossChainMessage) Expect(err).Should(BeNil()) Expect(event.DestinationChainID[:]).Should(Equal(subnetBInfo.BlockchainID[:])) @@ -60,22 +60,16 @@ func BasicOneWaySend() { // Relay the message to the destination // + // This is a nonsense message, so we don't check for successful execution of the teleporter message. utils.RelayMessage(ctx, receipt.BlockHash, receipt.BlockNumber, subnetAInfo, subnetBInfo) // // Check Teleporter message received on the destination // - data, err := teleportermessenger.PackMessageReceived(subnetAInfo.BlockchainID, teleporterMessageID) - Expect(err).Should(BeNil()) - callMessage := interfaces.CallMsg{ - To: &teleporterContractAddress, - Data: data, - } - result, err := subnetBInfo.WSClient.CallContract(context.Background(), callMessage, nil) - Expect(err).Should(BeNil()) - // check the contract call result - delivered, err := teleportermessenger.UnpackMessageReceivedResult(result) + teleporterMessengerB, err := teleportermessenger.NewTeleporterMessenger(teleporterContractAddress, subnetBInfo.WSClient) + Expect(err).Should(BeNil()) + success, err := teleporterMessengerB.MessageReceived(&bind.CallOpts{}, subnetAInfo.BlockchainID, teleporterMessageID) Expect(err).Should(BeNil()) - Expect(delivered).Should(BeTrue()) + Expect(success).Should(BeTrue()) } diff --git a/tests/erc20_to_native_token_bridge.go b/tests/erc20_to_native_token_bridge.go index 3e54c175a..26eed0600 100644 --- a/tests/erc20_to_native_token_bridge.go +++ b/tests/erc20_to_native_token_bridge.go @@ -3,10 +3,8 @@ package tests import ( "context" "crypto/ecdsa" - "fmt" "math/big" - "github.com/ava-labs/subnet-evm/accounts/abi" "github.com/ava-labs/subnet-evm/accounts/abi/bind" "github.com/ava-labs/subnet-evm/core/types" erc20tokensource "github.com/ava-labs/teleporter/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource" @@ -24,10 +22,9 @@ func ERC20ToNativeTokenBridge() { const ( initialReserveImbalance = uint64(1e15) valueToSend1 = initialReserveImbalance / 4 - valueToSend2 = initialReserveImbalance valueToReturn = valueToSend1 / 4 - // TODO use a unique deployer for each test file + // Each test file needs a unique deployer that must be funded with tokens to deploy deployerKeyStr = "ca7269c1fe2a5b86884a119aa516b8d5b641670b83aac0ebf9f2d71affcc12e4" ExampleERC20ByteCodeFile = "./contracts/out/ExampleERC20.sol/ExampleERC20.json" ERC20TokenSourceByteCodeFile = "./contracts/out/ERC20TokenSource.sol/ERC20TokenSource.json" @@ -59,22 +56,22 @@ func ERC20ToNativeTokenBridge() { log.Info("Example ERC20 Contract Address: " + exampleERC20ContractAddress.Hex()) // Deploy the contracts - // Both contracts in this test will be deployed to 0xAcB633F5B00099c7ec187eB00156c5cd9D854b5B, + // Both contracts in this test will be deployed to 0x3405506b3711859c5070949ed9b700c7ba7bf750, // though they do not necessarily have to be deployed at the same address, each contract needs // to know the address of the other. // The nativeTokenDestination contract must be added to "adminAddresses" of "contractNativeMinterConfig" // in the genesis file for the subnet. This will allow it to call the native minter precompile. erc20TokenSourceAbi, err := erc20tokensource.ERC20TokenSourceMetaData.GetAbi() Expect(err).Should(BeNil()) - DeployContract(ctx, ERC20TokenSourceByteCodeFile, deployerPK, subnetA, erc20TokenSourceAbi, teleporterContractAddress, subnetB.BlockchainID, bridgeContractAddress, exampleERC20ContractAddress) + utils.DeployContract(ctx, ERC20TokenSourceByteCodeFile, deployerPK, subnetA, erc20TokenSourceAbi, teleporterContractAddress, subnetB.BlockchainID, bridgeContractAddress, exampleERC20ContractAddress) nativeTokenDestinationAbi, err := nativetokendestination.NativeTokenDestinationMetaData.GetAbi() Expect(err).Should(BeNil()) - DeployContract(ctx, NativeTokenDestinationByteCodeFile, deployerPK, subnetB, nativeTokenDestinationAbi, teleporterContractAddress, subnetA.BlockchainID, bridgeContractAddress, new(big.Int).SetUint64(initialReserveImbalance)) + utils.DeployContract(ctx, NativeTokenDestinationByteCodeFile, deployerPK, subnetB, nativeTokenDestinationAbi, teleporterContractAddress, subnetA.BlockchainID, bridgeContractAddress, new(big.Int).SetUint64(initialReserveImbalance)) exampleERC20Abi, err := exampleerc20.ExampleERC20MetaData.GetAbi() Expect(err).Should(BeNil()) - DeployContract(ctx, ExampleERC20ByteCodeFile, deployerPK, subnetA, exampleERC20Abi) + utils.DeployContract(ctx, ExampleERC20ByteCodeFile, deployerPK, subnetA, exampleERC20Abi) log.Info("Finished deploying contracts") @@ -96,16 +93,22 @@ func ERC20ToNativeTokenBridge() { Expect(err).Should(BeNil()) log.Info("Sent TransferToSource transaction on destination chain", "sourceChainID", subnetA.BlockchainID, "txHash", tx.Hash().Hex()) - receipt := utils.WaitForTransaction(ctx, tx.Hash(), subnetB.WSClient) + sourceChainReceipt := utils.WaitForTransaction(ctx, tx.Hash(), subnetB.WSClient) + Expect(err).Should(BeNil()) + Expect(sourceChainReceipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + + transferEvent, err := utils.GetEventFromLogs(sourceChainReceipt.Logs, nativeTokenDestination.ParseTransferToSource) + Expect(err).Should(BeNil()) + Expect(transferEvent.Amount.Uint64()).Should(Equal(valueToSend)) + + receipt, err := utils.RelayMessage(ctx, sourceChainReceipt.BlockHash, sourceChainReceipt.BlockNumber, subnetB, subnetA) Expect(err).Should(BeNil()) - Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) - utils.RelayMessage(ctx, receipt.BlockHash, receipt.BlockNumber, subnetB, subnetA) return receipt } // Helper function - sendTokensToDestination := func(valueToSend uint64, fromKey *ecdsa.PrivateKey, toAddress common.Address) (*types.Receipt, *types.Receipt) { + sendTokensToDestination := func(valueToSend uint64, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, subnetA.ChainID) Expect(err).Should(BeNil()) @@ -117,8 +120,14 @@ func ERC20ToNativeTokenBridge() { Expect(err).Should(BeNil()) Expect(sourceChainReceipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) - destChainReceipt := utils.RelayMessage(ctx, sourceChainReceipt.BlockHash, sourceChainReceipt.BlockNumber, subnetA, subnetB) - return sourceChainReceipt, destChainReceipt + transferEvent, err := utils.GetEventFromLogs(sourceChainReceipt.Logs, erc20TokenSource.ParseTransferToDestination) + Expect(err).Should(BeNil()) + Expect(transferEvent.TransferAmount.Uint64()).Should(Equal(valueToSend)) + + receipt, err := utils.RelayMessage(ctx, sourceChainReceipt.BlockHash, sourceChainReceipt.BlockNumber, subnetA, subnetB) + Expect(err).Should(BeNil()) + + return receipt } { // Give erc20TokenSource allowance to spend all of the deployer's ERC20 Tokens @@ -138,100 +147,80 @@ func ERC20ToNativeTokenBridge() { { // Transfer some tokens A -> B // Check starting balance is 0 - bal, err := exampleERC20.BalanceOf(nil, tokenReceiverAddress) - Expect(err).Should(BeNil()) - Expect(bal.Uint64()).Should(BeZero()) + + utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) CheckReserveImbalance(initialReserveImbalance, nativeTokenDestination) - sourceChainReceipt, destChainReceipt := sendTokensToDestination(valueToSend1, deployerPK, tokenReceiverAddress) + destChainReceipt := sendTokensToDestination(valueToSend1, deployerPK, tokenReceiverAddress) + collateralEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseCollateralAdded) + Expect(err).Should(BeNil()) + Expect(collateralEvent.Amount.Uint64()).Should(Equal(valueToSend1)) - CheckReserveImbalance(initialReserveImbalance - valueToSend1, nativeTokenDestination) + _, err = utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseNativeTokensMinted) + Expect(err).ShouldNot(BeNil()) + + CheckReserveImbalance(initialReserveImbalance-valueToSend1, nativeTokenDestination) // Check intermediate balance, no tokens should be minted because we haven't collateralized - bal, err = subnetB.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) - Expect(err).Should(BeNil()) - Expect(bal.Uint64()).Should(BeZero()) + utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) } { // Fail to Transfer tokens B -> A because bridge is not collateralized // Check starting balance is 0 - bal, err := exampleERC20.BalanceOf(&bind.CallOpts{}, tokenReceiverAddress) - Expect(err).Should(BeNil()) - Expect(bal.Uint64()).Should(BeZero()) + utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetB.ChainID) Expect(err).Should(BeNil()) transactor.Value = new(big.Int).SetUint64(valueToSend1) - // This transfer should revert because the bridge isn't collateralized _, err = nativeTokenDestination.TransferToSource(transactor, tokenReceiverAddress, emptyDestFeeInfo, []common.Address{}) Expect(err).ShouldNot(BeNil()) - CheckReserveImbalance(initialReserveImbalance - valueToSend1, nativeTokenDestination) + CheckReserveImbalance(initialReserveImbalance-valueToSend1, nativeTokenDestination) - // Check we should fail to send because we're not collateralized - bal, err = exampleERC20.BalanceOf(&bind.CallOpts{}, tokenReceiverAddress) - Expect(err).Should(BeNil()) - Expect(bal.Uint64()).Should(BeZero()) + // Check we failed to send because we're not collateralized + utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) } { // Transfer more tokens A -> B to collateralize the bridge // Check starting balance is 0 - bal, err := subnetB.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) + utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) + + CheckReserveImbalance(initialReserveImbalance-valueToSend1, nativeTokenDestination) + + destChainReceipt := sendTokensToDestination(initialReserveImbalance, deployerPK, tokenReceiverAddress) + + collateralEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseCollateralAdded) Expect(err).Should(BeNil()) - Expect(bal.Uint64()).Should(BeZero()) + Expect(collateralEvent.Amount.Uint64()).Should(Equal(initialReserveImbalance - valueToSend1)) - sourceChainReceipt, destChainReceipt := sendTokensToDestination(valueToSend2, deployerPK, tokenReceiverAddress) + mintEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseNativeTokensMinted) + Expect(err).Should(BeNil()) + Expect(mintEvent.Amount.Uint64()).Should(Equal(valueToSend1)) CheckReserveImbalance(0, nativeTokenDestination) // We should have minted the excess coins after checking the collateral - bal, err = subnetB.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) - Expect(err).Should(BeNil()) - Expect(bal.Uint64()).Should(Equal(valueToSend1 + valueToSend2 - initialReserveImbalance)) + utils.CheckBalance(ctx, tokenReceiverAddress, valueToSend1, subnetB.WSClient) } { // Transfer tokens B -> A - sendTokensToSource(valueToReturn, deployerPK, tokenReceiverAddress) + sourceChainReceipt := sendTokensToSource(valueToReturn, deployerPK, tokenReceiverAddress) + + unlockEvent, err := utils.GetEventFromLogs(sourceChainReceipt.Logs, erc20TokenSource.ParseUnlockTokens) + Expect(err).Should(BeNil()) + Expect(unlockEvent.Amount.Uint64()).Should(Equal(valueToReturn)) - // Check we should fail to send because we're not collateralized bal, err := exampleERC20.BalanceOf(nil, tokenReceiverAddress) Expect(err).Should(BeNil()) Expect(bal.Uint64()).Should(Equal(valueToReturn)) } } -func DeployContract(ctx context.Context, byteCodeFileName string, deployerPK *ecdsa.PrivateKey, subnetInfo utils.SubnetTestInfo, abi *abi.ABI, constructorArgs ...interface{}) { - // Deploy an example ERC20 contract to be used as the source token - byteCode, err := deploymentUtils.ExtractByteCode(byteCodeFileName) - Expect(err).Should(BeNil()) - Expect(len(byteCode) > 0).Should(BeTrue()) - transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetInfo.ChainID) - Expect(err).Should(BeNil()) - contractAddress, tx, _, err := bind.DeployContract(transactor, *abi, byteCode, subnetInfo.WSClient, constructorArgs...) - Expect(err).Should(BeNil()) - - // Wait for transaction, then check code was deployed - utils.WaitForTransaction(ctx, tx.Hash(), subnetInfo.WSClient) - code, err := subnetInfo.WSClient.CodeAt(ctx, contractAddress, nil) - Expect(err).Should(BeNil()) - Expect(len(code)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode -} - func CheckReserveImbalance(value uint64, nativeTokenDestination *nativetokendestination.NativeTokenDestination) { imbalance, err := nativeTokenDestination.CurrentReserveImbalance(&bind.CallOpts{}) Expect(err).Should(BeNil()) Expect(imbalance.Uint64()).Should(Equal(value)) } - -func GetEventFromLogs[T any](logs []*types.Log, parser func(log types.Log) (T, error)) (T, error) { - for _, log := range logs { - event, err :=parser(*log) - if err == nil { - return event, nil - } - } - return *new(T), fmt.Errorf("failed to find SendCrossChainMessage event in receipt logs") -} diff --git a/tests/native_token_bridge.go b/tests/native_token_bridge.go index 19cd1b5a5..27920f04f 100644 --- a/tests/native_token_bridge.go +++ b/tests/native_token_bridge.go @@ -20,11 +20,10 @@ import ( func NativeTokenBridge() { const ( initialReserveImbalance = uint64(1e15) - valueToSend1 = initialReserveImbalance / 4 - valueToSend2 = initialReserveImbalance - valueToReturn = valueToSend1 / 4 + valueToSend = initialReserveImbalance / 4 + valueToReturn = valueToSend / 4 - // TODO use a unique deployer for each test file + // Each test file needs a unique deployer that must be funded with tokens to deploy deployerKeyStr = "aad7440febfc8f9d73a58c3cb1f1754779a566978f9ebffcd4f4698e9b043985" NativeTokenSourceByteCodeFile = "./contracts/out/NativeTokenSource.sol/NativeTokenSource.json" NativeTokenDestinationByteCodeFile = "./contracts/out/NativeTokenDestination.sol/NativeTokenDestination.json" @@ -63,12 +62,12 @@ func NativeTokenBridge() { // in the genesis file for the subnet. This will allow it to call the native minter precompile. erc20TokenSourceAbi, err := nativetokensource.NativeTokenSourceMetaData.GetAbi() Expect(err).Should(BeNil()) - DeployContract(ctx, NativeTokenSourceByteCodeFile, deployerPK, subnetA, erc20TokenSourceAbi, teleporterContractAddress, subnetB.BlockchainID, bridgeContractAddress) + utils.DeployContract(ctx, NativeTokenSourceByteCodeFile, deployerPK, subnetA, erc20TokenSourceAbi, teleporterContractAddress, subnetB.BlockchainID, bridgeContractAddress) Expect(err).Should(BeNil()) nativeTokenDestinationAbi, err := nativetokendestination.NativeTokenDestinationMetaData.GetAbi() Expect(err).Should(BeNil()) - DeployContract(ctx, NativeTokenDestinationByteCodeFile, deployerPK, subnetB, nativeTokenDestinationAbi, teleporterContractAddress, subnetA.BlockchainID, bridgeContractAddress, new(big.Int).SetUint64(initialReserveImbalance)) + utils.DeployContract(ctx, NativeTokenDestinationByteCodeFile, deployerPK, subnetB, nativeTokenDestinationAbi, teleporterContractAddress, subnetA.BlockchainID, bridgeContractAddress, new(big.Int).SetUint64(initialReserveImbalance)) log.Info("Finished deploying Bridge contracts") } @@ -89,11 +88,17 @@ func NativeTokenBridge() { Expect(err).Should(BeNil()) log.Info("Sent TransferToSource transaction on destination chain", "sourceChainID", subnetA.BlockchainID, "txHash", tx.Hash().Hex()) - receipt := utils.WaitForTransaction(ctx, tx.Hash(), subnetB.WSClient) + destChainReceipt := utils.WaitForTransaction(ctx, tx.Hash(), subnetB.WSClient) + Expect(err).Should(BeNil()) + Expect(destChainReceipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + + transferEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseTransferToSource) + Expect(err).Should(BeNil()) + Expect(transferEvent.Amount.Uint64()).Should(Equal(valueToSend)) + + receipt, err := utils.RelayMessage(ctx, destChainReceipt.BlockHash, destChainReceipt.BlockNumber, subnetB, subnetA) Expect(err).Should(BeNil()) - Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) - utils.RelayMessage(ctx, receipt.BlockHash, receipt.BlockNumber, subnetB, subnetA) return receipt } @@ -107,68 +112,86 @@ func NativeTokenBridge() { Expect(err).Should(BeNil()) log.Info("Sent TransferToDestination transaction on source chain", "destinationChainID", subnetB.BlockchainID, "txHash", tx.Hash().Hex()) - receipt := utils.WaitForTransaction(ctx, tx.Hash(), subnetA.WSClient) + sourceChainReceipt := utils.WaitForTransaction(ctx, tx.Hash(), subnetA.WSClient) + Expect(err).Should(BeNil()) + Expect(sourceChainReceipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + + transferEvent, err := utils.GetEventFromLogs(sourceChainReceipt.Logs, nativeTokenSource.ParseTransferToDestination) + Expect(err).Should(BeNil()) + Expect(transferEvent.Amount.Uint64()).Should(Equal(valueToSend)) + + receipt, err := utils.RelayMessage(ctx, sourceChainReceipt.BlockHash, sourceChainReceipt.BlockNumber, subnetA, subnetB) Expect(err).Should(BeNil()) - Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) - utils.RelayMessage(ctx, receipt.BlockHash, receipt.BlockNumber, subnetA, subnetB) return receipt } { // Transfer some tokens A -> B // Check starting balance is 0 - bal, err := subnetB.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) + utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) + + CheckReserveImbalance(initialReserveImbalance, nativeTokenDestination) + + destChainReceipt := sendTokensToDestination(valueToSend, deployerPK, tokenReceiverAddress) + + collateralEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseCollateralAdded) Expect(err).Should(BeNil()) - Expect(bal.Uint64()).Should(Equal(common.Big0.Uint64())) + Expect(collateralEvent.Amount.Uint64()).Should(Equal(valueToSend)) + + _, err = utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseNativeTokensMinted) + Expect(err).ShouldNot(BeNil()) - sendTokensToDestination(valueToSend1, deployerPK, tokenReceiverAddress) + CheckReserveImbalance(initialReserveImbalance - valueToSend, nativeTokenDestination) // Check intermediate balance, no tokens should be minted because we haven't collateralized - bal, err = subnetB.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) - Expect(err).Should(BeNil()) - Expect(bal.Uint64()).Should(BeZero()) + utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) } { // Fail to Transfer tokens B -> A because bridge is not collateralized // Check starting balance is 0 - bal, err := subnetA.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) - Expect(err).Should(BeNil()) - Expect(bal.Uint64()).Should(BeZero()) + utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetA.WSClient) transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetB.ChainID) Expect(err).Should(BeNil()) - transactor.Value = new(big.Int).SetUint64(valueToSend1) + transactor.Value = new(big.Int).SetUint64(valueToSend) // This transfer should revert because the bridge isn't collateralized _, err = nativeTokenDestination.TransferToSource(transactor, tokenReceiverAddress, emptyDestFeeInfo, []common.Address{}) Expect(err).ShouldNot(BeNil()) // Check we should fail to send because we're not collateralized - bal, err = subnetA.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) - Expect(err).Should(BeNil()) - Expect(bal.Uint64()).Should(BeZero()) + utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetA.WSClient) } { // Transfer more tokens A -> B to collateralize the bridge // Check starting balance is 0 - bal, err := subnetB.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) + utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) + + CheckReserveImbalance(initialReserveImbalance - valueToSend, nativeTokenDestination) + + destChainReceipt := sendTokensToDestination(initialReserveImbalance, deployerPK, tokenReceiverAddress) + + collateralEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseCollateralAdded) + Expect(err).Should(BeNil()) + Expect(collateralEvent.Amount.Uint64()).Should(Equal(initialReserveImbalance - valueToSend)) + + mintEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseNativeTokensMinted) Expect(err).Should(BeNil()) - Expect(bal.Uint64()).Should(BeZero()) + Expect(mintEvent.Amount.Uint64()).Should(Equal(valueToSend)) - sendTokensToDestination(valueToSend2, deployerPK, tokenReceiverAddress) + CheckReserveImbalance(0, nativeTokenDestination) // We should have minted the excess coins after checking the collateral - bal, err = subnetB.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) - Expect(err).Should(BeNil()) - Expect(bal.Uint64()).Should(Equal(valueToSend1 + valueToSend2 - initialReserveImbalance)) + utils.CheckBalance(ctx, tokenReceiverAddress, valueToSend, subnetB.WSClient) } { // Transfer tokens B -> A - sendTokensToSource(valueToReturn, deployerPK, tokenReceiverAddress) + sourceChainReceipt := sendTokensToSource(valueToReturn, deployerPK, tokenReceiverAddress) - // Check we should fail to send because we're not collateralized - bal, err := subnetA.WSClient.BalanceAt(ctx, tokenReceiverAddress, nil) + unlockEvent, err := utils.GetEventFromLogs(sourceChainReceipt.Logs, nativeTokenSource.ParseUnlockTokens) Expect(err).Should(BeNil()) - Expect(bal.Uint64()).Should(Equal(valueToReturn)) + Expect(unlockEvent.Amount.Uint64()).Should(Equal(valueToReturn)) + + utils.CheckBalance(ctx, tokenReceiverAddress, valueToReturn, subnetA.WSClient) } } diff --git a/tests/utils/network_setup.go b/tests/utils/network_setup.go index 39c2fa3bb..686e1962b 100644 --- a/tests/utils/network_setup.go +++ b/tests/utils/network_setup.go @@ -112,7 +112,7 @@ func SetupNetwork(warpGenesisFile string) { } f, err := os.CreateTemp(os.TempDir(), "config.json") Expect(err).Should(BeNil()) - _, err = f.Write([]byte(`{"warp-api-enabled": true}`)) + _, err = f.Write([]byte(`{"warp-api-enabled": true, "eth-apis":["eth","eth-filter","net","admin","web3","internal-eth","internal-blockchain","internal-transaction","internal-debug","internal-account","internal-personal","debug","debug-tracer","debug-file-tracer","debug-handler"]}`)) Expect(err).Should(BeNil()) warpChainConfigPath = f.Name() @@ -218,7 +218,7 @@ func DeployTeleporterContracts(transactionBytes []byte, deployerAddress common.A // Fund the deployer address { fundAmount := big.NewInt(0).Mul(big.NewInt(1e18), big.NewInt(10)) // 10eth - fundDeployerTx := createNativeTransferTransaction(ctx, subnetInfo, fundedAddress, fundedKey, deployerAddress, fundAmount) + fundDeployerTx := createNativeTransferTransaction(ctx, subnetInfo, fundedKey, deployerAddress, fundAmount) SendTransactionAndWaitForAcceptance(ctx, subnetInfo.WSClient, fundDeployerTx) } log.Info("Finished funding Teleporter deployer", "blockchainID", subnetInfo.BlockchainID.Hex()) diff --git a/tests/utils/utils.go b/tests/utils/utils.go index 7effcfdb1..9f71685c3 100644 --- a/tests/utils/utils.go +++ b/tests/utils/utils.go @@ -6,6 +6,7 @@ package utils import ( "context" "crypto/ecdsa" + "encoding/json" "fmt" "math/big" "strconv" @@ -14,19 +15,25 @@ import ( "github.com/ava-labs/avalanchego/ids" avalancheWarp "github.com/ava-labs/avalanchego/vms/platformvm/warp" + "github.com/ava-labs/subnet-evm/accounts/abi" + "github.com/ava-labs/subnet-evm/accounts/abi/bind" warpBackend "github.com/ava-labs/subnet-evm/warp" teleportermessenger "github.com/ava-labs/teleporter/abi-bindings/go/Teleporter/TeleporterMessenger" + deploymentUtils "github.com/ava-labs/teleporter/utils/deployment-utils" gasUtils "github.com/ava-labs/teleporter/utils/gas-utils" "github.com/ava-labs/subnet-evm/core/types" + "github.com/ava-labs/subnet-evm/eth/tracers" "github.com/ava-labs/subnet-evm/ethclient" "github.com/ava-labs/subnet-evm/interfaces" "github.com/ava-labs/subnet-evm/params" predicateutils "github.com/ava-labs/subnet-evm/predicate" + "github.com/ava-labs/subnet-evm/rpc" "github.com/ava-labs/subnet-evm/tests/utils" "github.com/ava-labs/subnet-evm/tests/utils/runner" "github.com/ava-labs/subnet-evm/x/warp" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/log" . "github.com/onsi/gomega" @@ -107,14 +114,13 @@ func CreateSendCrossChainMessageTransaction( ctx context.Context, source SubnetTestInfo, input teleportermessenger.TeleporterMessageInput, - fundedAddress common.Address, - fundedKey *ecdsa.PrivateKey, + relayerKey *ecdsa.PrivateKey, teleporterContractAddress common.Address, ) *types.Transaction { data, err := teleportermessenger.PackSendCrossChainMessage(input) Expect(err).Should(BeNil()) - gasFeeCap, gasTipCap, nonce := calculateTxParams(ctx, source.WSClient, fundedAddress) + gasFeeCap, gasTipCap, nonce := calculateTxParams(ctx, source.WSClient, PrivateKeyToAddress(relayerKey)) // Send a transaction to the Teleporter contract tx := types.NewTx(&types.DynamicFeeTx{ @@ -128,7 +134,7 @@ func CreateSendCrossChainMessageTransaction( Data: data, }) - return signTransaction(tx, fundedKey, source.ChainID) + return signTransaction(tx, relayerKey, source.ChainID) } // Constructs a transaction to call receiveCrossChainMessage @@ -138,8 +144,7 @@ func CreateReceiveCrossChainMessageTransaction( warpMessageBytes []byte, requiredGasLimit *big.Int, teleporterContractAddress common.Address, - fundedAddress common.Address, - fundedKey *ecdsa.PrivateKey, + relayerKey *ecdsa.PrivateKey, wsClient ethclient.Client, chainID *big.Int, ) *types.Transaction { @@ -154,10 +159,10 @@ func CreateReceiveCrossChainMessageTransaction( gasLimit, err := gasUtils.CalculateReceiveMessageGasLimit(numSigners, requiredGasLimit) Expect(err).Should(BeNil()) - callData, err := teleportermessenger.PackReceiveCrossChainMessage(0, fundedAddress) + callData, err := teleportermessenger.PackReceiveCrossChainMessage(0, PrivateKeyToAddress(relayerKey)) Expect(err).Should(BeNil()) - gasFeeCap, gasTipCap, nonce := calculateTxParams(ctx, wsClient, fundedAddress) + gasFeeCap, gasTipCap, nonce := calculateTxParams(ctx, wsClient, PrivateKeyToAddress(relayerKey)) destinationTx := predicateutils.NewPredicateTx( chainID, @@ -217,8 +222,15 @@ func WaitForAllValidatorsToAcceptBlock(ctx context.Context, nodeURIs []string, b } } +func SendAndWaitForTransaction(ctx context.Context, tx *types.Transaction, client ethclient.Client) *types.Receipt { + err := client.SendTransaction(ctx, tx) + Expect(err).Should(BeNil()) + + return WaitForTransaction(ctx, tx.Hash(), client) +} + func WaitForTransaction(ctx context.Context, txHash common.Hash, client ethclient.Client) *types.Receipt { - cctx, cancel := context.WithTimeout(ctx, 10*time.Second) + cctx, cancel := context.WithTimeout(ctx, 20 * time.Second) defer cancel() // Loop until we find the transaction or time out @@ -227,21 +239,23 @@ func WaitForTransaction(ctx context.Context, txHash common.Hash, client ethclien if err == nil { return receipt } else { + Expect(err).ShouldNot(Equal(context.DeadlineExceeded)) log.Info("Waiting for transaction", "hash", txHash.Hex()) - time.Sleep(200 * time.Millisecond) + time.Sleep(500 * time.Millisecond) } } } // Constructs the aggregate signature, packs the Teleporter message, and relays to the destination -// Returns the receipt on the destination chain +// Returns the receipt on the destination chain, and an error if the teleporter message failed to execute. func RelayMessage( ctx context.Context, sourceBlockHash common.Hash, sourceBlockNumber *big.Int, source SubnetTestInfo, destination SubnetTestInfo, -) *types.Receipt { +) (*types.Receipt, error) { + log.Info("Fetching relevant warp logs from the newly produced block") logs, err := source.WSClient.FilterLogs(ctx, interfaces.FilterQuery{ BlockHash: &sourceBlockHash, @@ -278,24 +292,27 @@ func RelayMessage( signedTx := CreateReceiveCrossChainMessageTransaction( ctx, signedWarpMessageBytes, - big.NewInt(1), + big.NewInt(200000), teleporterContractAddress, - fundedAddress, fundedKey, destination.WSClient, destination.ChainID, ) log.Info("Sending transaction to destination chain") - receipt := SendTransactionAndWaitForAcceptance(ctx, destination.WSClient, signedTx) + receipt := SendAndWaitForTransaction(ctx, signedTx, destination.WSClient) bind, err := teleportermessenger.NewTeleporterMessenger(teleporterContractAddress, source.WSClient) Expect(err).Should(BeNil()) // Check the transaction logs for the ReceiveCrossChainMessage event emitted by the Teleporter contract - event, err := GetEventFromLogs(receipt.Logs, bind.ParseReceiveCrossChainMessage) + receiveEvent, err := GetEventFromLogs(receipt.Logs, bind.ParseReceiveCrossChainMessage) Expect(err).Should(BeNil()) - Expect(event.OriginChainID[:]).Should(Equal(source.BlockchainID[:])) - return receipt + Expect(receiveEvent.OriginChainID[:]).Should(Equal(source.BlockchainID[:])) + + // Check for a successful execution of the teleporter message. + _, err = GetEventFromLogs(receipt.Logs, bind.ParseMessageExecuted) + + return receipt, err } // Returns the first log in 'logs' that is successfully parsed by 'parser' @@ -322,15 +339,15 @@ func signTransaction(tx *types.Transaction, key *ecdsa.PrivateKey, chainID *big. return signedTx } -// Returns the gasFeeCap, gasTipCap, and nonce the be used when constructing a transaction from fundedAddress -func calculateTxParams(ctx context.Context, wsClient ethclient.Client, fundedAddress common.Address) (*big.Int, *big.Int, uint64) { +// Returns the gasFeeCap, gasTipCap, and nonce the be used when constructing a transaction +func calculateTxParams(ctx context.Context, wsClient ethclient.Client, sender common.Address) (*big.Int, *big.Int, uint64) { baseFee, err := wsClient.EstimateBaseFee(ctx) Expect(err).Should(BeNil()) gasTipCap, err := wsClient.SuggestGasTipCap(ctx) Expect(err).Should(BeNil()) - nonce, err := wsClient.NonceAt(ctx, fundedAddress, nil) + nonce, err := wsClient.NonceAt(ctx, sender, nil) Expect(err).Should(BeNil()) gasFeeCap := baseFee.Mul(baseFee, big.NewInt(2)) @@ -342,12 +359,11 @@ func calculateTxParams(ctx context.Context, wsClient ethclient.Client, fundedAdd func createNativeTransferTransaction( ctx context.Context, network SubnetTestInfo, - fromAddress common.Address, - fromKey *ecdsa.PrivateKey, + senderKey *ecdsa.PrivateKey, recipient common.Address, amount *big.Int, ) *types.Transaction { - gasFeeCap, gasTipCap, nonce := calculateTxParams(ctx, network.WSClient, fundedAddress) + gasFeeCap, gasTipCap, nonce := calculateTxParams(ctx, network.WSClient, PrivateKeyToAddress(senderKey)) tx := types.NewTx(&types.DynamicFeeTx{ ChainID: network.ChainID, @@ -359,5 +375,51 @@ func createNativeTransferTransaction( Value: amount, }) - return signTransaction(tx, fundedKey, network.ChainID) + return signTransaction(tx, senderKey, network.ChainID) +} + +func PrivateKeyToAddress(k *ecdsa.PrivateKey) common.Address { + return crypto.PubkeyToAddress(k.PublicKey) +} + +// Throws a Gomega error if there is a mismatch +func CheckBalance(ctx context.Context, addr common.Address, expectedBalance uint64, wsClient ethclient.Client) { + bal, err :=wsClient.BalanceAt(ctx, addr, nil) + Expect(err).Should(BeNil()) + Expect(bal.Uint64()).Should(Equal(expectedBalance)) +} + +func TraceTransaction(ctx context.Context, txHash common.Hash, subnetInfo SubnetTestInfo) string { + url := HttpToRPCURI(subnetInfo.NodeURIs[0], subnetInfo.BlockchainID.String()) + rpcClient, err := rpc.DialContext(ctx, url) + Expect(err).Should(BeNil()) + defer rpcClient.Close() + + var result interface{} + ct := "callTracer" + err = rpcClient.Call(&result, "debug_traceTransaction", txHash.String(), tracers.TraceConfig{Tracer: &ct}) + Expect(err).Should(BeNil()) + + jsonStr, err := json.Marshal(result) + Expect(err).Should(BeNil()) + + return string(jsonStr) +} + +func DeployContract(ctx context.Context, byteCodeFileName string, deployerPK *ecdsa.PrivateKey, subnetInfo SubnetTestInfo, abi *abi.ABI, constructorArgs ...interface{}) { + // Deploy an example ERC20 contract to be used as the source token + byteCode, err := deploymentUtils.ExtractByteCode(byteCodeFileName) + Expect(err).Should(BeNil()) + Expect(len(byteCode) > 0).Should(BeTrue()) + transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetInfo.ChainID) + Expect(err).Should(BeNil()) + contractAddress, tx, _, err := bind.DeployContract(transactor, *abi, byteCode, subnetInfo.WSClient, constructorArgs...) + Expect(err).Should(BeNil()) + + // Wait for transaction, then check code was deployed + receipt := WaitForTransaction(ctx, tx.Hash(), subnetInfo.WSClient) + Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + code, err := subnetInfo.WSClient.CodeAt(ctx, contractAddress, nil) + Expect(err).Should(BeNil()) + Expect(len(code)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode } diff --git a/tests/utils/warp-genesis.json b/tests/utils/warp-genesis.json index 7c074e807..012b048fc 100644 --- a/tests/utils/warp-genesis.json +++ b/tests/utils/warp-genesis.json @@ -29,7 +29,8 @@ "contractNativeMinterConfig": { "blockTimestamp": 0, "adminAddresses": [ - "0xAcB633F5B00099c7ec187eB00156c5cd9D854b5B" + "0xAcB633F5B00099c7ec187eB00156c5cd9D854b5B", + "0x3405506b3711859c5070949ed9b700c7ba7bf750" ] } }, From 0004f59070c869570fc5e1402369829c6b383ca7 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Wed, 15 Nov 2023 09:48:05 -0500 Subject: [PATCH 102/183] Add contracts/pkg to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index fc932e387..e4adba139 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,7 @@ UniversalTeleporterMessengerContractAddress.txt # miscellaneous .idea/ +contracts/pkg # Generated template files docker-compose-test-local.yml From 19c921e260634e6d0fe445420ff701f349bf55e4 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Wed, 15 Nov 2023 11:53:48 -0500 Subject: [PATCH 103/183] Test cleanup --- .../NativeTokenBridge/ERC20TokenSource.sol | 2 +- .../NativeTokenDestination.sol | 2 +- .../NativeTokenBridge/NativeTokenSource.sol | 2 +- tests/erc20_to_native_token_bridge.go | 35 ++++++----- tests/native_token_bridge.go | 59 ++++++++++--------- tests/utils/utils.go | 8 ++- 6 files changed, 59 insertions(+), 49 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol index bbbc41114..ec94e6631 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol @@ -19,7 +19,7 @@ contract ERC20TokenSource is IERC20TokenSource, ReentrancyGuard { - uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 150_000; // TODO this is a placeholder + uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 100_000; bytes32 public immutable destinationBlockchainID; address public immutable nativeTokenDestinationAddress; address public immutable erc20ContractAddress; diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index aba615391..2a2100594 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -34,7 +34,7 @@ contract NativeTokenDestination is INativeMinter private immutable _nativeMinter = INativeMinter(0x0200000000000000000000000000000000000001); - uint256 public constant TRANSFER_NATIVE_TOKENS_REQUIRED_GAS = 150_000; // TODO this is a placeholder + uint256 public constant TRANSFER_NATIVE_TOKENS_REQUIRED_GAS = 100_000; bytes32 public immutable sourceBlockchainID; address public immutable nativeTokenSourceAddress; // The first `initialReserveImbalance` tokens sent to this subnet will not be minted. diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index d1e799191..f04fccec2 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -20,7 +20,7 @@ contract NativeTokenSource is INativeTokenSource, ReentrancyGuard { - uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 150_000; // TODO this is a placeholder + uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 100_000; bytes32 public immutable destinationBlockchainID; address public immutable nativeTokenDestinationAddress; diff --git a/tests/erc20_to_native_token_bridge.go b/tests/erc20_to_native_token_bridge.go index 26eed0600..eb074d6a0 100644 --- a/tests/erc20_to_native_token_bridge.go +++ b/tests/erc20_to_native_token_bridge.go @@ -93,9 +93,7 @@ func ERC20ToNativeTokenBridge() { Expect(err).Should(BeNil()) log.Info("Sent TransferToSource transaction on destination chain", "sourceChainID", subnetA.BlockchainID, "txHash", tx.Hash().Hex()) - sourceChainReceipt := utils.WaitForTransaction(ctx, tx.Hash(), subnetB.WSClient) - Expect(err).Should(BeNil()) - Expect(sourceChainReceipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + sourceChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetB.WSClient) transferEvent, err := utils.GetEventFromLogs(sourceChainReceipt.Logs, nativeTokenDestination.ParseTransferToSource) Expect(err).Should(BeNil()) @@ -116,9 +114,7 @@ func ERC20ToNativeTokenBridge() { Expect(err).Should(BeNil()) log.Info("Sent TransferToDestination transaction on source chain", "destinationChainID", subnetB.BlockchainID, "txHash", tx.Hash().Hex()) - sourceChainReceipt := utils.WaitForTransaction(ctx, tx.Hash(), subnetA.WSClient) - Expect(err).Should(BeNil()) - Expect(sourceChainReceipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + sourceChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetA.WSClient) transferEvent, err := utils.GetEventFromLogs(sourceChainReceipt.Logs, erc20TokenSource.ParseTransferToDestination) Expect(err).Should(BeNil()) @@ -140,9 +136,7 @@ func ERC20ToNativeTokenBridge() { tx, err := exampleERC20.Approve(transactor, bridgeContractAddress, bal) Expect(err).Should(BeNil()) - receipt := utils.WaitForTransaction(ctx, tx.Hash(), subnetA.WSClient) - Expect(err).Should(BeNil()) - Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetA.WSClient) } { // Transfer some tokens A -> B @@ -150,7 +144,7 @@ func ERC20ToNativeTokenBridge() { utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) - CheckReserveImbalance(initialReserveImbalance, nativeTokenDestination) + checkReserveImbalance(initialReserveImbalance, nativeTokenDestination) destChainReceipt := sendTokensToDestination(valueToSend1, deployerPK, tokenReceiverAddress) @@ -161,7 +155,7 @@ func ERC20ToNativeTokenBridge() { _, err = utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseNativeTokensMinted) Expect(err).ShouldNot(BeNil()) - CheckReserveImbalance(initialReserveImbalance-valueToSend1, nativeTokenDestination) + checkReserveImbalance(initialReserveImbalance-valueToSend1, nativeTokenDestination) // Check intermediate balance, no tokens should be minted because we haven't collateralized utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) @@ -178,7 +172,7 @@ func ERC20ToNativeTokenBridge() { _, err = nativeTokenDestination.TransferToSource(transactor, tokenReceiverAddress, emptyDestFeeInfo, []common.Address{}) Expect(err).ShouldNot(BeNil()) - CheckReserveImbalance(initialReserveImbalance-valueToSend1, nativeTokenDestination) + checkReserveImbalance(initialReserveImbalance-valueToSend1, nativeTokenDestination) // Check we failed to send because we're not collateralized utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) @@ -188,7 +182,7 @@ func ERC20ToNativeTokenBridge() { // Check starting balance is 0 utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) - CheckReserveImbalance(initialReserveImbalance-valueToSend1, nativeTokenDestination) + checkReserveImbalance(initialReserveImbalance-valueToSend1, nativeTokenDestination) destChainReceipt := sendTokensToDestination(initialReserveImbalance, deployerPK, tokenReceiverAddress) @@ -200,7 +194,7 @@ func ERC20ToNativeTokenBridge() { Expect(err).Should(BeNil()) Expect(mintEvent.Amount.Uint64()).Should(Equal(valueToSend1)) - CheckReserveImbalance(0, nativeTokenDestination) + checkReserveImbalance(0, nativeTokenDestination) // We should have minted the excess coins after checking the collateral utils.CheckBalance(ctx, tokenReceiverAddress, valueToSend1, subnetB.WSClient) @@ -209,9 +203,7 @@ func ERC20ToNativeTokenBridge() { { // Transfer tokens B -> A sourceChainReceipt := sendTokensToSource(valueToReturn, deployerPK, tokenReceiverAddress) - unlockEvent, err := utils.GetEventFromLogs(sourceChainReceipt.Logs, erc20TokenSource.ParseUnlockTokens) - Expect(err).Should(BeNil()) - Expect(unlockEvent.Amount.Uint64()).Should(Equal(valueToReturn)) + checkUnlockERC20Event(sourceChainReceipt.Logs, erc20TokenSource, tokenReceiverAddress, valueToReturn) bal, err := exampleERC20.BalanceOf(nil, tokenReceiverAddress) Expect(err).Should(BeNil()) @@ -219,8 +211,15 @@ func ERC20ToNativeTokenBridge() { } } -func CheckReserveImbalance(value uint64, nativeTokenDestination *nativetokendestination.NativeTokenDestination) { +func checkReserveImbalance(value uint64, nativeTokenDestination *nativetokendestination.NativeTokenDestination) { imbalance, err := nativeTokenDestination.CurrentReserveImbalance(&bind.CallOpts{}) Expect(err).Should(BeNil()) Expect(imbalance.Uint64()).Should(Equal(value)) } + +func checkUnlockERC20Event(logs []*types.Log, erc20TokenSource *erc20tokensource.ERC20TokenSource, recipient common.Address, value uint64) { + unlockEvent, err := utils.GetEventFromLogs(logs, erc20TokenSource.ParseUnlockTokens) + Expect(err).Should(BeNil()) + Expect(unlockEvent.Recipient).Should(Equal(recipient)) + Expect(unlockEvent.Amount.Uint64()).Should(Equal(value)) +} diff --git a/tests/native_token_bridge.go b/tests/native_token_bridge.go index 27920f04f..ba7ae4763 100644 --- a/tests/native_token_bridge.go +++ b/tests/native_token_bridge.go @@ -20,7 +20,7 @@ import ( func NativeTokenBridge() { const ( initialReserveImbalance = uint64(1e15) - valueToSend = initialReserveImbalance / 4 + valueToSend = initialReserveImbalance / 4 valueToReturn = valueToSend / 4 // Each test file needs a unique deployer that must be funded with tokens to deploy @@ -88,9 +88,7 @@ func NativeTokenBridge() { Expect(err).Should(BeNil()) log.Info("Sent TransferToSource transaction on destination chain", "sourceChainID", subnetA.BlockchainID, "txHash", tx.Hash().Hex()) - destChainReceipt := utils.WaitForTransaction(ctx, tx.Hash(), subnetB.WSClient) - Expect(err).Should(BeNil()) - Expect(destChainReceipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + destChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetB.WSClient) transferEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseTransferToSource) Expect(err).Should(BeNil()) @@ -112,9 +110,7 @@ func NativeTokenBridge() { Expect(err).Should(BeNil()) log.Info("Sent TransferToDestination transaction on source chain", "destinationChainID", subnetB.BlockchainID, "txHash", tx.Hash().Hex()) - sourceChainReceipt := utils.WaitForTransaction(ctx, tx.Hash(), subnetA.WSClient) - Expect(err).Should(BeNil()) - Expect(sourceChainReceipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + sourceChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetA.WSClient) transferEvent, err := utils.GetEventFromLogs(sourceChainReceipt.Logs, nativeTokenSource.ParseTransferToDestination) Expect(err).Should(BeNil()) @@ -130,19 +126,16 @@ func NativeTokenBridge() { // Check starting balance is 0 utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) - CheckReserveImbalance(initialReserveImbalance, nativeTokenDestination) + checkReserveImbalance(initialReserveImbalance, nativeTokenDestination) destChainReceipt := sendTokensToDestination(valueToSend, deployerPK, tokenReceiverAddress) - collateralEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseCollateralAdded) - Expect(err).Should(BeNil()) - Expect(collateralEvent.Amount.Uint64()).Should(Equal(valueToSend)) + checkCollateralEvent(destChainReceipt.Logs, nativeTokenDestination, valueToSend, initialReserveImbalance - valueToSend) + checkReserveImbalance(initialReserveImbalance-valueToSend, nativeTokenDestination) _, err = utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseNativeTokensMinted) Expect(err).ShouldNot(BeNil()) - CheckReserveImbalance(initialReserveImbalance - valueToSend, nativeTokenDestination) - // Check intermediate balance, no tokens should be minted because we haven't collateralized utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) } @@ -166,20 +159,13 @@ func NativeTokenBridge() { { // Transfer more tokens A -> B to collateralize the bridge // Check starting balance is 0 utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) - - CheckReserveImbalance(initialReserveImbalance - valueToSend, nativeTokenDestination) + checkReserveImbalance(initialReserveImbalance-valueToSend, nativeTokenDestination) destChainReceipt := sendTokensToDestination(initialReserveImbalance, deployerPK, tokenReceiverAddress) - collateralEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseCollateralAdded) - Expect(err).Should(BeNil()) - Expect(collateralEvent.Amount.Uint64()).Should(Equal(initialReserveImbalance - valueToSend)) - - mintEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseNativeTokensMinted) - Expect(err).Should(BeNil()) - Expect(mintEvent.Amount.Uint64()).Should(Equal(valueToSend)) - - CheckReserveImbalance(0, nativeTokenDestination) + checkCollateralEvent(destChainReceipt.Logs, nativeTokenDestination, initialReserveImbalance-valueToSend, 0) + checkMintEvent(destChainReceipt.Logs, nativeTokenDestination, tokenReceiverAddress, valueToSend) + checkReserveImbalance(0, nativeTokenDestination) // We should have minted the excess coins after checking the collateral utils.CheckBalance(ctx, tokenReceiverAddress, valueToSend, subnetB.WSClient) @@ -188,10 +174,29 @@ func NativeTokenBridge() { { // Transfer tokens B -> A sourceChainReceipt := sendTokensToSource(valueToReturn, deployerPK, tokenReceiverAddress) - unlockEvent, err := utils.GetEventFromLogs(sourceChainReceipt.Logs, nativeTokenSource.ParseUnlockTokens) - Expect(err).Should(BeNil()) - Expect(unlockEvent.Amount.Uint64()).Should(Equal(valueToReturn)) + checkUnlockNativeEvent(sourceChainReceipt.Logs, nativeTokenSource, tokenReceiverAddress, valueToReturn) utils.CheckBalance(ctx, tokenReceiverAddress, valueToReturn, subnetA.WSClient) } } + +func checkUnlockNativeEvent(logs []*types.Log, nativeTokenSource *nativetokensource.NativeTokenSource, recipient common.Address, value uint64) { + unlockEvent, err := utils.GetEventFromLogs(logs, nativeTokenSource.ParseUnlockTokens) + Expect(err).Should(BeNil()) + Expect(unlockEvent.Recipient).Should(Equal(recipient)) + Expect(unlockEvent.Amount.Uint64()).Should(Equal(value)) +} + +func checkCollateralEvent(logs []*types.Log, nativeTokenDestination *nativetokendestination.NativeTokenDestination, collateralAdded uint64, collateralRemaining uint64) { + collateralEvent, err := utils.GetEventFromLogs(logs, nativeTokenDestination.ParseCollateralAdded) + Expect(err).Should(BeNil()) + Expect(collateralEvent.Amount.Uint64()).Should(Equal(collateralAdded)) + Expect(collateralEvent.Remaining.Uint64()).Should(Equal(collateralRemaining)) +} + +func checkMintEvent(logs []*types.Log, nativeTokenDestination *nativetokendestination.NativeTokenDestination, recipient common.Address, value uint64) { + mintEvent, err := utils.GetEventFromLogs(logs, nativeTokenDestination.ParseNativeTokensMinted) + Expect(err).Should(BeNil()) + Expect(mintEvent.Recipient).Should(Equal(recipient)) + Expect(mintEvent.Amount.Uint64()).Should(Equal(value)) +} diff --git a/tests/utils/utils.go b/tests/utils/utils.go index 9f71685c3..5adbe26c0 100644 --- a/tests/utils/utils.go +++ b/tests/utils/utils.go @@ -229,6 +229,12 @@ func SendAndWaitForTransaction(ctx context.Context, tx *types.Transaction, clien return WaitForTransaction(ctx, tx.Hash(), client) } +func WaitForTransactionSuccess(ctx context.Context, txHash common.Hash, client ethclient.Client) *types.Receipt { + receipt := WaitForTransaction(ctx, txHash, client) + Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + return receipt +} + func WaitForTransaction(ctx context.Context, txHash common.Hash, client ethclient.Client) *types.Receipt { cctx, cancel := context.WithTimeout(ctx, 20 * time.Second) defer cancel() @@ -292,7 +298,7 @@ func RelayMessage( signedTx := CreateReceiveCrossChainMessageTransaction( ctx, signedWarpMessageBytes, - big.NewInt(200000), + big.NewInt(1), teleporterContractAddress, fundedKey, destination.WSClient, From 5b28388a690a593ff3aa15e1724956ae523235d7 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Wed, 15 Nov 2023 12:19:04 -0500 Subject: [PATCH 104/183] Remove duplicate lines --- scripts/abi_bindings.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/scripts/abi_bindings.sh b/scripts/abi_bindings.sh index 557830df1..477e9e17a 100755 --- a/scripts/abi_bindings.sh +++ b/scripts/abi_bindings.sh @@ -14,11 +14,6 @@ source $TELEPORTER_PATH/scripts/utils.sh setARCH -source $TELEPORTER_PATH/scripts/constants.sh -source $TELEPORTER_PATH/scripts/utils.sh - -setARCH - DEFAULT_CONTRACT_LIST="TeleporterMessenger ERC20Bridge ExampleCrossChainMessenger BlockHashPublisher BlockHashReceiver BridgeToken TeleporterRegistry NativeTokenSource NativeTokenDestination ERC20TokenSource ExampleERC20" CONTRACT_LIST= From 16c5d3300bf16d2c9119924f45c0dead5ade7ed1 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Thu, 16 Nov 2023 12:34:29 -0500 Subject: [PATCH 105/183] Update contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol Co-authored-by: minghinmatthewlam Signed-off-by: Geoff Stuart --- .../NativeTokenBridge/NativeTokenDestination.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index 2a2100594..2f07f5548 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -14,7 +14,7 @@ import {ITeleporterReceiver} from "../../Teleporter/ITeleporterReceiver.sol"; import {SafeERC20TransferFrom} from "../../Teleporter/SafeERC20TransferFrom.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; -// We need IAllowList is an indirect dependency in order to compile. +// We need IAllowList as an indirect dependency in order to compile. // solhint-disable-next-line import {IAllowList} from "@subnet-evm-contracts/interfaces/IAllowList.sol"; From 44226320e77667a9207089831d7b42d4a55fd78d Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Thu, 16 Nov 2023 12:36:46 -0500 Subject: [PATCH 106/183] Update contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol Co-authored-by: minghinmatthewlam Signed-off-by: Geoff Stuart --- .../NativeTokenBridge/INativeTokenSource.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol index c7fb8c41c..c0702e799 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol @@ -13,7 +13,7 @@ import {TeleporterFeeInfo} from "../../Teleporter/ITeleporterMessenger.sol"; */ interface INativeTokenSource { /** - * @dev Emitted when tokens are locked in the source contract to be transferred to the destination chain. + * @dev Emitted when native tokens are locked in the source contract to be transferred to the destination chain. */ event TransferToDestination( address indexed sender, From 526231df3dad91baabf96d5305412046ce24dfa2 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Thu, 16 Nov 2023 12:37:15 -0500 Subject: [PATCH 107/183] Update contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol Co-authored-by: minghinmatthewlam Signed-off-by: Geoff Stuart --- .../NativeTokenBridge/INativeTokenSource.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol index c0702e799..e79df4a94 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol @@ -8,7 +8,7 @@ pragma solidity 0.8.18; import {TeleporterFeeInfo} from "../../Teleporter/ITeleporterMessenger.sol"; /** - * @dev Interface that describes functionalities for a contract that will lock tokens and send a + * @dev Interface that describes functionalities for a contract that will lock native tokens on the source chain and send a * Teleporter message to a {INativeTokenDestination} contract to mint native tokens on the destination chain. */ interface INativeTokenSource { From 1caf6786d2dd2eeec0ce4423e4582f1dbbf00cbf Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Thu, 16 Nov 2023 12:37:32 -0500 Subject: [PATCH 108/183] Update contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol Co-authored-by: minghinmatthewlam Signed-off-by: Geoff Stuart --- .../NativeTokenBridge/IERC20TokenSource.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol index 44aa4f911..851b97b0b 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol @@ -11,7 +11,7 @@ pragma solidity 0.8.18; */ interface IERC20TokenSource { /** - * @dev Emitted when ERC20 tokens are locked in this bridge contract to be bridged to the destination chain. + * @dev Emitted when ERC20 tokens are locked in this source contract to be transferred to the destination chain. */ event TransferToDestination( address indexed sender, From 0bbb1b7ba43006ab451a0f50f4a3cd725f7319cf Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Thu, 16 Nov 2023 12:37:41 -0500 Subject: [PATCH 109/183] Update contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol Co-authored-by: minghinmatthewlam Signed-off-by: Geoff Stuart --- .../NativeTokenBridge/IERC20TokenSource.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol index 851b97b0b..591184ca0 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol @@ -7,7 +7,7 @@ pragma solidity 0.8.18; /** * @dev Interface that describes functionalities for a contract that will lock ERC20 tokens and send a - * Teleporter message to a NativeTokenDestination contract to mint native tokens on that chain. + * Teleporter message to a {INativeTokenDestination} contract to mint native tokens on that chain. */ interface IERC20TokenSource { /** From b9fea48acc89010ac7cb5e0ca80d01f528dccc8b Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Thu, 16 Nov 2023 12:38:07 -0500 Subject: [PATCH 110/183] Update contracts/src/CrossChainApplications/NativeTokenBridge/README.md Co-authored-by: cam-schultz <78878559+cam-schultz@users.noreply.github.com> Signed-off-by: Geoff Stuart --- .../src/CrossChainApplications/NativeTokenBridge/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/README.md b/contracts/src/CrossChainApplications/NativeTokenBridge/README.md index c363f44a1..8d31a5589 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/README.md +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/README.md @@ -10,7 +10,7 @@ The native-to-native bridge is implemented using two primary contracts. - `transferToDestination`: transfers all tokens payed to this function call to `recipient` on the destination chain by locking them and instructing the destination chain to mint. Optionally takes the address of an ERC20 contract `feeContractAddress` as well as an amount `feeAmount` that will be used as the relayer-incentivisation for the teleporter cross-chain call. Also allows for the caller to specify `allowedRelayerAddresses`. - `receiveTeleporterMessage`: unlocks tokens on the source chain when instructed to by the `NativeTokenDestination` contract. - `NativeTokenDestination` - - Lives on the `Destination chain`. Pairs with exactly one `NativeTokenSource` contract on a different chain. + - Lives on the Destination chain. Pairs with exactly one `NativeTokenSource` contract on a different chain. - Mints and burns native tokens on the Destination chain corresponding to locks and unlocks on the source chain. - `transferToSource`: transfers all tokens payed to this function call to `recipient` on the source chain by burning the tokens and instructing the source chain to unlock. Optionally takes the address of an ERC20 contract `feeContractAddress` as well as an amount `feeAmount` that will be used as the relayer-incentivisation for the teleporter cross-chain call. Also allows for the caller to specify `allowedRelayerAddresses`. - `receiveTeleporterMessage`: mints tokens on the destination chain when instructed to by the `NativeTokenDestination` contract. From 6346cca200b1c452fbf1cbf63ea7e460e582626e Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Thu, 16 Nov 2023 12:38:55 -0500 Subject: [PATCH 111/183] Update contracts/src/CrossChainApplications/NativeTokenBridge/README.md Co-authored-by: cam-schultz <78878559+cam-schultz@users.noreply.github.com> Signed-off-by: Geoff Stuart --- .../src/CrossChainApplications/NativeTokenBridge/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/README.md b/contracts/src/CrossChainApplications/NativeTokenBridge/README.md index 8d31a5589..c42b16563 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/README.md +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/README.md @@ -5,7 +5,7 @@ A pair of smart contracts built on top of Teleporter to support using an ERC20 t ## Design The native-to-native bridge is implemented using two primary contracts. - `NativeTokenSource` - - Lives on the `Source chain`. Pairs with exactly one `NativeTokenDestination` contract on a different chain. + - Lives on the Source chain. Pairs with exactly one `NativeTokenDestination` contract on a different chain. - Locks and unlocks native tokens on the Source chain corresponding to mints and burns on the destination chain. - `transferToDestination`: transfers all tokens payed to this function call to `recipient` on the destination chain by locking them and instructing the destination chain to mint. Optionally takes the address of an ERC20 contract `feeContractAddress` as well as an amount `feeAmount` that will be used as the relayer-incentivisation for the teleporter cross-chain call. Also allows for the caller to specify `allowedRelayerAddresses`. - `receiveTeleporterMessage`: unlocks tokens on the source chain when instructed to by the `NativeTokenDestination` contract. From 6f207dacf5f257471f1dcdc2498e9260e23b6301 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Thu, 16 Nov 2023 12:45:53 -0500 Subject: [PATCH 112/183] Ignore specific solhint rule --- .../NativeTokenBridge/NativeTokenDestination.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index 2f07f5548..3a1438289 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -15,7 +15,7 @@ import {SafeERC20TransferFrom} from "../../Teleporter/SafeERC20TransferFrom.sol" import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; // We need IAllowList as an indirect dependency in order to compile. -// solhint-disable-next-line +// solhint-disable-next-line no-unused-vars import {IAllowList} from "@subnet-evm-contracts/interfaces/IAllowList.sol"; // The address where the burned transaction fees are credited. From d78ab6426ee65098d761ecc1524c37140be88be9 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Thu, 16 Nov 2023 12:47:09 -0500 Subject: [PATCH 113/183] Ignore specific solhint rule --- .../NativeTokenBridge/NativeTokenDestination.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index 3a1438289..30c41cd7e 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -15,7 +15,7 @@ import {SafeERC20TransferFrom} from "../../Teleporter/SafeERC20TransferFrom.sol" import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; // We need IAllowList as an indirect dependency in order to compile. -// solhint-disable-next-line no-unused-vars +// solhint-disable-next-line no-unused-import import {IAllowList} from "@subnet-evm-contracts/interfaces/IAllowList.sol"; // The address where the burned transaction fees are credited. From 581f3d7d9e71573b3058d380927a62269edae38a Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Thu, 16 Nov 2023 12:50:23 -0500 Subject: [PATCH 114/183] Fix burned tokens total --- .../NativeTokenBridge/NativeTokenDestination.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index 30c41cd7e..da314a625 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -202,7 +202,7 @@ contract NativeTokenDestination is } function totalSupply() external view returns (uint256) { - uint256 burned = address(BURNED_TX_FEES_ADDRESS).balance - + uint256 burned = address(BURNED_TX_FEES_ADDRESS).balance + address(BLACKHOLE_ADDRESS).balance; require( burned <= totalMinted + initialReserveImbalance, From 49a2cb8060d547e9e76b89d459fa47db706d9ab7 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 20 Nov 2023 07:14:54 -0500 Subject: [PATCH 115/183] Review fixes --- .../NativeTokenDestination.go | 39 ++++++++++++------- .../NativeTokenSource/NativeTokenSource.go | 26 +++++++++---- .../INativeTokenDestination.sol | 5 +-- .../NativeTokenBridge/INativeTokenSource.sol | 2 +- .../NativeTokenDestination.sol | 15 +++++-- .../NativeTokenBridge/README.md | 16 ++++---- go.work.sum | 1 + 7 files changed, 67 insertions(+), 37 deletions(-) diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go index 28f8cd23f..ef88d729c 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go @@ -37,7 +37,7 @@ type TeleporterFeeInfo struct { // NativeTokenDestinationMetaData contains all meta data concerning the NativeTokenDestination contract. var NativeTokenDestinationMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialReserveImbalance_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalMinted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialReserveImbalance_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"addedBy\",\"type\":\"address\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalMinted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", } // NativeTokenDestinationABI is the input ABI used to generate the binding from. @@ -578,12 +578,13 @@ func (it *NativeTokenDestinationCollateralAddedIterator) Close() error { type NativeTokenDestinationCollateralAdded struct { Amount *big.Int Remaining *big.Int + AddedBy common.Address Raw types.Log // Blockchain specific contextual infos } -// FilterCollateralAdded is a free log retrieval operation binding the contract event 0x244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449. +// FilterCollateralAdded is a free log retrieval operation binding the contract event 0x66c12a5fefbc1f35dd64a1d9b069fc5bda187e6f68812c58a330b77b2a695ba9. // -// Solidity: event CollateralAdded(uint256 amount, uint256 remaining) +// Solidity: event CollateralAdded(uint256 amount, uint256 remaining, address addedBy) func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterCollateralAdded(opts *bind.FilterOpts) (*NativeTokenDestinationCollateralAddedIterator, error) { logs, sub, err := _NativeTokenDestination.contract.FilterLogs(opts, "CollateralAdded") @@ -593,9 +594,9 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterCollateralA return &NativeTokenDestinationCollateralAddedIterator{contract: _NativeTokenDestination.contract, event: "CollateralAdded", logs: logs, sub: sub}, nil } -// WatchCollateralAdded is a free log subscription operation binding the contract event 0x244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449. +// WatchCollateralAdded is a free log subscription operation binding the contract event 0x66c12a5fefbc1f35dd64a1d9b069fc5bda187e6f68812c58a330b77b2a695ba9. // -// Solidity: event CollateralAdded(uint256 amount, uint256 remaining) +// Solidity: event CollateralAdded(uint256 amount, uint256 remaining, address addedBy) func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchCollateralAdded(opts *bind.WatchOpts, sink chan<- *NativeTokenDestinationCollateralAdded) (event.Subscription, error) { logs, sub, err := _NativeTokenDestination.contract.WatchLogs(opts, "CollateralAdded") @@ -630,9 +631,9 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchCollateralAd }), nil } -// ParseCollateralAdded is a log parse operation binding the contract event 0x244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449. +// ParseCollateralAdded is a log parse operation binding the contract event 0x66c12a5fefbc1f35dd64a1d9b069fc5bda187e6f68812c58a330b77b2a695ba9. // -// Solidity: event CollateralAdded(uint256 amount, uint256 remaining) +// Solidity: event CollateralAdded(uint256 amount, uint256 remaining, address addedBy) func (_NativeTokenDestination *NativeTokenDestinationFilterer) ParseCollateralAdded(log types.Log) (*NativeTokenDestinationCollateralAdded, error) { event := new(NativeTokenDestinationCollateralAdded) if err := _NativeTokenDestination.contract.UnpackLog(event, "CollateralAdded", log); err != nil { @@ -865,8 +866,8 @@ type NativeTokenDestinationTransferToSource struct { // FilterTransferToSource is a free log retrieval operation binding the contract event 0x0322cbb1d3c23f6dbf1deddb3b4ef3ce0f93ae6eec7b44e4f395804104466d14. // -// Solidity: event TransferToSource(address indexed sender, address indexed recipient, uint256 amount, uint256 teleporterMessageID) -func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterTransferToSource(opts *bind.FilterOpts, sender []common.Address, recipient []common.Address) (*NativeTokenDestinationTransferToSourceIterator, error) { +// Solidity: event TransferToSource(address indexed sender, address indexed recipient, uint256 amount, uint256 indexed teleporterMessageID) +func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterTransferToSource(opts *bind.FilterOpts, sender []common.Address, recipient []common.Address, teleporterMessageID []*big.Int) (*NativeTokenDestinationTransferToSourceIterator, error) { var senderRule []interface{} for _, senderItem := range sender { @@ -877,7 +878,12 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterTransferToS recipientRule = append(recipientRule, recipientItem) } - logs, sub, err := _NativeTokenDestination.contract.FilterLogs(opts, "TransferToSource", senderRule, recipientRule) + var teleporterMessageIDRule []interface{} + for _, teleporterMessageIDItem := range teleporterMessageID { + teleporterMessageIDRule = append(teleporterMessageIDRule, teleporterMessageIDItem) + } + + logs, sub, err := _NativeTokenDestination.contract.FilterLogs(opts, "TransferToSource", senderRule, recipientRule, teleporterMessageIDRule) if err != nil { return nil, err } @@ -886,8 +892,8 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterTransferToS // WatchTransferToSource is a free log subscription operation binding the contract event 0x0322cbb1d3c23f6dbf1deddb3b4ef3ce0f93ae6eec7b44e4f395804104466d14. // -// Solidity: event TransferToSource(address indexed sender, address indexed recipient, uint256 amount, uint256 teleporterMessageID) -func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchTransferToSource(opts *bind.WatchOpts, sink chan<- *NativeTokenDestinationTransferToSource, sender []common.Address, recipient []common.Address) (event.Subscription, error) { +// Solidity: event TransferToSource(address indexed sender, address indexed recipient, uint256 amount, uint256 indexed teleporterMessageID) +func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchTransferToSource(opts *bind.WatchOpts, sink chan<- *NativeTokenDestinationTransferToSource, sender []common.Address, recipient []common.Address, teleporterMessageID []*big.Int) (event.Subscription, error) { var senderRule []interface{} for _, senderItem := range sender { @@ -898,7 +904,12 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchTransferToSo recipientRule = append(recipientRule, recipientItem) } - logs, sub, err := _NativeTokenDestination.contract.WatchLogs(opts, "TransferToSource", senderRule, recipientRule) + var teleporterMessageIDRule []interface{} + for _, teleporterMessageIDItem := range teleporterMessageID { + teleporterMessageIDRule = append(teleporterMessageIDRule, teleporterMessageIDItem) + } + + logs, sub, err := _NativeTokenDestination.contract.WatchLogs(opts, "TransferToSource", senderRule, recipientRule, teleporterMessageIDRule) if err != nil { return nil, err } @@ -932,7 +943,7 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchTransferToSo // ParseTransferToSource is a log parse operation binding the contract event 0x0322cbb1d3c23f6dbf1deddb3b4ef3ce0f93ae6eec7b44e4f395804104466d14. // -// Solidity: event TransferToSource(address indexed sender, address indexed recipient, uint256 amount, uint256 teleporterMessageID) +// Solidity: event TransferToSource(address indexed sender, address indexed recipient, uint256 amount, uint256 indexed teleporterMessageID) func (_NativeTokenDestination *NativeTokenDestinationFilterer) ParseTransferToSource(log types.Log) (*NativeTokenDestinationTransferToSource, error) { event := new(NativeTokenDestinationTransferToSource) if err := _NativeTokenDestination.contract.UnpackLog(event, "TransferToSource", log); err != nil { diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go index acdea7305..a1ac330c9 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go @@ -37,7 +37,7 @@ type TeleporterFeeInfo struct { // NativeTokenSourceMetaData contains all meta data concerning the NativeTokenSource contract. var NativeTokenSourceMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", } // NativeTokenSourceABI is the input ABI used to generate the binding from. @@ -430,8 +430,8 @@ type NativeTokenSourceTransferToDestination struct { // FilterTransferToDestination is a free log retrieval operation binding the contract event 0x2b4e8f08417773e367064a6aea9ca2df303a60876676f70b6c3c5e66b314ca5a. // -// Solidity: event TransferToDestination(address indexed sender, address indexed recipient, uint256 amount, uint256 teleporterMessageID) -func (_NativeTokenSource *NativeTokenSourceFilterer) FilterTransferToDestination(opts *bind.FilterOpts, sender []common.Address, recipient []common.Address) (*NativeTokenSourceTransferToDestinationIterator, error) { +// Solidity: event TransferToDestination(address indexed sender, address indexed recipient, uint256 amount, uint256 indexed teleporterMessageID) +func (_NativeTokenSource *NativeTokenSourceFilterer) FilterTransferToDestination(opts *bind.FilterOpts, sender []common.Address, recipient []common.Address, teleporterMessageID []*big.Int) (*NativeTokenSourceTransferToDestinationIterator, error) { var senderRule []interface{} for _, senderItem := range sender { @@ -442,7 +442,12 @@ func (_NativeTokenSource *NativeTokenSourceFilterer) FilterTransferToDestination recipientRule = append(recipientRule, recipientItem) } - logs, sub, err := _NativeTokenSource.contract.FilterLogs(opts, "TransferToDestination", senderRule, recipientRule) + var teleporterMessageIDRule []interface{} + for _, teleporterMessageIDItem := range teleporterMessageID { + teleporterMessageIDRule = append(teleporterMessageIDRule, teleporterMessageIDItem) + } + + logs, sub, err := _NativeTokenSource.contract.FilterLogs(opts, "TransferToDestination", senderRule, recipientRule, teleporterMessageIDRule) if err != nil { return nil, err } @@ -451,8 +456,8 @@ func (_NativeTokenSource *NativeTokenSourceFilterer) FilterTransferToDestination // WatchTransferToDestination is a free log subscription operation binding the contract event 0x2b4e8f08417773e367064a6aea9ca2df303a60876676f70b6c3c5e66b314ca5a. // -// Solidity: event TransferToDestination(address indexed sender, address indexed recipient, uint256 amount, uint256 teleporterMessageID) -func (_NativeTokenSource *NativeTokenSourceFilterer) WatchTransferToDestination(opts *bind.WatchOpts, sink chan<- *NativeTokenSourceTransferToDestination, sender []common.Address, recipient []common.Address) (event.Subscription, error) { +// Solidity: event TransferToDestination(address indexed sender, address indexed recipient, uint256 amount, uint256 indexed teleporterMessageID) +func (_NativeTokenSource *NativeTokenSourceFilterer) WatchTransferToDestination(opts *bind.WatchOpts, sink chan<- *NativeTokenSourceTransferToDestination, sender []common.Address, recipient []common.Address, teleporterMessageID []*big.Int) (event.Subscription, error) { var senderRule []interface{} for _, senderItem := range sender { @@ -463,7 +468,12 @@ func (_NativeTokenSource *NativeTokenSourceFilterer) WatchTransferToDestination( recipientRule = append(recipientRule, recipientItem) } - logs, sub, err := _NativeTokenSource.contract.WatchLogs(opts, "TransferToDestination", senderRule, recipientRule) + var teleporterMessageIDRule []interface{} + for _, teleporterMessageIDItem := range teleporterMessageID { + teleporterMessageIDRule = append(teleporterMessageIDRule, teleporterMessageIDItem) + } + + logs, sub, err := _NativeTokenSource.contract.WatchLogs(opts, "TransferToDestination", senderRule, recipientRule, teleporterMessageIDRule) if err != nil { return nil, err } @@ -497,7 +507,7 @@ func (_NativeTokenSource *NativeTokenSourceFilterer) WatchTransferToDestination( // ParseTransferToDestination is a log parse operation binding the contract event 0x2b4e8f08417773e367064a6aea9ca2df303a60876676f70b6c3c5e66b314ca5a. // -// Solidity: event TransferToDestination(address indexed sender, address indexed recipient, uint256 amount, uint256 teleporterMessageID) +// Solidity: event TransferToDestination(address indexed sender, address indexed recipient, uint256 amount, uint256 indexed teleporterMessageID) func (_NativeTokenSource *NativeTokenSourceFilterer) ParseTransferToDestination(log types.Log) (*NativeTokenSourceTransferToDestination, error) { event := new(NativeTokenSourceTransferToDestination) if err := _NativeTokenSource.contract.UnpackLog(event, "TransferToDestination", log); err != nil { diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol index 519be7083..b6825f0fd 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol @@ -19,13 +19,13 @@ interface INativeTokenDestination { address indexed sender, address indexed recipient, uint256 amount, - uint256 teleporterMessageID + uint256 indexed teleporterMessageID ); /** * @dev Emitted when tokens are not minted in order to collateralize the source contract. */ - event CollateralAdded(uint256 amount, uint256 remaining); + event CollateralAdded(uint256 amount, uint256 remaining, address addedBy); /** * @dev Emitted when minting native tokens. @@ -54,4 +54,3 @@ interface INativeTokenDestination { */ function totalSupply() external view returns (uint256); } - diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol index e79df4a94..9919983e3 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol @@ -19,7 +19,7 @@ interface INativeTokenSource { address indexed sender, address indexed recipient, uint256 amount, - uint256 teleporterMessageID + uint256 indexed teleporterMessageID ); /** diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index da314a625..ec270bf15 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -119,12 +119,16 @@ contract NativeTokenDestination is ); require(amount != 0, "NativeTokenDestination: zero transfer value"); + // If the contract has not yet been collateralized, we will deduct as many tokens + // as needed from the transfer as needed. If there are any excess tokens, they will + // be minted and sent to the recipient. uint256 adjustedAmount = amount; if (currentReserveImbalance > 0) { if (amount > currentReserveImbalance) { emit CollateralAdded({ amount: currentReserveImbalance, - remaining: 0 + remaining: 0, + addedBy: senderAddress }); adjustedAmount = amount - currentReserveImbalance; currentReserveImbalance = 0; @@ -132,7 +136,8 @@ contract NativeTokenDestination is currentReserveImbalance -= amount; emit CollateralAdded({ amount: amount, - remaining: currentReserveImbalance + remaining: currentReserveImbalance, + addedBy: senderAddress }); return; } @@ -172,7 +177,11 @@ contract NativeTokenDestination is IERC20(feeInfo.contractAddress), feeInfo.amount ); - SafeERC20.safeIncreaseAllowance(IERC20(feeInfo.contractAddress), address(teleporterMessenger), adjustedFeeAmount); + SafeERC20.safeIncreaseAllowance( + IERC20(feeInfo.contractAddress), + address(teleporterMessenger), + adjustedFeeAmount + ); } // Burn native token by sending to BLACKHOLE_ADDRESS diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/README.md b/contracts/src/CrossChainApplications/NativeTokenBridge/README.md index c42b16563..38baf3041 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/README.md +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/README.md @@ -4,28 +4,28 @@ A pair of smart contracts built on top of Teleporter to support using an ERC20 t ## Design The native-to-native bridge is implemented using two primary contracts. -- `NativeTokenSource` +### `NativeTokenSource` - Lives on the Source chain. Pairs with exactly one `NativeTokenDestination` contract on a different chain. - Locks and unlocks native tokens on the Source chain corresponding to mints and burns on the destination chain. - - `transferToDestination`: transfers all tokens payed to this function call to `recipient` on the destination chain by locking them and instructing the destination chain to mint. Optionally takes the address of an ERC20 contract `feeContractAddress` as well as an amount `feeAmount` that will be used as the relayer-incentivisation for the teleporter cross-chain call. Also allows for the caller to specify `allowedRelayerAddresses`. + - `transferToDestination`: transfers all tokens paid to this function call to `recipient` on the destination chain by locking them and instructing the destination chain to mint. Optionally takes the address of an ERC20 contract `feeContractAddress` as well as an amount `feeAmount` that will be used as the relayer-incentivisation for the teleporter cross-chain call. Also allows for the caller to specify `allowedRelayerAddresses`. - `receiveTeleporterMessage`: unlocks tokens on the source chain when instructed to by the `NativeTokenDestination` contract. -- `NativeTokenDestination` +### `NativeTokenDestination` - Lives on the Destination chain. Pairs with exactly one `NativeTokenSource` contract on a different chain. - Mints and burns native tokens on the Destination chain corresponding to locks and unlocks on the source chain. - - `transferToSource`: transfers all tokens payed to this function call to `recipient` on the source chain by burning the tokens and instructing the source chain to unlock. Optionally takes the address of an ERC20 contract `feeContractAddress` as well as an amount `feeAmount` that will be used as the relayer-incentivisation for the teleporter cross-chain call. Also allows for the caller to specify `allowedRelayerAddresses`. + - `transferToSource`: transfers all tokens paid to this function call to `recipient` on the source chain by burning the tokens and instructing the source chain to unlock. Optionally takes the address of an ERC20 contract `feeContractAddress` as well as an amount `feeAmount` that will be used as the relayer-incentivisation for the teleporter cross-chain call. Also allows for the caller to specify `allowedRelayerAddresses`. - `receiveTeleporterMessage`: mints tokens on the destination chain when instructed to by the `NativeTokenDestination` contract. - `isCollateralized`: returns true if `currentReserveImbalance == 0`, meaning that enough tokens have been sent from the source chain to offset the `initialReserveImbalance`. If true, all tokens sent to the destination chain will be minted, and burning/unlocking tokens will be enabled. - `totalSupply`: Returns the best estimate of available native tokens on this chain. Equal to the `initialReserveImbalance` + `all tokens minted` - `all tokens in known burn address`. Known burn addresses include the burn address for this contract used when burning/unlocking, and the address for burned transaction fees. -- `Collateralizing the bridge` - - On initialization, the bridge will be undercollateralized by exactly the number of tokens included in genesis on the destination chain. These tokens could theoretically be sent through the bridge, with no corresponding tokens able to be unlocked on the source chain. In order to avoid this problem, the `NativeTokenDestination` contract is initialized with the value for `initialReserveImbalance`, which should correspond to the number of tokens allocated in the genesis block for the destination chain. If `initialReserveImbalance` is not properly set, behaviour of this contract is undefined. The `NativeTokenDestination` contract will not mint tokens until it has received confirmation that at least `initialReserveImbalance` tokens have been locked on the source chain. It should be up to the contract deployer to ensure that the bridge is properly collateralized. Burning/unlocking is disabled until the bridge is properly collateralized. +### `Collateralizing the bridge` + - On initialization, the bridge will be undercollateralized by exactly the number of tokens minted in the genesis block on the destination chain. These tokens could theoretically be sent through the bridge, with no corresponding tokens able to be unlocked on the source chain. In order to avoid this problem, the `NativeTokenDestination` contract is initialized with the value for `initialReserveImbalance`, which should correspond to the number of tokens allocated in the genesis block for the destination chain. If `initialReserveImbalance` is not properly set, behaviour of this contract is undefined. The `NativeTokenDestination` contract will not mint tokens until it has received confirmation that at least `initialReserveImbalance` tokens have been locked on the source chain. It should be up to the contract deployer to ensure that the bridge is properly collateralized. Burning/unlocking is disabled until the bridge is properly collateralized. -- `Burning tokens spent as fees` +### `Burning tokens spent as fees` - As tokens are burned for transaction fees on the destination chain, contract owners may want to relay this information to the source chain in order to burn an equivalent number of locked tokens there because these tokens will never be bridged back. - The address for burned transaction fees is `0x0100000000000000000000000000000000000000`. When transferring token to the source chain, the "burned" tokens are sent here so that `0x0100000000000000000000000000000000000000` will only include burned transaction fees (or tokens others have decided to burn outside of this contract) so that this number can be reported to the source chain to burn an equivalent numbers of locked tokens. - `TODO` explain implementation. -- `Setup` +## `Setup` - `TeleporterMessenger` must be deployed on both chains, and the address must be passed to the constructor of both contracts. - `NativeTokenDestination` is meant to be deployed on a new subnet, and should be the only method for minting tokens on that subnet. The address of `NativeTokenDestination` must be included as the only entry for `adminAddresses` under `contractNativeMinterConfig` in the genesis config for the destination subnet. See `warp-genesis.json` for an example. - Both `NativeTokenSource` and `NativeTokenDestination` need to be deployed to addresses known beforehand. Each address must be passed to the constructor of the other contract. To do this, you will need a known EOA, and preferably use the first transaction from the EOA (nonce 0) to deploy the contract on each chain. It is advised to allocate tokens to the EOA in the destination subnet genesis file so that it can easily deploy the contract. diff --git a/go.work.sum b/go.work.sum index f56bd8768..bfc090582 100644 --- a/go.work.sum +++ b/go.work.sum @@ -970,6 +970,7 @@ github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjY github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo/v2 v2.4.0/go.mod h1:iHkDK1fKGcBoEHT5W7YBq4RFWaQulw+caOMkAt4OrFo= +github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= github.com/onsi/gomega v1.24.0/go.mod h1:Z/NWtiqwBrwUt4/2loMmHL63EDLnYHmVbuBpDr2vQAg= github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= github.com/onsi/gomega v1.29.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= From bf1b852ec0ee1100fff49e4b22166ba345970f2d Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 20 Nov 2023 08:10:18 -0500 Subject: [PATCH 116/183] Implement burn functionality --- .../ERC20TokenSource/ERC20TokenSource.go | 198 ++++++++++++++++- .../NativeTokenDestination.go | 199 +++++++++++++++++- .../NativeTokenSource/NativeTokenSource.go | 198 ++++++++++++++++- .../ERC20Bridge/BridgeToken.sol | 2 +- .../ERC20Bridge/IERC20Bridge.sol | 8 +- .../NativeTokenBridge/ERC20TokenSource.sol | 47 ++++- .../NativeTokenBridge/IERC20TokenSource.sol | 5 - .../INativeTokenDestination.sol | 8 + .../NativeTokenBridge/INativeTokenSource.sol | 5 - .../NativeTokenBridge/ITokenSource.sol | 26 +++ .../NativeTokenDestination.sol | 43 +++- .../NativeTokenBridge/NativeTokenSource.sol | 51 ++++- 12 files changed, 764 insertions(+), 26 deletions(-) create mode 100644 contracts/src/CrossChainApplications/NativeTokenBridge/ITokenSource.sol diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go index 04e3c48d1..06add0d6e 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go @@ -31,7 +31,7 @@ var ( // ERC20TokenSourceMetaData contains all meta data concerning the ERC20TokenSource contract. var ERC20TokenSourceMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"erc20ContractAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"transferAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"erc20ContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"erc20ContractAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"transferAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BLACKHOLE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationChainBurnedBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"erc20ContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // ERC20TokenSourceABI is the input ABI used to generate the binding from. @@ -180,6 +180,37 @@ func (_ERC20TokenSource *ERC20TokenSourceTransactorRaw) Transact(opts *bind.Tran return _ERC20TokenSource.Contract.contract.Transact(opts, method, params...) } +// BLACKHOLEADDRESS is a free data retrieval call binding the contract method 0xd3681114. +// +// Solidity: function BLACKHOLE_ADDRESS() view returns(address) +func (_ERC20TokenSource *ERC20TokenSourceCaller) BLACKHOLEADDRESS(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _ERC20TokenSource.contract.Call(opts, &out, "BLACKHOLE_ADDRESS") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// BLACKHOLEADDRESS is a free data retrieval call binding the contract method 0xd3681114. +// +// Solidity: function BLACKHOLE_ADDRESS() view returns(address) +func (_ERC20TokenSource *ERC20TokenSourceSession) BLACKHOLEADDRESS() (common.Address, error) { + return _ERC20TokenSource.Contract.BLACKHOLEADDRESS(&_ERC20TokenSource.CallOpts) +} + +// BLACKHOLEADDRESS is a free data retrieval call binding the contract method 0xd3681114. +// +// Solidity: function BLACKHOLE_ADDRESS() view returns(address) +func (_ERC20TokenSource *ERC20TokenSourceCallerSession) BLACKHOLEADDRESS() (common.Address, error) { + return _ERC20TokenSource.Contract.BLACKHOLEADDRESS(&_ERC20TokenSource.CallOpts) +} + // MINTNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xb6171f73. // // Solidity: function MINT_NATIVE_TOKENS_REQUIRED_GAS() view returns(uint256) @@ -242,6 +273,37 @@ func (_ERC20TokenSource *ERC20TokenSourceCallerSession) DestinationBlockchainID( return _ERC20TokenSource.Contract.DestinationBlockchainID(&_ERC20TokenSource.CallOpts) } +// DestinationChainBurnedBalance is a free data retrieval call binding the contract method 0xd98d180d. +// +// Solidity: function destinationChainBurnedBalance() view returns(uint256) +func (_ERC20TokenSource *ERC20TokenSourceCaller) DestinationChainBurnedBalance(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _ERC20TokenSource.contract.Call(opts, &out, "destinationChainBurnedBalance") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// DestinationChainBurnedBalance is a free data retrieval call binding the contract method 0xd98d180d. +// +// Solidity: function destinationChainBurnedBalance() view returns(uint256) +func (_ERC20TokenSource *ERC20TokenSourceSession) DestinationChainBurnedBalance() (*big.Int, error) { + return _ERC20TokenSource.Contract.DestinationChainBurnedBalance(&_ERC20TokenSource.CallOpts) +} + +// DestinationChainBurnedBalance is a free data retrieval call binding the contract method 0xd98d180d. +// +// Solidity: function destinationChainBurnedBalance() view returns(uint256) +func (_ERC20TokenSource *ERC20TokenSourceCallerSession) DestinationChainBurnedBalance() (*big.Int, error) { + return _ERC20TokenSource.Contract.DestinationChainBurnedBalance(&_ERC20TokenSource.CallOpts) +} + // Erc20ContractAddress is a free data retrieval call binding the contract method 0xe486df15. // // Solidity: function erc20ContractAddress() view returns(address) @@ -377,6 +439,140 @@ func (_ERC20TokenSource *ERC20TokenSourceTransactorSession) TransferToDestinatio return _ERC20TokenSource.Contract.TransferToDestination(&_ERC20TokenSource.TransactOpts, recipient, totalAmount, feeAmount, allowedRelayerAddresses) } +// ERC20TokenSourceBurnTokensIterator is returned from FilterBurnTokens and is used to iterate over the raw logs and unpacked data for BurnTokens events raised by the ERC20TokenSource contract. +type ERC20TokenSourceBurnTokensIterator struct { + Event *ERC20TokenSourceBurnTokens // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ERC20TokenSourceBurnTokensIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ERC20TokenSourceBurnTokens) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ERC20TokenSourceBurnTokens) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ERC20TokenSourceBurnTokensIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ERC20TokenSourceBurnTokensIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ERC20TokenSourceBurnTokens represents a BurnTokens event raised by the ERC20TokenSource contract. +type ERC20TokenSourceBurnTokens struct { + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBurnTokens is a free log retrieval operation binding the contract event 0x2cd3fd70cd5a5d6d805e90d22741aa1a84590ace7cf01b244719558d26614382. +// +// Solidity: event BurnTokens(uint256 amount) +func (_ERC20TokenSource *ERC20TokenSourceFilterer) FilterBurnTokens(opts *bind.FilterOpts) (*ERC20TokenSourceBurnTokensIterator, error) { + + logs, sub, err := _ERC20TokenSource.contract.FilterLogs(opts, "BurnTokens") + if err != nil { + return nil, err + } + return &ERC20TokenSourceBurnTokensIterator{contract: _ERC20TokenSource.contract, event: "BurnTokens", logs: logs, sub: sub}, nil +} + +// WatchBurnTokens is a free log subscription operation binding the contract event 0x2cd3fd70cd5a5d6d805e90d22741aa1a84590ace7cf01b244719558d26614382. +// +// Solidity: event BurnTokens(uint256 amount) +func (_ERC20TokenSource *ERC20TokenSourceFilterer) WatchBurnTokens(opts *bind.WatchOpts, sink chan<- *ERC20TokenSourceBurnTokens) (event.Subscription, error) { + + logs, sub, err := _ERC20TokenSource.contract.WatchLogs(opts, "BurnTokens") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ERC20TokenSourceBurnTokens) + if err := _ERC20TokenSource.contract.UnpackLog(event, "BurnTokens", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseBurnTokens is a log parse operation binding the contract event 0x2cd3fd70cd5a5d6d805e90d22741aa1a84590ace7cf01b244719558d26614382. +// +// Solidity: event BurnTokens(uint256 amount) +func (_ERC20TokenSource *ERC20TokenSourceFilterer) ParseBurnTokens(log types.Log) (*ERC20TokenSourceBurnTokens, error) { + event := new(ERC20TokenSourceBurnTokens) + if err := _ERC20TokenSource.contract.UnpackLog(event, "BurnTokens", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + // ERC20TokenSourceTransferToDestinationIterator is returned from FilterTransferToDestination and is used to iterate over the raw logs and unpacked data for TransferToDestination events raised by the ERC20TokenSource contract. type ERC20TokenSourceTransferToDestinationIterator struct { Event *ERC20TokenSourceTransferToDestination // Event containing the contract specifics and raw log diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go index ef88d729c..5a66a5a8b 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go @@ -37,7 +37,7 @@ type TeleporterFeeInfo struct { // NativeTokenDestinationMetaData contains all meta data concerning the NativeTokenDestination contract. var NativeTokenDestinationMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialReserveImbalance_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"addedBy\",\"type\":\"address\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalMinted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialReserveImbalance_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"addedBy\",\"type\":\"address\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"burnAddressBalance\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"ReportTotalBurnedTxFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"REPORT_BURNED_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"reportTotalBurnedTxFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalMinted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", } // NativeTokenDestinationABI is the input ABI used to generate the binding from. @@ -186,6 +186,37 @@ func (_NativeTokenDestination *NativeTokenDestinationTransactorRaw) Transact(opt return _NativeTokenDestination.Contract.contract.Transact(opts, method, params...) } +// REPORTBURNEDTOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xd3095126. +// +// Solidity: function REPORT_BURNED_TOKENS_REQUIRED_GAS() view returns(uint256) +func (_NativeTokenDestination *NativeTokenDestinationCaller) REPORTBURNEDTOKENSREQUIREDGAS(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _NativeTokenDestination.contract.Call(opts, &out, "REPORT_BURNED_TOKENS_REQUIRED_GAS") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// REPORTBURNEDTOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xd3095126. +// +// Solidity: function REPORT_BURNED_TOKENS_REQUIRED_GAS() view returns(uint256) +func (_NativeTokenDestination *NativeTokenDestinationSession) REPORTBURNEDTOKENSREQUIREDGAS() (*big.Int, error) { + return _NativeTokenDestination.Contract.REPORTBURNEDTOKENSREQUIREDGAS(&_NativeTokenDestination.CallOpts) +} + +// REPORTBURNEDTOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xd3095126. +// +// Solidity: function REPORT_BURNED_TOKENS_REQUIRED_GAS() view returns(uint256) +func (_NativeTokenDestination *NativeTokenDestinationCallerSession) REPORTBURNEDTOKENSREQUIREDGAS() (*big.Int, error) { + return _NativeTokenDestination.Contract.REPORTBURNEDTOKENSREQUIREDGAS(&_NativeTokenDestination.CallOpts) +} + // TRANSFERNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xab285230. // // Solidity: function TRANSFER_NATIVE_TOKENS_REQUIRED_GAS() view returns(uint256) @@ -486,6 +517,27 @@ func (_NativeTokenDestination *NativeTokenDestinationTransactorSession) ReceiveT return _NativeTokenDestination.Contract.ReceiveTeleporterMessage(&_NativeTokenDestination.TransactOpts, senderBlockchainID, senderAddress, message) } +// ReportTotalBurnedTxFees is a paid mutator transaction binding the contract method 0x3a94fe51. +// +// Solidity: function reportTotalBurnedTxFees((address,uint256) feeInfo, address[] allowedRelayerAddresses) returns() +func (_NativeTokenDestination *NativeTokenDestinationTransactor) ReportTotalBurnedTxFees(opts *bind.TransactOpts, feeInfo TeleporterFeeInfo, allowedRelayerAddresses []common.Address) (*types.Transaction, error) { + return _NativeTokenDestination.contract.Transact(opts, "reportTotalBurnedTxFees", feeInfo, allowedRelayerAddresses) +} + +// ReportTotalBurnedTxFees is a paid mutator transaction binding the contract method 0x3a94fe51. +// +// Solidity: function reportTotalBurnedTxFees((address,uint256) feeInfo, address[] allowedRelayerAddresses) returns() +func (_NativeTokenDestination *NativeTokenDestinationSession) ReportTotalBurnedTxFees(feeInfo TeleporterFeeInfo, allowedRelayerAddresses []common.Address) (*types.Transaction, error) { + return _NativeTokenDestination.Contract.ReportTotalBurnedTxFees(&_NativeTokenDestination.TransactOpts, feeInfo, allowedRelayerAddresses) +} + +// ReportTotalBurnedTxFees is a paid mutator transaction binding the contract method 0x3a94fe51. +// +// Solidity: function reportTotalBurnedTxFees((address,uint256) feeInfo, address[] allowedRelayerAddresses) returns() +func (_NativeTokenDestination *NativeTokenDestinationTransactorSession) ReportTotalBurnedTxFees(feeInfo TeleporterFeeInfo, allowedRelayerAddresses []common.Address) (*types.Transaction, error) { + return _NativeTokenDestination.Contract.ReportTotalBurnedTxFees(&_NativeTokenDestination.TransactOpts, feeInfo, allowedRelayerAddresses) +} + // TransferToSource is a paid mutator transaction binding the contract method 0x75846562. // // Solidity: function transferToSource(address recipient, (address,uint256) feeInfo, address[] allowedRelayerAddresses) payable returns() @@ -788,6 +840,151 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) ParseNativeTokens return event, nil } +// NativeTokenDestinationReportTotalBurnedTxFeesIterator is returned from FilterReportTotalBurnedTxFees and is used to iterate over the raw logs and unpacked data for ReportTotalBurnedTxFees events raised by the NativeTokenDestination contract. +type NativeTokenDestinationReportTotalBurnedTxFeesIterator struct { + Event *NativeTokenDestinationReportTotalBurnedTxFees // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *NativeTokenDestinationReportTotalBurnedTxFeesIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(NativeTokenDestinationReportTotalBurnedTxFees) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(NativeTokenDestinationReportTotalBurnedTxFees) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *NativeTokenDestinationReportTotalBurnedTxFeesIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *NativeTokenDestinationReportTotalBurnedTxFeesIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// NativeTokenDestinationReportTotalBurnedTxFees represents a ReportTotalBurnedTxFees event raised by the NativeTokenDestination contract. +type NativeTokenDestinationReportTotalBurnedTxFees struct { + BurnAddressBalance *big.Int + TeleporterMessageID *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterReportTotalBurnedTxFees is a free log retrieval operation binding the contract event 0x2550fa6041684d40e635e29e93dde9017d70c25b46aa88393317b5182ed6ae7c. +// +// Solidity: event ReportTotalBurnedTxFees(uint256 burnAddressBalance, uint256 indexed teleporterMessageID) +func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterReportTotalBurnedTxFees(opts *bind.FilterOpts, teleporterMessageID []*big.Int) (*NativeTokenDestinationReportTotalBurnedTxFeesIterator, error) { + + var teleporterMessageIDRule []interface{} + for _, teleporterMessageIDItem := range teleporterMessageID { + teleporterMessageIDRule = append(teleporterMessageIDRule, teleporterMessageIDItem) + } + + logs, sub, err := _NativeTokenDestination.contract.FilterLogs(opts, "ReportTotalBurnedTxFees", teleporterMessageIDRule) + if err != nil { + return nil, err + } + return &NativeTokenDestinationReportTotalBurnedTxFeesIterator{contract: _NativeTokenDestination.contract, event: "ReportTotalBurnedTxFees", logs: logs, sub: sub}, nil +} + +// WatchReportTotalBurnedTxFees is a free log subscription operation binding the contract event 0x2550fa6041684d40e635e29e93dde9017d70c25b46aa88393317b5182ed6ae7c. +// +// Solidity: event ReportTotalBurnedTxFees(uint256 burnAddressBalance, uint256 indexed teleporterMessageID) +func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchReportTotalBurnedTxFees(opts *bind.WatchOpts, sink chan<- *NativeTokenDestinationReportTotalBurnedTxFees, teleporterMessageID []*big.Int) (event.Subscription, error) { + + var teleporterMessageIDRule []interface{} + for _, teleporterMessageIDItem := range teleporterMessageID { + teleporterMessageIDRule = append(teleporterMessageIDRule, teleporterMessageIDItem) + } + + logs, sub, err := _NativeTokenDestination.contract.WatchLogs(opts, "ReportTotalBurnedTxFees", teleporterMessageIDRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(NativeTokenDestinationReportTotalBurnedTxFees) + if err := _NativeTokenDestination.contract.UnpackLog(event, "ReportTotalBurnedTxFees", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseReportTotalBurnedTxFees is a log parse operation binding the contract event 0x2550fa6041684d40e635e29e93dde9017d70c25b46aa88393317b5182ed6ae7c. +// +// Solidity: event ReportTotalBurnedTxFees(uint256 burnAddressBalance, uint256 indexed teleporterMessageID) +func (_NativeTokenDestination *NativeTokenDestinationFilterer) ParseReportTotalBurnedTxFees(log types.Log) (*NativeTokenDestinationReportTotalBurnedTxFees, error) { + event := new(NativeTokenDestinationReportTotalBurnedTxFees) + if err := _NativeTokenDestination.contract.UnpackLog(event, "ReportTotalBurnedTxFees", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + // NativeTokenDestinationTransferToSourceIterator is returned from FilterTransferToSource and is used to iterate over the raw logs and unpacked data for TransferToSource events raised by the NativeTokenDestination contract. type NativeTokenDestinationTransferToSourceIterator struct { Event *NativeTokenDestinationTransferToSource // Event containing the contract specifics and raw log diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go index a1ac330c9..8a01880ba 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go @@ -37,7 +37,7 @@ type TeleporterFeeInfo struct { // NativeTokenSourceMetaData contains all meta data concerning the NativeTokenSource contract. var NativeTokenSourceMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BLACKHOLE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationChainBurnedBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", } // NativeTokenSourceABI is the input ABI used to generate the binding from. @@ -186,6 +186,37 @@ func (_NativeTokenSource *NativeTokenSourceTransactorRaw) Transact(opts *bind.Tr return _NativeTokenSource.Contract.contract.Transact(opts, method, params...) } +// BLACKHOLEADDRESS is a free data retrieval call binding the contract method 0xd3681114. +// +// Solidity: function BLACKHOLE_ADDRESS() view returns(address) +func (_NativeTokenSource *NativeTokenSourceCaller) BLACKHOLEADDRESS(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _NativeTokenSource.contract.Call(opts, &out, "BLACKHOLE_ADDRESS") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// BLACKHOLEADDRESS is a free data retrieval call binding the contract method 0xd3681114. +// +// Solidity: function BLACKHOLE_ADDRESS() view returns(address) +func (_NativeTokenSource *NativeTokenSourceSession) BLACKHOLEADDRESS() (common.Address, error) { + return _NativeTokenSource.Contract.BLACKHOLEADDRESS(&_NativeTokenSource.CallOpts) +} + +// BLACKHOLEADDRESS is a free data retrieval call binding the contract method 0xd3681114. +// +// Solidity: function BLACKHOLE_ADDRESS() view returns(address) +func (_NativeTokenSource *NativeTokenSourceCallerSession) BLACKHOLEADDRESS() (common.Address, error) { + return _NativeTokenSource.Contract.BLACKHOLEADDRESS(&_NativeTokenSource.CallOpts) +} + // MINTNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xb6171f73. // // Solidity: function MINT_NATIVE_TOKENS_REQUIRED_GAS() view returns(uint256) @@ -248,6 +279,37 @@ func (_NativeTokenSource *NativeTokenSourceCallerSession) DestinationBlockchainI return _NativeTokenSource.Contract.DestinationBlockchainID(&_NativeTokenSource.CallOpts) } +// DestinationChainBurnedBalance is a free data retrieval call binding the contract method 0xd98d180d. +// +// Solidity: function destinationChainBurnedBalance() view returns(uint256) +func (_NativeTokenSource *NativeTokenSourceCaller) DestinationChainBurnedBalance(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _NativeTokenSource.contract.Call(opts, &out, "destinationChainBurnedBalance") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// DestinationChainBurnedBalance is a free data retrieval call binding the contract method 0xd98d180d. +// +// Solidity: function destinationChainBurnedBalance() view returns(uint256) +func (_NativeTokenSource *NativeTokenSourceSession) DestinationChainBurnedBalance() (*big.Int, error) { + return _NativeTokenSource.Contract.DestinationChainBurnedBalance(&_NativeTokenSource.CallOpts) +} + +// DestinationChainBurnedBalance is a free data retrieval call binding the contract method 0xd98d180d. +// +// Solidity: function destinationChainBurnedBalance() view returns(uint256) +func (_NativeTokenSource *NativeTokenSourceCallerSession) DestinationChainBurnedBalance() (*big.Int, error) { + return _NativeTokenSource.Contract.DestinationChainBurnedBalance(&_NativeTokenSource.CallOpts) +} + // NativeTokenDestinationAddress is a free data retrieval call binding the contract method 0xb8c9091a. // // Solidity: function nativeTokenDestinationAddress() view returns(address) @@ -352,6 +414,140 @@ func (_NativeTokenSource *NativeTokenSourceTransactorSession) TransferToDestinat return _NativeTokenSource.Contract.TransferToDestination(&_NativeTokenSource.TransactOpts, recipient, feeInfo, allowedRelayerAddresses) } +// NativeTokenSourceBurnTokensIterator is returned from FilterBurnTokens and is used to iterate over the raw logs and unpacked data for BurnTokens events raised by the NativeTokenSource contract. +type NativeTokenSourceBurnTokensIterator struct { + Event *NativeTokenSourceBurnTokens // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *NativeTokenSourceBurnTokensIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(NativeTokenSourceBurnTokens) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(NativeTokenSourceBurnTokens) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *NativeTokenSourceBurnTokensIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *NativeTokenSourceBurnTokensIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// NativeTokenSourceBurnTokens represents a BurnTokens event raised by the NativeTokenSource contract. +type NativeTokenSourceBurnTokens struct { + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBurnTokens is a free log retrieval operation binding the contract event 0x2cd3fd70cd5a5d6d805e90d22741aa1a84590ace7cf01b244719558d26614382. +// +// Solidity: event BurnTokens(uint256 amount) +func (_NativeTokenSource *NativeTokenSourceFilterer) FilterBurnTokens(opts *bind.FilterOpts) (*NativeTokenSourceBurnTokensIterator, error) { + + logs, sub, err := _NativeTokenSource.contract.FilterLogs(opts, "BurnTokens") + if err != nil { + return nil, err + } + return &NativeTokenSourceBurnTokensIterator{contract: _NativeTokenSource.contract, event: "BurnTokens", logs: logs, sub: sub}, nil +} + +// WatchBurnTokens is a free log subscription operation binding the contract event 0x2cd3fd70cd5a5d6d805e90d22741aa1a84590ace7cf01b244719558d26614382. +// +// Solidity: event BurnTokens(uint256 amount) +func (_NativeTokenSource *NativeTokenSourceFilterer) WatchBurnTokens(opts *bind.WatchOpts, sink chan<- *NativeTokenSourceBurnTokens) (event.Subscription, error) { + + logs, sub, err := _NativeTokenSource.contract.WatchLogs(opts, "BurnTokens") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(NativeTokenSourceBurnTokens) + if err := _NativeTokenSource.contract.UnpackLog(event, "BurnTokens", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseBurnTokens is a log parse operation binding the contract event 0x2cd3fd70cd5a5d6d805e90d22741aa1a84590ace7cf01b244719558d26614382. +// +// Solidity: event BurnTokens(uint256 amount) +func (_NativeTokenSource *NativeTokenSourceFilterer) ParseBurnTokens(log types.Log) (*NativeTokenSourceBurnTokens, error) { + event := new(NativeTokenSourceBurnTokens) + if err := _NativeTokenSource.contract.UnpackLog(event, "BurnTokens", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + // NativeTokenSourceTransferToDestinationIterator is returned from FilterTransferToDestination and is used to iterate over the raw logs and unpacked data for TransferToDestination events raised by the NativeTokenSource contract. type NativeTokenSourceTransferToDestinationIterator struct { Event *NativeTokenSourceTransferToDestination // Event containing the contract specifics and raw log diff --git a/contracts/src/CrossChainApplications/ERC20Bridge/BridgeToken.sol b/contracts/src/CrossChainApplications/ERC20Bridge/BridgeToken.sol index da0734aed..13ca7d384 100644 --- a/contracts/src/CrossChainApplications/ERC20Bridge/BridgeToken.sol +++ b/contracts/src/CrossChainApplications/ERC20Bridge/BridgeToken.sol @@ -7,7 +7,7 @@ pragma solidity 0.8.18; import {ERC20, ERC20Burnable} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; -/** +/**tran * @dev BridgeToken is an ERC20Burnable token contract that is associated with a specific native chain bridge and asset, and is only mintable by the bridge contract on this chain. */ contract BridgeToken is ERC20Burnable { diff --git a/contracts/src/CrossChainApplications/ERC20Bridge/IERC20Bridge.sol b/contracts/src/CrossChainApplications/ERC20Bridge/IERC20Bridge.sol index ee928e160..9fad94262 100644 --- a/contracts/src/CrossChainApplications/ERC20Bridge/IERC20Bridge.sol +++ b/contracts/src/CrossChainApplications/ERC20Bridge/IERC20Bridge.sol @@ -11,14 +11,14 @@ import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; * @dev Interface that describes functionalities for a cross-chain ERC20 bridge. */ interface IERC20Bridge { - /** - * @dev Enum representing the action to take on receiving a Teleporter message. - */ + enum BridgeAction { Create, Mint, Transfer - } + } /** + * @dev Enum representing the action to take on receiving a Teleporter message. + */ /** * @dev Emitted when tokens are locked in this bridge contract to be bridged to another chain. diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol index ec94e6631..6bac25961 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol @@ -8,6 +8,7 @@ pragma solidity 0.8.18; import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import {IWarpMessenger} from "@subnet-evm-contracts/interfaces/IWarpMessenger.sol"; import {IERC20TokenSource} from "./IERC20TokenSource.sol"; +import {ITokenSource} from "./ITokenSource.sol"; import {ITeleporterMessenger, TeleporterMessageInput, TeleporterFeeInfo} from "../../Teleporter/ITeleporterMessenger.sol"; import {ITeleporterReceiver} from "../../Teleporter/ITeleporterReceiver.sol"; import {SafeERC20TransferFrom} from "../../Teleporter/SafeERC20TransferFrom.sol"; @@ -17,9 +18,17 @@ import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol contract ERC20TokenSource is ITeleporterReceiver, IERC20TokenSource, + ITokenSource, ReentrancyGuard { + // Designated Blackhole Address. Tokens are sent here to be "burned" before sending an unlock + // message to the source chain. Different from the burned tx fee address so they can be + // tracked separately. + address public constant BLACKHOLE_ADDRESS = 0x0100000000000000000000000000000000000001; uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 100_000; + // Used to keep track of tokens burned through transactions on the destination chain. They can + // be reported to this contract to burn an equivalent number of tokens on this chain. + uint256 public destinationChainBurnedBalance = 0; bytes32 public immutable destinationBlockchainID; address public immutable nativeTokenDestinationAddress; address public immutable erc20ContractAddress; @@ -92,10 +101,31 @@ contract ERC20TokenSource is "ERC20TokenSource: unauthorized sender" ); - (address recipient, uint256 amount) = abi.decode( + // Decode the payload to recover the action and corresponding function parameters + (SourceAction action, bytes memory actionData) = abi.decode( message, - (address, uint256) + (SourceAction, bytes) ); + + // Route to the appropriate function. + if (action == SourceAction.Unlock) { + (address recipient, uint256 amount) = abi.decode( + actionData, + (address, uint256) + ); + _unlockTokens(recipient, amount); + } else if (action == SourceAction.Burn) { + uint256 newBurnBalance = abi.decode(actionData, (uint256)); + _burnTokens(newBurnBalance); + } else { + revert("ERC20TokenSource: invalid action"); + } + } + + /** + * @dev Unlocks tokens to recipient. + */ + function _unlockTokens(address recipient, uint256 amount) private { require( recipient != address(0), "ERC20TokenSource: zero recipient address" @@ -107,6 +137,19 @@ contract ERC20TokenSource is emit UnlockTokens(recipient, amount); } + /** + * @dev Sends tokens to BLACKHOLE_ADDRESS. + */ + function _burnTokens(uint256 newBurnBalance) private { + if (newBurnBalance > destinationChainBurnedBalance) { + uint256 difference = newBurnBalance - destinationChainBurnedBalance; + + SafeERC20.safeTransfer(IERC20(erc20ContractAddress), BLACKHOLE_ADDRESS, difference); + destinationChainBurnedBalance = newBurnBalance; + emit BurnTokens(difference); + } + } + /** * @dev See {IERC20TokenSource-transferToDestination}. */ diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol index 591184ca0..4c2d1580a 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol @@ -21,11 +21,6 @@ interface IERC20TokenSource { uint256 teleporterMessageID ); - /** - * @dev Emitted when tokens are unlocked on this chain. - */ - event UnlockTokens(address recipient, uint256 amount); - /** * @dev Locks ERC20 tokens on the source contract chain, and sends a message to the destination * contract to mint corresponding tokens. diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol index b6825f0fd..80fef3fb1 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol @@ -32,6 +32,14 @@ interface INativeTokenDestination { */ event NativeTokensMinted(address indexed recipient, uint256 amount); + /** + * @dev Emitted when minting reporting total burned tx fees to source chain. + */ + event ReportTotalBurnedTxFees( + uint256 burnAddressBalance, + uint256 indexed teleporterMessageID + ); + /** * @dev Burns native tokens on the destination contract chain, and sends a message to the source * contract to unlock corresponding tokens. diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol index 9919983e3..95c861a97 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol @@ -22,11 +22,6 @@ interface INativeTokenSource { uint256 indexed teleporterMessageID ); - /** - * @dev Emitted when tokens are unlocked on this chain. - */ - event UnlockTokens(address recipient, uint256 amount); - /** * @dev Locks native tokens on the source contract chain, and sends a message to the destination * contract to mint corresponding tokens. diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/ITokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/ITokenSource.sol new file mode 100644 index 000000000..40a553cc6 --- /dev/null +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/ITokenSource.sol @@ -0,0 +1,26 @@ +// (c) 2023, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +// SPDX-License-Identifier: Ecosystem + +pragma solidity 0.8.18; + +interface ITokenSource { + /** + * @dev Enum representing the action to take on receiving a Teleporter message. + */ + enum SourceAction { + Unlock, + Burn + } + + /** + * @dev Emitted when tokens are unlocked on this chain. + */ + event UnlockTokens(address recipient, uint256 amount); + + /** + * @dev Emitted when tokens are burned on this chain. + */ + event BurnTokens(uint256 amount); +} \ No newline at end of file diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index ec270bf15..39b47ffe8 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -9,6 +9,7 @@ import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard. import {IWarpMessenger} from "@subnet-evm-contracts/interfaces/IWarpMessenger.sol"; import {INativeMinter} from "@subnet-evm-contracts/interfaces/INativeMinter.sol"; import {INativeTokenDestination} from "./INativeTokenDestination.sol"; +import {ITokenSource} from "./ITokenSource.sol"; import {ITeleporterMessenger, TeleporterFeeInfo, TeleporterMessageInput} from "../../Teleporter/ITeleporterMessenger.sol"; import {ITeleporterReceiver} from "../../Teleporter/ITeleporterReceiver.sol"; import {SafeERC20TransferFrom} from "../../Teleporter/SafeERC20TransferFrom.sol"; @@ -35,6 +36,7 @@ contract NativeTokenDestination is INativeMinter(0x0200000000000000000000000000000000000001); uint256 public constant TRANSFER_NATIVE_TOKENS_REQUIRED_GAS = 100_000; + uint256 public constant REPORT_BURNED_TOKENS_REQUIRED_GAS = 20_000; bytes32 public immutable sourceBlockchainID; address public immutable nativeTokenSourceAddress; // The first `initialReserveImbalance` tokens sent to this subnet will not be minted. @@ -84,7 +86,7 @@ contract NativeTokenDestination is /** * @dev See {ITeleporterReceiver-receiveTeleporterMessage}. * - * Receives a Teleporter message and routes to the appropriate internal function call. + * Receives a Teleporter message. */ function receiveTeleporterMessage( bytes32 senderBlockchainID, @@ -194,7 +196,10 @@ contract NativeTokenDestination is feeInfo: feeInfo, requiredGasLimit: TRANSFER_NATIVE_TOKENS_REQUIRED_GAS, allowedRelayerAddresses: allowedRelayerAddresses, - message: abi.encode(recipient, msg.value) + message: abi.encode( + ITokenSource.SourceAction.Unlock, + abi.encode(recipient, msg.value) + ) }) ); @@ -206,10 +211,44 @@ contract NativeTokenDestination is }); } + /** + * @dev See {INativeTokenDestination-reportTotalBurnedTxFees}. + */ + function reportTotalBurnedTxFees( + TeleporterFeeInfo calldata feeInfo, + address[] calldata allowedRelayerAddresses + ) external { + uint256 totalBurnedTxFees = address(BURNED_TX_FEES_ADDRESS).balance; + uint256 messageID = teleporterMessenger.sendCrossChainMessage( + TeleporterMessageInput({ + destinationChainID: sourceBlockchainID, + destinationAddress: nativeTokenSourceAddress, + feeInfo: feeInfo, + requiredGasLimit: REPORT_BURNED_TOKENS_REQUIRED_GAS, + allowedRelayerAddresses: allowedRelayerAddresses, + message: abi.encode( + ITokenSource.SourceAction.Burn, + abi.encode(totalBurnedTxFees) + ) + }) + ); + + emit ReportTotalBurnedTxFees({ + burnAddressBalance: totalBurnedTxFees, + teleporterMessageID: messageID + }); + } + + /** + * @dev See {INativeTokenDestination-isCollateralized}. + */ function isCollateralized() external view returns (bool) { return currentReserveImbalance == 0; } + /** + * @dev See {INativeTokenDestination-totalSupply}. + */ function totalSupply() external view returns (uint256) { uint256 burned = address(BURNED_TX_FEES_ADDRESS).balance + address(BLACKHOLE_ADDRESS).balance; diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index f04fccec2..1f6ab4647 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -8,6 +8,7 @@ pragma solidity 0.8.18; import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import {IWarpMessenger} from "@subnet-evm-contracts/interfaces/IWarpMessenger.sol"; import {INativeTokenSource} from "./INativeTokenSource.sol"; +import {ITokenSource} from "./ITokenSource.sol"; import {ITeleporterMessenger, TeleporterFeeInfo, TeleporterMessageInput} from "../../Teleporter/ITeleporterMessenger.sol"; import {ITeleporterReceiver} from "../../Teleporter/ITeleporterReceiver.sol"; import {SafeERC20TransferFrom} from "../../Teleporter/SafeERC20TransferFrom.sol"; @@ -18,9 +19,17 @@ import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol contract NativeTokenSource is ITeleporterReceiver, INativeTokenSource, + ITokenSource, ReentrancyGuard { + // Designated Blackhole Address. Tokens are sent here to be "burned" before sending an unlock + // message to the source chain. Different from the burned tx fee address so they can be + // tracked separately. + address public constant BLACKHOLE_ADDRESS = 0x0100000000000000000000000000000000000001; uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 100_000; + // Used to keep track of tokens burned through transactions on the destination chain. They can + // be reported to this contract to burn an equivalent number of tokens on this chain. + uint256 public destinationChainBurnedBalance = 0; bytes32 public immutable destinationBlockchainID; address public immutable nativeTokenDestinationAddress; @@ -85,21 +94,55 @@ contract NativeTokenSource is "NativeTokenSource: unauthorized sender" ); - (address recipient, uint256 amount) = abi.decode( + // Decode the payload to recover the action and corresponding function parameters + (SourceAction action, bytes memory actionData) = abi.decode( message, - (address, uint256) + (SourceAction, bytes) ); + + // Route to the appropriate function. + if (action == SourceAction.Unlock) { + (address recipient, uint256 amount) = abi.decode( + actionData, + (address, uint256) + ); + _unlockTokens(recipient, amount); + } else if (action == SourceAction.Burn) { + uint256 newBurnBalance = abi.decode(actionData, (uint256)); + _burnTokens(newBurnBalance); + } else { + revert("NativeTokenSource: invalid action"); + } + } + + /** + * @dev Unlocks tokens to recipient. + */ + function _unlockTokens(address recipient, uint256 amount) private { require( recipient != address(0), - "NativeTokenSource: zero recipient address" + "ERC20TokenSource: zero recipient address" ); - // Send to recipient + // Transfer to recipient payable(recipient).transfer(amount); emit UnlockTokens(recipient, amount); } + /** + * @dev Sends tokens to BLACKHOLE_ADDRESS. + */ + function _burnTokens(uint256 newBurnBalance) private { + if (newBurnBalance > destinationChainBurnedBalance) { + uint256 difference = newBurnBalance - destinationChainBurnedBalance; + + payable(BLACKHOLE_ADDRESS).transfer(difference); + destinationChainBurnedBalance = newBurnBalance; + emit BurnTokens(difference); + } + } + /** * @dev See {INativeTokenSource-transferToDestination}. */ From cdfc623b812e416f658f1d891aec22ffd319ad30 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 20 Nov 2023 08:12:45 -0500 Subject: [PATCH 117/183] linter --- .../NativeTokenBridge/ERC20TokenSource.sol | 56 +++++++++---------- .../NativeTokenBridge/NativeTokenSource.sol | 56 +++++++++---------- 2 files changed, 56 insertions(+), 56 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol index 6bac25961..5b469bec5 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol @@ -73,6 +73,34 @@ contract ERC20TokenSource is erc20ContractAddress = erc20ContractAddress_; } + /** + * @dev Unlocks tokens to recipient. + */ + function _unlockTokens(address recipient, uint256 amount) private { + require( + recipient != address(0), + "ERC20TokenSource: zero recipient address" + ); + + // Transfer to recipient + SafeERC20.safeTransfer(IERC20(erc20ContractAddress), recipient, amount); + + emit UnlockTokens(recipient, amount); + } + + /** + * @dev Sends tokens to BLACKHOLE_ADDRESS. + */ + function _burnTokens(uint256 newBurnBalance) private { + if (newBurnBalance > destinationChainBurnedBalance) { + uint256 difference = newBurnBalance - destinationChainBurnedBalance; + + SafeERC20.safeTransfer(IERC20(erc20ContractAddress), BLACKHOLE_ADDRESS, difference); + destinationChainBurnedBalance = newBurnBalance; + emit BurnTokens(difference); + } + } + /** * @dev See {ITeleporterReceiver-receiveTeleporterMessage}. * @@ -122,34 +150,6 @@ contract ERC20TokenSource is } } - /** - * @dev Unlocks tokens to recipient. - */ - function _unlockTokens(address recipient, uint256 amount) private { - require( - recipient != address(0), - "ERC20TokenSource: zero recipient address" - ); - - // Transfer to recipient - SafeERC20.safeTransfer(IERC20(erc20ContractAddress), recipient, amount); - - emit UnlockTokens(recipient, amount); - } - - /** - * @dev Sends tokens to BLACKHOLE_ADDRESS. - */ - function _burnTokens(uint256 newBurnBalance) private { - if (newBurnBalance > destinationChainBurnedBalance) { - uint256 difference = newBurnBalance - destinationChainBurnedBalance; - - SafeERC20.safeTransfer(IERC20(erc20ContractAddress), BLACKHOLE_ADDRESS, difference); - destinationChainBurnedBalance = newBurnBalance; - emit BurnTokens(difference); - } - } - /** * @dev See {IERC20TokenSource-transferToDestination}. */ diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index 1f6ab4647..d8bf32a53 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -66,6 +66,34 @@ contract NativeTokenSource is nativeTokenDestinationAddress = nativeTokenDestinationAddress_; } + /** + * @dev Unlocks tokens to recipient. + */ + function _unlockTokens(address recipient, uint256 amount) private { + require( + recipient != address(0), + "ERC20TokenSource: zero recipient address" + ); + + // Transfer to recipient + payable(recipient).transfer(amount); + + emit UnlockTokens(recipient, amount); + } + + /** + * @dev Sends tokens to BLACKHOLE_ADDRESS. + */ + function _burnTokens(uint256 newBurnBalance) private { + if (newBurnBalance > destinationChainBurnedBalance) { + uint256 difference = newBurnBalance - destinationChainBurnedBalance; + + payable(BLACKHOLE_ADDRESS).transfer(difference); + destinationChainBurnedBalance = newBurnBalance; + emit BurnTokens(difference); + } + } + /** * @dev See {ITeleporterReceiver-receiveTeleporterMessage}. * @@ -115,34 +143,6 @@ contract NativeTokenSource is } } - /** - * @dev Unlocks tokens to recipient. - */ - function _unlockTokens(address recipient, uint256 amount) private { - require( - recipient != address(0), - "ERC20TokenSource: zero recipient address" - ); - - // Transfer to recipient - payable(recipient).transfer(amount); - - emit UnlockTokens(recipient, amount); - } - - /** - * @dev Sends tokens to BLACKHOLE_ADDRESS. - */ - function _burnTokens(uint256 newBurnBalance) private { - if (newBurnBalance > destinationChainBurnedBalance) { - uint256 difference = newBurnBalance - destinationChainBurnedBalance; - - payable(BLACKHOLE_ADDRESS).transfer(difference); - destinationChainBurnedBalance = newBurnBalance; - emit BurnTokens(difference); - } - } - /** * @dev See {INativeTokenSource-transferToDestination}. */ From 01436a4c7c1b7863395275ba9b1b5dfe39ec4a01 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 20 Nov 2023 08:17:19 -0500 Subject: [PATCH 118/183] Split burning and updating --- .../NativeTokenBridge/ERC20TokenSource.sol | 16 +++++++++++----- .../NativeTokenBridge/NativeTokenSource.sol | 16 +++++++++++----- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol index 5b469bec5..ddb88ab87 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol @@ -91,13 +91,19 @@ contract ERC20TokenSource is /** * @dev Sends tokens to BLACKHOLE_ADDRESS. */ - function _burnTokens(uint256 newBurnBalance) private { + function _burnTokens(uint256 amount) private { + payable(BLACKHOLE_ADDRESS).transfer(amount); + emit BurnTokens(amount); + } + + /** + * @dev Update destinationChainBurnedBalance sent from destination chain + */ + function _updateDestinationChainBurnedBalance(uint256 newBurnBalance) private { if (newBurnBalance > destinationChainBurnedBalance) { uint256 difference = newBurnBalance - destinationChainBurnedBalance; - - SafeERC20.safeTransfer(IERC20(erc20ContractAddress), BLACKHOLE_ADDRESS, difference); + _burnTokens(difference); destinationChainBurnedBalance = newBurnBalance; - emit BurnTokens(difference); } } @@ -144,7 +150,7 @@ contract ERC20TokenSource is _unlockTokens(recipient, amount); } else if (action == SourceAction.Burn) { uint256 newBurnBalance = abi.decode(actionData, (uint256)); - _burnTokens(newBurnBalance); + _updateDestinationChainBurnedBalance(newBurnBalance); } else { revert("ERC20TokenSource: invalid action"); } diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index d8bf32a53..dacc1f895 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -84,13 +84,19 @@ contract NativeTokenSource is /** * @dev Sends tokens to BLACKHOLE_ADDRESS. */ - function _burnTokens(uint256 newBurnBalance) private { + function _burnTokens(uint256 amount) private { + payable(BLACKHOLE_ADDRESS).transfer(amount); + emit BurnTokens(amount); + } + + /** + * @dev Update destinationChainBurnedBalance sent from destination chain + */ + function _updateDestinationChainBurnedBalance(uint256 newBurnBalance) private { if (newBurnBalance > destinationChainBurnedBalance) { uint256 difference = newBurnBalance - destinationChainBurnedBalance; - - payable(BLACKHOLE_ADDRESS).transfer(difference); + _burnTokens(difference); destinationChainBurnedBalance = newBurnBalance; - emit BurnTokens(difference); } } @@ -137,7 +143,7 @@ contract NativeTokenSource is _unlockTokens(recipient, amount); } else if (action == SourceAction.Burn) { uint256 newBurnBalance = abi.decode(actionData, (uint256)); - _burnTokens(newBurnBalance); + _updateDestinationChainBurnedBalance(newBurnBalance); } else { revert("NativeTokenSource: invalid action"); } From 2d8365a2a14e49b0588fe8b35d2568ce09e51aec Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 20 Nov 2023 08:21:19 -0500 Subject: [PATCH 119/183] linter --- .../NativeTokenBridge/ERC20TokenSource.sol | 69 ++++++++++--------- .../NativeTokenBridge/NativeTokenSource.sol | 68 +++++++++--------- 2 files changed, 69 insertions(+), 68 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol index ddb88ab87..4a573d236 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol @@ -73,40 +73,6 @@ contract ERC20TokenSource is erc20ContractAddress = erc20ContractAddress_; } - /** - * @dev Unlocks tokens to recipient. - */ - function _unlockTokens(address recipient, uint256 amount) private { - require( - recipient != address(0), - "ERC20TokenSource: zero recipient address" - ); - - // Transfer to recipient - SafeERC20.safeTransfer(IERC20(erc20ContractAddress), recipient, amount); - - emit UnlockTokens(recipient, amount); - } - - /** - * @dev Sends tokens to BLACKHOLE_ADDRESS. - */ - function _burnTokens(uint256 amount) private { - payable(BLACKHOLE_ADDRESS).transfer(amount); - emit BurnTokens(amount); - } - - /** - * @dev Update destinationChainBurnedBalance sent from destination chain - */ - function _updateDestinationChainBurnedBalance(uint256 newBurnBalance) private { - if (newBurnBalance > destinationChainBurnedBalance) { - uint256 difference = newBurnBalance - destinationChainBurnedBalance; - _burnTokens(difference); - destinationChainBurnedBalance = newBurnBalance; - } - } - /** * @dev See {ITeleporterReceiver-receiveTeleporterMessage}. * @@ -218,4 +184,39 @@ contract ERC20TokenSource is teleporterMessageID: messageID }); } + + /** + * @dev Unlocks tokens to recipient. + */ + function _unlockTokens(address recipient, uint256 amount) private { + require( + recipient != address(0), + "ERC20TokenSource: zero recipient address" + ); + + // Transfer to recipient + SafeERC20.safeTransfer(IERC20(erc20ContractAddress), recipient, amount); + + emit UnlockTokens(recipient, amount); + } + + /** + * @dev Sends tokens to BLACKHOLE_ADDRESS. + */ + function _burnTokens(uint256 amount) private { + SafeERC20.safeTransfer(IERC20(erc20ContractAddress), BLACKHOLE_ADDRESS, amount); + emit BurnTokens(amount); + } + + /** + * @dev Update destinationChainBurnedBalance sent from destination chain + */ + function _updateDestinationChainBurnedBalance(uint256 newBurnBalance) private { + if (newBurnBalance > destinationChainBurnedBalance) { + uint256 difference = newBurnBalance - destinationChainBurnedBalance; + _burnTokens(difference); + destinationChainBurnedBalance = newBurnBalance; + } + } } + diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index dacc1f895..2e2efca90 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -66,40 +66,6 @@ contract NativeTokenSource is nativeTokenDestinationAddress = nativeTokenDestinationAddress_; } - /** - * @dev Unlocks tokens to recipient. - */ - function _unlockTokens(address recipient, uint256 amount) private { - require( - recipient != address(0), - "ERC20TokenSource: zero recipient address" - ); - - // Transfer to recipient - payable(recipient).transfer(amount); - - emit UnlockTokens(recipient, amount); - } - - /** - * @dev Sends tokens to BLACKHOLE_ADDRESS. - */ - function _burnTokens(uint256 amount) private { - payable(BLACKHOLE_ADDRESS).transfer(amount); - emit BurnTokens(amount); - } - - /** - * @dev Update destinationChainBurnedBalance sent from destination chain - */ - function _updateDestinationChainBurnedBalance(uint256 newBurnBalance) private { - if (newBurnBalance > destinationChainBurnedBalance) { - uint256 difference = newBurnBalance - destinationChainBurnedBalance; - _burnTokens(difference); - destinationChainBurnedBalance = newBurnBalance; - } - } - /** * @dev See {ITeleporterReceiver-receiveTeleporterMessage}. * @@ -193,4 +159,38 @@ contract NativeTokenSource is teleporterMessageID: messageID }); } + + /** + * @dev Unlocks tokens to recipient. + */ + function _unlockTokens(address recipient, uint256 amount) private { + require( + recipient != address(0), + "ERC20TokenSource: zero recipient address" + ); + + // Transfer to recipient + payable(recipient).transfer(amount); + + emit UnlockTokens(recipient, amount); + } + + /** + * @dev Sends tokens to BLACKHOLE_ADDRESS. + */ + function _burnTokens(uint256 amount) private { + payable(BLACKHOLE_ADDRESS).transfer(amount); + emit BurnTokens(amount); + } + + /** + * @dev Update destinationChainBurnedBalance sent from destination chain + */ + function _updateDestinationChainBurnedBalance(uint256 newBurnBalance) private { + if (newBurnBalance > destinationChainBurnedBalance) { + uint256 difference = newBurnBalance - destinationChainBurnedBalance; + _burnTokens(difference); + destinationChainBurnedBalance = newBurnBalance; + } + } } From 471b66ae38d70a77c06582a9b974f4424b62fd20 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 20 Nov 2023 09:28:10 -0500 Subject: [PATCH 120/183] Update README --- .../NativeTokenBridge/README.md | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/README.md b/contracts/src/CrossChainApplications/NativeTokenBridge/README.md index 38baf3041..aadf1b931 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/README.md +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/README.md @@ -1,29 +1,36 @@ -# Native-to-Native Token Bridge +# Native Token Bridge -A pair of smart contracts built on top of Teleporter to support using an ERC20 token or the native token of any `subnet-evm` chain as the native token for a given subnet. +A set of smart contracts - one `NativeTokenDestination` contract and one "TokenSource" contract, which can be either a `NativeTokenSource` contract or an `ERC20TokenSource` contract. These contracts are built on top of Teleporter to support using an ERC20 token or the native token of any `subnet-evm` chain as the native token for a given subnet. ## Design -The native-to-native bridge is implemented using two primary contracts. -### `NativeTokenSource` - - Lives on the Source chain. Pairs with exactly one `NativeTokenDestination` contract on a different chain. - - Locks and unlocks native tokens on the Source chain corresponding to mints and burns on the destination chain. - - `transferToDestination`: transfers all tokens paid to this function call to `recipient` on the destination chain by locking them and instructing the destination chain to mint. Optionally takes the address of an ERC20 contract `feeContractAddress` as well as an amount `feeAmount` that will be used as the relayer-incentivisation for the teleporter cross-chain call. Also allows for the caller to specify `allowedRelayerAddresses`. - - `receiveTeleporterMessage`: unlocks tokens on the source chain when instructed to by the `NativeTokenDestination` contract. ### `NativeTokenDestination` - - Lives on the Destination chain. Pairs with exactly one `NativeTokenSource` contract on a different chain. + - Lives on the Destination chain. Pairs with exactly one `NativeTokenSource` OR `ERC20TokenSource` contract on a different chain. - Mints and burns native tokens on the Destination chain corresponding to locks and unlocks on the source chain. - `transferToSource`: transfers all tokens paid to this function call to `recipient` on the source chain by burning the tokens and instructing the source chain to unlock. Optionally takes the address of an ERC20 contract `feeContractAddress` as well as an amount `feeAmount` that will be used as the relayer-incentivisation for the teleporter cross-chain call. Also allows for the caller to specify `allowedRelayerAddresses`. - `receiveTeleporterMessage`: mints tokens on the destination chain when instructed to by the `NativeTokenDestination` contract. + - `reportTotalBurnedTxFees` sends the balance of `BURNED_TX_FEES_ADDRESS` to the source chain. The source chain can then burn tokens to match the amount that has been burned in transaction fees on this chain. Always reports the total tokens ever burned, so this number is monotonically increasing. - `isCollateralized`: returns true if `currentReserveImbalance == 0`, meaning that enough tokens have been sent from the source chain to offset the `initialReserveImbalance`. If true, all tokens sent to the destination chain will be minted, and burning/unlocking tokens will be enabled. - `totalSupply`: Returns the best estimate of available native tokens on this chain. Equal to the `initialReserveImbalance` + `all tokens minted` - `all tokens in known burn address`. Known burn addresses include the burn address for this contract used when burning/unlocking, and the address for burned transaction fees. +### `NativeTokenSource` + - Lives on the Source chain. Pairs with exactly one `NativeTokenDestination` contract on a different chain. + - Locks and unlocks native tokens on the Source chain corresponding to mints and burns on the destination chain. + - `transferToDestination`: transfers all tokens paid to this function call to `recipient` on the destination chain by locking them and instructing the destination chain to mint. Optionally takes the address of an ERC20 contract `feeContractAddress` as well as an amount `feeAmount` that will be used as the relayer-incentivisation for the teleporter cross-chain call. Also allows for the caller to specify `allowedRelayerAddresses`. + - `receiveTeleporterMessage`: unlocks tokens on the source chain when instructed to by the `NativeTokenDestination` contract, or accepts a new total of tokens burned as tx fees on the destination chain, and burns and equivalent number of native tokens on this chain. + +### `ERC20TokenSource` + - Lives on the Source chain. Pairs with exactly one `NativeTokenDestination` contract on a different chain. + - Locks and unlocks ERC20 tokens on the Source chain corresponding to mints and burns on the destination chain. + - `transferToDestination`: transfers all tokens paid to this function call to `recipient` on the destination chain by locking them and instructing the destination chain to mint. Optionally takes an amount `feeAmount` that will be used as the relayer-incentivisation for the teleporter cross-chain call, using the same ERC20 contract that this contract was initialized with. Also allows for the caller to specify `allowedRelayerAddresses`. + - `receiveTeleporterMessage`: unlocks tokens on the source chain when instructed to by the `NativeTokenDestination` contract, or accepts a new total of tokens burned as tx fees on the destination chain, and burns and equivalent number of ERC20 tokens on this chain. + ### `Collateralizing the bridge` - On initialization, the bridge will be undercollateralized by exactly the number of tokens minted in the genesis block on the destination chain. These tokens could theoretically be sent through the bridge, with no corresponding tokens able to be unlocked on the source chain. In order to avoid this problem, the `NativeTokenDestination` contract is initialized with the value for `initialReserveImbalance`, which should correspond to the number of tokens allocated in the genesis block for the destination chain. If `initialReserveImbalance` is not properly set, behaviour of this contract is undefined. The `NativeTokenDestination` contract will not mint tokens until it has received confirmation that at least `initialReserveImbalance` tokens have been locked on the source chain. It should be up to the contract deployer to ensure that the bridge is properly collateralized. Burning/unlocking is disabled until the bridge is properly collateralized. ### `Burning tokens spent as fees` - As tokens are burned for transaction fees on the destination chain, contract owners may want to relay this information to the source chain in order to burn an equivalent number of locked tokens there because these tokens will never be bridged back. - The address for burned transaction fees is `0x0100000000000000000000000000000000000000`. When transferring token to the source chain, the "burned" tokens are sent here so that `0x0100000000000000000000000000000000000000` will only include burned transaction fees (or tokens others have decided to burn outside of this contract) so that this number can be reported to the source chain to burn an equivalent numbers of locked tokens. - - `TODO` explain implementation. + - Anyone on the destination can call `reportTotalBurnedTxFees`, which will provide the source chain with the total number of tokens burned in transactions on this chain. ## `Setup` - `TeleporterMessenger` must be deployed on both chains, and the address must be passed to the constructor of both contracts. @@ -31,4 +38,4 @@ The native-to-native bridge is implemented using two primary contracts. - Both `NativeTokenSource` and `NativeTokenDestination` need to be deployed to addresses known beforehand. Each address must be passed to the constructor of the other contract. To do this, you will need a known EOA, and preferably use the first transaction from the EOA (nonce 0) to deploy the contract on each chain. It is advised to allocate tokens to the EOA in the destination subnet genesis file so that it can easily deploy the contract. - Both contracts need to be initialized with `teleporterMessengerAddress`, which is the only address they will accept function calls from. - `NativeTokenDestination` needs to be intialized with `initialReserveImbalance`, which should equal the number of tokens allocated in the genesis file for the destination chain. If `initialReserveImbalance` is not properly set, behavior of these contracts in undefined. - - On the source chain, at least `initialReserveImbalance` tokens need to be transferred to `NativeTokenSource` using `transferToSource` in order to properly collateralize the bridge and allow regular functionality in both directions. The first `initialReserveImbalance` tokens will not be delivered to the recipient, but any excess will be delivered. Burning/unlocking is disabled until the bridge is fully collateralized. \ No newline at end of file + - On the source chain, at least `initialReserveImbalance` tokens need to be transferred to `TokenSource` using `transferToSource` in order to properly collateralize the bridge and allow regular functionality in both directions. The first `initialReserveImbalance` tokens will not be delivered to the recipient, but any excess will be delivered. Burning/unlocking is disabled until the bridge is fully collateralized. \ No newline at end of file From 5447a4e1a47b03255a0f843602869ca289356f13 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 20 Nov 2023 09:48:07 -0500 Subject: [PATCH 121/183] Native token bridge now uses TeleporterOwnerUpgradeable instead of teleporter directly --- .../ERC20TokenSource/ERC20TokenSource.go | 457 +++++++++++++++++- .../NativeTokenDestination.go | 457 +++++++++++++++++- .../NativeTokenSource/NativeTokenSource.go | 457 +++++++++++++++++- .../NativeTokenBridge/ERC20TokenSource.sol | 43 +- .../NativeTokenDestination.sol | 28 +- .../NativeTokenBridge/NativeTokenSource.sol | 38 +- 6 files changed, 1387 insertions(+), 93 deletions(-) diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go index 06add0d6e..903b6b236 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go @@ -31,7 +31,7 @@ var ( // ERC20TokenSourceMetaData contains all meta data concerning the ERC20TokenSource contract. var ERC20TokenSourceMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"erc20ContractAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"transferAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BLACKHOLE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationChainBurnedBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"erc20ContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterRegistryAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"erc20ContractAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"oldMinTeleporterVersion\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"newMinTeleporterVersion\",\"type\":\"uint256\"}],\"name\":\"MinTeleporterVersionUpdated\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"transferAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BLACKHOLE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationChainBurnedBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"erc20ContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minTeleporterVersion\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterRegistry\",\"outputs\":[{\"internalType\":\"contractTeleporterRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"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\":\"totalAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"updateMinTeleporterVersion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // ERC20TokenSourceABI is the input ABI used to generate the binding from. @@ -335,6 +335,37 @@ func (_ERC20TokenSource *ERC20TokenSourceCallerSession) Erc20ContractAddress() ( return _ERC20TokenSource.Contract.Erc20ContractAddress(&_ERC20TokenSource.CallOpts) } +// MinTeleporterVersion is a free data retrieval call binding the contract method 0xe49cc553. +// +// Solidity: function minTeleporterVersion() view returns(uint256) +func (_ERC20TokenSource *ERC20TokenSourceCaller) MinTeleporterVersion(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _ERC20TokenSource.contract.Call(opts, &out, "minTeleporterVersion") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// MinTeleporterVersion is a free data retrieval call binding the contract method 0xe49cc553. +// +// Solidity: function minTeleporterVersion() view returns(uint256) +func (_ERC20TokenSource *ERC20TokenSourceSession) MinTeleporterVersion() (*big.Int, error) { + return _ERC20TokenSource.Contract.MinTeleporterVersion(&_ERC20TokenSource.CallOpts) +} + +// MinTeleporterVersion is a free data retrieval call binding the contract method 0xe49cc553. +// +// Solidity: function minTeleporterVersion() view returns(uint256) +func (_ERC20TokenSource *ERC20TokenSourceCallerSession) MinTeleporterVersion() (*big.Int, error) { + return _ERC20TokenSource.Contract.MinTeleporterVersion(&_ERC20TokenSource.CallOpts) +} + // NativeTokenDestinationAddress is a free data retrieval call binding the contract method 0xb8c9091a. // // Solidity: function nativeTokenDestinationAddress() view returns(address) @@ -366,12 +397,12 @@ func (_ERC20TokenSource *ERC20TokenSourceCallerSession) NativeTokenDestinationAd return _ERC20TokenSource.Contract.NativeTokenDestinationAddress(&_ERC20TokenSource.CallOpts) } -// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. // -// Solidity: function teleporterMessenger() view returns(address) -func (_ERC20TokenSource *ERC20TokenSourceCaller) TeleporterMessenger(opts *bind.CallOpts) (common.Address, error) { +// Solidity: function owner() view returns(address) +func (_ERC20TokenSource *ERC20TokenSourceCaller) Owner(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _ERC20TokenSource.contract.Call(opts, &out, "teleporterMessenger") + err := _ERC20TokenSource.contract.Call(opts, &out, "owner") if err != nil { return *new(common.Address), err @@ -383,18 +414,49 @@ func (_ERC20TokenSource *ERC20TokenSourceCaller) TeleporterMessenger(opts *bind. } -// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. // -// Solidity: function teleporterMessenger() view returns(address) -func (_ERC20TokenSource *ERC20TokenSourceSession) TeleporterMessenger() (common.Address, error) { - return _ERC20TokenSource.Contract.TeleporterMessenger(&_ERC20TokenSource.CallOpts) +// Solidity: function owner() view returns(address) +func (_ERC20TokenSource *ERC20TokenSourceSession) Owner() (common.Address, error) { + return _ERC20TokenSource.Contract.Owner(&_ERC20TokenSource.CallOpts) } -// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. // -// Solidity: function teleporterMessenger() view returns(address) -func (_ERC20TokenSource *ERC20TokenSourceCallerSession) TeleporterMessenger() (common.Address, error) { - return _ERC20TokenSource.Contract.TeleporterMessenger(&_ERC20TokenSource.CallOpts) +// Solidity: function owner() view returns(address) +func (_ERC20TokenSource *ERC20TokenSourceCallerSession) Owner() (common.Address, error) { + return _ERC20TokenSource.Contract.Owner(&_ERC20TokenSource.CallOpts) +} + +// TeleporterRegistry is a free data retrieval call binding the contract method 0x1a7f5bec. +// +// Solidity: function teleporterRegistry() view returns(address) +func (_ERC20TokenSource *ERC20TokenSourceCaller) TeleporterRegistry(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _ERC20TokenSource.contract.Call(opts, &out, "teleporterRegistry") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// TeleporterRegistry is a free data retrieval call binding the contract method 0x1a7f5bec. +// +// Solidity: function teleporterRegistry() view returns(address) +func (_ERC20TokenSource *ERC20TokenSourceSession) TeleporterRegistry() (common.Address, error) { + return _ERC20TokenSource.Contract.TeleporterRegistry(&_ERC20TokenSource.CallOpts) +} + +// TeleporterRegistry is a free data retrieval call binding the contract method 0x1a7f5bec. +// +// Solidity: function teleporterRegistry() view returns(address) +func (_ERC20TokenSource *ERC20TokenSourceCallerSession) TeleporterRegistry() (common.Address, error) { + return _ERC20TokenSource.Contract.TeleporterRegistry(&_ERC20TokenSource.CallOpts) } // ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. @@ -418,6 +480,48 @@ func (_ERC20TokenSource *ERC20TokenSourceTransactorSession) ReceiveTeleporterMes return _ERC20TokenSource.Contract.ReceiveTeleporterMessage(&_ERC20TokenSource.TransactOpts, senderBlockchainID, senderAddress, message) } +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_ERC20TokenSource *ERC20TokenSourceTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ERC20TokenSource.contract.Transact(opts, "renounceOwnership") +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_ERC20TokenSource *ERC20TokenSourceSession) RenounceOwnership() (*types.Transaction, error) { + return _ERC20TokenSource.Contract.RenounceOwnership(&_ERC20TokenSource.TransactOpts) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_ERC20TokenSource *ERC20TokenSourceTransactorSession) RenounceOwnership() (*types.Transaction, error) { + return _ERC20TokenSource.Contract.RenounceOwnership(&_ERC20TokenSource.TransactOpts) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_ERC20TokenSource *ERC20TokenSourceTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { + return _ERC20TokenSource.contract.Transact(opts, "transferOwnership", newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_ERC20TokenSource *ERC20TokenSourceSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _ERC20TokenSource.Contract.TransferOwnership(&_ERC20TokenSource.TransactOpts, newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_ERC20TokenSource *ERC20TokenSourceTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _ERC20TokenSource.Contract.TransferOwnership(&_ERC20TokenSource.TransactOpts, newOwner) +} + // TransferToDestination is a paid mutator transaction binding the contract method 0x87a2edba. // // Solidity: function transferToDestination(address recipient, uint256 totalAmount, uint256 feeAmount, address[] allowedRelayerAddresses) returns() @@ -439,6 +543,27 @@ func (_ERC20TokenSource *ERC20TokenSourceTransactorSession) TransferToDestinatio return _ERC20TokenSource.Contract.TransferToDestination(&_ERC20TokenSource.TransactOpts, recipient, totalAmount, feeAmount, allowedRelayerAddresses) } +// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. +// +// Solidity: function updateMinTeleporterVersion() returns() +func (_ERC20TokenSource *ERC20TokenSourceTransactor) UpdateMinTeleporterVersion(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ERC20TokenSource.contract.Transact(opts, "updateMinTeleporterVersion") +} + +// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. +// +// Solidity: function updateMinTeleporterVersion() returns() +func (_ERC20TokenSource *ERC20TokenSourceSession) UpdateMinTeleporterVersion() (*types.Transaction, error) { + return _ERC20TokenSource.Contract.UpdateMinTeleporterVersion(&_ERC20TokenSource.TransactOpts) +} + +// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. +// +// Solidity: function updateMinTeleporterVersion() returns() +func (_ERC20TokenSource *ERC20TokenSourceTransactorSession) UpdateMinTeleporterVersion() (*types.Transaction, error) { + return _ERC20TokenSource.Contract.UpdateMinTeleporterVersion(&_ERC20TokenSource.TransactOpts) +} + // ERC20TokenSourceBurnTokensIterator is returned from FilterBurnTokens and is used to iterate over the raw logs and unpacked data for BurnTokens events raised by the ERC20TokenSource contract. type ERC20TokenSourceBurnTokensIterator struct { Event *ERC20TokenSourceBurnTokens // Event containing the contract specifics and raw log @@ -573,6 +698,312 @@ func (_ERC20TokenSource *ERC20TokenSourceFilterer) ParseBurnTokens(log types.Log return event, nil } +// ERC20TokenSourceMinTeleporterVersionUpdatedIterator is returned from FilterMinTeleporterVersionUpdated and is used to iterate over the raw logs and unpacked data for MinTeleporterVersionUpdated events raised by the ERC20TokenSource contract. +type ERC20TokenSourceMinTeleporterVersionUpdatedIterator struct { + Event *ERC20TokenSourceMinTeleporterVersionUpdated // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ERC20TokenSourceMinTeleporterVersionUpdatedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ERC20TokenSourceMinTeleporterVersionUpdated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ERC20TokenSourceMinTeleporterVersionUpdated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ERC20TokenSourceMinTeleporterVersionUpdatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ERC20TokenSourceMinTeleporterVersionUpdatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ERC20TokenSourceMinTeleporterVersionUpdated represents a MinTeleporterVersionUpdated event raised by the ERC20TokenSource contract. +type ERC20TokenSourceMinTeleporterVersionUpdated struct { + OldMinTeleporterVersion *big.Int + NewMinTeleporterVersion *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterMinTeleporterVersionUpdated is a free log retrieval operation binding the contract event 0xa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d. +// +// Solidity: event MinTeleporterVersionUpdated(uint256 indexed oldMinTeleporterVersion, uint256 indexed newMinTeleporterVersion) +func (_ERC20TokenSource *ERC20TokenSourceFilterer) FilterMinTeleporterVersionUpdated(opts *bind.FilterOpts, oldMinTeleporterVersion []*big.Int, newMinTeleporterVersion []*big.Int) (*ERC20TokenSourceMinTeleporterVersionUpdatedIterator, error) { + + var oldMinTeleporterVersionRule []interface{} + for _, oldMinTeleporterVersionItem := range oldMinTeleporterVersion { + oldMinTeleporterVersionRule = append(oldMinTeleporterVersionRule, oldMinTeleporterVersionItem) + } + var newMinTeleporterVersionRule []interface{} + for _, newMinTeleporterVersionItem := range newMinTeleporterVersion { + newMinTeleporterVersionRule = append(newMinTeleporterVersionRule, newMinTeleporterVersionItem) + } + + logs, sub, err := _ERC20TokenSource.contract.FilterLogs(opts, "MinTeleporterVersionUpdated", oldMinTeleporterVersionRule, newMinTeleporterVersionRule) + if err != nil { + return nil, err + } + return &ERC20TokenSourceMinTeleporterVersionUpdatedIterator{contract: _ERC20TokenSource.contract, event: "MinTeleporterVersionUpdated", logs: logs, sub: sub}, nil +} + +// WatchMinTeleporterVersionUpdated is a free log subscription operation binding the contract event 0xa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d. +// +// Solidity: event MinTeleporterVersionUpdated(uint256 indexed oldMinTeleporterVersion, uint256 indexed newMinTeleporterVersion) +func (_ERC20TokenSource *ERC20TokenSourceFilterer) WatchMinTeleporterVersionUpdated(opts *bind.WatchOpts, sink chan<- *ERC20TokenSourceMinTeleporterVersionUpdated, oldMinTeleporterVersion []*big.Int, newMinTeleporterVersion []*big.Int) (event.Subscription, error) { + + var oldMinTeleporterVersionRule []interface{} + for _, oldMinTeleporterVersionItem := range oldMinTeleporterVersion { + oldMinTeleporterVersionRule = append(oldMinTeleporterVersionRule, oldMinTeleporterVersionItem) + } + var newMinTeleporterVersionRule []interface{} + for _, newMinTeleporterVersionItem := range newMinTeleporterVersion { + newMinTeleporterVersionRule = append(newMinTeleporterVersionRule, newMinTeleporterVersionItem) + } + + logs, sub, err := _ERC20TokenSource.contract.WatchLogs(opts, "MinTeleporterVersionUpdated", oldMinTeleporterVersionRule, newMinTeleporterVersionRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ERC20TokenSourceMinTeleporterVersionUpdated) + if err := _ERC20TokenSource.contract.UnpackLog(event, "MinTeleporterVersionUpdated", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseMinTeleporterVersionUpdated is a log parse operation binding the contract event 0xa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d. +// +// Solidity: event MinTeleporterVersionUpdated(uint256 indexed oldMinTeleporterVersion, uint256 indexed newMinTeleporterVersion) +func (_ERC20TokenSource *ERC20TokenSourceFilterer) ParseMinTeleporterVersionUpdated(log types.Log) (*ERC20TokenSourceMinTeleporterVersionUpdated, error) { + event := new(ERC20TokenSourceMinTeleporterVersionUpdated) + if err := _ERC20TokenSource.contract.UnpackLog(event, "MinTeleporterVersionUpdated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ERC20TokenSourceOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the ERC20TokenSource contract. +type ERC20TokenSourceOwnershipTransferredIterator struct { + Event *ERC20TokenSourceOwnershipTransferred // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ERC20TokenSourceOwnershipTransferredIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ERC20TokenSourceOwnershipTransferred) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ERC20TokenSourceOwnershipTransferred) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ERC20TokenSourceOwnershipTransferredIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ERC20TokenSourceOwnershipTransferredIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ERC20TokenSourceOwnershipTransferred represents a OwnershipTransferred event raised by the ERC20TokenSource contract. +type ERC20TokenSourceOwnershipTransferred struct { + PreviousOwner common.Address + NewOwner common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_ERC20TokenSource *ERC20TokenSourceFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*ERC20TokenSourceOwnershipTransferredIterator, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _ERC20TokenSource.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return &ERC20TokenSourceOwnershipTransferredIterator{contract: _ERC20TokenSource.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil +} + +// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_ERC20TokenSource *ERC20TokenSourceFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *ERC20TokenSourceOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _ERC20TokenSource.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ERC20TokenSourceOwnershipTransferred) + if err := _ERC20TokenSource.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_ERC20TokenSource *ERC20TokenSourceFilterer) ParseOwnershipTransferred(log types.Log) (*ERC20TokenSourceOwnershipTransferred, error) { + event := new(ERC20TokenSourceOwnershipTransferred) + if err := _ERC20TokenSource.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + // ERC20TokenSourceTransferToDestinationIterator is returned from FilterTransferToDestination and is used to iterate over the raw logs and unpacked data for TransferToDestination events raised by the ERC20TokenSource contract. type ERC20TokenSourceTransferToDestinationIterator struct { Event *ERC20TokenSourceTransferToDestination // Event containing the contract specifics and raw log diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go index 5a66a5a8b..cb3bf1672 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go @@ -37,7 +37,7 @@ type TeleporterFeeInfo struct { // NativeTokenDestinationMetaData contains all meta data concerning the NativeTokenDestination contract. var NativeTokenDestinationMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialReserveImbalance_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"addedBy\",\"type\":\"address\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"burnAddressBalance\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"ReportTotalBurnedTxFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"REPORT_BURNED_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"reportTotalBurnedTxFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalMinted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterRegistryAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialReserveImbalance_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"addedBy\",\"type\":\"address\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"oldMinTeleporterVersion\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"newMinTeleporterVersion\",\"type\":\"uint256\"}],\"name\":\"MinTeleporterVersionUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"burnAddressBalance\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"ReportTotalBurnedTxFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"REPORT_BURNED_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minTeleporterVersion\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"reportTotalBurnedTxFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterRegistry\",\"outputs\":[{\"internalType\":\"contractTeleporterRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalMinted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"updateMinTeleporterVersion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // NativeTokenDestinationABI is the input ABI used to generate the binding from. @@ -341,6 +341,37 @@ func (_NativeTokenDestination *NativeTokenDestinationCallerSession) IsCollateral return _NativeTokenDestination.Contract.IsCollateralized(&_NativeTokenDestination.CallOpts) } +// MinTeleporterVersion is a free data retrieval call binding the contract method 0xe49cc553. +// +// Solidity: function minTeleporterVersion() view returns(uint256) +func (_NativeTokenDestination *NativeTokenDestinationCaller) MinTeleporterVersion(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _NativeTokenDestination.contract.Call(opts, &out, "minTeleporterVersion") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// MinTeleporterVersion is a free data retrieval call binding the contract method 0xe49cc553. +// +// Solidity: function minTeleporterVersion() view returns(uint256) +func (_NativeTokenDestination *NativeTokenDestinationSession) MinTeleporterVersion() (*big.Int, error) { + return _NativeTokenDestination.Contract.MinTeleporterVersion(&_NativeTokenDestination.CallOpts) +} + +// MinTeleporterVersion is a free data retrieval call binding the contract method 0xe49cc553. +// +// Solidity: function minTeleporterVersion() view returns(uint256) +func (_NativeTokenDestination *NativeTokenDestinationCallerSession) MinTeleporterVersion() (*big.Int, error) { + return _NativeTokenDestination.Contract.MinTeleporterVersion(&_NativeTokenDestination.CallOpts) +} + // NativeTokenSourceAddress is a free data retrieval call binding the contract method 0x5d93f9af. // // Solidity: function nativeTokenSourceAddress() view returns(address) @@ -372,6 +403,37 @@ func (_NativeTokenDestination *NativeTokenDestinationCallerSession) NativeTokenS return _NativeTokenDestination.Contract.NativeTokenSourceAddress(&_NativeTokenDestination.CallOpts) } +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_NativeTokenDestination *NativeTokenDestinationCaller) Owner(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _NativeTokenDestination.contract.Call(opts, &out, "owner") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_NativeTokenDestination *NativeTokenDestinationSession) Owner() (common.Address, error) { + return _NativeTokenDestination.Contract.Owner(&_NativeTokenDestination.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_NativeTokenDestination *NativeTokenDestinationCallerSession) Owner() (common.Address, error) { + return _NativeTokenDestination.Contract.Owner(&_NativeTokenDestination.CallOpts) +} + // SourceBlockchainID is a free data retrieval call binding the contract method 0x29b7b3fd. // // Solidity: function sourceBlockchainID() view returns(bytes32) @@ -403,12 +465,12 @@ func (_NativeTokenDestination *NativeTokenDestinationCallerSession) SourceBlockc return _NativeTokenDestination.Contract.SourceBlockchainID(&_NativeTokenDestination.CallOpts) } -// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// TeleporterRegistry is a free data retrieval call binding the contract method 0x1a7f5bec. // -// Solidity: function teleporterMessenger() view returns(address) -func (_NativeTokenDestination *NativeTokenDestinationCaller) TeleporterMessenger(opts *bind.CallOpts) (common.Address, error) { +// Solidity: function teleporterRegistry() view returns(address) +func (_NativeTokenDestination *NativeTokenDestinationCaller) TeleporterRegistry(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _NativeTokenDestination.contract.Call(opts, &out, "teleporterMessenger") + err := _NativeTokenDestination.contract.Call(opts, &out, "teleporterRegistry") if err != nil { return *new(common.Address), err @@ -420,18 +482,18 @@ func (_NativeTokenDestination *NativeTokenDestinationCaller) TeleporterMessenger } -// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// TeleporterRegistry is a free data retrieval call binding the contract method 0x1a7f5bec. // -// Solidity: function teleporterMessenger() view returns(address) -func (_NativeTokenDestination *NativeTokenDestinationSession) TeleporterMessenger() (common.Address, error) { - return _NativeTokenDestination.Contract.TeleporterMessenger(&_NativeTokenDestination.CallOpts) +// Solidity: function teleporterRegistry() view returns(address) +func (_NativeTokenDestination *NativeTokenDestinationSession) TeleporterRegistry() (common.Address, error) { + return _NativeTokenDestination.Contract.TeleporterRegistry(&_NativeTokenDestination.CallOpts) } -// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// TeleporterRegistry is a free data retrieval call binding the contract method 0x1a7f5bec. // -// Solidity: function teleporterMessenger() view returns(address) -func (_NativeTokenDestination *NativeTokenDestinationCallerSession) TeleporterMessenger() (common.Address, error) { - return _NativeTokenDestination.Contract.TeleporterMessenger(&_NativeTokenDestination.CallOpts) +// Solidity: function teleporterRegistry() view returns(address) +func (_NativeTokenDestination *NativeTokenDestinationCallerSession) TeleporterRegistry() (common.Address, error) { + return _NativeTokenDestination.Contract.TeleporterRegistry(&_NativeTokenDestination.CallOpts) } // TotalMinted is a free data retrieval call binding the contract method 0xa2309ff8. @@ -517,6 +579,27 @@ func (_NativeTokenDestination *NativeTokenDestinationTransactorSession) ReceiveT return _NativeTokenDestination.Contract.ReceiveTeleporterMessage(&_NativeTokenDestination.TransactOpts, senderBlockchainID, senderAddress, message) } +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_NativeTokenDestination *NativeTokenDestinationTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { + return _NativeTokenDestination.contract.Transact(opts, "renounceOwnership") +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_NativeTokenDestination *NativeTokenDestinationSession) RenounceOwnership() (*types.Transaction, error) { + return _NativeTokenDestination.Contract.RenounceOwnership(&_NativeTokenDestination.TransactOpts) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_NativeTokenDestination *NativeTokenDestinationTransactorSession) RenounceOwnership() (*types.Transaction, error) { + return _NativeTokenDestination.Contract.RenounceOwnership(&_NativeTokenDestination.TransactOpts) +} + // ReportTotalBurnedTxFees is a paid mutator transaction binding the contract method 0x3a94fe51. // // Solidity: function reportTotalBurnedTxFees((address,uint256) feeInfo, address[] allowedRelayerAddresses) returns() @@ -538,6 +621,27 @@ func (_NativeTokenDestination *NativeTokenDestinationTransactorSession) ReportTo return _NativeTokenDestination.Contract.ReportTotalBurnedTxFees(&_NativeTokenDestination.TransactOpts, feeInfo, allowedRelayerAddresses) } +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_NativeTokenDestination *NativeTokenDestinationTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { + return _NativeTokenDestination.contract.Transact(opts, "transferOwnership", newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_NativeTokenDestination *NativeTokenDestinationSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _NativeTokenDestination.Contract.TransferOwnership(&_NativeTokenDestination.TransactOpts, newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_NativeTokenDestination *NativeTokenDestinationTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _NativeTokenDestination.Contract.TransferOwnership(&_NativeTokenDestination.TransactOpts, newOwner) +} + // TransferToSource is a paid mutator transaction binding the contract method 0x75846562. // // Solidity: function transferToSource(address recipient, (address,uint256) feeInfo, address[] allowedRelayerAddresses) payable returns() @@ -559,6 +663,27 @@ func (_NativeTokenDestination *NativeTokenDestinationTransactorSession) Transfer return _NativeTokenDestination.Contract.TransferToSource(&_NativeTokenDestination.TransactOpts, recipient, feeInfo, allowedRelayerAddresses) } +// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. +// +// Solidity: function updateMinTeleporterVersion() returns() +func (_NativeTokenDestination *NativeTokenDestinationTransactor) UpdateMinTeleporterVersion(opts *bind.TransactOpts) (*types.Transaction, error) { + return _NativeTokenDestination.contract.Transact(opts, "updateMinTeleporterVersion") +} + +// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. +// +// Solidity: function updateMinTeleporterVersion() returns() +func (_NativeTokenDestination *NativeTokenDestinationSession) UpdateMinTeleporterVersion() (*types.Transaction, error) { + return _NativeTokenDestination.Contract.UpdateMinTeleporterVersion(&_NativeTokenDestination.TransactOpts) +} + +// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. +// +// Solidity: function updateMinTeleporterVersion() returns() +func (_NativeTokenDestination *NativeTokenDestinationTransactorSession) UpdateMinTeleporterVersion() (*types.Transaction, error) { + return _NativeTokenDestination.Contract.UpdateMinTeleporterVersion(&_NativeTokenDestination.TransactOpts) +} + // NativeTokenDestinationCollateralAddedIterator is returned from FilterCollateralAdded and is used to iterate over the raw logs and unpacked data for CollateralAdded events raised by the NativeTokenDestination contract. type NativeTokenDestinationCollateralAddedIterator struct { Event *NativeTokenDestinationCollateralAdded // Event containing the contract specifics and raw log @@ -695,6 +820,159 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) ParseCollateralAd return event, nil } +// NativeTokenDestinationMinTeleporterVersionUpdatedIterator is returned from FilterMinTeleporterVersionUpdated and is used to iterate over the raw logs and unpacked data for MinTeleporterVersionUpdated events raised by the NativeTokenDestination contract. +type NativeTokenDestinationMinTeleporterVersionUpdatedIterator struct { + Event *NativeTokenDestinationMinTeleporterVersionUpdated // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *NativeTokenDestinationMinTeleporterVersionUpdatedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(NativeTokenDestinationMinTeleporterVersionUpdated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(NativeTokenDestinationMinTeleporterVersionUpdated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *NativeTokenDestinationMinTeleporterVersionUpdatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *NativeTokenDestinationMinTeleporterVersionUpdatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// NativeTokenDestinationMinTeleporterVersionUpdated represents a MinTeleporterVersionUpdated event raised by the NativeTokenDestination contract. +type NativeTokenDestinationMinTeleporterVersionUpdated struct { + OldMinTeleporterVersion *big.Int + NewMinTeleporterVersion *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterMinTeleporterVersionUpdated is a free log retrieval operation binding the contract event 0xa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d. +// +// Solidity: event MinTeleporterVersionUpdated(uint256 indexed oldMinTeleporterVersion, uint256 indexed newMinTeleporterVersion) +func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterMinTeleporterVersionUpdated(opts *bind.FilterOpts, oldMinTeleporterVersion []*big.Int, newMinTeleporterVersion []*big.Int) (*NativeTokenDestinationMinTeleporterVersionUpdatedIterator, error) { + + var oldMinTeleporterVersionRule []interface{} + for _, oldMinTeleporterVersionItem := range oldMinTeleporterVersion { + oldMinTeleporterVersionRule = append(oldMinTeleporterVersionRule, oldMinTeleporterVersionItem) + } + var newMinTeleporterVersionRule []interface{} + for _, newMinTeleporterVersionItem := range newMinTeleporterVersion { + newMinTeleporterVersionRule = append(newMinTeleporterVersionRule, newMinTeleporterVersionItem) + } + + logs, sub, err := _NativeTokenDestination.contract.FilterLogs(opts, "MinTeleporterVersionUpdated", oldMinTeleporterVersionRule, newMinTeleporterVersionRule) + if err != nil { + return nil, err + } + return &NativeTokenDestinationMinTeleporterVersionUpdatedIterator{contract: _NativeTokenDestination.contract, event: "MinTeleporterVersionUpdated", logs: logs, sub: sub}, nil +} + +// WatchMinTeleporterVersionUpdated is a free log subscription operation binding the contract event 0xa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d. +// +// Solidity: event MinTeleporterVersionUpdated(uint256 indexed oldMinTeleporterVersion, uint256 indexed newMinTeleporterVersion) +func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchMinTeleporterVersionUpdated(opts *bind.WatchOpts, sink chan<- *NativeTokenDestinationMinTeleporterVersionUpdated, oldMinTeleporterVersion []*big.Int, newMinTeleporterVersion []*big.Int) (event.Subscription, error) { + + var oldMinTeleporterVersionRule []interface{} + for _, oldMinTeleporterVersionItem := range oldMinTeleporterVersion { + oldMinTeleporterVersionRule = append(oldMinTeleporterVersionRule, oldMinTeleporterVersionItem) + } + var newMinTeleporterVersionRule []interface{} + for _, newMinTeleporterVersionItem := range newMinTeleporterVersion { + newMinTeleporterVersionRule = append(newMinTeleporterVersionRule, newMinTeleporterVersionItem) + } + + logs, sub, err := _NativeTokenDestination.contract.WatchLogs(opts, "MinTeleporterVersionUpdated", oldMinTeleporterVersionRule, newMinTeleporterVersionRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(NativeTokenDestinationMinTeleporterVersionUpdated) + if err := _NativeTokenDestination.contract.UnpackLog(event, "MinTeleporterVersionUpdated", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseMinTeleporterVersionUpdated is a log parse operation binding the contract event 0xa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d. +// +// Solidity: event MinTeleporterVersionUpdated(uint256 indexed oldMinTeleporterVersion, uint256 indexed newMinTeleporterVersion) +func (_NativeTokenDestination *NativeTokenDestinationFilterer) ParseMinTeleporterVersionUpdated(log types.Log) (*NativeTokenDestinationMinTeleporterVersionUpdated, error) { + event := new(NativeTokenDestinationMinTeleporterVersionUpdated) + if err := _NativeTokenDestination.contract.UnpackLog(event, "MinTeleporterVersionUpdated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + // NativeTokenDestinationNativeTokensMintedIterator is returned from FilterNativeTokensMinted and is used to iterate over the raw logs and unpacked data for NativeTokensMinted events raised by the NativeTokenDestination contract. type NativeTokenDestinationNativeTokensMintedIterator struct { Event *NativeTokenDestinationNativeTokensMinted // Event containing the contract specifics and raw log @@ -840,6 +1118,159 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) ParseNativeTokens return event, nil } +// NativeTokenDestinationOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the NativeTokenDestination contract. +type NativeTokenDestinationOwnershipTransferredIterator struct { + Event *NativeTokenDestinationOwnershipTransferred // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *NativeTokenDestinationOwnershipTransferredIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(NativeTokenDestinationOwnershipTransferred) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(NativeTokenDestinationOwnershipTransferred) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *NativeTokenDestinationOwnershipTransferredIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *NativeTokenDestinationOwnershipTransferredIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// NativeTokenDestinationOwnershipTransferred represents a OwnershipTransferred event raised by the NativeTokenDestination contract. +type NativeTokenDestinationOwnershipTransferred struct { + PreviousOwner common.Address + NewOwner common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*NativeTokenDestinationOwnershipTransferredIterator, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _NativeTokenDestination.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return &NativeTokenDestinationOwnershipTransferredIterator{contract: _NativeTokenDestination.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil +} + +// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *NativeTokenDestinationOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _NativeTokenDestination.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(NativeTokenDestinationOwnershipTransferred) + if err := _NativeTokenDestination.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_NativeTokenDestination *NativeTokenDestinationFilterer) ParseOwnershipTransferred(log types.Log) (*NativeTokenDestinationOwnershipTransferred, error) { + event := new(NativeTokenDestinationOwnershipTransferred) + if err := _NativeTokenDestination.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + // NativeTokenDestinationReportTotalBurnedTxFeesIterator is returned from FilterReportTotalBurnedTxFees and is used to iterate over the raw logs and unpacked data for ReportTotalBurnedTxFees events raised by the NativeTokenDestination contract. type NativeTokenDestinationReportTotalBurnedTxFeesIterator struct { Event *NativeTokenDestinationReportTotalBurnedTxFees // Event containing the contract specifics and raw log diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go index 8a01880ba..caedff794 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go @@ -37,7 +37,7 @@ type TeleporterFeeInfo struct { // NativeTokenSourceMetaData contains all meta data concerning the NativeTokenSource contract. var NativeTokenSourceMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BLACKHOLE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationChainBurnedBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterRegistryAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"oldMinTeleporterVersion\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"newMinTeleporterVersion\",\"type\":\"uint256\"}],\"name\":\"MinTeleporterVersionUpdated\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BLACKHOLE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationChainBurnedBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minTeleporterVersion\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterRegistry\",\"outputs\":[{\"internalType\":\"contractTeleporterRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"updateMinTeleporterVersion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // NativeTokenSourceABI is the input ABI used to generate the binding from. @@ -310,6 +310,37 @@ func (_NativeTokenSource *NativeTokenSourceCallerSession) DestinationChainBurned return _NativeTokenSource.Contract.DestinationChainBurnedBalance(&_NativeTokenSource.CallOpts) } +// MinTeleporterVersion is a free data retrieval call binding the contract method 0xe49cc553. +// +// Solidity: function minTeleporterVersion() view returns(uint256) +func (_NativeTokenSource *NativeTokenSourceCaller) MinTeleporterVersion(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _NativeTokenSource.contract.Call(opts, &out, "minTeleporterVersion") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// MinTeleporterVersion is a free data retrieval call binding the contract method 0xe49cc553. +// +// Solidity: function minTeleporterVersion() view returns(uint256) +func (_NativeTokenSource *NativeTokenSourceSession) MinTeleporterVersion() (*big.Int, error) { + return _NativeTokenSource.Contract.MinTeleporterVersion(&_NativeTokenSource.CallOpts) +} + +// MinTeleporterVersion is a free data retrieval call binding the contract method 0xe49cc553. +// +// Solidity: function minTeleporterVersion() view returns(uint256) +func (_NativeTokenSource *NativeTokenSourceCallerSession) MinTeleporterVersion() (*big.Int, error) { + return _NativeTokenSource.Contract.MinTeleporterVersion(&_NativeTokenSource.CallOpts) +} + // NativeTokenDestinationAddress is a free data retrieval call binding the contract method 0xb8c9091a. // // Solidity: function nativeTokenDestinationAddress() view returns(address) @@ -341,12 +372,12 @@ func (_NativeTokenSource *NativeTokenSourceCallerSession) NativeTokenDestination return _NativeTokenSource.Contract.NativeTokenDestinationAddress(&_NativeTokenSource.CallOpts) } -// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. // -// Solidity: function teleporterMessenger() view returns(address) -func (_NativeTokenSource *NativeTokenSourceCaller) TeleporterMessenger(opts *bind.CallOpts) (common.Address, error) { +// Solidity: function owner() view returns(address) +func (_NativeTokenSource *NativeTokenSourceCaller) Owner(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _NativeTokenSource.contract.Call(opts, &out, "teleporterMessenger") + err := _NativeTokenSource.contract.Call(opts, &out, "owner") if err != nil { return *new(common.Address), err @@ -358,18 +389,49 @@ func (_NativeTokenSource *NativeTokenSourceCaller) TeleporterMessenger(opts *bin } -// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. // -// Solidity: function teleporterMessenger() view returns(address) -func (_NativeTokenSource *NativeTokenSourceSession) TeleporterMessenger() (common.Address, error) { - return _NativeTokenSource.Contract.TeleporterMessenger(&_NativeTokenSource.CallOpts) +// Solidity: function owner() view returns(address) +func (_NativeTokenSource *NativeTokenSourceSession) Owner() (common.Address, error) { + return _NativeTokenSource.Contract.Owner(&_NativeTokenSource.CallOpts) } -// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. // -// Solidity: function teleporterMessenger() view returns(address) -func (_NativeTokenSource *NativeTokenSourceCallerSession) TeleporterMessenger() (common.Address, error) { - return _NativeTokenSource.Contract.TeleporterMessenger(&_NativeTokenSource.CallOpts) +// Solidity: function owner() view returns(address) +func (_NativeTokenSource *NativeTokenSourceCallerSession) Owner() (common.Address, error) { + return _NativeTokenSource.Contract.Owner(&_NativeTokenSource.CallOpts) +} + +// TeleporterRegistry is a free data retrieval call binding the contract method 0x1a7f5bec. +// +// Solidity: function teleporterRegistry() view returns(address) +func (_NativeTokenSource *NativeTokenSourceCaller) TeleporterRegistry(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _NativeTokenSource.contract.Call(opts, &out, "teleporterRegistry") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// TeleporterRegistry is a free data retrieval call binding the contract method 0x1a7f5bec. +// +// Solidity: function teleporterRegistry() view returns(address) +func (_NativeTokenSource *NativeTokenSourceSession) TeleporterRegistry() (common.Address, error) { + return _NativeTokenSource.Contract.TeleporterRegistry(&_NativeTokenSource.CallOpts) +} + +// TeleporterRegistry is a free data retrieval call binding the contract method 0x1a7f5bec. +// +// Solidity: function teleporterRegistry() view returns(address) +func (_NativeTokenSource *NativeTokenSourceCallerSession) TeleporterRegistry() (common.Address, error) { + return _NativeTokenSource.Contract.TeleporterRegistry(&_NativeTokenSource.CallOpts) } // ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. @@ -393,6 +455,48 @@ func (_NativeTokenSource *NativeTokenSourceTransactorSession) ReceiveTeleporterM return _NativeTokenSource.Contract.ReceiveTeleporterMessage(&_NativeTokenSource.TransactOpts, senderBlockchainID, senderAddress, message) } +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_NativeTokenSource *NativeTokenSourceTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { + return _NativeTokenSource.contract.Transact(opts, "renounceOwnership") +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_NativeTokenSource *NativeTokenSourceSession) RenounceOwnership() (*types.Transaction, error) { + return _NativeTokenSource.Contract.RenounceOwnership(&_NativeTokenSource.TransactOpts) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_NativeTokenSource *NativeTokenSourceTransactorSession) RenounceOwnership() (*types.Transaction, error) { + return _NativeTokenSource.Contract.RenounceOwnership(&_NativeTokenSource.TransactOpts) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_NativeTokenSource *NativeTokenSourceTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { + return _NativeTokenSource.contract.Transact(opts, "transferOwnership", newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_NativeTokenSource *NativeTokenSourceSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _NativeTokenSource.Contract.TransferOwnership(&_NativeTokenSource.TransactOpts, newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_NativeTokenSource *NativeTokenSourceTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _NativeTokenSource.Contract.TransferOwnership(&_NativeTokenSource.TransactOpts, newOwner) +} + // TransferToDestination is a paid mutator transaction binding the contract method 0xad0aee25. // // Solidity: function transferToDestination(address recipient, (address,uint256) feeInfo, address[] allowedRelayerAddresses) payable returns() @@ -414,6 +518,27 @@ func (_NativeTokenSource *NativeTokenSourceTransactorSession) TransferToDestinat return _NativeTokenSource.Contract.TransferToDestination(&_NativeTokenSource.TransactOpts, recipient, feeInfo, allowedRelayerAddresses) } +// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. +// +// Solidity: function updateMinTeleporterVersion() returns() +func (_NativeTokenSource *NativeTokenSourceTransactor) UpdateMinTeleporterVersion(opts *bind.TransactOpts) (*types.Transaction, error) { + return _NativeTokenSource.contract.Transact(opts, "updateMinTeleporterVersion") +} + +// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. +// +// Solidity: function updateMinTeleporterVersion() returns() +func (_NativeTokenSource *NativeTokenSourceSession) UpdateMinTeleporterVersion() (*types.Transaction, error) { + return _NativeTokenSource.Contract.UpdateMinTeleporterVersion(&_NativeTokenSource.TransactOpts) +} + +// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. +// +// Solidity: function updateMinTeleporterVersion() returns() +func (_NativeTokenSource *NativeTokenSourceTransactorSession) UpdateMinTeleporterVersion() (*types.Transaction, error) { + return _NativeTokenSource.Contract.UpdateMinTeleporterVersion(&_NativeTokenSource.TransactOpts) +} + // NativeTokenSourceBurnTokensIterator is returned from FilterBurnTokens and is used to iterate over the raw logs and unpacked data for BurnTokens events raised by the NativeTokenSource contract. type NativeTokenSourceBurnTokensIterator struct { Event *NativeTokenSourceBurnTokens // Event containing the contract specifics and raw log @@ -548,6 +673,312 @@ func (_NativeTokenSource *NativeTokenSourceFilterer) ParseBurnTokens(log types.L return event, nil } +// NativeTokenSourceMinTeleporterVersionUpdatedIterator is returned from FilterMinTeleporterVersionUpdated and is used to iterate over the raw logs and unpacked data for MinTeleporterVersionUpdated events raised by the NativeTokenSource contract. +type NativeTokenSourceMinTeleporterVersionUpdatedIterator struct { + Event *NativeTokenSourceMinTeleporterVersionUpdated // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *NativeTokenSourceMinTeleporterVersionUpdatedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(NativeTokenSourceMinTeleporterVersionUpdated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(NativeTokenSourceMinTeleporterVersionUpdated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *NativeTokenSourceMinTeleporterVersionUpdatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *NativeTokenSourceMinTeleporterVersionUpdatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// NativeTokenSourceMinTeleporterVersionUpdated represents a MinTeleporterVersionUpdated event raised by the NativeTokenSource contract. +type NativeTokenSourceMinTeleporterVersionUpdated struct { + OldMinTeleporterVersion *big.Int + NewMinTeleporterVersion *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterMinTeleporterVersionUpdated is a free log retrieval operation binding the contract event 0xa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d. +// +// Solidity: event MinTeleporterVersionUpdated(uint256 indexed oldMinTeleporterVersion, uint256 indexed newMinTeleporterVersion) +func (_NativeTokenSource *NativeTokenSourceFilterer) FilterMinTeleporterVersionUpdated(opts *bind.FilterOpts, oldMinTeleporterVersion []*big.Int, newMinTeleporterVersion []*big.Int) (*NativeTokenSourceMinTeleporterVersionUpdatedIterator, error) { + + var oldMinTeleporterVersionRule []interface{} + for _, oldMinTeleporterVersionItem := range oldMinTeleporterVersion { + oldMinTeleporterVersionRule = append(oldMinTeleporterVersionRule, oldMinTeleporterVersionItem) + } + var newMinTeleporterVersionRule []interface{} + for _, newMinTeleporterVersionItem := range newMinTeleporterVersion { + newMinTeleporterVersionRule = append(newMinTeleporterVersionRule, newMinTeleporterVersionItem) + } + + logs, sub, err := _NativeTokenSource.contract.FilterLogs(opts, "MinTeleporterVersionUpdated", oldMinTeleporterVersionRule, newMinTeleporterVersionRule) + if err != nil { + return nil, err + } + return &NativeTokenSourceMinTeleporterVersionUpdatedIterator{contract: _NativeTokenSource.contract, event: "MinTeleporterVersionUpdated", logs: logs, sub: sub}, nil +} + +// WatchMinTeleporterVersionUpdated is a free log subscription operation binding the contract event 0xa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d. +// +// Solidity: event MinTeleporterVersionUpdated(uint256 indexed oldMinTeleporterVersion, uint256 indexed newMinTeleporterVersion) +func (_NativeTokenSource *NativeTokenSourceFilterer) WatchMinTeleporterVersionUpdated(opts *bind.WatchOpts, sink chan<- *NativeTokenSourceMinTeleporterVersionUpdated, oldMinTeleporterVersion []*big.Int, newMinTeleporterVersion []*big.Int) (event.Subscription, error) { + + var oldMinTeleporterVersionRule []interface{} + for _, oldMinTeleporterVersionItem := range oldMinTeleporterVersion { + oldMinTeleporterVersionRule = append(oldMinTeleporterVersionRule, oldMinTeleporterVersionItem) + } + var newMinTeleporterVersionRule []interface{} + for _, newMinTeleporterVersionItem := range newMinTeleporterVersion { + newMinTeleporterVersionRule = append(newMinTeleporterVersionRule, newMinTeleporterVersionItem) + } + + logs, sub, err := _NativeTokenSource.contract.WatchLogs(opts, "MinTeleporterVersionUpdated", oldMinTeleporterVersionRule, newMinTeleporterVersionRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(NativeTokenSourceMinTeleporterVersionUpdated) + if err := _NativeTokenSource.contract.UnpackLog(event, "MinTeleporterVersionUpdated", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseMinTeleporterVersionUpdated is a log parse operation binding the contract event 0xa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d. +// +// Solidity: event MinTeleporterVersionUpdated(uint256 indexed oldMinTeleporterVersion, uint256 indexed newMinTeleporterVersion) +func (_NativeTokenSource *NativeTokenSourceFilterer) ParseMinTeleporterVersionUpdated(log types.Log) (*NativeTokenSourceMinTeleporterVersionUpdated, error) { + event := new(NativeTokenSourceMinTeleporterVersionUpdated) + if err := _NativeTokenSource.contract.UnpackLog(event, "MinTeleporterVersionUpdated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// NativeTokenSourceOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the NativeTokenSource contract. +type NativeTokenSourceOwnershipTransferredIterator struct { + Event *NativeTokenSourceOwnershipTransferred // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *NativeTokenSourceOwnershipTransferredIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(NativeTokenSourceOwnershipTransferred) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(NativeTokenSourceOwnershipTransferred) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *NativeTokenSourceOwnershipTransferredIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *NativeTokenSourceOwnershipTransferredIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// NativeTokenSourceOwnershipTransferred represents a OwnershipTransferred event raised by the NativeTokenSource contract. +type NativeTokenSourceOwnershipTransferred struct { + PreviousOwner common.Address + NewOwner common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_NativeTokenSource *NativeTokenSourceFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*NativeTokenSourceOwnershipTransferredIterator, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _NativeTokenSource.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return &NativeTokenSourceOwnershipTransferredIterator{contract: _NativeTokenSource.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil +} + +// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_NativeTokenSource *NativeTokenSourceFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *NativeTokenSourceOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _NativeTokenSource.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(NativeTokenSourceOwnershipTransferred) + if err := _NativeTokenSource.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_NativeTokenSource *NativeTokenSourceFilterer) ParseOwnershipTransferred(log types.Log) (*NativeTokenSourceOwnershipTransferred, error) { + event := new(NativeTokenSourceOwnershipTransferred) + if err := _NativeTokenSource.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + // NativeTokenSourceTransferToDestinationIterator is returned from FilterTransferToDestination and is used to iterate over the raw logs and unpacked data for TransferToDestination events raised by the NativeTokenSource contract. type NativeTokenSourceTransferToDestinationIterator struct { Event *NativeTokenSourceTransferToDestination // Event containing the contract specifics and raw log diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol index 4a573d236..9a7fdcb0b 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol @@ -10,6 +10,7 @@ import {IWarpMessenger} from "@subnet-evm-contracts/interfaces/IWarpMessenger.so import {IERC20TokenSource} from "./IERC20TokenSource.sol"; import {ITokenSource} from "./ITokenSource.sol"; import {ITeleporterMessenger, TeleporterMessageInput, TeleporterFeeInfo} from "../../Teleporter/ITeleporterMessenger.sol"; +import {TeleporterOwnerUpgradeable} from "../../Teleporter/upgrades/TeleporterOwnerUpgradeable.sol"; import {ITeleporterReceiver} from "../../Teleporter/ITeleporterReceiver.sol"; import {SafeERC20TransferFrom} from "../../Teleporter/SafeERC20TransferFrom.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; @@ -17,6 +18,7 @@ import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol contract ERC20TokenSource is ITeleporterReceiver, + TeleporterOwnerUpgradeable, IERC20TokenSource, ITokenSource, ReentrancyGuard @@ -24,7 +26,8 @@ contract ERC20TokenSource is // Designated Blackhole Address. Tokens are sent here to be "burned" before sending an unlock // message to the source chain. Different from the burned tx fee address so they can be // tracked separately. - address public constant BLACKHOLE_ADDRESS = 0x0100000000000000000000000000000000000001; + address public constant BLACKHOLE_ADDRESS = + 0x0100000000000000000000000000000000000001; uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 100_000; // Used to keep track of tokens burned through transactions on the destination chain. They can // be reported to this contract to burn an equivalent number of tokens on this chain. @@ -33,20 +36,16 @@ contract ERC20TokenSource is address public immutable nativeTokenDestinationAddress; address public immutable erc20ContractAddress; - // Used for sending and receiving Teleporter messages. - ITeleporterMessenger public immutable teleporterMessenger; - constructor( - address teleporterMessengerAddress, + address teleporterRegistryAddress, bytes32 destinationBlockchainID_, address nativeTokenDestinationAddress_, address erc20ContractAddress_ - ) { + ) TeleporterOwnerUpgradeable(teleporterRegistryAddress) { require( - teleporterMessengerAddress != address(0), - "ERC20TokenSource: zero TeleporterMessenger address" + teleporterRegistryAddress != address(0), + "NativeTokenSource: zero TeleporterRegistry address" ); - teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); require( destinationBlockchainID_ != bytes32(0), @@ -82,13 +81,7 @@ contract ERC20TokenSource is bytes32 senderBlockchainID, address senderAddress, bytes calldata message - ) external nonReentrant { - // Only allow the Teleporter messenger to deliver messages. - require( - msg.sender == address(teleporterMessenger), - "ERC20TokenSource: unauthorized TeleporterMessenger contract" - ); - + ) external onlyAllowedTeleporter nonReentrant { // Only allow messages from the destination chain. require( senderBlockchainID == destinationBlockchainID, @@ -131,6 +124,9 @@ contract ERC20TokenSource is uint256 feeAmount, address[] calldata allowedRelayerAddresses ) external nonReentrant { + ITeleporterMessenger teleporterMessenger = teleporterRegistry + .getLatestTeleporter(); + // The recipient cannot be the zero address. require( recipient != address(0), @@ -204,14 +200,20 @@ contract ERC20TokenSource is * @dev Sends tokens to BLACKHOLE_ADDRESS. */ function _burnTokens(uint256 amount) private { - SafeERC20.safeTransfer(IERC20(erc20ContractAddress), BLACKHOLE_ADDRESS, amount); - emit BurnTokens(amount); - } + SafeERC20.safeTransfer( + IERC20(erc20ContractAddress), + BLACKHOLE_ADDRESS, + amount + ); + emit BurnTokens(amount); + } /** * @dev Update destinationChainBurnedBalance sent from destination chain */ - function _updateDestinationChainBurnedBalance(uint256 newBurnBalance) private { + function _updateDestinationChainBurnedBalance( + uint256 newBurnBalance + ) private { if (newBurnBalance > destinationChainBurnedBalance) { uint256 difference = newBurnBalance - destinationChainBurnedBalance; _burnTokens(difference); @@ -219,4 +221,3 @@ contract ERC20TokenSource is } } } - diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index 39b47ffe8..cb111ca80 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -11,6 +11,7 @@ import {INativeMinter} from "@subnet-evm-contracts/interfaces/INativeMinter.sol" import {INativeTokenDestination} from "./INativeTokenDestination.sol"; import {ITokenSource} from "./ITokenSource.sol"; import {ITeleporterMessenger, TeleporterFeeInfo, TeleporterMessageInput} from "../../Teleporter/ITeleporterMessenger.sol"; +import {TeleporterOwnerUpgradeable} from "../../Teleporter/upgrades/TeleporterOwnerUpgradeable.sol"; import {ITeleporterReceiver} from "../../Teleporter/ITeleporterReceiver.sol"; import {SafeERC20TransferFrom} from "../../Teleporter/SafeERC20TransferFrom.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; @@ -29,6 +30,7 @@ address constant BLACKHOLE_ADDRESS = 0x0100000000000000000000000000000000000001; contract NativeTokenDestination is ITeleporterReceiver, + TeleporterOwnerUpgradeable, INativeTokenDestination, ReentrancyGuard { @@ -46,20 +48,16 @@ contract NativeTokenDestination is uint256 public currentReserveImbalance; uint256 public totalMinted = 0; - // Used for sending and receiving Teleporter messages. - ITeleporterMessenger public immutable teleporterMessenger; - constructor( - address teleporterMessengerAddress, + address teleporterRegistryAddress, bytes32 sourceBlockchainID_, address nativeTokenSourceAddress_, uint256 initialReserveImbalance_ - ) { + ) TeleporterOwnerUpgradeable(teleporterRegistryAddress) { require( - teleporterMessengerAddress != address(0), - "NativeTokenDestination: zero TeleporterMessenger address" + teleporterRegistryAddress != address(0), + "NativeTokenSource: zero TeleporterRegistry address" ); - teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); require( sourceBlockchainID_ != bytes32(0), @@ -92,13 +90,7 @@ contract NativeTokenDestination is bytes32 senderBlockchainID, address senderAddress, bytes calldata message - ) external nonReentrant { - // Only allow the Teleporter messenger to deliver messages. - require( - msg.sender == address(teleporterMessenger), - "NativeTokenDestination: unauthorized TeleporterMessenger contract" - ); - + ) external onlyAllowedTeleporter nonReentrant { // Only allow messages from the source chain. require( senderBlockchainID == sourceBlockchainID, @@ -159,6 +151,9 @@ contract NativeTokenDestination is TeleporterFeeInfo calldata feeInfo, address[] calldata allowedRelayerAddresses ) external payable nonReentrant { + ITeleporterMessenger teleporterMessenger = teleporterRegistry + .getLatestTeleporter(); + // The recipient cannot be the zero address. require( recipient != address(0), @@ -218,6 +213,9 @@ contract NativeTokenDestination is TeleporterFeeInfo calldata feeInfo, address[] calldata allowedRelayerAddresses ) external { + ITeleporterMessenger teleporterMessenger = teleporterRegistry + .getLatestTeleporter(); + uint256 totalBurnedTxFees = address(BURNED_TX_FEES_ADDRESS).balance; uint256 messageID = teleporterMessenger.sendCrossChainMessage( TeleporterMessageInput({ diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index 2e2efca90..72f604850 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -10,6 +10,7 @@ import {IWarpMessenger} from "@subnet-evm-contracts/interfaces/IWarpMessenger.so import {INativeTokenSource} from "./INativeTokenSource.sol"; import {ITokenSource} from "./ITokenSource.sol"; import {ITeleporterMessenger, TeleporterFeeInfo, TeleporterMessageInput} from "../../Teleporter/ITeleporterMessenger.sol"; +import {TeleporterOwnerUpgradeable} from "../../Teleporter/upgrades/TeleporterOwnerUpgradeable.sol"; import {ITeleporterReceiver} from "../../Teleporter/ITeleporterReceiver.sol"; import {SafeERC20TransferFrom} from "../../Teleporter/SafeERC20TransferFrom.sol"; import {SafeERC20TransferFrom} from "../../Teleporter/SafeERC20TransferFrom.sol"; @@ -18,6 +19,7 @@ import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol contract NativeTokenSource is ITeleporterReceiver, + TeleporterOwnerUpgradeable, INativeTokenSource, ITokenSource, ReentrancyGuard @@ -25,7 +27,8 @@ contract NativeTokenSource is // Designated Blackhole Address. Tokens are sent here to be "burned" before sending an unlock // message to the source chain. Different from the burned tx fee address so they can be // tracked separately. - address public constant BLACKHOLE_ADDRESS = 0x0100000000000000000000000000000000000001; + address public constant BLACKHOLE_ADDRESS = + 0x0100000000000000000000000000000000000001; uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 100_000; // Used to keep track of tokens burned through transactions on the destination chain. They can // be reported to this contract to burn an equivalent number of tokens on this chain. @@ -33,19 +36,15 @@ contract NativeTokenSource is bytes32 public immutable destinationBlockchainID; address public immutable nativeTokenDestinationAddress; - // Used for sending and receiving Teleporter messages. - ITeleporterMessenger public immutable teleporterMessenger; - constructor( - address teleporterMessengerAddress, + address teleporterRegistryAddress, bytes32 destinationBlockchainID_, address nativeTokenDestinationAddress_ - ) { + ) TeleporterOwnerUpgradeable(teleporterRegistryAddress) { require( - teleporterMessengerAddress != address(0), - "NativeTokenSource: zero TeleporterMessenger address" + teleporterRegistryAddress != address(0), + "NativeTokenSource: zero TeleporterRegistry address" ); - teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); require( destinationBlockchainID_ != bytes32(0), @@ -75,13 +74,7 @@ contract NativeTokenSource is bytes32 senderBlockchainID, address senderAddress, bytes calldata message - ) external nonReentrant { - // Only allow the Teleporter messenger to deliver messages. - require( - msg.sender == address(teleporterMessenger), - "NativeTokenSource: unauthorized teleporterMessenger contract" - ); - + ) external onlyAllowedTeleporter nonReentrant { // Only allow messages from the destination chain. require( senderBlockchainID == destinationBlockchainID, @@ -123,6 +116,9 @@ contract NativeTokenSource is TeleporterFeeInfo calldata feeInfo, address[] calldata allowedRelayerAddresses ) external payable nonReentrant { + ITeleporterMessenger teleporterMessenger = teleporterRegistry + .getLatestTeleporter(); + // The recipient cannot be the zero address. require( recipient != address(0), @@ -138,7 +134,11 @@ contract NativeTokenSource is IERC20(feeInfo.contractAddress), feeInfo.amount ); - SafeERC20.safeIncreaseAllowance(IERC20(feeInfo.contractAddress), address(teleporterMessenger), adjustedFeeAmount); + SafeERC20.safeIncreaseAllowance( + IERC20(feeInfo.contractAddress), + address(teleporterMessenger), + adjustedFeeAmount + ); } uint256 messageID = teleporterMessenger.sendCrossChainMessage( @@ -186,7 +186,9 @@ contract NativeTokenSource is /** * @dev Update destinationChainBurnedBalance sent from destination chain */ - function _updateDestinationChainBurnedBalance(uint256 newBurnBalance) private { + function _updateDestinationChainBurnedBalance( + uint256 newBurnBalance + ) private { if (newBurnBalance > destinationChainBurnedBalance) { uint256 difference = newBurnBalance - destinationChainBurnedBalance; _burnTokens(difference); From a67ca77bfb4584d63f9ae525349e827a0ca5090d Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 20 Nov 2023 09:53:02 -0500 Subject: [PATCH 122/183] Revert "Native token bridge now uses TeleporterOwnerUpgradeable instead of teleporter directly" This reverts commit 5447a4e1a47b03255a0f843602869ca289356f13. --- .../ERC20TokenSource/ERC20TokenSource.go | 457 +----------------- .../NativeTokenDestination.go | 457 +----------------- .../NativeTokenSource/NativeTokenSource.go | 457 +----------------- .../NativeTokenBridge/ERC20TokenSource.sol | 43 +- .../NativeTokenDestination.sol | 28 +- .../NativeTokenBridge/NativeTokenSource.sol | 38 +- 6 files changed, 93 insertions(+), 1387 deletions(-) diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go index 903b6b236..06add0d6e 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go @@ -31,7 +31,7 @@ var ( // ERC20TokenSourceMetaData contains all meta data concerning the ERC20TokenSource contract. var ERC20TokenSourceMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterRegistryAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"erc20ContractAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"oldMinTeleporterVersion\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"newMinTeleporterVersion\",\"type\":\"uint256\"}],\"name\":\"MinTeleporterVersionUpdated\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"transferAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BLACKHOLE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationChainBurnedBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"erc20ContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minTeleporterVersion\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterRegistry\",\"outputs\":[{\"internalType\":\"contractTeleporterRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"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\":\"totalAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"updateMinTeleporterVersion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"erc20ContractAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"transferAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BLACKHOLE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationChainBurnedBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"erc20ContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // ERC20TokenSourceABI is the input ABI used to generate the binding from. @@ -335,37 +335,6 @@ func (_ERC20TokenSource *ERC20TokenSourceCallerSession) Erc20ContractAddress() ( return _ERC20TokenSource.Contract.Erc20ContractAddress(&_ERC20TokenSource.CallOpts) } -// MinTeleporterVersion is a free data retrieval call binding the contract method 0xe49cc553. -// -// Solidity: function minTeleporterVersion() view returns(uint256) -func (_ERC20TokenSource *ERC20TokenSourceCaller) MinTeleporterVersion(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _ERC20TokenSource.contract.Call(opts, &out, "minTeleporterVersion") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// MinTeleporterVersion is a free data retrieval call binding the contract method 0xe49cc553. -// -// Solidity: function minTeleporterVersion() view returns(uint256) -func (_ERC20TokenSource *ERC20TokenSourceSession) MinTeleporterVersion() (*big.Int, error) { - return _ERC20TokenSource.Contract.MinTeleporterVersion(&_ERC20TokenSource.CallOpts) -} - -// MinTeleporterVersion is a free data retrieval call binding the contract method 0xe49cc553. -// -// Solidity: function minTeleporterVersion() view returns(uint256) -func (_ERC20TokenSource *ERC20TokenSourceCallerSession) MinTeleporterVersion() (*big.Int, error) { - return _ERC20TokenSource.Contract.MinTeleporterVersion(&_ERC20TokenSource.CallOpts) -} - // NativeTokenDestinationAddress is a free data retrieval call binding the contract method 0xb8c9091a. // // Solidity: function nativeTokenDestinationAddress() view returns(address) @@ -397,12 +366,12 @@ func (_ERC20TokenSource *ERC20TokenSourceCallerSession) NativeTokenDestinationAd return _ERC20TokenSource.Contract.NativeTokenDestinationAddress(&_ERC20TokenSource.CallOpts) } -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. // -// Solidity: function owner() view returns(address) -func (_ERC20TokenSource *ERC20TokenSourceCaller) Owner(opts *bind.CallOpts) (common.Address, error) { +// Solidity: function teleporterMessenger() view returns(address) +func (_ERC20TokenSource *ERC20TokenSourceCaller) TeleporterMessenger(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _ERC20TokenSource.contract.Call(opts, &out, "owner") + err := _ERC20TokenSource.contract.Call(opts, &out, "teleporterMessenger") if err != nil { return *new(common.Address), err @@ -414,49 +383,18 @@ func (_ERC20TokenSource *ERC20TokenSourceCaller) Owner(opts *bind.CallOpts) (com } -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. // -// Solidity: function owner() view returns(address) -func (_ERC20TokenSource *ERC20TokenSourceSession) Owner() (common.Address, error) { - return _ERC20TokenSource.Contract.Owner(&_ERC20TokenSource.CallOpts) +// Solidity: function teleporterMessenger() view returns(address) +func (_ERC20TokenSource *ERC20TokenSourceSession) TeleporterMessenger() (common.Address, error) { + return _ERC20TokenSource.Contract.TeleporterMessenger(&_ERC20TokenSource.CallOpts) } -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. // -// Solidity: function owner() view returns(address) -func (_ERC20TokenSource *ERC20TokenSourceCallerSession) Owner() (common.Address, error) { - return _ERC20TokenSource.Contract.Owner(&_ERC20TokenSource.CallOpts) -} - -// TeleporterRegistry is a free data retrieval call binding the contract method 0x1a7f5bec. -// -// Solidity: function teleporterRegistry() view returns(address) -func (_ERC20TokenSource *ERC20TokenSourceCaller) TeleporterRegistry(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _ERC20TokenSource.contract.Call(opts, &out, "teleporterRegistry") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// TeleporterRegistry is a free data retrieval call binding the contract method 0x1a7f5bec. -// -// Solidity: function teleporterRegistry() view returns(address) -func (_ERC20TokenSource *ERC20TokenSourceSession) TeleporterRegistry() (common.Address, error) { - return _ERC20TokenSource.Contract.TeleporterRegistry(&_ERC20TokenSource.CallOpts) -} - -// TeleporterRegistry is a free data retrieval call binding the contract method 0x1a7f5bec. -// -// Solidity: function teleporterRegistry() view returns(address) -func (_ERC20TokenSource *ERC20TokenSourceCallerSession) TeleporterRegistry() (common.Address, error) { - return _ERC20TokenSource.Contract.TeleporterRegistry(&_ERC20TokenSource.CallOpts) +// Solidity: function teleporterMessenger() view returns(address) +func (_ERC20TokenSource *ERC20TokenSourceCallerSession) TeleporterMessenger() (common.Address, error) { + return _ERC20TokenSource.Contract.TeleporterMessenger(&_ERC20TokenSource.CallOpts) } // ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. @@ -480,48 +418,6 @@ func (_ERC20TokenSource *ERC20TokenSourceTransactorSession) ReceiveTeleporterMes return _ERC20TokenSource.Contract.ReceiveTeleporterMessage(&_ERC20TokenSource.TransactOpts, senderBlockchainID, senderAddress, message) } -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_ERC20TokenSource *ERC20TokenSourceTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { - return _ERC20TokenSource.contract.Transact(opts, "renounceOwnership") -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_ERC20TokenSource *ERC20TokenSourceSession) RenounceOwnership() (*types.Transaction, error) { - return _ERC20TokenSource.Contract.RenounceOwnership(&_ERC20TokenSource.TransactOpts) -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_ERC20TokenSource *ERC20TokenSourceTransactorSession) RenounceOwnership() (*types.Transaction, error) { - return _ERC20TokenSource.Contract.RenounceOwnership(&_ERC20TokenSource.TransactOpts) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_ERC20TokenSource *ERC20TokenSourceTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { - return _ERC20TokenSource.contract.Transact(opts, "transferOwnership", newOwner) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_ERC20TokenSource *ERC20TokenSourceSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _ERC20TokenSource.Contract.TransferOwnership(&_ERC20TokenSource.TransactOpts, newOwner) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_ERC20TokenSource *ERC20TokenSourceTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _ERC20TokenSource.Contract.TransferOwnership(&_ERC20TokenSource.TransactOpts, newOwner) -} - // TransferToDestination is a paid mutator transaction binding the contract method 0x87a2edba. // // Solidity: function transferToDestination(address recipient, uint256 totalAmount, uint256 feeAmount, address[] allowedRelayerAddresses) returns() @@ -543,27 +439,6 @@ func (_ERC20TokenSource *ERC20TokenSourceTransactorSession) TransferToDestinatio return _ERC20TokenSource.Contract.TransferToDestination(&_ERC20TokenSource.TransactOpts, recipient, totalAmount, feeAmount, allowedRelayerAddresses) } -// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. -// -// Solidity: function updateMinTeleporterVersion() returns() -func (_ERC20TokenSource *ERC20TokenSourceTransactor) UpdateMinTeleporterVersion(opts *bind.TransactOpts) (*types.Transaction, error) { - return _ERC20TokenSource.contract.Transact(opts, "updateMinTeleporterVersion") -} - -// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. -// -// Solidity: function updateMinTeleporterVersion() returns() -func (_ERC20TokenSource *ERC20TokenSourceSession) UpdateMinTeleporterVersion() (*types.Transaction, error) { - return _ERC20TokenSource.Contract.UpdateMinTeleporterVersion(&_ERC20TokenSource.TransactOpts) -} - -// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. -// -// Solidity: function updateMinTeleporterVersion() returns() -func (_ERC20TokenSource *ERC20TokenSourceTransactorSession) UpdateMinTeleporterVersion() (*types.Transaction, error) { - return _ERC20TokenSource.Contract.UpdateMinTeleporterVersion(&_ERC20TokenSource.TransactOpts) -} - // ERC20TokenSourceBurnTokensIterator is returned from FilterBurnTokens and is used to iterate over the raw logs and unpacked data for BurnTokens events raised by the ERC20TokenSource contract. type ERC20TokenSourceBurnTokensIterator struct { Event *ERC20TokenSourceBurnTokens // Event containing the contract specifics and raw log @@ -698,312 +573,6 @@ func (_ERC20TokenSource *ERC20TokenSourceFilterer) ParseBurnTokens(log types.Log return event, nil } -// ERC20TokenSourceMinTeleporterVersionUpdatedIterator is returned from FilterMinTeleporterVersionUpdated and is used to iterate over the raw logs and unpacked data for MinTeleporterVersionUpdated events raised by the ERC20TokenSource contract. -type ERC20TokenSourceMinTeleporterVersionUpdatedIterator struct { - Event *ERC20TokenSourceMinTeleporterVersionUpdated // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub interfaces.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *ERC20TokenSourceMinTeleporterVersionUpdatedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(ERC20TokenSourceMinTeleporterVersionUpdated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(ERC20TokenSourceMinTeleporterVersionUpdated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *ERC20TokenSourceMinTeleporterVersionUpdatedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *ERC20TokenSourceMinTeleporterVersionUpdatedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// ERC20TokenSourceMinTeleporterVersionUpdated represents a MinTeleporterVersionUpdated event raised by the ERC20TokenSource contract. -type ERC20TokenSourceMinTeleporterVersionUpdated struct { - OldMinTeleporterVersion *big.Int - NewMinTeleporterVersion *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterMinTeleporterVersionUpdated is a free log retrieval operation binding the contract event 0xa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d. -// -// Solidity: event MinTeleporterVersionUpdated(uint256 indexed oldMinTeleporterVersion, uint256 indexed newMinTeleporterVersion) -func (_ERC20TokenSource *ERC20TokenSourceFilterer) FilterMinTeleporterVersionUpdated(opts *bind.FilterOpts, oldMinTeleporterVersion []*big.Int, newMinTeleporterVersion []*big.Int) (*ERC20TokenSourceMinTeleporterVersionUpdatedIterator, error) { - - var oldMinTeleporterVersionRule []interface{} - for _, oldMinTeleporterVersionItem := range oldMinTeleporterVersion { - oldMinTeleporterVersionRule = append(oldMinTeleporterVersionRule, oldMinTeleporterVersionItem) - } - var newMinTeleporterVersionRule []interface{} - for _, newMinTeleporterVersionItem := range newMinTeleporterVersion { - newMinTeleporterVersionRule = append(newMinTeleporterVersionRule, newMinTeleporterVersionItem) - } - - logs, sub, err := _ERC20TokenSource.contract.FilterLogs(opts, "MinTeleporterVersionUpdated", oldMinTeleporterVersionRule, newMinTeleporterVersionRule) - if err != nil { - return nil, err - } - return &ERC20TokenSourceMinTeleporterVersionUpdatedIterator{contract: _ERC20TokenSource.contract, event: "MinTeleporterVersionUpdated", logs: logs, sub: sub}, nil -} - -// WatchMinTeleporterVersionUpdated is a free log subscription operation binding the contract event 0xa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d. -// -// Solidity: event MinTeleporterVersionUpdated(uint256 indexed oldMinTeleporterVersion, uint256 indexed newMinTeleporterVersion) -func (_ERC20TokenSource *ERC20TokenSourceFilterer) WatchMinTeleporterVersionUpdated(opts *bind.WatchOpts, sink chan<- *ERC20TokenSourceMinTeleporterVersionUpdated, oldMinTeleporterVersion []*big.Int, newMinTeleporterVersion []*big.Int) (event.Subscription, error) { - - var oldMinTeleporterVersionRule []interface{} - for _, oldMinTeleporterVersionItem := range oldMinTeleporterVersion { - oldMinTeleporterVersionRule = append(oldMinTeleporterVersionRule, oldMinTeleporterVersionItem) - } - var newMinTeleporterVersionRule []interface{} - for _, newMinTeleporterVersionItem := range newMinTeleporterVersion { - newMinTeleporterVersionRule = append(newMinTeleporterVersionRule, newMinTeleporterVersionItem) - } - - logs, sub, err := _ERC20TokenSource.contract.WatchLogs(opts, "MinTeleporterVersionUpdated", oldMinTeleporterVersionRule, newMinTeleporterVersionRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(ERC20TokenSourceMinTeleporterVersionUpdated) - if err := _ERC20TokenSource.contract.UnpackLog(event, "MinTeleporterVersionUpdated", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseMinTeleporterVersionUpdated is a log parse operation binding the contract event 0xa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d. -// -// Solidity: event MinTeleporterVersionUpdated(uint256 indexed oldMinTeleporterVersion, uint256 indexed newMinTeleporterVersion) -func (_ERC20TokenSource *ERC20TokenSourceFilterer) ParseMinTeleporterVersionUpdated(log types.Log) (*ERC20TokenSourceMinTeleporterVersionUpdated, error) { - event := new(ERC20TokenSourceMinTeleporterVersionUpdated) - if err := _ERC20TokenSource.contract.UnpackLog(event, "MinTeleporterVersionUpdated", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// ERC20TokenSourceOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the ERC20TokenSource contract. -type ERC20TokenSourceOwnershipTransferredIterator struct { - Event *ERC20TokenSourceOwnershipTransferred // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub interfaces.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *ERC20TokenSourceOwnershipTransferredIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(ERC20TokenSourceOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(ERC20TokenSourceOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *ERC20TokenSourceOwnershipTransferredIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *ERC20TokenSourceOwnershipTransferredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// ERC20TokenSourceOwnershipTransferred represents a OwnershipTransferred event raised by the ERC20TokenSource contract. -type ERC20TokenSourceOwnershipTransferred struct { - PreviousOwner common.Address - NewOwner common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_ERC20TokenSource *ERC20TokenSourceFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*ERC20TokenSourceOwnershipTransferredIterator, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } - - logs, sub, err := _ERC20TokenSource.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) - if err != nil { - return nil, err - } - return &ERC20TokenSourceOwnershipTransferredIterator{contract: _ERC20TokenSource.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil -} - -// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_ERC20TokenSource *ERC20TokenSourceFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *ERC20TokenSourceOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } - - logs, sub, err := _ERC20TokenSource.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(ERC20TokenSourceOwnershipTransferred) - if err := _ERC20TokenSource.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_ERC20TokenSource *ERC20TokenSourceFilterer) ParseOwnershipTransferred(log types.Log) (*ERC20TokenSourceOwnershipTransferred, error) { - event := new(ERC20TokenSourceOwnershipTransferred) - if err := _ERC20TokenSource.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - // ERC20TokenSourceTransferToDestinationIterator is returned from FilterTransferToDestination and is used to iterate over the raw logs and unpacked data for TransferToDestination events raised by the ERC20TokenSource contract. type ERC20TokenSourceTransferToDestinationIterator struct { Event *ERC20TokenSourceTransferToDestination // Event containing the contract specifics and raw log diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go index cb3bf1672..5a66a5a8b 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go @@ -37,7 +37,7 @@ type TeleporterFeeInfo struct { // NativeTokenDestinationMetaData contains all meta data concerning the NativeTokenDestination contract. var NativeTokenDestinationMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterRegistryAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialReserveImbalance_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"addedBy\",\"type\":\"address\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"oldMinTeleporterVersion\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"newMinTeleporterVersion\",\"type\":\"uint256\"}],\"name\":\"MinTeleporterVersionUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"burnAddressBalance\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"ReportTotalBurnedTxFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"REPORT_BURNED_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minTeleporterVersion\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"reportTotalBurnedTxFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterRegistry\",\"outputs\":[{\"internalType\":\"contractTeleporterRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalMinted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"updateMinTeleporterVersion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialReserveImbalance_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"addedBy\",\"type\":\"address\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"burnAddressBalance\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"ReportTotalBurnedTxFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"REPORT_BURNED_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"reportTotalBurnedTxFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalMinted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", } // NativeTokenDestinationABI is the input ABI used to generate the binding from. @@ -341,37 +341,6 @@ func (_NativeTokenDestination *NativeTokenDestinationCallerSession) IsCollateral return _NativeTokenDestination.Contract.IsCollateralized(&_NativeTokenDestination.CallOpts) } -// MinTeleporterVersion is a free data retrieval call binding the contract method 0xe49cc553. -// -// Solidity: function minTeleporterVersion() view returns(uint256) -func (_NativeTokenDestination *NativeTokenDestinationCaller) MinTeleporterVersion(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _NativeTokenDestination.contract.Call(opts, &out, "minTeleporterVersion") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// MinTeleporterVersion is a free data retrieval call binding the contract method 0xe49cc553. -// -// Solidity: function minTeleporterVersion() view returns(uint256) -func (_NativeTokenDestination *NativeTokenDestinationSession) MinTeleporterVersion() (*big.Int, error) { - return _NativeTokenDestination.Contract.MinTeleporterVersion(&_NativeTokenDestination.CallOpts) -} - -// MinTeleporterVersion is a free data retrieval call binding the contract method 0xe49cc553. -// -// Solidity: function minTeleporterVersion() view returns(uint256) -func (_NativeTokenDestination *NativeTokenDestinationCallerSession) MinTeleporterVersion() (*big.Int, error) { - return _NativeTokenDestination.Contract.MinTeleporterVersion(&_NativeTokenDestination.CallOpts) -} - // NativeTokenSourceAddress is a free data retrieval call binding the contract method 0x5d93f9af. // // Solidity: function nativeTokenSourceAddress() view returns(address) @@ -403,37 +372,6 @@ func (_NativeTokenDestination *NativeTokenDestinationCallerSession) NativeTokenS return _NativeTokenDestination.Contract.NativeTokenSourceAddress(&_NativeTokenDestination.CallOpts) } -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_NativeTokenDestination *NativeTokenDestinationCaller) Owner(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _NativeTokenDestination.contract.Call(opts, &out, "owner") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_NativeTokenDestination *NativeTokenDestinationSession) Owner() (common.Address, error) { - return _NativeTokenDestination.Contract.Owner(&_NativeTokenDestination.CallOpts) -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_NativeTokenDestination *NativeTokenDestinationCallerSession) Owner() (common.Address, error) { - return _NativeTokenDestination.Contract.Owner(&_NativeTokenDestination.CallOpts) -} - // SourceBlockchainID is a free data retrieval call binding the contract method 0x29b7b3fd. // // Solidity: function sourceBlockchainID() view returns(bytes32) @@ -465,12 +403,12 @@ func (_NativeTokenDestination *NativeTokenDestinationCallerSession) SourceBlockc return _NativeTokenDestination.Contract.SourceBlockchainID(&_NativeTokenDestination.CallOpts) } -// TeleporterRegistry is a free data retrieval call binding the contract method 0x1a7f5bec. +// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. // -// Solidity: function teleporterRegistry() view returns(address) -func (_NativeTokenDestination *NativeTokenDestinationCaller) TeleporterRegistry(opts *bind.CallOpts) (common.Address, error) { +// Solidity: function teleporterMessenger() view returns(address) +func (_NativeTokenDestination *NativeTokenDestinationCaller) TeleporterMessenger(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _NativeTokenDestination.contract.Call(opts, &out, "teleporterRegistry") + err := _NativeTokenDestination.contract.Call(opts, &out, "teleporterMessenger") if err != nil { return *new(common.Address), err @@ -482,18 +420,18 @@ func (_NativeTokenDestination *NativeTokenDestinationCaller) TeleporterRegistry( } -// TeleporterRegistry is a free data retrieval call binding the contract method 0x1a7f5bec. +// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. // -// Solidity: function teleporterRegistry() view returns(address) -func (_NativeTokenDestination *NativeTokenDestinationSession) TeleporterRegistry() (common.Address, error) { - return _NativeTokenDestination.Contract.TeleporterRegistry(&_NativeTokenDestination.CallOpts) +// Solidity: function teleporterMessenger() view returns(address) +func (_NativeTokenDestination *NativeTokenDestinationSession) TeleporterMessenger() (common.Address, error) { + return _NativeTokenDestination.Contract.TeleporterMessenger(&_NativeTokenDestination.CallOpts) } -// TeleporterRegistry is a free data retrieval call binding the contract method 0x1a7f5bec. +// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. // -// Solidity: function teleporterRegistry() view returns(address) -func (_NativeTokenDestination *NativeTokenDestinationCallerSession) TeleporterRegistry() (common.Address, error) { - return _NativeTokenDestination.Contract.TeleporterRegistry(&_NativeTokenDestination.CallOpts) +// Solidity: function teleporterMessenger() view returns(address) +func (_NativeTokenDestination *NativeTokenDestinationCallerSession) TeleporterMessenger() (common.Address, error) { + return _NativeTokenDestination.Contract.TeleporterMessenger(&_NativeTokenDestination.CallOpts) } // TotalMinted is a free data retrieval call binding the contract method 0xa2309ff8. @@ -579,27 +517,6 @@ func (_NativeTokenDestination *NativeTokenDestinationTransactorSession) ReceiveT return _NativeTokenDestination.Contract.ReceiveTeleporterMessage(&_NativeTokenDestination.TransactOpts, senderBlockchainID, senderAddress, message) } -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_NativeTokenDestination *NativeTokenDestinationTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { - return _NativeTokenDestination.contract.Transact(opts, "renounceOwnership") -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_NativeTokenDestination *NativeTokenDestinationSession) RenounceOwnership() (*types.Transaction, error) { - return _NativeTokenDestination.Contract.RenounceOwnership(&_NativeTokenDestination.TransactOpts) -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_NativeTokenDestination *NativeTokenDestinationTransactorSession) RenounceOwnership() (*types.Transaction, error) { - return _NativeTokenDestination.Contract.RenounceOwnership(&_NativeTokenDestination.TransactOpts) -} - // ReportTotalBurnedTxFees is a paid mutator transaction binding the contract method 0x3a94fe51. // // Solidity: function reportTotalBurnedTxFees((address,uint256) feeInfo, address[] allowedRelayerAddresses) returns() @@ -621,27 +538,6 @@ func (_NativeTokenDestination *NativeTokenDestinationTransactorSession) ReportTo return _NativeTokenDestination.Contract.ReportTotalBurnedTxFees(&_NativeTokenDestination.TransactOpts, feeInfo, allowedRelayerAddresses) } -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_NativeTokenDestination *NativeTokenDestinationTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { - return _NativeTokenDestination.contract.Transact(opts, "transferOwnership", newOwner) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_NativeTokenDestination *NativeTokenDestinationSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _NativeTokenDestination.Contract.TransferOwnership(&_NativeTokenDestination.TransactOpts, newOwner) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_NativeTokenDestination *NativeTokenDestinationTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _NativeTokenDestination.Contract.TransferOwnership(&_NativeTokenDestination.TransactOpts, newOwner) -} - // TransferToSource is a paid mutator transaction binding the contract method 0x75846562. // // Solidity: function transferToSource(address recipient, (address,uint256) feeInfo, address[] allowedRelayerAddresses) payable returns() @@ -663,27 +559,6 @@ func (_NativeTokenDestination *NativeTokenDestinationTransactorSession) Transfer return _NativeTokenDestination.Contract.TransferToSource(&_NativeTokenDestination.TransactOpts, recipient, feeInfo, allowedRelayerAddresses) } -// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. -// -// Solidity: function updateMinTeleporterVersion() returns() -func (_NativeTokenDestination *NativeTokenDestinationTransactor) UpdateMinTeleporterVersion(opts *bind.TransactOpts) (*types.Transaction, error) { - return _NativeTokenDestination.contract.Transact(opts, "updateMinTeleporterVersion") -} - -// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. -// -// Solidity: function updateMinTeleporterVersion() returns() -func (_NativeTokenDestination *NativeTokenDestinationSession) UpdateMinTeleporterVersion() (*types.Transaction, error) { - return _NativeTokenDestination.Contract.UpdateMinTeleporterVersion(&_NativeTokenDestination.TransactOpts) -} - -// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. -// -// Solidity: function updateMinTeleporterVersion() returns() -func (_NativeTokenDestination *NativeTokenDestinationTransactorSession) UpdateMinTeleporterVersion() (*types.Transaction, error) { - return _NativeTokenDestination.Contract.UpdateMinTeleporterVersion(&_NativeTokenDestination.TransactOpts) -} - // NativeTokenDestinationCollateralAddedIterator is returned from FilterCollateralAdded and is used to iterate over the raw logs and unpacked data for CollateralAdded events raised by the NativeTokenDestination contract. type NativeTokenDestinationCollateralAddedIterator struct { Event *NativeTokenDestinationCollateralAdded // Event containing the contract specifics and raw log @@ -820,159 +695,6 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) ParseCollateralAd return event, nil } -// NativeTokenDestinationMinTeleporterVersionUpdatedIterator is returned from FilterMinTeleporterVersionUpdated and is used to iterate over the raw logs and unpacked data for MinTeleporterVersionUpdated events raised by the NativeTokenDestination contract. -type NativeTokenDestinationMinTeleporterVersionUpdatedIterator struct { - Event *NativeTokenDestinationMinTeleporterVersionUpdated // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub interfaces.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *NativeTokenDestinationMinTeleporterVersionUpdatedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(NativeTokenDestinationMinTeleporterVersionUpdated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(NativeTokenDestinationMinTeleporterVersionUpdated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *NativeTokenDestinationMinTeleporterVersionUpdatedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *NativeTokenDestinationMinTeleporterVersionUpdatedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// NativeTokenDestinationMinTeleporterVersionUpdated represents a MinTeleporterVersionUpdated event raised by the NativeTokenDestination contract. -type NativeTokenDestinationMinTeleporterVersionUpdated struct { - OldMinTeleporterVersion *big.Int - NewMinTeleporterVersion *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterMinTeleporterVersionUpdated is a free log retrieval operation binding the contract event 0xa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d. -// -// Solidity: event MinTeleporterVersionUpdated(uint256 indexed oldMinTeleporterVersion, uint256 indexed newMinTeleporterVersion) -func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterMinTeleporterVersionUpdated(opts *bind.FilterOpts, oldMinTeleporterVersion []*big.Int, newMinTeleporterVersion []*big.Int) (*NativeTokenDestinationMinTeleporterVersionUpdatedIterator, error) { - - var oldMinTeleporterVersionRule []interface{} - for _, oldMinTeleporterVersionItem := range oldMinTeleporterVersion { - oldMinTeleporterVersionRule = append(oldMinTeleporterVersionRule, oldMinTeleporterVersionItem) - } - var newMinTeleporterVersionRule []interface{} - for _, newMinTeleporterVersionItem := range newMinTeleporterVersion { - newMinTeleporterVersionRule = append(newMinTeleporterVersionRule, newMinTeleporterVersionItem) - } - - logs, sub, err := _NativeTokenDestination.contract.FilterLogs(opts, "MinTeleporterVersionUpdated", oldMinTeleporterVersionRule, newMinTeleporterVersionRule) - if err != nil { - return nil, err - } - return &NativeTokenDestinationMinTeleporterVersionUpdatedIterator{contract: _NativeTokenDestination.contract, event: "MinTeleporterVersionUpdated", logs: logs, sub: sub}, nil -} - -// WatchMinTeleporterVersionUpdated is a free log subscription operation binding the contract event 0xa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d. -// -// Solidity: event MinTeleporterVersionUpdated(uint256 indexed oldMinTeleporterVersion, uint256 indexed newMinTeleporterVersion) -func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchMinTeleporterVersionUpdated(opts *bind.WatchOpts, sink chan<- *NativeTokenDestinationMinTeleporterVersionUpdated, oldMinTeleporterVersion []*big.Int, newMinTeleporterVersion []*big.Int) (event.Subscription, error) { - - var oldMinTeleporterVersionRule []interface{} - for _, oldMinTeleporterVersionItem := range oldMinTeleporterVersion { - oldMinTeleporterVersionRule = append(oldMinTeleporterVersionRule, oldMinTeleporterVersionItem) - } - var newMinTeleporterVersionRule []interface{} - for _, newMinTeleporterVersionItem := range newMinTeleporterVersion { - newMinTeleporterVersionRule = append(newMinTeleporterVersionRule, newMinTeleporterVersionItem) - } - - logs, sub, err := _NativeTokenDestination.contract.WatchLogs(opts, "MinTeleporterVersionUpdated", oldMinTeleporterVersionRule, newMinTeleporterVersionRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(NativeTokenDestinationMinTeleporterVersionUpdated) - if err := _NativeTokenDestination.contract.UnpackLog(event, "MinTeleporterVersionUpdated", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseMinTeleporterVersionUpdated is a log parse operation binding the contract event 0xa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d. -// -// Solidity: event MinTeleporterVersionUpdated(uint256 indexed oldMinTeleporterVersion, uint256 indexed newMinTeleporterVersion) -func (_NativeTokenDestination *NativeTokenDestinationFilterer) ParseMinTeleporterVersionUpdated(log types.Log) (*NativeTokenDestinationMinTeleporterVersionUpdated, error) { - event := new(NativeTokenDestinationMinTeleporterVersionUpdated) - if err := _NativeTokenDestination.contract.UnpackLog(event, "MinTeleporterVersionUpdated", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - // NativeTokenDestinationNativeTokensMintedIterator is returned from FilterNativeTokensMinted and is used to iterate over the raw logs and unpacked data for NativeTokensMinted events raised by the NativeTokenDestination contract. type NativeTokenDestinationNativeTokensMintedIterator struct { Event *NativeTokenDestinationNativeTokensMinted // Event containing the contract specifics and raw log @@ -1118,159 +840,6 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) ParseNativeTokens return event, nil } -// NativeTokenDestinationOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the NativeTokenDestination contract. -type NativeTokenDestinationOwnershipTransferredIterator struct { - Event *NativeTokenDestinationOwnershipTransferred // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub interfaces.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *NativeTokenDestinationOwnershipTransferredIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(NativeTokenDestinationOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(NativeTokenDestinationOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *NativeTokenDestinationOwnershipTransferredIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *NativeTokenDestinationOwnershipTransferredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// NativeTokenDestinationOwnershipTransferred represents a OwnershipTransferred event raised by the NativeTokenDestination contract. -type NativeTokenDestinationOwnershipTransferred struct { - PreviousOwner common.Address - NewOwner common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*NativeTokenDestinationOwnershipTransferredIterator, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } - - logs, sub, err := _NativeTokenDestination.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) - if err != nil { - return nil, err - } - return &NativeTokenDestinationOwnershipTransferredIterator{contract: _NativeTokenDestination.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil -} - -// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *NativeTokenDestinationOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } - - logs, sub, err := _NativeTokenDestination.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(NativeTokenDestinationOwnershipTransferred) - if err := _NativeTokenDestination.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_NativeTokenDestination *NativeTokenDestinationFilterer) ParseOwnershipTransferred(log types.Log) (*NativeTokenDestinationOwnershipTransferred, error) { - event := new(NativeTokenDestinationOwnershipTransferred) - if err := _NativeTokenDestination.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - // NativeTokenDestinationReportTotalBurnedTxFeesIterator is returned from FilterReportTotalBurnedTxFees and is used to iterate over the raw logs and unpacked data for ReportTotalBurnedTxFees events raised by the NativeTokenDestination contract. type NativeTokenDestinationReportTotalBurnedTxFeesIterator struct { Event *NativeTokenDestinationReportTotalBurnedTxFees // Event containing the contract specifics and raw log diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go index caedff794..8a01880ba 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go @@ -37,7 +37,7 @@ type TeleporterFeeInfo struct { // NativeTokenSourceMetaData contains all meta data concerning the NativeTokenSource contract. var NativeTokenSourceMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterRegistryAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"oldMinTeleporterVersion\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"newMinTeleporterVersion\",\"type\":\"uint256\"}],\"name\":\"MinTeleporterVersionUpdated\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BLACKHOLE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationChainBurnedBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minTeleporterVersion\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterRegistry\",\"outputs\":[{\"internalType\":\"contractTeleporterRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"updateMinTeleporterVersion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BLACKHOLE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationChainBurnedBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", } // NativeTokenSourceABI is the input ABI used to generate the binding from. @@ -310,37 +310,6 @@ func (_NativeTokenSource *NativeTokenSourceCallerSession) DestinationChainBurned return _NativeTokenSource.Contract.DestinationChainBurnedBalance(&_NativeTokenSource.CallOpts) } -// MinTeleporterVersion is a free data retrieval call binding the contract method 0xe49cc553. -// -// Solidity: function minTeleporterVersion() view returns(uint256) -func (_NativeTokenSource *NativeTokenSourceCaller) MinTeleporterVersion(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _NativeTokenSource.contract.Call(opts, &out, "minTeleporterVersion") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// MinTeleporterVersion is a free data retrieval call binding the contract method 0xe49cc553. -// -// Solidity: function minTeleporterVersion() view returns(uint256) -func (_NativeTokenSource *NativeTokenSourceSession) MinTeleporterVersion() (*big.Int, error) { - return _NativeTokenSource.Contract.MinTeleporterVersion(&_NativeTokenSource.CallOpts) -} - -// MinTeleporterVersion is a free data retrieval call binding the contract method 0xe49cc553. -// -// Solidity: function minTeleporterVersion() view returns(uint256) -func (_NativeTokenSource *NativeTokenSourceCallerSession) MinTeleporterVersion() (*big.Int, error) { - return _NativeTokenSource.Contract.MinTeleporterVersion(&_NativeTokenSource.CallOpts) -} - // NativeTokenDestinationAddress is a free data retrieval call binding the contract method 0xb8c9091a. // // Solidity: function nativeTokenDestinationAddress() view returns(address) @@ -372,12 +341,12 @@ func (_NativeTokenSource *NativeTokenSourceCallerSession) NativeTokenDestination return _NativeTokenSource.Contract.NativeTokenDestinationAddress(&_NativeTokenSource.CallOpts) } -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. // -// Solidity: function owner() view returns(address) -func (_NativeTokenSource *NativeTokenSourceCaller) Owner(opts *bind.CallOpts) (common.Address, error) { +// Solidity: function teleporterMessenger() view returns(address) +func (_NativeTokenSource *NativeTokenSourceCaller) TeleporterMessenger(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _NativeTokenSource.contract.Call(opts, &out, "owner") + err := _NativeTokenSource.contract.Call(opts, &out, "teleporterMessenger") if err != nil { return *new(common.Address), err @@ -389,49 +358,18 @@ func (_NativeTokenSource *NativeTokenSourceCaller) Owner(opts *bind.CallOpts) (c } -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. // -// Solidity: function owner() view returns(address) -func (_NativeTokenSource *NativeTokenSourceSession) Owner() (common.Address, error) { - return _NativeTokenSource.Contract.Owner(&_NativeTokenSource.CallOpts) +// Solidity: function teleporterMessenger() view returns(address) +func (_NativeTokenSource *NativeTokenSourceSession) TeleporterMessenger() (common.Address, error) { + return _NativeTokenSource.Contract.TeleporterMessenger(&_NativeTokenSource.CallOpts) } -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. // -// Solidity: function owner() view returns(address) -func (_NativeTokenSource *NativeTokenSourceCallerSession) Owner() (common.Address, error) { - return _NativeTokenSource.Contract.Owner(&_NativeTokenSource.CallOpts) -} - -// TeleporterRegistry is a free data retrieval call binding the contract method 0x1a7f5bec. -// -// Solidity: function teleporterRegistry() view returns(address) -func (_NativeTokenSource *NativeTokenSourceCaller) TeleporterRegistry(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _NativeTokenSource.contract.Call(opts, &out, "teleporterRegistry") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// TeleporterRegistry is a free data retrieval call binding the contract method 0x1a7f5bec. -// -// Solidity: function teleporterRegistry() view returns(address) -func (_NativeTokenSource *NativeTokenSourceSession) TeleporterRegistry() (common.Address, error) { - return _NativeTokenSource.Contract.TeleporterRegistry(&_NativeTokenSource.CallOpts) -} - -// TeleporterRegistry is a free data retrieval call binding the contract method 0x1a7f5bec. -// -// Solidity: function teleporterRegistry() view returns(address) -func (_NativeTokenSource *NativeTokenSourceCallerSession) TeleporterRegistry() (common.Address, error) { - return _NativeTokenSource.Contract.TeleporterRegistry(&_NativeTokenSource.CallOpts) +// Solidity: function teleporterMessenger() view returns(address) +func (_NativeTokenSource *NativeTokenSourceCallerSession) TeleporterMessenger() (common.Address, error) { + return _NativeTokenSource.Contract.TeleporterMessenger(&_NativeTokenSource.CallOpts) } // ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. @@ -455,48 +393,6 @@ func (_NativeTokenSource *NativeTokenSourceTransactorSession) ReceiveTeleporterM return _NativeTokenSource.Contract.ReceiveTeleporterMessage(&_NativeTokenSource.TransactOpts, senderBlockchainID, senderAddress, message) } -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_NativeTokenSource *NativeTokenSourceTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { - return _NativeTokenSource.contract.Transact(opts, "renounceOwnership") -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_NativeTokenSource *NativeTokenSourceSession) RenounceOwnership() (*types.Transaction, error) { - return _NativeTokenSource.Contract.RenounceOwnership(&_NativeTokenSource.TransactOpts) -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_NativeTokenSource *NativeTokenSourceTransactorSession) RenounceOwnership() (*types.Transaction, error) { - return _NativeTokenSource.Contract.RenounceOwnership(&_NativeTokenSource.TransactOpts) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_NativeTokenSource *NativeTokenSourceTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { - return _NativeTokenSource.contract.Transact(opts, "transferOwnership", newOwner) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_NativeTokenSource *NativeTokenSourceSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _NativeTokenSource.Contract.TransferOwnership(&_NativeTokenSource.TransactOpts, newOwner) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_NativeTokenSource *NativeTokenSourceTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _NativeTokenSource.Contract.TransferOwnership(&_NativeTokenSource.TransactOpts, newOwner) -} - // TransferToDestination is a paid mutator transaction binding the contract method 0xad0aee25. // // Solidity: function transferToDestination(address recipient, (address,uint256) feeInfo, address[] allowedRelayerAddresses) payable returns() @@ -518,27 +414,6 @@ func (_NativeTokenSource *NativeTokenSourceTransactorSession) TransferToDestinat return _NativeTokenSource.Contract.TransferToDestination(&_NativeTokenSource.TransactOpts, recipient, feeInfo, allowedRelayerAddresses) } -// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. -// -// Solidity: function updateMinTeleporterVersion() returns() -func (_NativeTokenSource *NativeTokenSourceTransactor) UpdateMinTeleporterVersion(opts *bind.TransactOpts) (*types.Transaction, error) { - return _NativeTokenSource.contract.Transact(opts, "updateMinTeleporterVersion") -} - -// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. -// -// Solidity: function updateMinTeleporterVersion() returns() -func (_NativeTokenSource *NativeTokenSourceSession) UpdateMinTeleporterVersion() (*types.Transaction, error) { - return _NativeTokenSource.Contract.UpdateMinTeleporterVersion(&_NativeTokenSource.TransactOpts) -} - -// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. -// -// Solidity: function updateMinTeleporterVersion() returns() -func (_NativeTokenSource *NativeTokenSourceTransactorSession) UpdateMinTeleporterVersion() (*types.Transaction, error) { - return _NativeTokenSource.Contract.UpdateMinTeleporterVersion(&_NativeTokenSource.TransactOpts) -} - // NativeTokenSourceBurnTokensIterator is returned from FilterBurnTokens and is used to iterate over the raw logs and unpacked data for BurnTokens events raised by the NativeTokenSource contract. type NativeTokenSourceBurnTokensIterator struct { Event *NativeTokenSourceBurnTokens // Event containing the contract specifics and raw log @@ -673,312 +548,6 @@ func (_NativeTokenSource *NativeTokenSourceFilterer) ParseBurnTokens(log types.L return event, nil } -// NativeTokenSourceMinTeleporterVersionUpdatedIterator is returned from FilterMinTeleporterVersionUpdated and is used to iterate over the raw logs and unpacked data for MinTeleporterVersionUpdated events raised by the NativeTokenSource contract. -type NativeTokenSourceMinTeleporterVersionUpdatedIterator struct { - Event *NativeTokenSourceMinTeleporterVersionUpdated // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub interfaces.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *NativeTokenSourceMinTeleporterVersionUpdatedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(NativeTokenSourceMinTeleporterVersionUpdated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(NativeTokenSourceMinTeleporterVersionUpdated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *NativeTokenSourceMinTeleporterVersionUpdatedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *NativeTokenSourceMinTeleporterVersionUpdatedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// NativeTokenSourceMinTeleporterVersionUpdated represents a MinTeleporterVersionUpdated event raised by the NativeTokenSource contract. -type NativeTokenSourceMinTeleporterVersionUpdated struct { - OldMinTeleporterVersion *big.Int - NewMinTeleporterVersion *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterMinTeleporterVersionUpdated is a free log retrieval operation binding the contract event 0xa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d. -// -// Solidity: event MinTeleporterVersionUpdated(uint256 indexed oldMinTeleporterVersion, uint256 indexed newMinTeleporterVersion) -func (_NativeTokenSource *NativeTokenSourceFilterer) FilterMinTeleporterVersionUpdated(opts *bind.FilterOpts, oldMinTeleporterVersion []*big.Int, newMinTeleporterVersion []*big.Int) (*NativeTokenSourceMinTeleporterVersionUpdatedIterator, error) { - - var oldMinTeleporterVersionRule []interface{} - for _, oldMinTeleporterVersionItem := range oldMinTeleporterVersion { - oldMinTeleporterVersionRule = append(oldMinTeleporterVersionRule, oldMinTeleporterVersionItem) - } - var newMinTeleporterVersionRule []interface{} - for _, newMinTeleporterVersionItem := range newMinTeleporterVersion { - newMinTeleporterVersionRule = append(newMinTeleporterVersionRule, newMinTeleporterVersionItem) - } - - logs, sub, err := _NativeTokenSource.contract.FilterLogs(opts, "MinTeleporterVersionUpdated", oldMinTeleporterVersionRule, newMinTeleporterVersionRule) - if err != nil { - return nil, err - } - return &NativeTokenSourceMinTeleporterVersionUpdatedIterator{contract: _NativeTokenSource.contract, event: "MinTeleporterVersionUpdated", logs: logs, sub: sub}, nil -} - -// WatchMinTeleporterVersionUpdated is a free log subscription operation binding the contract event 0xa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d. -// -// Solidity: event MinTeleporterVersionUpdated(uint256 indexed oldMinTeleporterVersion, uint256 indexed newMinTeleporterVersion) -func (_NativeTokenSource *NativeTokenSourceFilterer) WatchMinTeleporterVersionUpdated(opts *bind.WatchOpts, sink chan<- *NativeTokenSourceMinTeleporterVersionUpdated, oldMinTeleporterVersion []*big.Int, newMinTeleporterVersion []*big.Int) (event.Subscription, error) { - - var oldMinTeleporterVersionRule []interface{} - for _, oldMinTeleporterVersionItem := range oldMinTeleporterVersion { - oldMinTeleporterVersionRule = append(oldMinTeleporterVersionRule, oldMinTeleporterVersionItem) - } - var newMinTeleporterVersionRule []interface{} - for _, newMinTeleporterVersionItem := range newMinTeleporterVersion { - newMinTeleporterVersionRule = append(newMinTeleporterVersionRule, newMinTeleporterVersionItem) - } - - logs, sub, err := _NativeTokenSource.contract.WatchLogs(opts, "MinTeleporterVersionUpdated", oldMinTeleporterVersionRule, newMinTeleporterVersionRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(NativeTokenSourceMinTeleporterVersionUpdated) - if err := _NativeTokenSource.contract.UnpackLog(event, "MinTeleporterVersionUpdated", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseMinTeleporterVersionUpdated is a log parse operation binding the contract event 0xa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d. -// -// Solidity: event MinTeleporterVersionUpdated(uint256 indexed oldMinTeleporterVersion, uint256 indexed newMinTeleporterVersion) -func (_NativeTokenSource *NativeTokenSourceFilterer) ParseMinTeleporterVersionUpdated(log types.Log) (*NativeTokenSourceMinTeleporterVersionUpdated, error) { - event := new(NativeTokenSourceMinTeleporterVersionUpdated) - if err := _NativeTokenSource.contract.UnpackLog(event, "MinTeleporterVersionUpdated", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// NativeTokenSourceOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the NativeTokenSource contract. -type NativeTokenSourceOwnershipTransferredIterator struct { - Event *NativeTokenSourceOwnershipTransferred // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub interfaces.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *NativeTokenSourceOwnershipTransferredIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(NativeTokenSourceOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(NativeTokenSourceOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *NativeTokenSourceOwnershipTransferredIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *NativeTokenSourceOwnershipTransferredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// NativeTokenSourceOwnershipTransferred represents a OwnershipTransferred event raised by the NativeTokenSource contract. -type NativeTokenSourceOwnershipTransferred struct { - PreviousOwner common.Address - NewOwner common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_NativeTokenSource *NativeTokenSourceFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*NativeTokenSourceOwnershipTransferredIterator, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } - - logs, sub, err := _NativeTokenSource.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) - if err != nil { - return nil, err - } - return &NativeTokenSourceOwnershipTransferredIterator{contract: _NativeTokenSource.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil -} - -// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_NativeTokenSource *NativeTokenSourceFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *NativeTokenSourceOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } - - logs, sub, err := _NativeTokenSource.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(NativeTokenSourceOwnershipTransferred) - if err := _NativeTokenSource.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_NativeTokenSource *NativeTokenSourceFilterer) ParseOwnershipTransferred(log types.Log) (*NativeTokenSourceOwnershipTransferred, error) { - event := new(NativeTokenSourceOwnershipTransferred) - if err := _NativeTokenSource.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - // NativeTokenSourceTransferToDestinationIterator is returned from FilterTransferToDestination and is used to iterate over the raw logs and unpacked data for TransferToDestination events raised by the NativeTokenSource contract. type NativeTokenSourceTransferToDestinationIterator struct { Event *NativeTokenSourceTransferToDestination // Event containing the contract specifics and raw log diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol index 9a7fdcb0b..4a573d236 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol @@ -10,7 +10,6 @@ import {IWarpMessenger} from "@subnet-evm-contracts/interfaces/IWarpMessenger.so import {IERC20TokenSource} from "./IERC20TokenSource.sol"; import {ITokenSource} from "./ITokenSource.sol"; import {ITeleporterMessenger, TeleporterMessageInput, TeleporterFeeInfo} from "../../Teleporter/ITeleporterMessenger.sol"; -import {TeleporterOwnerUpgradeable} from "../../Teleporter/upgrades/TeleporterOwnerUpgradeable.sol"; import {ITeleporterReceiver} from "../../Teleporter/ITeleporterReceiver.sol"; import {SafeERC20TransferFrom} from "../../Teleporter/SafeERC20TransferFrom.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; @@ -18,7 +17,6 @@ import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol contract ERC20TokenSource is ITeleporterReceiver, - TeleporterOwnerUpgradeable, IERC20TokenSource, ITokenSource, ReentrancyGuard @@ -26,8 +24,7 @@ contract ERC20TokenSource is // Designated Blackhole Address. Tokens are sent here to be "burned" before sending an unlock // message to the source chain. Different from the burned tx fee address so they can be // tracked separately. - address public constant BLACKHOLE_ADDRESS = - 0x0100000000000000000000000000000000000001; + address public constant BLACKHOLE_ADDRESS = 0x0100000000000000000000000000000000000001; uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 100_000; // Used to keep track of tokens burned through transactions on the destination chain. They can // be reported to this contract to burn an equivalent number of tokens on this chain. @@ -36,16 +33,20 @@ contract ERC20TokenSource is address public immutable nativeTokenDestinationAddress; address public immutable erc20ContractAddress; + // Used for sending and receiving Teleporter messages. + ITeleporterMessenger public immutable teleporterMessenger; + constructor( - address teleporterRegistryAddress, + address teleporterMessengerAddress, bytes32 destinationBlockchainID_, address nativeTokenDestinationAddress_, address erc20ContractAddress_ - ) TeleporterOwnerUpgradeable(teleporterRegistryAddress) { + ) { require( - teleporterRegistryAddress != address(0), - "NativeTokenSource: zero TeleporterRegistry address" + teleporterMessengerAddress != address(0), + "ERC20TokenSource: zero TeleporterMessenger address" ); + teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); require( destinationBlockchainID_ != bytes32(0), @@ -81,7 +82,13 @@ contract ERC20TokenSource is bytes32 senderBlockchainID, address senderAddress, bytes calldata message - ) external onlyAllowedTeleporter nonReentrant { + ) external nonReentrant { + // Only allow the Teleporter messenger to deliver messages. + require( + msg.sender == address(teleporterMessenger), + "ERC20TokenSource: unauthorized TeleporterMessenger contract" + ); + // Only allow messages from the destination chain. require( senderBlockchainID == destinationBlockchainID, @@ -124,9 +131,6 @@ contract ERC20TokenSource is uint256 feeAmount, address[] calldata allowedRelayerAddresses ) external nonReentrant { - ITeleporterMessenger teleporterMessenger = teleporterRegistry - .getLatestTeleporter(); - // The recipient cannot be the zero address. require( recipient != address(0), @@ -200,20 +204,14 @@ contract ERC20TokenSource is * @dev Sends tokens to BLACKHOLE_ADDRESS. */ function _burnTokens(uint256 amount) private { - SafeERC20.safeTransfer( - IERC20(erc20ContractAddress), - BLACKHOLE_ADDRESS, - amount - ); - emit BurnTokens(amount); - } + SafeERC20.safeTransfer(IERC20(erc20ContractAddress), BLACKHOLE_ADDRESS, amount); + emit BurnTokens(amount); + } /** * @dev Update destinationChainBurnedBalance sent from destination chain */ - function _updateDestinationChainBurnedBalance( - uint256 newBurnBalance - ) private { + function _updateDestinationChainBurnedBalance(uint256 newBurnBalance) private { if (newBurnBalance > destinationChainBurnedBalance) { uint256 difference = newBurnBalance - destinationChainBurnedBalance; _burnTokens(difference); @@ -221,3 +219,4 @@ contract ERC20TokenSource is } } } + diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index cb111ca80..39b47ffe8 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -11,7 +11,6 @@ import {INativeMinter} from "@subnet-evm-contracts/interfaces/INativeMinter.sol" import {INativeTokenDestination} from "./INativeTokenDestination.sol"; import {ITokenSource} from "./ITokenSource.sol"; import {ITeleporterMessenger, TeleporterFeeInfo, TeleporterMessageInput} from "../../Teleporter/ITeleporterMessenger.sol"; -import {TeleporterOwnerUpgradeable} from "../../Teleporter/upgrades/TeleporterOwnerUpgradeable.sol"; import {ITeleporterReceiver} from "../../Teleporter/ITeleporterReceiver.sol"; import {SafeERC20TransferFrom} from "../../Teleporter/SafeERC20TransferFrom.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; @@ -30,7 +29,6 @@ address constant BLACKHOLE_ADDRESS = 0x0100000000000000000000000000000000000001; contract NativeTokenDestination is ITeleporterReceiver, - TeleporterOwnerUpgradeable, INativeTokenDestination, ReentrancyGuard { @@ -48,16 +46,20 @@ contract NativeTokenDestination is uint256 public currentReserveImbalance; uint256 public totalMinted = 0; + // Used for sending and receiving Teleporter messages. + ITeleporterMessenger public immutable teleporterMessenger; + constructor( - address teleporterRegistryAddress, + address teleporterMessengerAddress, bytes32 sourceBlockchainID_, address nativeTokenSourceAddress_, uint256 initialReserveImbalance_ - ) TeleporterOwnerUpgradeable(teleporterRegistryAddress) { + ) { require( - teleporterRegistryAddress != address(0), - "NativeTokenSource: zero TeleporterRegistry address" + teleporterMessengerAddress != address(0), + "NativeTokenDestination: zero TeleporterMessenger address" ); + teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); require( sourceBlockchainID_ != bytes32(0), @@ -90,7 +92,13 @@ contract NativeTokenDestination is bytes32 senderBlockchainID, address senderAddress, bytes calldata message - ) external onlyAllowedTeleporter nonReentrant { + ) external nonReentrant { + // Only allow the Teleporter messenger to deliver messages. + require( + msg.sender == address(teleporterMessenger), + "NativeTokenDestination: unauthorized TeleporterMessenger contract" + ); + // Only allow messages from the source chain. require( senderBlockchainID == sourceBlockchainID, @@ -151,9 +159,6 @@ contract NativeTokenDestination is TeleporterFeeInfo calldata feeInfo, address[] calldata allowedRelayerAddresses ) external payable nonReentrant { - ITeleporterMessenger teleporterMessenger = teleporterRegistry - .getLatestTeleporter(); - // The recipient cannot be the zero address. require( recipient != address(0), @@ -213,9 +218,6 @@ contract NativeTokenDestination is TeleporterFeeInfo calldata feeInfo, address[] calldata allowedRelayerAddresses ) external { - ITeleporterMessenger teleporterMessenger = teleporterRegistry - .getLatestTeleporter(); - uint256 totalBurnedTxFees = address(BURNED_TX_FEES_ADDRESS).balance; uint256 messageID = teleporterMessenger.sendCrossChainMessage( TeleporterMessageInput({ diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index 72f604850..2e2efca90 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -10,7 +10,6 @@ import {IWarpMessenger} from "@subnet-evm-contracts/interfaces/IWarpMessenger.so import {INativeTokenSource} from "./INativeTokenSource.sol"; import {ITokenSource} from "./ITokenSource.sol"; import {ITeleporterMessenger, TeleporterFeeInfo, TeleporterMessageInput} from "../../Teleporter/ITeleporterMessenger.sol"; -import {TeleporterOwnerUpgradeable} from "../../Teleporter/upgrades/TeleporterOwnerUpgradeable.sol"; import {ITeleporterReceiver} from "../../Teleporter/ITeleporterReceiver.sol"; import {SafeERC20TransferFrom} from "../../Teleporter/SafeERC20TransferFrom.sol"; import {SafeERC20TransferFrom} from "../../Teleporter/SafeERC20TransferFrom.sol"; @@ -19,7 +18,6 @@ import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol contract NativeTokenSource is ITeleporterReceiver, - TeleporterOwnerUpgradeable, INativeTokenSource, ITokenSource, ReentrancyGuard @@ -27,8 +25,7 @@ contract NativeTokenSource is // Designated Blackhole Address. Tokens are sent here to be "burned" before sending an unlock // message to the source chain. Different from the burned tx fee address so they can be // tracked separately. - address public constant BLACKHOLE_ADDRESS = - 0x0100000000000000000000000000000000000001; + address public constant BLACKHOLE_ADDRESS = 0x0100000000000000000000000000000000000001; uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 100_000; // Used to keep track of tokens burned through transactions on the destination chain. They can // be reported to this contract to burn an equivalent number of tokens on this chain. @@ -36,15 +33,19 @@ contract NativeTokenSource is bytes32 public immutable destinationBlockchainID; address public immutable nativeTokenDestinationAddress; + // Used for sending and receiving Teleporter messages. + ITeleporterMessenger public immutable teleporterMessenger; + constructor( - address teleporterRegistryAddress, + address teleporterMessengerAddress, bytes32 destinationBlockchainID_, address nativeTokenDestinationAddress_ - ) TeleporterOwnerUpgradeable(teleporterRegistryAddress) { + ) { require( - teleporterRegistryAddress != address(0), - "NativeTokenSource: zero TeleporterRegistry address" + teleporterMessengerAddress != address(0), + "NativeTokenSource: zero TeleporterMessenger address" ); + teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); require( destinationBlockchainID_ != bytes32(0), @@ -74,7 +75,13 @@ contract NativeTokenSource is bytes32 senderBlockchainID, address senderAddress, bytes calldata message - ) external onlyAllowedTeleporter nonReentrant { + ) external nonReentrant { + // Only allow the Teleporter messenger to deliver messages. + require( + msg.sender == address(teleporterMessenger), + "NativeTokenSource: unauthorized teleporterMessenger contract" + ); + // Only allow messages from the destination chain. require( senderBlockchainID == destinationBlockchainID, @@ -116,9 +123,6 @@ contract NativeTokenSource is TeleporterFeeInfo calldata feeInfo, address[] calldata allowedRelayerAddresses ) external payable nonReentrant { - ITeleporterMessenger teleporterMessenger = teleporterRegistry - .getLatestTeleporter(); - // The recipient cannot be the zero address. require( recipient != address(0), @@ -134,11 +138,7 @@ contract NativeTokenSource is IERC20(feeInfo.contractAddress), feeInfo.amount ); - SafeERC20.safeIncreaseAllowance( - IERC20(feeInfo.contractAddress), - address(teleporterMessenger), - adjustedFeeAmount - ); + SafeERC20.safeIncreaseAllowance(IERC20(feeInfo.contractAddress), address(teleporterMessenger), adjustedFeeAmount); } uint256 messageID = teleporterMessenger.sendCrossChainMessage( @@ -186,9 +186,7 @@ contract NativeTokenSource is /** * @dev Update destinationChainBurnedBalance sent from destination chain */ - function _updateDestinationChainBurnedBalance( - uint256 newBurnBalance - ) private { + function _updateDestinationChainBurnedBalance(uint256 newBurnBalance) private { if (newBurnBalance > destinationChainBurnedBalance) { uint256 difference = newBurnBalance - destinationChainBurnedBalance; _burnTokens(difference); From ea41649876c672db820546add1c3fe9c8a2b272d Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 20 Nov 2023 09:53:16 -0500 Subject: [PATCH 123/183] Update README --- .../NativeTokenBridge/README.md | 29 +++++++------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/README.md b/contracts/src/CrossChainApplications/NativeTokenBridge/README.md index aadf1b931..38baf3041 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/README.md +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/README.md @@ -1,36 +1,29 @@ -# Native Token Bridge +# Native-to-Native Token Bridge -A set of smart contracts - one `NativeTokenDestination` contract and one "TokenSource" contract, which can be either a `NativeTokenSource` contract or an `ERC20TokenSource` contract. These contracts are built on top of Teleporter to support using an ERC20 token or the native token of any `subnet-evm` chain as the native token for a given subnet. +A pair of smart contracts built on top of Teleporter to support using an ERC20 token or the native token of any `subnet-evm` chain as the native token for a given subnet. ## Design +The native-to-native bridge is implemented using two primary contracts. +### `NativeTokenSource` + - Lives on the Source chain. Pairs with exactly one `NativeTokenDestination` contract on a different chain. + - Locks and unlocks native tokens on the Source chain corresponding to mints and burns on the destination chain. + - `transferToDestination`: transfers all tokens paid to this function call to `recipient` on the destination chain by locking them and instructing the destination chain to mint. Optionally takes the address of an ERC20 contract `feeContractAddress` as well as an amount `feeAmount` that will be used as the relayer-incentivisation for the teleporter cross-chain call. Also allows for the caller to specify `allowedRelayerAddresses`. + - `receiveTeleporterMessage`: unlocks tokens on the source chain when instructed to by the `NativeTokenDestination` contract. ### `NativeTokenDestination` - - Lives on the Destination chain. Pairs with exactly one `NativeTokenSource` OR `ERC20TokenSource` contract on a different chain. + - Lives on the Destination chain. Pairs with exactly one `NativeTokenSource` contract on a different chain. - Mints and burns native tokens on the Destination chain corresponding to locks and unlocks on the source chain. - `transferToSource`: transfers all tokens paid to this function call to `recipient` on the source chain by burning the tokens and instructing the source chain to unlock. Optionally takes the address of an ERC20 contract `feeContractAddress` as well as an amount `feeAmount` that will be used as the relayer-incentivisation for the teleporter cross-chain call. Also allows for the caller to specify `allowedRelayerAddresses`. - `receiveTeleporterMessage`: mints tokens on the destination chain when instructed to by the `NativeTokenDestination` contract. - - `reportTotalBurnedTxFees` sends the balance of `BURNED_TX_FEES_ADDRESS` to the source chain. The source chain can then burn tokens to match the amount that has been burned in transaction fees on this chain. Always reports the total tokens ever burned, so this number is monotonically increasing. - `isCollateralized`: returns true if `currentReserveImbalance == 0`, meaning that enough tokens have been sent from the source chain to offset the `initialReserveImbalance`. If true, all tokens sent to the destination chain will be minted, and burning/unlocking tokens will be enabled. - `totalSupply`: Returns the best estimate of available native tokens on this chain. Equal to the `initialReserveImbalance` + `all tokens minted` - `all tokens in known burn address`. Known burn addresses include the burn address for this contract used when burning/unlocking, and the address for burned transaction fees. -### `NativeTokenSource` - - Lives on the Source chain. Pairs with exactly one `NativeTokenDestination` contract on a different chain. - - Locks and unlocks native tokens on the Source chain corresponding to mints and burns on the destination chain. - - `transferToDestination`: transfers all tokens paid to this function call to `recipient` on the destination chain by locking them and instructing the destination chain to mint. Optionally takes the address of an ERC20 contract `feeContractAddress` as well as an amount `feeAmount` that will be used as the relayer-incentivisation for the teleporter cross-chain call. Also allows for the caller to specify `allowedRelayerAddresses`. - - `receiveTeleporterMessage`: unlocks tokens on the source chain when instructed to by the `NativeTokenDestination` contract, or accepts a new total of tokens burned as tx fees on the destination chain, and burns and equivalent number of native tokens on this chain. - -### `ERC20TokenSource` - - Lives on the Source chain. Pairs with exactly one `NativeTokenDestination` contract on a different chain. - - Locks and unlocks ERC20 tokens on the Source chain corresponding to mints and burns on the destination chain. - - `transferToDestination`: transfers all tokens paid to this function call to `recipient` on the destination chain by locking them and instructing the destination chain to mint. Optionally takes an amount `feeAmount` that will be used as the relayer-incentivisation for the teleporter cross-chain call, using the same ERC20 contract that this contract was initialized with. Also allows for the caller to specify `allowedRelayerAddresses`. - - `receiveTeleporterMessage`: unlocks tokens on the source chain when instructed to by the `NativeTokenDestination` contract, or accepts a new total of tokens burned as tx fees on the destination chain, and burns and equivalent number of ERC20 tokens on this chain. - ### `Collateralizing the bridge` - On initialization, the bridge will be undercollateralized by exactly the number of tokens minted in the genesis block on the destination chain. These tokens could theoretically be sent through the bridge, with no corresponding tokens able to be unlocked on the source chain. In order to avoid this problem, the `NativeTokenDestination` contract is initialized with the value for `initialReserveImbalance`, which should correspond to the number of tokens allocated in the genesis block for the destination chain. If `initialReserveImbalance` is not properly set, behaviour of this contract is undefined. The `NativeTokenDestination` contract will not mint tokens until it has received confirmation that at least `initialReserveImbalance` tokens have been locked on the source chain. It should be up to the contract deployer to ensure that the bridge is properly collateralized. Burning/unlocking is disabled until the bridge is properly collateralized. ### `Burning tokens spent as fees` - As tokens are burned for transaction fees on the destination chain, contract owners may want to relay this information to the source chain in order to burn an equivalent number of locked tokens there because these tokens will never be bridged back. - The address for burned transaction fees is `0x0100000000000000000000000000000000000000`. When transferring token to the source chain, the "burned" tokens are sent here so that `0x0100000000000000000000000000000000000000` will only include burned transaction fees (or tokens others have decided to burn outside of this contract) so that this number can be reported to the source chain to burn an equivalent numbers of locked tokens. - - Anyone on the destination can call `reportTotalBurnedTxFees`, which will provide the source chain with the total number of tokens burned in transactions on this chain. + - `TODO` explain implementation. ## `Setup` - `TeleporterMessenger` must be deployed on both chains, and the address must be passed to the constructor of both contracts. @@ -38,4 +31,4 @@ A set of smart contracts - one `NativeTokenDestination` contract and one "TokenS - Both `NativeTokenSource` and `NativeTokenDestination` need to be deployed to addresses known beforehand. Each address must be passed to the constructor of the other contract. To do this, you will need a known EOA, and preferably use the first transaction from the EOA (nonce 0) to deploy the contract on each chain. It is advised to allocate tokens to the EOA in the destination subnet genesis file so that it can easily deploy the contract. - Both contracts need to be initialized with `teleporterMessengerAddress`, which is the only address they will accept function calls from. - `NativeTokenDestination` needs to be intialized with `initialReserveImbalance`, which should equal the number of tokens allocated in the genesis file for the destination chain. If `initialReserveImbalance` is not properly set, behavior of these contracts in undefined. - - On the source chain, at least `initialReserveImbalance` tokens need to be transferred to `TokenSource` using `transferToSource` in order to properly collateralize the bridge and allow regular functionality in both directions. The first `initialReserveImbalance` tokens will not be delivered to the recipient, but any excess will be delivered. Burning/unlocking is disabled until the bridge is fully collateralized. \ No newline at end of file + - On the source chain, at least `initialReserveImbalance` tokens need to be transferred to `NativeTokenSource` using `transferToSource` in order to properly collateralize the bridge and allow regular functionality in both directions. The first `initialReserveImbalance` tokens will not be delivered to the recipient, but any excess will be delivered. Burning/unlocking is disabled until the bridge is fully collateralized. \ No newline at end of file From 045bfc2e4cedd838af38adcd940fa4fe47330758 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 20 Nov 2023 16:26:54 -0500 Subject: [PATCH 124/183] Tests for report burn --- .../NativeTokenBridge/ERC20TokenSource.sol | 22 ++-- .../NativeTokenDestination.sol | 20 ++-- .../NativeTokenBridge/NativeTokenSource.sol | 19 ++-- .../src/Teleporter/TeleporterMessenger.sol | 51 +++++---- tests/erc20_to_native_token_bridge.go | 97 +++++++++++------ tests/native_token_bridge.go | 101 ++++++++++++------ tests/utils/utils.go | 28 ++++- 7 files changed, 220 insertions(+), 118 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol index 4a573d236..dd696232d 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol @@ -21,10 +21,9 @@ contract ERC20TokenSource is ITokenSource, ReentrancyGuard { - // Designated Blackhole Address. Tokens are sent here to be "burned" before sending an unlock - // message to the source chain. Different from the burned tx fee address so they can be - // tracked separately. - address public constant BLACKHOLE_ADDRESS = 0x0100000000000000000000000000000000000001; + // The address where the burned transaction fees are credited. + address public constant BURNED_TX_FEES_ADDRESS = + 0x0100000000000000000000000000000000000000; uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 100_000; // Used to keep track of tokens burned through transactions on the destination chain. They can // be reported to this contract to burn an equivalent number of tokens on this chain. @@ -204,14 +203,20 @@ contract ERC20TokenSource is * @dev Sends tokens to BLACKHOLE_ADDRESS. */ function _burnTokens(uint256 amount) private { - SafeERC20.safeTransfer(IERC20(erc20ContractAddress), BLACKHOLE_ADDRESS, amount); - emit BurnTokens(amount); - } + SafeERC20.safeTransfer( + IERC20(erc20ContractAddress), + BURNED_TX_FEES_ADDRESS, + amount + ); + emit BurnTokens(amount); + } /** * @dev Update destinationChainBurnedBalance sent from destination chain */ - function _updateDestinationChainBurnedBalance(uint256 newBurnBalance) private { + function _updateDestinationChainBurnedBalance( + uint256 newBurnBalance + ) private { if (newBurnBalance > destinationChainBurnedBalance) { uint256 difference = newBurnBalance - destinationChainBurnedBalance; _burnTokens(difference); @@ -219,4 +224,3 @@ contract ERC20TokenSource is } } } - diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index 39b47ffe8..eb5043038 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -19,24 +19,23 @@ import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol // solhint-disable-next-line no-unused-import import {IAllowList} from "@subnet-evm-contracts/interfaces/IAllowList.sol"; -// The address where the burned transaction fees are credited. -// TODO implement mechanism to report burned tx fees to source chian. -address constant BURNED_TX_FEES_ADDRESS = 0x0100000000000000000000000000000000000000; -// Designated Blackhole Address. Tokens are sent here to be "burned" before sending an unlock -// message to the source chain. Different from the burned tx fee address so they can be -// tracked separately. -address constant BLACKHOLE_ADDRESS = 0x0100000000000000000000000000000000000001; - contract NativeTokenDestination is ITeleporterReceiver, INativeTokenDestination, ReentrancyGuard { + // The address where the burned transaction fees are credited. + address public constant BURNED_TX_FEES_ADDRESS = 0x0100000000000000000000000000000000000000; + // Designated Blackhole Address. Tokens are sent here to be "burned" before sending an unlock + // message to the source chain. Different from the burned tx fee address so they can be + // tracked separately. + address public constant BLACKHOLE_ADDRESS = 0x0100000000000000000000000000000000000001; + INativeMinter private immutable _nativeMinter = INativeMinter(0x0200000000000000000000000000000000000001); uint256 public constant TRANSFER_NATIVE_TOKENS_REQUIRED_GAS = 100_000; - uint256 public constant REPORT_BURNED_TOKENS_REQUIRED_GAS = 20_000; + uint256 public constant REPORT_BURNED_TOKENS_REQUIRED_GAS = 50_000; bytes32 public immutable sourceBlockchainID; address public immutable nativeTokenSourceAddress; // The first `initialReserveImbalance` tokens sent to this subnet will not be minted. @@ -252,6 +251,9 @@ contract NativeTokenDestination is function totalSupply() external view returns (uint256) { uint256 burned = address(BURNED_TX_FEES_ADDRESS).balance + address(BLACKHOLE_ADDRESS).balance; + + // This scenario should never happen, but this check will prevent an underflow + // where the contract would return a garbage value. require( burned <= totalMinted + initialReserveImbalance, "NativeTokenDestination: FATAL - contract has tokens unaccounted for" diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index 2e2efca90..3752c74e6 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -22,10 +22,9 @@ contract NativeTokenSource is ITokenSource, ReentrancyGuard { - // Designated Blackhole Address. Tokens are sent here to be "burned" before sending an unlock - // message to the source chain. Different from the burned tx fee address so they can be - // tracked separately. - address public constant BLACKHOLE_ADDRESS = 0x0100000000000000000000000000000000000001; + // The address where the burned transaction fees are credited. + address public constant BURNED_TX_FEES_ADDRESS = + 0x0100000000000000000000000000000000000000; uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 100_000; // Used to keep track of tokens burned through transactions on the destination chain. They can // be reported to this contract to burn an equivalent number of tokens on this chain. @@ -138,7 +137,11 @@ contract NativeTokenSource is IERC20(feeInfo.contractAddress), feeInfo.amount ); - SafeERC20.safeIncreaseAllowance(IERC20(feeInfo.contractAddress), address(teleporterMessenger), adjustedFeeAmount); + SafeERC20.safeIncreaseAllowance( + IERC20(feeInfo.contractAddress), + address(teleporterMessenger), + adjustedFeeAmount + ); } uint256 messageID = teleporterMessenger.sendCrossChainMessage( @@ -179,14 +182,16 @@ contract NativeTokenSource is * @dev Sends tokens to BLACKHOLE_ADDRESS. */ function _burnTokens(uint256 amount) private { - payable(BLACKHOLE_ADDRESS).transfer(amount); + payable(BURNED_TX_FEES_ADDRESS).transfer(amount); emit BurnTokens(amount); } /** * @dev Update destinationChainBurnedBalance sent from destination chain */ - function _updateDestinationChainBurnedBalance(uint256 newBurnBalance) private { + function _updateDestinationChainBurnedBalance( + uint256 newBurnBalance + ) private { if (newBurnBalance > destinationChainBurnedBalance) { uint256 difference = newBurnBalance - destinationChainBurnedBalance; _burnTokens(difference); diff --git a/contracts/src/Teleporter/TeleporterMessenger.sol b/contracts/src/Teleporter/TeleporterMessenger.sol index dacf929c1..8c8e902a0 100644 --- a/contracts/src/Teleporter/TeleporterMessenger.sol +++ b/contracts/src/Teleporter/TeleporterMessenger.sol @@ -735,29 +735,36 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { return; } - // Encode the payload by ABI encoding a call to the {receiveTeleporterMessage} function - // defined by the {ITeleporterReceiver} interface. - bytes memory payload = abi.encodeCall( - ITeleporterReceiver.receiveTeleporterMessage, - (originChainID, message.senderAddress, message.message) - ); - - // Call the destination address of the message with the formatted call data. Only provide the required - // gas limit to the sub-call so that the end application cannot consume an arbitrary amount of gas. - bool success = _tryExecuteMessage( - message.destinationAddress, - message.requiredGasLimit, - payload - ); + // // Encode the payload by ABI encoding a call to the {receiveTeleporterMessage} function + // // defined by the {ITeleporterReceiver} interface. + // bytes memory payload = abi.encodeCall( + // ITeleporterReceiver.receiveTeleporterMessage, + // (originChainID, message.senderAddress, message.message) + // ); + + // // Call the destination address of the message with the formatted call data. Only provide the required + // // gas limit to the sub-call so that the end application cannot consume an arbitrary amount of gas. + // bool success = _tryExecuteMessage( + // message.destinationAddress, + // message.requiredGasLimit, + // payload + // ); + + ITeleporterReceiver(message.destinationAddress) + .receiveTeleporterMessage( + originChainID, + message.senderAddress, + message.message + ); - // If the execution failed, store a hash of the message in state such that its - // execution can be retried again in the future with a higher gas limit (paid by whoever - // retries).Either way, the message will now be considered "delivered" since the relayer - // provided enough gas to meet the required gas limit. - if (!success) { - _storeFailedMessageExecution(originChainID, message); - return; - } + // // If the execution failed, store a hash of the message in state such that its + // // execution can be retried again in the future with a higher gas limit (paid by whoever + // // retries).Either way, the message will now be considered "delivered" since the relayer + // // provided enough gas to meet the required gas limit. + // if (!success) { + // _storeFailedMessageExecution(originChainID, message); + // return; + // } emit MessageExecuted(originChainID, message.messageID); } diff --git a/tests/erc20_to_native_token_bridge.go b/tests/erc20_to_native_token_bridge.go index eb074d6a0..f3d11c405 100644 --- a/tests/erc20_to_native_token_bridge.go +++ b/tests/erc20_to_native_token_bridge.go @@ -20,10 +20,6 @@ import ( func ERC20ToNativeTokenBridge() { const ( - initialReserveImbalance = uint64(1e15) - valueToSend1 = initialReserveImbalance / 4 - valueToReturn = valueToSend1 / 4 - // Each test file needs a unique deployer that must be funded with tokens to deploy deployerKeyStr = "ca7269c1fe2a5b86884a119aa516b8d5b641670b83aac0ebf9f2d71affcc12e4" ExampleERC20ByteCodeFile = "./contracts/out/ExampleERC20.sol/ExampleERC20.json" @@ -31,9 +27,15 @@ func ERC20ToNativeTokenBridge() { NativeTokenDestinationByteCodeFile = "./contracts/out/NativeTokenDestination.sol/NativeTokenDestination.json" ) var ( + initialReserveImbalance = big.NewInt(0).Mul(big.NewInt(1e15), big.NewInt(1e9)) + valueToSend = big.NewInt(0).Div(initialReserveImbalance, big.NewInt(4)) + intermediateReserveImbalance = utils.BigIntSub(initialReserveImbalance, valueToSend) + valueToReturn = big.NewInt(0).Div(valueToSend, big.NewInt(4)) + ctx = context.Background() deployerAddress = common.HexToAddress("0x539447ab8Be7e927bE8E005663C81ff2AE951337") tokenReceiverAddress = common.HexToAddress("0x4444444444444444444444444444444444444444") + burnedTxFeeAddress = common.HexToAddress("0x0100000000000000000000000000000000000000") emptyDestFeeInfo = nativetokendestination.TeleporterFeeInfo{ ContractAddress: common.Address{}, @@ -67,7 +69,7 @@ func ERC20ToNativeTokenBridge() { nativeTokenDestinationAbi, err := nativetokendestination.NativeTokenDestinationMetaData.GetAbi() Expect(err).Should(BeNil()) - utils.DeployContract(ctx, NativeTokenDestinationByteCodeFile, deployerPK, subnetB, nativeTokenDestinationAbi, teleporterContractAddress, subnetA.BlockchainID, bridgeContractAddress, new(big.Int).SetUint64(initialReserveImbalance)) + utils.DeployContract(ctx, NativeTokenDestinationByteCodeFile, deployerPK, subnetB, nativeTokenDestinationAbi, teleporterContractAddress, subnetA.BlockchainID, bridgeContractAddress,initialReserveImbalance) exampleERC20Abi, err := exampleerc20.ExampleERC20MetaData.GetAbi() Expect(err).Should(BeNil()) @@ -84,10 +86,10 @@ func ERC20ToNativeTokenBridge() { Expect(err).Should(BeNil()) // Helper function - sendTokensToSource := func(valueToSend uint64, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { + sendTokensToSource := func(valueToSend *big.Int, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, subnetB.ChainID) Expect(err).Should(BeNil()) - transactor.Value = new(big.Int).SetUint64(valueToSend) + transactor.Value = valueToSend tx, err := nativeTokenDestination.TransferToSource(transactor, toAddress, emptyDestFeeInfo, []common.Address{}) Expect(err).Should(BeNil()) @@ -97,7 +99,7 @@ func ERC20ToNativeTokenBridge() { transferEvent, err := utils.GetEventFromLogs(sourceChainReceipt.Logs, nativeTokenDestination.ParseTransferToSource) Expect(err).Should(BeNil()) - Expect(transferEvent.Amount.Uint64()).Should(Equal(valueToSend)) + utils.ExpectBigEqual(transferEvent.Amount, valueToSend) receipt, err := utils.RelayMessage(ctx, sourceChainReceipt.BlockHash, sourceChainReceipt.BlockNumber, subnetB, subnetA) Expect(err).Should(BeNil()) @@ -106,11 +108,11 @@ func ERC20ToNativeTokenBridge() { } // Helper function - sendTokensToDestination := func(valueToSend uint64, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { + sendTokensToDestination := func(valueToSend *big.Int, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, subnetA.ChainID) Expect(err).Should(BeNil()) - tx, err := erc20TokenSource.TransferToDestination(transactor, toAddress, new(big.Int).SetUint64(valueToSend), big.NewInt(0), []common.Address{}) + tx, err := erc20TokenSource.TransferToDestination(transactor, toAddress, valueToSend, big.NewInt(0), []common.Address{}) Expect(err).Should(BeNil()) log.Info("Sent TransferToDestination transaction on source chain", "destinationChainID", subnetB.BlockchainID, "txHash", tx.Hash().Hex()) @@ -118,7 +120,7 @@ func ERC20ToNativeTokenBridge() { transferEvent, err := utils.GetEventFromLogs(sourceChainReceipt.Logs, erc20TokenSource.ParseTransferToDestination) Expect(err).Should(BeNil()) - Expect(transferEvent.TransferAmount.Uint64()).Should(Equal(valueToSend)) + utils.ExpectBigEqual(transferEvent.TransferAmount, valueToSend) receipt, err := utils.RelayMessage(ctx, sourceChainReceipt.BlockHash, sourceChainReceipt.BlockNumber, subnetA, subnetB) Expect(err).Should(BeNil()) @@ -129,7 +131,6 @@ func ERC20ToNativeTokenBridge() { { // Give erc20TokenSource allowance to spend all of the deployer's ERC20 Tokens bal, err := exampleERC20.BalanceOf(nil, deployerAddress) Expect(err).Should(BeNil()) - Expect(bal.Div(bal, big.NewInt(10)).Uint64() > initialReserveImbalance).Should(BeTrue()) transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetA.ChainID) Expect(err).Should(BeNil()) @@ -142,62 +143,62 @@ func ERC20ToNativeTokenBridge() { { // Transfer some tokens A -> B // Check starting balance is 0 - utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) checkReserveImbalance(initialReserveImbalance, nativeTokenDestination) - destChainReceipt := sendTokensToDestination(valueToSend1, deployerPK, tokenReceiverAddress) + destChainReceipt := sendTokensToDestination(valueToSend, deployerPK, tokenReceiverAddress) collateralEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseCollateralAdded) Expect(err).Should(BeNil()) - Expect(collateralEvent.Amount.Uint64()).Should(Equal(valueToSend1)) + utils.ExpectBigEqual(collateralEvent.Amount, valueToSend) _, err = utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseNativeTokensMinted) Expect(err).ShouldNot(BeNil()) - checkReserveImbalance(initialReserveImbalance-valueToSend1, nativeTokenDestination) + checkReserveImbalance(intermediateReserveImbalance, nativeTokenDestination) // Check intermediate balance, no tokens should be minted because we haven't collateralized - utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) } { // Fail to Transfer tokens B -> A because bridge is not collateralized // Check starting balance is 0 - utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetB.ChainID) Expect(err).Should(BeNil()) - transactor.Value = new(big.Int).SetUint64(valueToSend1) + transactor.Value = valueToSend _, err = nativeTokenDestination.TransferToSource(transactor, tokenReceiverAddress, emptyDestFeeInfo, []common.Address{}) Expect(err).ShouldNot(BeNil()) - checkReserveImbalance(initialReserveImbalance-valueToSend1, nativeTokenDestination) + checkReserveImbalance(intermediateReserveImbalance, nativeTokenDestination) // Check we failed to send because we're not collateralized - utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) } { // Transfer more tokens A -> B to collateralize the bridge // Check starting balance is 0 - utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) - checkReserveImbalance(initialReserveImbalance-valueToSend1, nativeTokenDestination) + checkReserveImbalance(intermediateReserveImbalance, nativeTokenDestination) destChainReceipt := sendTokensToDestination(initialReserveImbalance, deployerPK, tokenReceiverAddress) collateralEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseCollateralAdded) Expect(err).Should(BeNil()) - Expect(collateralEvent.Amount.Uint64()).Should(Equal(initialReserveImbalance - valueToSend1)) + Expect(collateralEvent.Amount).Should(Equal(intermediateReserveImbalance)) mintEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseNativeTokensMinted) Expect(err).Should(BeNil()) - Expect(mintEvent.Amount.Uint64()).Should(Equal(valueToSend1)) + utils.ExpectBigEqual(mintEvent.Amount, valueToSend) - checkReserveImbalance(0, nativeTokenDestination) + checkReserveImbalance(common.Big0, nativeTokenDestination) // We should have minted the excess coins after checking the collateral - utils.CheckBalance(ctx, tokenReceiverAddress, valueToSend1, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, valueToSend, subnetB.WSClient) } { // Transfer tokens B -> A @@ -207,19 +208,45 @@ func ERC20ToNativeTokenBridge() { bal, err := exampleERC20.BalanceOf(nil, tokenReceiverAddress) Expect(err).Should(BeNil()) - Expect(bal.Uint64()).Should(Equal(valueToReturn)) + utils.ExpectBigEqual(bal, valueToReturn) } -} -func checkReserveImbalance(value uint64, nativeTokenDestination *nativetokendestination.NativeTokenDestination) { - imbalance, err := nativeTokenDestination.CurrentReserveImbalance(&bind.CallOpts{}) - Expect(err).Should(BeNil()) - Expect(imbalance.Uint64()).Should(Equal(value)) + { // Check reporting of burned tx fees to Source Chain + burnedTxFeesBalanceDest, err := subnetB.WSClient.BalanceAt(ctx, burnedTxFeeAddress, nil) + Expect(err).Should(BeNil()) + Expect(burnedTxFeesBalanceDest.Cmp(common.Big0) > 0).Should(BeTrue()) + + transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetB.ChainID) + Expect(err).Should(BeNil()) + tx, err := nativeTokenDestination.ReportTotalBurnedTxFees(transactor, emptyDestFeeInfo, []common.Address{}) + Expect(err).Should(BeNil()) + + destChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetB.WSClient) + + reportEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseReportTotalBurnedTxFees) + Expect(err).Should(BeNil()) + utils.ExpectBigEqual(reportEvent.BurnAddressBalance, burnedTxFeesBalanceDest) + + burnedTxFeesBalanceSource, err := exampleERC20.BalanceOf(nil, burnedTxFeeAddress) + Expect(err).Should(BeNil()) + utils.ExpectBigEqual(burnedTxFeesBalanceSource, common.Big0) + + sourceChainReceipt, err := utils.RelayMessage(ctx, destChainReceipt.BlockHash, destChainReceipt.BlockNumber, subnetB, subnetA) + Expect(err).Should(BeNil()) + + burnEvent, err := utils.GetEventFromLogs(sourceChainReceipt.Logs, erc20TokenSource.ParseBurnTokens) + Expect(err).Should(BeNil()) + utils.ExpectBigEqual(burnedTxFeesBalanceDest, burnEvent.Amount) + + burnedTxFeesBalanceSource2, err := exampleERC20.BalanceOf(nil, burnedTxFeeAddress) + Expect(err).Should(BeNil()) + utils.ExpectBigEqual(burnedTxFeesBalanceSource2, burnEvent.Amount) + } } -func checkUnlockERC20Event(logs []*types.Log, erc20TokenSource *erc20tokensource.ERC20TokenSource, recipient common.Address, value uint64) { +func checkUnlockERC20Event(logs []*types.Log, erc20TokenSource *erc20tokensource.ERC20TokenSource, recipient common.Address, value *big.Int) { unlockEvent, err := utils.GetEventFromLogs(logs, erc20TokenSource.ParseUnlockTokens) Expect(err).Should(BeNil()) Expect(unlockEvent.Recipient).Should(Equal(recipient)) - Expect(unlockEvent.Amount.Uint64()).Should(Equal(value)) + utils.ExpectBigEqual(unlockEvent.Amount, value) } diff --git a/tests/native_token_bridge.go b/tests/native_token_bridge.go index ba7ae4763..4cdc658e2 100644 --- a/tests/native_token_bridge.go +++ b/tests/native_token_bridge.go @@ -19,9 +19,6 @@ import ( func NativeTokenBridge() { const ( - initialReserveImbalance = uint64(1e15) - valueToSend = initialReserveImbalance / 4 - valueToReturn = valueToSend / 4 // Each test file needs a unique deployer that must be funded with tokens to deploy deployerKeyStr = "aad7440febfc8f9d73a58c3cb1f1754779a566978f9ebffcd4f4698e9b043985" @@ -29,9 +26,13 @@ func NativeTokenBridge() { NativeTokenDestinationByteCodeFile = "./contracts/out/NativeTokenDestination.sol/NativeTokenDestination.json" ) var ( - ctx = context.Background() - deployerAddress = common.HexToAddress("0x1337cfd2dCff6270615B90938aCB1efE79801704") - tokenReceiverAddress = common.HexToAddress("0x0123456789012345678901234567890123456789") + initialReserveImbalance = big.NewInt(0).Mul(big.NewInt(1e15), big.NewInt(1e9)) + valueToSend = big.NewInt(0).Div(initialReserveImbalance, big.NewInt(4)) + valueToReturn = big.NewInt(0).Div(valueToSend, big.NewInt(4)) + ctx = context.Background() + deployerAddress = common.HexToAddress("0x1337cfd2dCff6270615B90938aCB1efE79801704") + tokenReceiverAddress = common.HexToAddress("0x0123456789012345678901234567890123456789") + burnedTxFeeAddress = common.HexToAddress("0x0100000000000000000000000000000000000000") emptyDestFeeInfo = nativetokendestination.TeleporterFeeInfo{ ContractAddress: common.Address{}, @@ -67,7 +68,7 @@ func NativeTokenBridge() { nativeTokenDestinationAbi, err := nativetokendestination.NativeTokenDestinationMetaData.GetAbi() Expect(err).Should(BeNil()) - utils.DeployContract(ctx, NativeTokenDestinationByteCodeFile, deployerPK, subnetB, nativeTokenDestinationAbi, teleporterContractAddress, subnetA.BlockchainID, bridgeContractAddress, new(big.Int).SetUint64(initialReserveImbalance)) + utils.DeployContract(ctx, NativeTokenDestinationByteCodeFile, deployerPK, subnetB, nativeTokenDestinationAbi, teleporterContractAddress, subnetA.BlockchainID, bridgeContractAddress, initialReserveImbalance) log.Info("Finished deploying Bridge contracts") } @@ -79,10 +80,10 @@ func NativeTokenBridge() { Expect(err).Should(BeNil()) // Helper function - sendTokensToSource := func(valueToSend uint64, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { + sendTokensToSource := func(valueToSend *big.Int, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, subnetB.ChainID) Expect(err).Should(BeNil()) - transactor.Value = new(big.Int).SetUint64(valueToSend) + transactor.Value = valueToSend tx, err := nativeTokenDestination.TransferToSource(transactor, toAddress, emptyDestFeeInfo, []common.Address{}) Expect(err).Should(BeNil()) @@ -92,7 +93,7 @@ func NativeTokenBridge() { transferEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseTransferToSource) Expect(err).Should(BeNil()) - Expect(transferEvent.Amount.Uint64()).Should(Equal(valueToSend)) + utils.ExpectBigEqual(transferEvent.Amount, valueToSend) receipt, err := utils.RelayMessage(ctx, destChainReceipt.BlockHash, destChainReceipt.BlockNumber, subnetB, subnetA) Expect(err).Should(BeNil()) @@ -101,10 +102,10 @@ func NativeTokenBridge() { } // Helper function - sendTokensToDestination := func(valueToSend uint64, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { + sendTokensToDestination := func(valueToSend *big.Int, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, subnetA.ChainID) Expect(err).Should(BeNil()) - transactor.Value = new(big.Int).SetUint64(valueToSend) + transactor.Value = valueToSend tx, err := nativeTokenSource.TransferToDestination(transactor, toAddress, emptySourceFeeInfo, []common.Address{}) Expect(err).Should(BeNil()) @@ -114,7 +115,7 @@ func NativeTokenBridge() { transferEvent, err := utils.GetEventFromLogs(sourceChainReceipt.Logs, nativeTokenSource.ParseTransferToDestination) Expect(err).Should(BeNil()) - Expect(transferEvent.Amount.Uint64()).Should(Equal(valueToSend)) + utils.ExpectBigEqual(transferEvent.Amount, valueToSend) receipt, err := utils.RelayMessage(ctx, sourceChainReceipt.BlockHash, sourceChainReceipt.BlockNumber, subnetA, subnetB) Expect(err).Should(BeNil()) @@ -124,48 +125,48 @@ func NativeTokenBridge() { { // Transfer some tokens A -> B // Check starting balance is 0 - utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) checkReserveImbalance(initialReserveImbalance, nativeTokenDestination) destChainReceipt := sendTokensToDestination(valueToSend, deployerPK, tokenReceiverAddress) - checkCollateralEvent(destChainReceipt.Logs, nativeTokenDestination, valueToSend, initialReserveImbalance - valueToSend) - checkReserveImbalance(initialReserveImbalance-valueToSend, nativeTokenDestination) + checkCollateralEvent(destChainReceipt.Logs, nativeTokenDestination, valueToSend, big.NewInt(0).Sub(initialReserveImbalance, valueToSend)) + checkReserveImbalance(big.NewInt(0).Sub(initialReserveImbalance, valueToSend), nativeTokenDestination) _, err = utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseNativeTokensMinted) Expect(err).ShouldNot(BeNil()) // Check intermediate balance, no tokens should be minted because we haven't collateralized - utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) } { // Fail to Transfer tokens B -> A because bridge is not collateralized // Check starting balance is 0 - utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetA.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetA.WSClient) transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetB.ChainID) Expect(err).Should(BeNil()) - transactor.Value = new(big.Int).SetUint64(valueToSend) + transactor.Value = valueToSend // This transfer should revert because the bridge isn't collateralized _, err = nativeTokenDestination.TransferToSource(transactor, tokenReceiverAddress, emptyDestFeeInfo, []common.Address{}) Expect(err).ShouldNot(BeNil()) // Check we should fail to send because we're not collateralized - utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetA.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetA.WSClient) } { // Transfer more tokens A -> B to collateralize the bridge // Check starting balance is 0 - utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) - checkReserveImbalance(initialReserveImbalance-valueToSend, nativeTokenDestination) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) + checkReserveImbalance(big.NewInt(0).Sub(initialReserveImbalance, valueToSend), nativeTokenDestination) destChainReceipt := sendTokensToDestination(initialReserveImbalance, deployerPK, tokenReceiverAddress) - checkCollateralEvent(destChainReceipt.Logs, nativeTokenDestination, initialReserveImbalance-valueToSend, 0) + checkCollateralEvent(destChainReceipt.Logs, nativeTokenDestination, big.NewInt(0).Sub(initialReserveImbalance, valueToSend), common.Big0) checkMintEvent(destChainReceipt.Logs, nativeTokenDestination, tokenReceiverAddress, valueToSend) - checkReserveImbalance(0, nativeTokenDestination) + checkReserveImbalance(common.Big0, nativeTokenDestination) // We should have minted the excess coins after checking the collateral utils.CheckBalance(ctx, tokenReceiverAddress, valueToSend, subnetB.WSClient) @@ -178,25 +179,63 @@ func NativeTokenBridge() { utils.CheckBalance(ctx, tokenReceiverAddress, valueToReturn, subnetA.WSClient) } + + { // Check reporting of burned tx fees to Source Chain + burnedTxFeesBalanceDest, err := subnetB.WSClient.BalanceAt(ctx, burnedTxFeeAddress, nil) + Expect(err).Should(BeNil()) + Expect(burnedTxFeesBalanceDest.Cmp(common.Big0) > 0).Should(BeTrue()) + + transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetB.ChainID) + Expect(err).Should(BeNil()) + tx, err := nativeTokenDestination.ReportTotalBurnedTxFees(transactor, emptyDestFeeInfo, []common.Address{}) + Expect(err).Should(BeNil()) + + destChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetB.WSClient) + + reportEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseReportTotalBurnedTxFees) + Expect(err).Should(BeNil()) + utils.ExpectBigEqual(reportEvent.BurnAddressBalance, burnedTxFeesBalanceDest) + + burnedTxFeesBalanceSource, err := subnetA.WSClient.BalanceAt(ctx, burnedTxFeeAddress, nil) + Expect(err).Should(BeNil()) + Expect(burnedTxFeesBalanceSource.Cmp(common.Big0) > 0).Should(BeTrue()) + + sourceChainReceipt, err := utils.RelayMessage(ctx, destChainReceipt.BlockHash, destChainReceipt.BlockNumber, subnetB, subnetA) + Expect(err).Should(BeNil()) + + burnEvent, err := utils.GetEventFromLogs(sourceChainReceipt.Logs, nativeTokenSource.ParseBurnTokens) + Expect(err).Should(BeNil()) + utils.ExpectBigEqual(burnedTxFeesBalanceDest, burnEvent.Amount) + + burnedTxFeesBalanceSource2, err := subnetA.WSClient.BalanceAt(ctx, burnedTxFeeAddress, nil) + Expect(err).Should(BeNil()) + Expect(burnedTxFeesBalanceSource2.Cmp(big.NewInt(0).Add(burnedTxFeesBalanceSource, burnEvent.Amount)) >= 0).Should(BeTrue()) + } } -func checkUnlockNativeEvent(logs []*types.Log, nativeTokenSource *nativetokensource.NativeTokenSource, recipient common.Address, value uint64) { +func checkUnlockNativeEvent(logs []*types.Log, nativeTokenSource *nativetokensource.NativeTokenSource, recipient common.Address, value *big.Int) { unlockEvent, err := utils.GetEventFromLogs(logs, nativeTokenSource.ParseUnlockTokens) Expect(err).Should(BeNil()) Expect(unlockEvent.Recipient).Should(Equal(recipient)) - Expect(unlockEvent.Amount.Uint64()).Should(Equal(value)) + Expect(unlockEvent.Amount.Cmp(value)).Should(BeZero()) } -func checkCollateralEvent(logs []*types.Log, nativeTokenDestination *nativetokendestination.NativeTokenDestination, collateralAdded uint64, collateralRemaining uint64) { +func checkCollateralEvent(logs []*types.Log, nativeTokenDestination *nativetokendestination.NativeTokenDestination, collateralAdded *big.Int, collateralRemaining *big.Int) { collateralEvent, err := utils.GetEventFromLogs(logs, nativeTokenDestination.ParseCollateralAdded) Expect(err).Should(BeNil()) - Expect(collateralEvent.Amount.Uint64()).Should(Equal(collateralAdded)) - Expect(collateralEvent.Remaining.Uint64()).Should(Equal(collateralRemaining)) + Expect(collateralEvent.Amount.Cmp(collateralAdded)).Should(BeZero()) + Expect(collateralEvent.Remaining.Cmp(collateralEvent.Remaining)).Should(BeZero()) } -func checkMintEvent(logs []*types.Log, nativeTokenDestination *nativetokendestination.NativeTokenDestination, recipient common.Address, value uint64) { +func checkMintEvent(logs []*types.Log, nativeTokenDestination *nativetokendestination.NativeTokenDestination, recipient common.Address, value *big.Int) { mintEvent, err := utils.GetEventFromLogs(logs, nativeTokenDestination.ParseNativeTokensMinted) Expect(err).Should(BeNil()) Expect(mintEvent.Recipient).Should(Equal(recipient)) - Expect(mintEvent.Amount.Uint64()).Should(Equal(value)) + Expect(mintEvent.Amount.Cmp(value)).Should(BeZero()) +} + +func checkReserveImbalance(value *big.Int, nativeTokenDestination *nativetokendestination.NativeTokenDestination) { + imbalance, err := nativeTokenDestination.CurrentReserveImbalance(&bind.CallOpts{}) + Expect(err).Should(BeNil()) + utils.ExpectBigEqual(imbalance, value) } diff --git a/tests/utils/utils.go b/tests/utils/utils.go index 5adbe26c0..763b2945a 100644 --- a/tests/utils/utils.go +++ b/tests/utils/utils.go @@ -236,7 +236,7 @@ func WaitForTransactionSuccess(ctx context.Context, txHash common.Hash, client e } func WaitForTransaction(ctx context.Context, txHash common.Hash, client ethclient.Client) *types.Receipt { - cctx, cancel := context.WithTimeout(ctx, 20 * time.Second) + cctx, cancel := context.WithTimeout(ctx, 20*time.Second) defer cancel() // Loop until we find the transaction or time out @@ -312,7 +312,12 @@ func RelayMessage( Expect(err).Should(BeNil()) // Check the transaction logs for the ReceiveCrossChainMessage event emitted by the Teleporter contract receiveEvent, err := GetEventFromLogs(receipt.Logs, bind.ParseReceiveCrossChainMessage) - Expect(err).Should(BeNil()) + if err != nil { + // If we didn't find the ReceiveCrossChainMessage event, trace the transaction. + // We compare it with the empty string so that ginkgo will print it out for us. + trace := TraceTransaction(ctx, receipt.TxHash, destination) + Expect(trace).Should(Equal("")) + } Expect(receiveEvent.OriginChainID[:]).Should(Equal(source.BlockchainID[:])) // Check for a successful execution of the teleporter message. @@ -389,10 +394,10 @@ func PrivateKeyToAddress(k *ecdsa.PrivateKey) common.Address { } // Throws a Gomega error if there is a mismatch -func CheckBalance(ctx context.Context, addr common.Address, expectedBalance uint64, wsClient ethclient.Client) { - bal, err :=wsClient.BalanceAt(ctx, addr, nil) +func CheckBalance(ctx context.Context, addr common.Address, expectedBalance *big.Int, wsClient ethclient.Client) { + bal, err := wsClient.BalanceAt(ctx, addr, nil) Expect(err).Should(BeNil()) - Expect(bal.Uint64()).Should(Equal(expectedBalance)) + ExpectBigEqual(bal, expectedBalance) } func TraceTransaction(ctx context.Context, txHash common.Hash, subnetInfo SubnetTestInfo) string { @@ -429,3 +434,16 @@ func DeployContract(ctx context.Context, byteCodeFileName string, deployerPK *ec Expect(err).Should(BeNil()) Expect(len(code)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode } + +func ExpectBigEqual(v1 *big.Int, v2 *big.Int) { + // Compare strings, so gomega will print the numbers if they differ + Expect(v1.String()).Should(Equal(v2.String())) +} + +func BigIntSub(v1 *big.Int, v2 *big.Int) *big.Int { + return big.NewInt(0).Sub(v1, v2) +} + +func BigIntMul(v1 *big.Int, v2 *big.Int) *big.Int { + return big.NewInt(0).Mul(v1, v2) +} From 1584c903f100274a8e24ae45240480b1875e045c Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 20 Nov 2023 16:33:17 -0500 Subject: [PATCH 125/183] Revert "Tests for report burn" This reverts commit 045bfc2e4cedd838af38adcd940fa4fe47330758. --- .../NativeTokenBridge/ERC20TokenSource.sol | 22 ++-- .../NativeTokenDestination.sol | 20 ++-- .../NativeTokenBridge/NativeTokenSource.sol | 19 ++-- .../src/Teleporter/TeleporterMessenger.sol | 51 ++++----- tests/erc20_to_native_token_bridge.go | 97 ++++++----------- tests/native_token_bridge.go | 101 ++++++------------ tests/utils/utils.go | 28 +---- 7 files changed, 118 insertions(+), 220 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol index dd696232d..4a573d236 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol @@ -21,9 +21,10 @@ contract ERC20TokenSource is ITokenSource, ReentrancyGuard { - // The address where the burned transaction fees are credited. - address public constant BURNED_TX_FEES_ADDRESS = - 0x0100000000000000000000000000000000000000; + // Designated Blackhole Address. Tokens are sent here to be "burned" before sending an unlock + // message to the source chain. Different from the burned tx fee address so they can be + // tracked separately. + address public constant BLACKHOLE_ADDRESS = 0x0100000000000000000000000000000000000001; uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 100_000; // Used to keep track of tokens burned through transactions on the destination chain. They can // be reported to this contract to burn an equivalent number of tokens on this chain. @@ -203,20 +204,14 @@ contract ERC20TokenSource is * @dev Sends tokens to BLACKHOLE_ADDRESS. */ function _burnTokens(uint256 amount) private { - SafeERC20.safeTransfer( - IERC20(erc20ContractAddress), - BURNED_TX_FEES_ADDRESS, - amount - ); - emit BurnTokens(amount); - } + SafeERC20.safeTransfer(IERC20(erc20ContractAddress), BLACKHOLE_ADDRESS, amount); + emit BurnTokens(amount); + } /** * @dev Update destinationChainBurnedBalance sent from destination chain */ - function _updateDestinationChainBurnedBalance( - uint256 newBurnBalance - ) private { + function _updateDestinationChainBurnedBalance(uint256 newBurnBalance) private { if (newBurnBalance > destinationChainBurnedBalance) { uint256 difference = newBurnBalance - destinationChainBurnedBalance; _burnTokens(difference); @@ -224,3 +219,4 @@ contract ERC20TokenSource is } } } + diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index eb5043038..39b47ffe8 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -19,23 +19,24 @@ import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol // solhint-disable-next-line no-unused-import import {IAllowList} from "@subnet-evm-contracts/interfaces/IAllowList.sol"; +// The address where the burned transaction fees are credited. +// TODO implement mechanism to report burned tx fees to source chian. +address constant BURNED_TX_FEES_ADDRESS = 0x0100000000000000000000000000000000000000; +// Designated Blackhole Address. Tokens are sent here to be "burned" before sending an unlock +// message to the source chain. Different from the burned tx fee address so they can be +// tracked separately. +address constant BLACKHOLE_ADDRESS = 0x0100000000000000000000000000000000000001; + contract NativeTokenDestination is ITeleporterReceiver, INativeTokenDestination, ReentrancyGuard { - // The address where the burned transaction fees are credited. - address public constant BURNED_TX_FEES_ADDRESS = 0x0100000000000000000000000000000000000000; - // Designated Blackhole Address. Tokens are sent here to be "burned" before sending an unlock - // message to the source chain. Different from the burned tx fee address so they can be - // tracked separately. - address public constant BLACKHOLE_ADDRESS = 0x0100000000000000000000000000000000000001; - INativeMinter private immutable _nativeMinter = INativeMinter(0x0200000000000000000000000000000000000001); uint256 public constant TRANSFER_NATIVE_TOKENS_REQUIRED_GAS = 100_000; - uint256 public constant REPORT_BURNED_TOKENS_REQUIRED_GAS = 50_000; + uint256 public constant REPORT_BURNED_TOKENS_REQUIRED_GAS = 20_000; bytes32 public immutable sourceBlockchainID; address public immutable nativeTokenSourceAddress; // The first `initialReserveImbalance` tokens sent to this subnet will not be minted. @@ -251,9 +252,6 @@ contract NativeTokenDestination is function totalSupply() external view returns (uint256) { uint256 burned = address(BURNED_TX_FEES_ADDRESS).balance + address(BLACKHOLE_ADDRESS).balance; - - // This scenario should never happen, but this check will prevent an underflow - // where the contract would return a garbage value. require( burned <= totalMinted + initialReserveImbalance, "NativeTokenDestination: FATAL - contract has tokens unaccounted for" diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index 3752c74e6..2e2efca90 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -22,9 +22,10 @@ contract NativeTokenSource is ITokenSource, ReentrancyGuard { - // The address where the burned transaction fees are credited. - address public constant BURNED_TX_FEES_ADDRESS = - 0x0100000000000000000000000000000000000000; + // Designated Blackhole Address. Tokens are sent here to be "burned" before sending an unlock + // message to the source chain. Different from the burned tx fee address so they can be + // tracked separately. + address public constant BLACKHOLE_ADDRESS = 0x0100000000000000000000000000000000000001; uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 100_000; // Used to keep track of tokens burned through transactions on the destination chain. They can // be reported to this contract to burn an equivalent number of tokens on this chain. @@ -137,11 +138,7 @@ contract NativeTokenSource is IERC20(feeInfo.contractAddress), feeInfo.amount ); - SafeERC20.safeIncreaseAllowance( - IERC20(feeInfo.contractAddress), - address(teleporterMessenger), - adjustedFeeAmount - ); + SafeERC20.safeIncreaseAllowance(IERC20(feeInfo.contractAddress), address(teleporterMessenger), adjustedFeeAmount); } uint256 messageID = teleporterMessenger.sendCrossChainMessage( @@ -182,16 +179,14 @@ contract NativeTokenSource is * @dev Sends tokens to BLACKHOLE_ADDRESS. */ function _burnTokens(uint256 amount) private { - payable(BURNED_TX_FEES_ADDRESS).transfer(amount); + payable(BLACKHOLE_ADDRESS).transfer(amount); emit BurnTokens(amount); } /** * @dev Update destinationChainBurnedBalance sent from destination chain */ - function _updateDestinationChainBurnedBalance( - uint256 newBurnBalance - ) private { + function _updateDestinationChainBurnedBalance(uint256 newBurnBalance) private { if (newBurnBalance > destinationChainBurnedBalance) { uint256 difference = newBurnBalance - destinationChainBurnedBalance; _burnTokens(difference); diff --git a/contracts/src/Teleporter/TeleporterMessenger.sol b/contracts/src/Teleporter/TeleporterMessenger.sol index 8c8e902a0..dacf929c1 100644 --- a/contracts/src/Teleporter/TeleporterMessenger.sol +++ b/contracts/src/Teleporter/TeleporterMessenger.sol @@ -735,36 +735,29 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { return; } - // // Encode the payload by ABI encoding a call to the {receiveTeleporterMessage} function - // // defined by the {ITeleporterReceiver} interface. - // bytes memory payload = abi.encodeCall( - // ITeleporterReceiver.receiveTeleporterMessage, - // (originChainID, message.senderAddress, message.message) - // ); - - // // Call the destination address of the message with the formatted call data. Only provide the required - // // gas limit to the sub-call so that the end application cannot consume an arbitrary amount of gas. - // bool success = _tryExecuteMessage( - // message.destinationAddress, - // message.requiredGasLimit, - // payload - // ); - - ITeleporterReceiver(message.destinationAddress) - .receiveTeleporterMessage( - originChainID, - message.senderAddress, - message.message - ); + // Encode the payload by ABI encoding a call to the {receiveTeleporterMessage} function + // defined by the {ITeleporterReceiver} interface. + bytes memory payload = abi.encodeCall( + ITeleporterReceiver.receiveTeleporterMessage, + (originChainID, message.senderAddress, message.message) + ); + + // Call the destination address of the message with the formatted call data. Only provide the required + // gas limit to the sub-call so that the end application cannot consume an arbitrary amount of gas. + bool success = _tryExecuteMessage( + message.destinationAddress, + message.requiredGasLimit, + payload + ); - // // If the execution failed, store a hash of the message in state such that its - // // execution can be retried again in the future with a higher gas limit (paid by whoever - // // retries).Either way, the message will now be considered "delivered" since the relayer - // // provided enough gas to meet the required gas limit. - // if (!success) { - // _storeFailedMessageExecution(originChainID, message); - // return; - // } + // If the execution failed, store a hash of the message in state such that its + // execution can be retried again in the future with a higher gas limit (paid by whoever + // retries).Either way, the message will now be considered "delivered" since the relayer + // provided enough gas to meet the required gas limit. + if (!success) { + _storeFailedMessageExecution(originChainID, message); + return; + } emit MessageExecuted(originChainID, message.messageID); } diff --git a/tests/erc20_to_native_token_bridge.go b/tests/erc20_to_native_token_bridge.go index f3d11c405..eb074d6a0 100644 --- a/tests/erc20_to_native_token_bridge.go +++ b/tests/erc20_to_native_token_bridge.go @@ -20,6 +20,10 @@ import ( func ERC20ToNativeTokenBridge() { const ( + initialReserveImbalance = uint64(1e15) + valueToSend1 = initialReserveImbalance / 4 + valueToReturn = valueToSend1 / 4 + // Each test file needs a unique deployer that must be funded with tokens to deploy deployerKeyStr = "ca7269c1fe2a5b86884a119aa516b8d5b641670b83aac0ebf9f2d71affcc12e4" ExampleERC20ByteCodeFile = "./contracts/out/ExampleERC20.sol/ExampleERC20.json" @@ -27,15 +31,9 @@ func ERC20ToNativeTokenBridge() { NativeTokenDestinationByteCodeFile = "./contracts/out/NativeTokenDestination.sol/NativeTokenDestination.json" ) var ( - initialReserveImbalance = big.NewInt(0).Mul(big.NewInt(1e15), big.NewInt(1e9)) - valueToSend = big.NewInt(0).Div(initialReserveImbalance, big.NewInt(4)) - intermediateReserveImbalance = utils.BigIntSub(initialReserveImbalance, valueToSend) - valueToReturn = big.NewInt(0).Div(valueToSend, big.NewInt(4)) - ctx = context.Background() deployerAddress = common.HexToAddress("0x539447ab8Be7e927bE8E005663C81ff2AE951337") tokenReceiverAddress = common.HexToAddress("0x4444444444444444444444444444444444444444") - burnedTxFeeAddress = common.HexToAddress("0x0100000000000000000000000000000000000000") emptyDestFeeInfo = nativetokendestination.TeleporterFeeInfo{ ContractAddress: common.Address{}, @@ -69,7 +67,7 @@ func ERC20ToNativeTokenBridge() { nativeTokenDestinationAbi, err := nativetokendestination.NativeTokenDestinationMetaData.GetAbi() Expect(err).Should(BeNil()) - utils.DeployContract(ctx, NativeTokenDestinationByteCodeFile, deployerPK, subnetB, nativeTokenDestinationAbi, teleporterContractAddress, subnetA.BlockchainID, bridgeContractAddress,initialReserveImbalance) + utils.DeployContract(ctx, NativeTokenDestinationByteCodeFile, deployerPK, subnetB, nativeTokenDestinationAbi, teleporterContractAddress, subnetA.BlockchainID, bridgeContractAddress, new(big.Int).SetUint64(initialReserveImbalance)) exampleERC20Abi, err := exampleerc20.ExampleERC20MetaData.GetAbi() Expect(err).Should(BeNil()) @@ -86,10 +84,10 @@ func ERC20ToNativeTokenBridge() { Expect(err).Should(BeNil()) // Helper function - sendTokensToSource := func(valueToSend *big.Int, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { + sendTokensToSource := func(valueToSend uint64, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, subnetB.ChainID) Expect(err).Should(BeNil()) - transactor.Value = valueToSend + transactor.Value = new(big.Int).SetUint64(valueToSend) tx, err := nativeTokenDestination.TransferToSource(transactor, toAddress, emptyDestFeeInfo, []common.Address{}) Expect(err).Should(BeNil()) @@ -99,7 +97,7 @@ func ERC20ToNativeTokenBridge() { transferEvent, err := utils.GetEventFromLogs(sourceChainReceipt.Logs, nativeTokenDestination.ParseTransferToSource) Expect(err).Should(BeNil()) - utils.ExpectBigEqual(transferEvent.Amount, valueToSend) + Expect(transferEvent.Amount.Uint64()).Should(Equal(valueToSend)) receipt, err := utils.RelayMessage(ctx, sourceChainReceipt.BlockHash, sourceChainReceipt.BlockNumber, subnetB, subnetA) Expect(err).Should(BeNil()) @@ -108,11 +106,11 @@ func ERC20ToNativeTokenBridge() { } // Helper function - sendTokensToDestination := func(valueToSend *big.Int, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { + sendTokensToDestination := func(valueToSend uint64, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, subnetA.ChainID) Expect(err).Should(BeNil()) - tx, err := erc20TokenSource.TransferToDestination(transactor, toAddress, valueToSend, big.NewInt(0), []common.Address{}) + tx, err := erc20TokenSource.TransferToDestination(transactor, toAddress, new(big.Int).SetUint64(valueToSend), big.NewInt(0), []common.Address{}) Expect(err).Should(BeNil()) log.Info("Sent TransferToDestination transaction on source chain", "destinationChainID", subnetB.BlockchainID, "txHash", tx.Hash().Hex()) @@ -120,7 +118,7 @@ func ERC20ToNativeTokenBridge() { transferEvent, err := utils.GetEventFromLogs(sourceChainReceipt.Logs, erc20TokenSource.ParseTransferToDestination) Expect(err).Should(BeNil()) - utils.ExpectBigEqual(transferEvent.TransferAmount, valueToSend) + Expect(transferEvent.TransferAmount.Uint64()).Should(Equal(valueToSend)) receipt, err := utils.RelayMessage(ctx, sourceChainReceipt.BlockHash, sourceChainReceipt.BlockNumber, subnetA, subnetB) Expect(err).Should(BeNil()) @@ -131,6 +129,7 @@ func ERC20ToNativeTokenBridge() { { // Give erc20TokenSource allowance to spend all of the deployer's ERC20 Tokens bal, err := exampleERC20.BalanceOf(nil, deployerAddress) Expect(err).Should(BeNil()) + Expect(bal.Div(bal, big.NewInt(10)).Uint64() > initialReserveImbalance).Should(BeTrue()) transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetA.ChainID) Expect(err).Should(BeNil()) @@ -143,62 +142,62 @@ func ERC20ToNativeTokenBridge() { { // Transfer some tokens A -> B // Check starting balance is 0 - utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) checkReserveImbalance(initialReserveImbalance, nativeTokenDestination) - destChainReceipt := sendTokensToDestination(valueToSend, deployerPK, tokenReceiverAddress) + destChainReceipt := sendTokensToDestination(valueToSend1, deployerPK, tokenReceiverAddress) collateralEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseCollateralAdded) Expect(err).Should(BeNil()) - utils.ExpectBigEqual(collateralEvent.Amount, valueToSend) + Expect(collateralEvent.Amount.Uint64()).Should(Equal(valueToSend1)) _, err = utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseNativeTokensMinted) Expect(err).ShouldNot(BeNil()) - checkReserveImbalance(intermediateReserveImbalance, nativeTokenDestination) + checkReserveImbalance(initialReserveImbalance-valueToSend1, nativeTokenDestination) // Check intermediate balance, no tokens should be minted because we haven't collateralized - utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) } { // Fail to Transfer tokens B -> A because bridge is not collateralized // Check starting balance is 0 - utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetB.ChainID) Expect(err).Should(BeNil()) - transactor.Value = valueToSend + transactor.Value = new(big.Int).SetUint64(valueToSend1) _, err = nativeTokenDestination.TransferToSource(transactor, tokenReceiverAddress, emptyDestFeeInfo, []common.Address{}) Expect(err).ShouldNot(BeNil()) - checkReserveImbalance(intermediateReserveImbalance, nativeTokenDestination) + checkReserveImbalance(initialReserveImbalance-valueToSend1, nativeTokenDestination) // Check we failed to send because we're not collateralized - utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) } { // Transfer more tokens A -> B to collateralize the bridge // Check starting balance is 0 - utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) - checkReserveImbalance(intermediateReserveImbalance, nativeTokenDestination) + checkReserveImbalance(initialReserveImbalance-valueToSend1, nativeTokenDestination) destChainReceipt := sendTokensToDestination(initialReserveImbalance, deployerPK, tokenReceiverAddress) collateralEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseCollateralAdded) Expect(err).Should(BeNil()) - Expect(collateralEvent.Amount).Should(Equal(intermediateReserveImbalance)) + Expect(collateralEvent.Amount.Uint64()).Should(Equal(initialReserveImbalance - valueToSend1)) mintEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseNativeTokensMinted) Expect(err).Should(BeNil()) - utils.ExpectBigEqual(mintEvent.Amount, valueToSend) + Expect(mintEvent.Amount.Uint64()).Should(Equal(valueToSend1)) - checkReserveImbalance(common.Big0, nativeTokenDestination) + checkReserveImbalance(0, nativeTokenDestination) // We should have minted the excess coins after checking the collateral - utils.CheckBalance(ctx, tokenReceiverAddress, valueToSend, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, valueToSend1, subnetB.WSClient) } { // Transfer tokens B -> A @@ -208,45 +207,19 @@ func ERC20ToNativeTokenBridge() { bal, err := exampleERC20.BalanceOf(nil, tokenReceiverAddress) Expect(err).Should(BeNil()) - utils.ExpectBigEqual(bal, valueToReturn) + Expect(bal.Uint64()).Should(Equal(valueToReturn)) } +} - { // Check reporting of burned tx fees to Source Chain - burnedTxFeesBalanceDest, err := subnetB.WSClient.BalanceAt(ctx, burnedTxFeeAddress, nil) - Expect(err).Should(BeNil()) - Expect(burnedTxFeesBalanceDest.Cmp(common.Big0) > 0).Should(BeTrue()) - - transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetB.ChainID) - Expect(err).Should(BeNil()) - tx, err := nativeTokenDestination.ReportTotalBurnedTxFees(transactor, emptyDestFeeInfo, []common.Address{}) - Expect(err).Should(BeNil()) - - destChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetB.WSClient) - - reportEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseReportTotalBurnedTxFees) - Expect(err).Should(BeNil()) - utils.ExpectBigEqual(reportEvent.BurnAddressBalance, burnedTxFeesBalanceDest) - - burnedTxFeesBalanceSource, err := exampleERC20.BalanceOf(nil, burnedTxFeeAddress) - Expect(err).Should(BeNil()) - utils.ExpectBigEqual(burnedTxFeesBalanceSource, common.Big0) - - sourceChainReceipt, err := utils.RelayMessage(ctx, destChainReceipt.BlockHash, destChainReceipt.BlockNumber, subnetB, subnetA) - Expect(err).Should(BeNil()) - - burnEvent, err := utils.GetEventFromLogs(sourceChainReceipt.Logs, erc20TokenSource.ParseBurnTokens) - Expect(err).Should(BeNil()) - utils.ExpectBigEqual(burnedTxFeesBalanceDest, burnEvent.Amount) - - burnedTxFeesBalanceSource2, err := exampleERC20.BalanceOf(nil, burnedTxFeeAddress) - Expect(err).Should(BeNil()) - utils.ExpectBigEqual(burnedTxFeesBalanceSource2, burnEvent.Amount) - } +func checkReserveImbalance(value uint64, nativeTokenDestination *nativetokendestination.NativeTokenDestination) { + imbalance, err := nativeTokenDestination.CurrentReserveImbalance(&bind.CallOpts{}) + Expect(err).Should(BeNil()) + Expect(imbalance.Uint64()).Should(Equal(value)) } -func checkUnlockERC20Event(logs []*types.Log, erc20TokenSource *erc20tokensource.ERC20TokenSource, recipient common.Address, value *big.Int) { +func checkUnlockERC20Event(logs []*types.Log, erc20TokenSource *erc20tokensource.ERC20TokenSource, recipient common.Address, value uint64) { unlockEvent, err := utils.GetEventFromLogs(logs, erc20TokenSource.ParseUnlockTokens) Expect(err).Should(BeNil()) Expect(unlockEvent.Recipient).Should(Equal(recipient)) - utils.ExpectBigEqual(unlockEvent.Amount, value) + Expect(unlockEvent.Amount.Uint64()).Should(Equal(value)) } diff --git a/tests/native_token_bridge.go b/tests/native_token_bridge.go index 4cdc658e2..ba7ae4763 100644 --- a/tests/native_token_bridge.go +++ b/tests/native_token_bridge.go @@ -19,6 +19,9 @@ import ( func NativeTokenBridge() { const ( + initialReserveImbalance = uint64(1e15) + valueToSend = initialReserveImbalance / 4 + valueToReturn = valueToSend / 4 // Each test file needs a unique deployer that must be funded with tokens to deploy deployerKeyStr = "aad7440febfc8f9d73a58c3cb1f1754779a566978f9ebffcd4f4698e9b043985" @@ -26,13 +29,9 @@ func NativeTokenBridge() { NativeTokenDestinationByteCodeFile = "./contracts/out/NativeTokenDestination.sol/NativeTokenDestination.json" ) var ( - initialReserveImbalance = big.NewInt(0).Mul(big.NewInt(1e15), big.NewInt(1e9)) - valueToSend = big.NewInt(0).Div(initialReserveImbalance, big.NewInt(4)) - valueToReturn = big.NewInt(0).Div(valueToSend, big.NewInt(4)) - ctx = context.Background() - deployerAddress = common.HexToAddress("0x1337cfd2dCff6270615B90938aCB1efE79801704") - tokenReceiverAddress = common.HexToAddress("0x0123456789012345678901234567890123456789") - burnedTxFeeAddress = common.HexToAddress("0x0100000000000000000000000000000000000000") + ctx = context.Background() + deployerAddress = common.HexToAddress("0x1337cfd2dCff6270615B90938aCB1efE79801704") + tokenReceiverAddress = common.HexToAddress("0x0123456789012345678901234567890123456789") emptyDestFeeInfo = nativetokendestination.TeleporterFeeInfo{ ContractAddress: common.Address{}, @@ -68,7 +67,7 @@ func NativeTokenBridge() { nativeTokenDestinationAbi, err := nativetokendestination.NativeTokenDestinationMetaData.GetAbi() Expect(err).Should(BeNil()) - utils.DeployContract(ctx, NativeTokenDestinationByteCodeFile, deployerPK, subnetB, nativeTokenDestinationAbi, teleporterContractAddress, subnetA.BlockchainID, bridgeContractAddress, initialReserveImbalance) + utils.DeployContract(ctx, NativeTokenDestinationByteCodeFile, deployerPK, subnetB, nativeTokenDestinationAbi, teleporterContractAddress, subnetA.BlockchainID, bridgeContractAddress, new(big.Int).SetUint64(initialReserveImbalance)) log.Info("Finished deploying Bridge contracts") } @@ -80,10 +79,10 @@ func NativeTokenBridge() { Expect(err).Should(BeNil()) // Helper function - sendTokensToSource := func(valueToSend *big.Int, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { + sendTokensToSource := func(valueToSend uint64, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, subnetB.ChainID) Expect(err).Should(BeNil()) - transactor.Value = valueToSend + transactor.Value = new(big.Int).SetUint64(valueToSend) tx, err := nativeTokenDestination.TransferToSource(transactor, toAddress, emptyDestFeeInfo, []common.Address{}) Expect(err).Should(BeNil()) @@ -93,7 +92,7 @@ func NativeTokenBridge() { transferEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseTransferToSource) Expect(err).Should(BeNil()) - utils.ExpectBigEqual(transferEvent.Amount, valueToSend) + Expect(transferEvent.Amount.Uint64()).Should(Equal(valueToSend)) receipt, err := utils.RelayMessage(ctx, destChainReceipt.BlockHash, destChainReceipt.BlockNumber, subnetB, subnetA) Expect(err).Should(BeNil()) @@ -102,10 +101,10 @@ func NativeTokenBridge() { } // Helper function - sendTokensToDestination := func(valueToSend *big.Int, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { + sendTokensToDestination := func(valueToSend uint64, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, subnetA.ChainID) Expect(err).Should(BeNil()) - transactor.Value = valueToSend + transactor.Value = new(big.Int).SetUint64(valueToSend) tx, err := nativeTokenSource.TransferToDestination(transactor, toAddress, emptySourceFeeInfo, []common.Address{}) Expect(err).Should(BeNil()) @@ -115,7 +114,7 @@ func NativeTokenBridge() { transferEvent, err := utils.GetEventFromLogs(sourceChainReceipt.Logs, nativeTokenSource.ParseTransferToDestination) Expect(err).Should(BeNil()) - utils.ExpectBigEqual(transferEvent.Amount, valueToSend) + Expect(transferEvent.Amount.Uint64()).Should(Equal(valueToSend)) receipt, err := utils.RelayMessage(ctx, sourceChainReceipt.BlockHash, sourceChainReceipt.BlockNumber, subnetA, subnetB) Expect(err).Should(BeNil()) @@ -125,48 +124,48 @@ func NativeTokenBridge() { { // Transfer some tokens A -> B // Check starting balance is 0 - utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) checkReserveImbalance(initialReserveImbalance, nativeTokenDestination) destChainReceipt := sendTokensToDestination(valueToSend, deployerPK, tokenReceiverAddress) - checkCollateralEvent(destChainReceipt.Logs, nativeTokenDestination, valueToSend, big.NewInt(0).Sub(initialReserveImbalance, valueToSend)) - checkReserveImbalance(big.NewInt(0).Sub(initialReserveImbalance, valueToSend), nativeTokenDestination) + checkCollateralEvent(destChainReceipt.Logs, nativeTokenDestination, valueToSend, initialReserveImbalance - valueToSend) + checkReserveImbalance(initialReserveImbalance-valueToSend, nativeTokenDestination) _, err = utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseNativeTokensMinted) Expect(err).ShouldNot(BeNil()) // Check intermediate balance, no tokens should be minted because we haven't collateralized - utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) } { // Fail to Transfer tokens B -> A because bridge is not collateralized // Check starting balance is 0 - utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetA.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetA.WSClient) transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetB.ChainID) Expect(err).Should(BeNil()) - transactor.Value = valueToSend + transactor.Value = new(big.Int).SetUint64(valueToSend) // This transfer should revert because the bridge isn't collateralized _, err = nativeTokenDestination.TransferToSource(transactor, tokenReceiverAddress, emptyDestFeeInfo, []common.Address{}) Expect(err).ShouldNot(BeNil()) // Check we should fail to send because we're not collateralized - utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetA.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetA.WSClient) } { // Transfer more tokens A -> B to collateralize the bridge // Check starting balance is 0 - utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) - checkReserveImbalance(big.NewInt(0).Sub(initialReserveImbalance, valueToSend), nativeTokenDestination) + utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) + checkReserveImbalance(initialReserveImbalance-valueToSend, nativeTokenDestination) destChainReceipt := sendTokensToDestination(initialReserveImbalance, deployerPK, tokenReceiverAddress) - checkCollateralEvent(destChainReceipt.Logs, nativeTokenDestination, big.NewInt(0).Sub(initialReserveImbalance, valueToSend), common.Big0) + checkCollateralEvent(destChainReceipt.Logs, nativeTokenDestination, initialReserveImbalance-valueToSend, 0) checkMintEvent(destChainReceipt.Logs, nativeTokenDestination, tokenReceiverAddress, valueToSend) - checkReserveImbalance(common.Big0, nativeTokenDestination) + checkReserveImbalance(0, nativeTokenDestination) // We should have minted the excess coins after checking the collateral utils.CheckBalance(ctx, tokenReceiverAddress, valueToSend, subnetB.WSClient) @@ -179,63 +178,25 @@ func NativeTokenBridge() { utils.CheckBalance(ctx, tokenReceiverAddress, valueToReturn, subnetA.WSClient) } - - { // Check reporting of burned tx fees to Source Chain - burnedTxFeesBalanceDest, err := subnetB.WSClient.BalanceAt(ctx, burnedTxFeeAddress, nil) - Expect(err).Should(BeNil()) - Expect(burnedTxFeesBalanceDest.Cmp(common.Big0) > 0).Should(BeTrue()) - - transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetB.ChainID) - Expect(err).Should(BeNil()) - tx, err := nativeTokenDestination.ReportTotalBurnedTxFees(transactor, emptyDestFeeInfo, []common.Address{}) - Expect(err).Should(BeNil()) - - destChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetB.WSClient) - - reportEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseReportTotalBurnedTxFees) - Expect(err).Should(BeNil()) - utils.ExpectBigEqual(reportEvent.BurnAddressBalance, burnedTxFeesBalanceDest) - - burnedTxFeesBalanceSource, err := subnetA.WSClient.BalanceAt(ctx, burnedTxFeeAddress, nil) - Expect(err).Should(BeNil()) - Expect(burnedTxFeesBalanceSource.Cmp(common.Big0) > 0).Should(BeTrue()) - - sourceChainReceipt, err := utils.RelayMessage(ctx, destChainReceipt.BlockHash, destChainReceipt.BlockNumber, subnetB, subnetA) - Expect(err).Should(BeNil()) - - burnEvent, err := utils.GetEventFromLogs(sourceChainReceipt.Logs, nativeTokenSource.ParseBurnTokens) - Expect(err).Should(BeNil()) - utils.ExpectBigEqual(burnedTxFeesBalanceDest, burnEvent.Amount) - - burnedTxFeesBalanceSource2, err := subnetA.WSClient.BalanceAt(ctx, burnedTxFeeAddress, nil) - Expect(err).Should(BeNil()) - Expect(burnedTxFeesBalanceSource2.Cmp(big.NewInt(0).Add(burnedTxFeesBalanceSource, burnEvent.Amount)) >= 0).Should(BeTrue()) - } } -func checkUnlockNativeEvent(logs []*types.Log, nativeTokenSource *nativetokensource.NativeTokenSource, recipient common.Address, value *big.Int) { +func checkUnlockNativeEvent(logs []*types.Log, nativeTokenSource *nativetokensource.NativeTokenSource, recipient common.Address, value uint64) { unlockEvent, err := utils.GetEventFromLogs(logs, nativeTokenSource.ParseUnlockTokens) Expect(err).Should(BeNil()) Expect(unlockEvent.Recipient).Should(Equal(recipient)) - Expect(unlockEvent.Amount.Cmp(value)).Should(BeZero()) + Expect(unlockEvent.Amount.Uint64()).Should(Equal(value)) } -func checkCollateralEvent(logs []*types.Log, nativeTokenDestination *nativetokendestination.NativeTokenDestination, collateralAdded *big.Int, collateralRemaining *big.Int) { +func checkCollateralEvent(logs []*types.Log, nativeTokenDestination *nativetokendestination.NativeTokenDestination, collateralAdded uint64, collateralRemaining uint64) { collateralEvent, err := utils.GetEventFromLogs(logs, nativeTokenDestination.ParseCollateralAdded) Expect(err).Should(BeNil()) - Expect(collateralEvent.Amount.Cmp(collateralAdded)).Should(BeZero()) - Expect(collateralEvent.Remaining.Cmp(collateralEvent.Remaining)).Should(BeZero()) + Expect(collateralEvent.Amount.Uint64()).Should(Equal(collateralAdded)) + Expect(collateralEvent.Remaining.Uint64()).Should(Equal(collateralRemaining)) } -func checkMintEvent(logs []*types.Log, nativeTokenDestination *nativetokendestination.NativeTokenDestination, recipient common.Address, value *big.Int) { +func checkMintEvent(logs []*types.Log, nativeTokenDestination *nativetokendestination.NativeTokenDestination, recipient common.Address, value uint64) { mintEvent, err := utils.GetEventFromLogs(logs, nativeTokenDestination.ParseNativeTokensMinted) Expect(err).Should(BeNil()) Expect(mintEvent.Recipient).Should(Equal(recipient)) - Expect(mintEvent.Amount.Cmp(value)).Should(BeZero()) -} - -func checkReserveImbalance(value *big.Int, nativeTokenDestination *nativetokendestination.NativeTokenDestination) { - imbalance, err := nativeTokenDestination.CurrentReserveImbalance(&bind.CallOpts{}) - Expect(err).Should(BeNil()) - utils.ExpectBigEqual(imbalance, value) + Expect(mintEvent.Amount.Uint64()).Should(Equal(value)) } diff --git a/tests/utils/utils.go b/tests/utils/utils.go index 763b2945a..5adbe26c0 100644 --- a/tests/utils/utils.go +++ b/tests/utils/utils.go @@ -236,7 +236,7 @@ func WaitForTransactionSuccess(ctx context.Context, txHash common.Hash, client e } func WaitForTransaction(ctx context.Context, txHash common.Hash, client ethclient.Client) *types.Receipt { - cctx, cancel := context.WithTimeout(ctx, 20*time.Second) + cctx, cancel := context.WithTimeout(ctx, 20 * time.Second) defer cancel() // Loop until we find the transaction or time out @@ -312,12 +312,7 @@ func RelayMessage( Expect(err).Should(BeNil()) // Check the transaction logs for the ReceiveCrossChainMessage event emitted by the Teleporter contract receiveEvent, err := GetEventFromLogs(receipt.Logs, bind.ParseReceiveCrossChainMessage) - if err != nil { - // If we didn't find the ReceiveCrossChainMessage event, trace the transaction. - // We compare it with the empty string so that ginkgo will print it out for us. - trace := TraceTransaction(ctx, receipt.TxHash, destination) - Expect(trace).Should(Equal("")) - } + Expect(err).Should(BeNil()) Expect(receiveEvent.OriginChainID[:]).Should(Equal(source.BlockchainID[:])) // Check for a successful execution of the teleporter message. @@ -394,10 +389,10 @@ func PrivateKeyToAddress(k *ecdsa.PrivateKey) common.Address { } // Throws a Gomega error if there is a mismatch -func CheckBalance(ctx context.Context, addr common.Address, expectedBalance *big.Int, wsClient ethclient.Client) { - bal, err := wsClient.BalanceAt(ctx, addr, nil) +func CheckBalance(ctx context.Context, addr common.Address, expectedBalance uint64, wsClient ethclient.Client) { + bal, err :=wsClient.BalanceAt(ctx, addr, nil) Expect(err).Should(BeNil()) - ExpectBigEqual(bal, expectedBalance) + Expect(bal.Uint64()).Should(Equal(expectedBalance)) } func TraceTransaction(ctx context.Context, txHash common.Hash, subnetInfo SubnetTestInfo) string { @@ -434,16 +429,3 @@ func DeployContract(ctx context.Context, byteCodeFileName string, deployerPK *ec Expect(err).Should(BeNil()) Expect(len(code)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode } - -func ExpectBigEqual(v1 *big.Int, v2 *big.Int) { - // Compare strings, so gomega will print the numbers if they differ - Expect(v1.String()).Should(Equal(v2.String())) -} - -func BigIntSub(v1 *big.Int, v2 *big.Int) *big.Int { - return big.NewInt(0).Sub(v1, v2) -} - -func BigIntMul(v1 *big.Int, v2 *big.Int) *big.Int { - return big.NewInt(0).Mul(v1, v2) -} From 39f570c0451f114dfd4d8740b9563c640e506f71 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 20 Nov 2023 16:34:17 -0500 Subject: [PATCH 126/183] Tests for report burn --- .../NativeTokenBridge/ERC20TokenSource.sol | 22 ++-- .../NativeTokenDestination.sol | 20 ++-- .../NativeTokenBridge/NativeTokenSource.sol | 19 ++-- tests/erc20_to_native_token_bridge.go | 97 +++++++++++------ tests/native_token_bridge.go | 101 ++++++++++++------ tests/utils/utils.go | 28 ++++- 6 files changed, 191 insertions(+), 96 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol index 4a573d236..dd696232d 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol @@ -21,10 +21,9 @@ contract ERC20TokenSource is ITokenSource, ReentrancyGuard { - // Designated Blackhole Address. Tokens are sent here to be "burned" before sending an unlock - // message to the source chain. Different from the burned tx fee address so they can be - // tracked separately. - address public constant BLACKHOLE_ADDRESS = 0x0100000000000000000000000000000000000001; + // The address where the burned transaction fees are credited. + address public constant BURNED_TX_FEES_ADDRESS = + 0x0100000000000000000000000000000000000000; uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 100_000; // Used to keep track of tokens burned through transactions on the destination chain. They can // be reported to this contract to burn an equivalent number of tokens on this chain. @@ -204,14 +203,20 @@ contract ERC20TokenSource is * @dev Sends tokens to BLACKHOLE_ADDRESS. */ function _burnTokens(uint256 amount) private { - SafeERC20.safeTransfer(IERC20(erc20ContractAddress), BLACKHOLE_ADDRESS, amount); - emit BurnTokens(amount); - } + SafeERC20.safeTransfer( + IERC20(erc20ContractAddress), + BURNED_TX_FEES_ADDRESS, + amount + ); + emit BurnTokens(amount); + } /** * @dev Update destinationChainBurnedBalance sent from destination chain */ - function _updateDestinationChainBurnedBalance(uint256 newBurnBalance) private { + function _updateDestinationChainBurnedBalance( + uint256 newBurnBalance + ) private { if (newBurnBalance > destinationChainBurnedBalance) { uint256 difference = newBurnBalance - destinationChainBurnedBalance; _burnTokens(difference); @@ -219,4 +224,3 @@ contract ERC20TokenSource is } } } - diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index 39b47ffe8..eb5043038 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -19,24 +19,23 @@ import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol // solhint-disable-next-line no-unused-import import {IAllowList} from "@subnet-evm-contracts/interfaces/IAllowList.sol"; -// The address where the burned transaction fees are credited. -// TODO implement mechanism to report burned tx fees to source chian. -address constant BURNED_TX_FEES_ADDRESS = 0x0100000000000000000000000000000000000000; -// Designated Blackhole Address. Tokens are sent here to be "burned" before sending an unlock -// message to the source chain. Different from the burned tx fee address so they can be -// tracked separately. -address constant BLACKHOLE_ADDRESS = 0x0100000000000000000000000000000000000001; - contract NativeTokenDestination is ITeleporterReceiver, INativeTokenDestination, ReentrancyGuard { + // The address where the burned transaction fees are credited. + address public constant BURNED_TX_FEES_ADDRESS = 0x0100000000000000000000000000000000000000; + // Designated Blackhole Address. Tokens are sent here to be "burned" before sending an unlock + // message to the source chain. Different from the burned tx fee address so they can be + // tracked separately. + address public constant BLACKHOLE_ADDRESS = 0x0100000000000000000000000000000000000001; + INativeMinter private immutable _nativeMinter = INativeMinter(0x0200000000000000000000000000000000000001); uint256 public constant TRANSFER_NATIVE_TOKENS_REQUIRED_GAS = 100_000; - uint256 public constant REPORT_BURNED_TOKENS_REQUIRED_GAS = 20_000; + uint256 public constant REPORT_BURNED_TOKENS_REQUIRED_GAS = 50_000; bytes32 public immutable sourceBlockchainID; address public immutable nativeTokenSourceAddress; // The first `initialReserveImbalance` tokens sent to this subnet will not be minted. @@ -252,6 +251,9 @@ contract NativeTokenDestination is function totalSupply() external view returns (uint256) { uint256 burned = address(BURNED_TX_FEES_ADDRESS).balance + address(BLACKHOLE_ADDRESS).balance; + + // This scenario should never happen, but this check will prevent an underflow + // where the contract would return a garbage value. require( burned <= totalMinted + initialReserveImbalance, "NativeTokenDestination: FATAL - contract has tokens unaccounted for" diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index 2e2efca90..3752c74e6 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -22,10 +22,9 @@ contract NativeTokenSource is ITokenSource, ReentrancyGuard { - // Designated Blackhole Address. Tokens are sent here to be "burned" before sending an unlock - // message to the source chain. Different from the burned tx fee address so they can be - // tracked separately. - address public constant BLACKHOLE_ADDRESS = 0x0100000000000000000000000000000000000001; + // The address where the burned transaction fees are credited. + address public constant BURNED_TX_FEES_ADDRESS = + 0x0100000000000000000000000000000000000000; uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 100_000; // Used to keep track of tokens burned through transactions on the destination chain. They can // be reported to this contract to burn an equivalent number of tokens on this chain. @@ -138,7 +137,11 @@ contract NativeTokenSource is IERC20(feeInfo.contractAddress), feeInfo.amount ); - SafeERC20.safeIncreaseAllowance(IERC20(feeInfo.contractAddress), address(teleporterMessenger), adjustedFeeAmount); + SafeERC20.safeIncreaseAllowance( + IERC20(feeInfo.contractAddress), + address(teleporterMessenger), + adjustedFeeAmount + ); } uint256 messageID = teleporterMessenger.sendCrossChainMessage( @@ -179,14 +182,16 @@ contract NativeTokenSource is * @dev Sends tokens to BLACKHOLE_ADDRESS. */ function _burnTokens(uint256 amount) private { - payable(BLACKHOLE_ADDRESS).transfer(amount); + payable(BURNED_TX_FEES_ADDRESS).transfer(amount); emit BurnTokens(amount); } /** * @dev Update destinationChainBurnedBalance sent from destination chain */ - function _updateDestinationChainBurnedBalance(uint256 newBurnBalance) private { + function _updateDestinationChainBurnedBalance( + uint256 newBurnBalance + ) private { if (newBurnBalance > destinationChainBurnedBalance) { uint256 difference = newBurnBalance - destinationChainBurnedBalance; _burnTokens(difference); diff --git a/tests/erc20_to_native_token_bridge.go b/tests/erc20_to_native_token_bridge.go index eb074d6a0..f3d11c405 100644 --- a/tests/erc20_to_native_token_bridge.go +++ b/tests/erc20_to_native_token_bridge.go @@ -20,10 +20,6 @@ import ( func ERC20ToNativeTokenBridge() { const ( - initialReserveImbalance = uint64(1e15) - valueToSend1 = initialReserveImbalance / 4 - valueToReturn = valueToSend1 / 4 - // Each test file needs a unique deployer that must be funded with tokens to deploy deployerKeyStr = "ca7269c1fe2a5b86884a119aa516b8d5b641670b83aac0ebf9f2d71affcc12e4" ExampleERC20ByteCodeFile = "./contracts/out/ExampleERC20.sol/ExampleERC20.json" @@ -31,9 +27,15 @@ func ERC20ToNativeTokenBridge() { NativeTokenDestinationByteCodeFile = "./contracts/out/NativeTokenDestination.sol/NativeTokenDestination.json" ) var ( + initialReserveImbalance = big.NewInt(0).Mul(big.NewInt(1e15), big.NewInt(1e9)) + valueToSend = big.NewInt(0).Div(initialReserveImbalance, big.NewInt(4)) + intermediateReserveImbalance = utils.BigIntSub(initialReserveImbalance, valueToSend) + valueToReturn = big.NewInt(0).Div(valueToSend, big.NewInt(4)) + ctx = context.Background() deployerAddress = common.HexToAddress("0x539447ab8Be7e927bE8E005663C81ff2AE951337") tokenReceiverAddress = common.HexToAddress("0x4444444444444444444444444444444444444444") + burnedTxFeeAddress = common.HexToAddress("0x0100000000000000000000000000000000000000") emptyDestFeeInfo = nativetokendestination.TeleporterFeeInfo{ ContractAddress: common.Address{}, @@ -67,7 +69,7 @@ func ERC20ToNativeTokenBridge() { nativeTokenDestinationAbi, err := nativetokendestination.NativeTokenDestinationMetaData.GetAbi() Expect(err).Should(BeNil()) - utils.DeployContract(ctx, NativeTokenDestinationByteCodeFile, deployerPK, subnetB, nativeTokenDestinationAbi, teleporterContractAddress, subnetA.BlockchainID, bridgeContractAddress, new(big.Int).SetUint64(initialReserveImbalance)) + utils.DeployContract(ctx, NativeTokenDestinationByteCodeFile, deployerPK, subnetB, nativeTokenDestinationAbi, teleporterContractAddress, subnetA.BlockchainID, bridgeContractAddress,initialReserveImbalance) exampleERC20Abi, err := exampleerc20.ExampleERC20MetaData.GetAbi() Expect(err).Should(BeNil()) @@ -84,10 +86,10 @@ func ERC20ToNativeTokenBridge() { Expect(err).Should(BeNil()) // Helper function - sendTokensToSource := func(valueToSend uint64, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { + sendTokensToSource := func(valueToSend *big.Int, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, subnetB.ChainID) Expect(err).Should(BeNil()) - transactor.Value = new(big.Int).SetUint64(valueToSend) + transactor.Value = valueToSend tx, err := nativeTokenDestination.TransferToSource(transactor, toAddress, emptyDestFeeInfo, []common.Address{}) Expect(err).Should(BeNil()) @@ -97,7 +99,7 @@ func ERC20ToNativeTokenBridge() { transferEvent, err := utils.GetEventFromLogs(sourceChainReceipt.Logs, nativeTokenDestination.ParseTransferToSource) Expect(err).Should(BeNil()) - Expect(transferEvent.Amount.Uint64()).Should(Equal(valueToSend)) + utils.ExpectBigEqual(transferEvent.Amount, valueToSend) receipt, err := utils.RelayMessage(ctx, sourceChainReceipt.BlockHash, sourceChainReceipt.BlockNumber, subnetB, subnetA) Expect(err).Should(BeNil()) @@ -106,11 +108,11 @@ func ERC20ToNativeTokenBridge() { } // Helper function - sendTokensToDestination := func(valueToSend uint64, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { + sendTokensToDestination := func(valueToSend *big.Int, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, subnetA.ChainID) Expect(err).Should(BeNil()) - tx, err := erc20TokenSource.TransferToDestination(transactor, toAddress, new(big.Int).SetUint64(valueToSend), big.NewInt(0), []common.Address{}) + tx, err := erc20TokenSource.TransferToDestination(transactor, toAddress, valueToSend, big.NewInt(0), []common.Address{}) Expect(err).Should(BeNil()) log.Info("Sent TransferToDestination transaction on source chain", "destinationChainID", subnetB.BlockchainID, "txHash", tx.Hash().Hex()) @@ -118,7 +120,7 @@ func ERC20ToNativeTokenBridge() { transferEvent, err := utils.GetEventFromLogs(sourceChainReceipt.Logs, erc20TokenSource.ParseTransferToDestination) Expect(err).Should(BeNil()) - Expect(transferEvent.TransferAmount.Uint64()).Should(Equal(valueToSend)) + utils.ExpectBigEqual(transferEvent.TransferAmount, valueToSend) receipt, err := utils.RelayMessage(ctx, sourceChainReceipt.BlockHash, sourceChainReceipt.BlockNumber, subnetA, subnetB) Expect(err).Should(BeNil()) @@ -129,7 +131,6 @@ func ERC20ToNativeTokenBridge() { { // Give erc20TokenSource allowance to spend all of the deployer's ERC20 Tokens bal, err := exampleERC20.BalanceOf(nil, deployerAddress) Expect(err).Should(BeNil()) - Expect(bal.Div(bal, big.NewInt(10)).Uint64() > initialReserveImbalance).Should(BeTrue()) transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetA.ChainID) Expect(err).Should(BeNil()) @@ -142,62 +143,62 @@ func ERC20ToNativeTokenBridge() { { // Transfer some tokens A -> B // Check starting balance is 0 - utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) checkReserveImbalance(initialReserveImbalance, nativeTokenDestination) - destChainReceipt := sendTokensToDestination(valueToSend1, deployerPK, tokenReceiverAddress) + destChainReceipt := sendTokensToDestination(valueToSend, deployerPK, tokenReceiverAddress) collateralEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseCollateralAdded) Expect(err).Should(BeNil()) - Expect(collateralEvent.Amount.Uint64()).Should(Equal(valueToSend1)) + utils.ExpectBigEqual(collateralEvent.Amount, valueToSend) _, err = utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseNativeTokensMinted) Expect(err).ShouldNot(BeNil()) - checkReserveImbalance(initialReserveImbalance-valueToSend1, nativeTokenDestination) + checkReserveImbalance(intermediateReserveImbalance, nativeTokenDestination) // Check intermediate balance, no tokens should be minted because we haven't collateralized - utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) } { // Fail to Transfer tokens B -> A because bridge is not collateralized // Check starting balance is 0 - utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetB.ChainID) Expect(err).Should(BeNil()) - transactor.Value = new(big.Int).SetUint64(valueToSend1) + transactor.Value = valueToSend _, err = nativeTokenDestination.TransferToSource(transactor, tokenReceiverAddress, emptyDestFeeInfo, []common.Address{}) Expect(err).ShouldNot(BeNil()) - checkReserveImbalance(initialReserveImbalance-valueToSend1, nativeTokenDestination) + checkReserveImbalance(intermediateReserveImbalance, nativeTokenDestination) // Check we failed to send because we're not collateralized - utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) } { // Transfer more tokens A -> B to collateralize the bridge // Check starting balance is 0 - utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) - checkReserveImbalance(initialReserveImbalance-valueToSend1, nativeTokenDestination) + checkReserveImbalance(intermediateReserveImbalance, nativeTokenDestination) destChainReceipt := sendTokensToDestination(initialReserveImbalance, deployerPK, tokenReceiverAddress) collateralEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseCollateralAdded) Expect(err).Should(BeNil()) - Expect(collateralEvent.Amount.Uint64()).Should(Equal(initialReserveImbalance - valueToSend1)) + Expect(collateralEvent.Amount).Should(Equal(intermediateReserveImbalance)) mintEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseNativeTokensMinted) Expect(err).Should(BeNil()) - Expect(mintEvent.Amount.Uint64()).Should(Equal(valueToSend1)) + utils.ExpectBigEqual(mintEvent.Amount, valueToSend) - checkReserveImbalance(0, nativeTokenDestination) + checkReserveImbalance(common.Big0, nativeTokenDestination) // We should have minted the excess coins after checking the collateral - utils.CheckBalance(ctx, tokenReceiverAddress, valueToSend1, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, valueToSend, subnetB.WSClient) } { // Transfer tokens B -> A @@ -207,19 +208,45 @@ func ERC20ToNativeTokenBridge() { bal, err := exampleERC20.BalanceOf(nil, tokenReceiverAddress) Expect(err).Should(BeNil()) - Expect(bal.Uint64()).Should(Equal(valueToReturn)) + utils.ExpectBigEqual(bal, valueToReturn) } -} -func checkReserveImbalance(value uint64, nativeTokenDestination *nativetokendestination.NativeTokenDestination) { - imbalance, err := nativeTokenDestination.CurrentReserveImbalance(&bind.CallOpts{}) - Expect(err).Should(BeNil()) - Expect(imbalance.Uint64()).Should(Equal(value)) + { // Check reporting of burned tx fees to Source Chain + burnedTxFeesBalanceDest, err := subnetB.WSClient.BalanceAt(ctx, burnedTxFeeAddress, nil) + Expect(err).Should(BeNil()) + Expect(burnedTxFeesBalanceDest.Cmp(common.Big0) > 0).Should(BeTrue()) + + transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetB.ChainID) + Expect(err).Should(BeNil()) + tx, err := nativeTokenDestination.ReportTotalBurnedTxFees(transactor, emptyDestFeeInfo, []common.Address{}) + Expect(err).Should(BeNil()) + + destChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetB.WSClient) + + reportEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseReportTotalBurnedTxFees) + Expect(err).Should(BeNil()) + utils.ExpectBigEqual(reportEvent.BurnAddressBalance, burnedTxFeesBalanceDest) + + burnedTxFeesBalanceSource, err := exampleERC20.BalanceOf(nil, burnedTxFeeAddress) + Expect(err).Should(BeNil()) + utils.ExpectBigEqual(burnedTxFeesBalanceSource, common.Big0) + + sourceChainReceipt, err := utils.RelayMessage(ctx, destChainReceipt.BlockHash, destChainReceipt.BlockNumber, subnetB, subnetA) + Expect(err).Should(BeNil()) + + burnEvent, err := utils.GetEventFromLogs(sourceChainReceipt.Logs, erc20TokenSource.ParseBurnTokens) + Expect(err).Should(BeNil()) + utils.ExpectBigEqual(burnedTxFeesBalanceDest, burnEvent.Amount) + + burnedTxFeesBalanceSource2, err := exampleERC20.BalanceOf(nil, burnedTxFeeAddress) + Expect(err).Should(BeNil()) + utils.ExpectBigEqual(burnedTxFeesBalanceSource2, burnEvent.Amount) + } } -func checkUnlockERC20Event(logs []*types.Log, erc20TokenSource *erc20tokensource.ERC20TokenSource, recipient common.Address, value uint64) { +func checkUnlockERC20Event(logs []*types.Log, erc20TokenSource *erc20tokensource.ERC20TokenSource, recipient common.Address, value *big.Int) { unlockEvent, err := utils.GetEventFromLogs(logs, erc20TokenSource.ParseUnlockTokens) Expect(err).Should(BeNil()) Expect(unlockEvent.Recipient).Should(Equal(recipient)) - Expect(unlockEvent.Amount.Uint64()).Should(Equal(value)) + utils.ExpectBigEqual(unlockEvent.Amount, value) } diff --git a/tests/native_token_bridge.go b/tests/native_token_bridge.go index ba7ae4763..4cdc658e2 100644 --- a/tests/native_token_bridge.go +++ b/tests/native_token_bridge.go @@ -19,9 +19,6 @@ import ( func NativeTokenBridge() { const ( - initialReserveImbalance = uint64(1e15) - valueToSend = initialReserveImbalance / 4 - valueToReturn = valueToSend / 4 // Each test file needs a unique deployer that must be funded with tokens to deploy deployerKeyStr = "aad7440febfc8f9d73a58c3cb1f1754779a566978f9ebffcd4f4698e9b043985" @@ -29,9 +26,13 @@ func NativeTokenBridge() { NativeTokenDestinationByteCodeFile = "./contracts/out/NativeTokenDestination.sol/NativeTokenDestination.json" ) var ( - ctx = context.Background() - deployerAddress = common.HexToAddress("0x1337cfd2dCff6270615B90938aCB1efE79801704") - tokenReceiverAddress = common.HexToAddress("0x0123456789012345678901234567890123456789") + initialReserveImbalance = big.NewInt(0).Mul(big.NewInt(1e15), big.NewInt(1e9)) + valueToSend = big.NewInt(0).Div(initialReserveImbalance, big.NewInt(4)) + valueToReturn = big.NewInt(0).Div(valueToSend, big.NewInt(4)) + ctx = context.Background() + deployerAddress = common.HexToAddress("0x1337cfd2dCff6270615B90938aCB1efE79801704") + tokenReceiverAddress = common.HexToAddress("0x0123456789012345678901234567890123456789") + burnedTxFeeAddress = common.HexToAddress("0x0100000000000000000000000000000000000000") emptyDestFeeInfo = nativetokendestination.TeleporterFeeInfo{ ContractAddress: common.Address{}, @@ -67,7 +68,7 @@ func NativeTokenBridge() { nativeTokenDestinationAbi, err := nativetokendestination.NativeTokenDestinationMetaData.GetAbi() Expect(err).Should(BeNil()) - utils.DeployContract(ctx, NativeTokenDestinationByteCodeFile, deployerPK, subnetB, nativeTokenDestinationAbi, teleporterContractAddress, subnetA.BlockchainID, bridgeContractAddress, new(big.Int).SetUint64(initialReserveImbalance)) + utils.DeployContract(ctx, NativeTokenDestinationByteCodeFile, deployerPK, subnetB, nativeTokenDestinationAbi, teleporterContractAddress, subnetA.BlockchainID, bridgeContractAddress, initialReserveImbalance) log.Info("Finished deploying Bridge contracts") } @@ -79,10 +80,10 @@ func NativeTokenBridge() { Expect(err).Should(BeNil()) // Helper function - sendTokensToSource := func(valueToSend uint64, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { + sendTokensToSource := func(valueToSend *big.Int, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, subnetB.ChainID) Expect(err).Should(BeNil()) - transactor.Value = new(big.Int).SetUint64(valueToSend) + transactor.Value = valueToSend tx, err := nativeTokenDestination.TransferToSource(transactor, toAddress, emptyDestFeeInfo, []common.Address{}) Expect(err).Should(BeNil()) @@ -92,7 +93,7 @@ func NativeTokenBridge() { transferEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseTransferToSource) Expect(err).Should(BeNil()) - Expect(transferEvent.Amount.Uint64()).Should(Equal(valueToSend)) + utils.ExpectBigEqual(transferEvent.Amount, valueToSend) receipt, err := utils.RelayMessage(ctx, destChainReceipt.BlockHash, destChainReceipt.BlockNumber, subnetB, subnetA) Expect(err).Should(BeNil()) @@ -101,10 +102,10 @@ func NativeTokenBridge() { } // Helper function - sendTokensToDestination := func(valueToSend uint64, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { + sendTokensToDestination := func(valueToSend *big.Int, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, subnetA.ChainID) Expect(err).Should(BeNil()) - transactor.Value = new(big.Int).SetUint64(valueToSend) + transactor.Value = valueToSend tx, err := nativeTokenSource.TransferToDestination(transactor, toAddress, emptySourceFeeInfo, []common.Address{}) Expect(err).Should(BeNil()) @@ -114,7 +115,7 @@ func NativeTokenBridge() { transferEvent, err := utils.GetEventFromLogs(sourceChainReceipt.Logs, nativeTokenSource.ParseTransferToDestination) Expect(err).Should(BeNil()) - Expect(transferEvent.Amount.Uint64()).Should(Equal(valueToSend)) + utils.ExpectBigEqual(transferEvent.Amount, valueToSend) receipt, err := utils.RelayMessage(ctx, sourceChainReceipt.BlockHash, sourceChainReceipt.BlockNumber, subnetA, subnetB) Expect(err).Should(BeNil()) @@ -124,48 +125,48 @@ func NativeTokenBridge() { { // Transfer some tokens A -> B // Check starting balance is 0 - utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) checkReserveImbalance(initialReserveImbalance, nativeTokenDestination) destChainReceipt := sendTokensToDestination(valueToSend, deployerPK, tokenReceiverAddress) - checkCollateralEvent(destChainReceipt.Logs, nativeTokenDestination, valueToSend, initialReserveImbalance - valueToSend) - checkReserveImbalance(initialReserveImbalance-valueToSend, nativeTokenDestination) + checkCollateralEvent(destChainReceipt.Logs, nativeTokenDestination, valueToSend, big.NewInt(0).Sub(initialReserveImbalance, valueToSend)) + checkReserveImbalance(big.NewInt(0).Sub(initialReserveImbalance, valueToSend), nativeTokenDestination) _, err = utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseNativeTokensMinted) Expect(err).ShouldNot(BeNil()) // Check intermediate balance, no tokens should be minted because we haven't collateralized - utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) } { // Fail to Transfer tokens B -> A because bridge is not collateralized // Check starting balance is 0 - utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetA.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetA.WSClient) transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetB.ChainID) Expect(err).Should(BeNil()) - transactor.Value = new(big.Int).SetUint64(valueToSend) + transactor.Value = valueToSend // This transfer should revert because the bridge isn't collateralized _, err = nativeTokenDestination.TransferToSource(transactor, tokenReceiverAddress, emptyDestFeeInfo, []common.Address{}) Expect(err).ShouldNot(BeNil()) // Check we should fail to send because we're not collateralized - utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetA.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetA.WSClient) } { // Transfer more tokens A -> B to collateralize the bridge // Check starting balance is 0 - utils.CheckBalance(ctx, tokenReceiverAddress, 0, subnetB.WSClient) - checkReserveImbalance(initialReserveImbalance-valueToSend, nativeTokenDestination) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) + checkReserveImbalance(big.NewInt(0).Sub(initialReserveImbalance, valueToSend), nativeTokenDestination) destChainReceipt := sendTokensToDestination(initialReserveImbalance, deployerPK, tokenReceiverAddress) - checkCollateralEvent(destChainReceipt.Logs, nativeTokenDestination, initialReserveImbalance-valueToSend, 0) + checkCollateralEvent(destChainReceipt.Logs, nativeTokenDestination, big.NewInt(0).Sub(initialReserveImbalance, valueToSend), common.Big0) checkMintEvent(destChainReceipt.Logs, nativeTokenDestination, tokenReceiverAddress, valueToSend) - checkReserveImbalance(0, nativeTokenDestination) + checkReserveImbalance(common.Big0, nativeTokenDestination) // We should have minted the excess coins after checking the collateral utils.CheckBalance(ctx, tokenReceiverAddress, valueToSend, subnetB.WSClient) @@ -178,25 +179,63 @@ func NativeTokenBridge() { utils.CheckBalance(ctx, tokenReceiverAddress, valueToReturn, subnetA.WSClient) } + + { // Check reporting of burned tx fees to Source Chain + burnedTxFeesBalanceDest, err := subnetB.WSClient.BalanceAt(ctx, burnedTxFeeAddress, nil) + Expect(err).Should(BeNil()) + Expect(burnedTxFeesBalanceDest.Cmp(common.Big0) > 0).Should(BeTrue()) + + transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetB.ChainID) + Expect(err).Should(BeNil()) + tx, err := nativeTokenDestination.ReportTotalBurnedTxFees(transactor, emptyDestFeeInfo, []common.Address{}) + Expect(err).Should(BeNil()) + + destChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetB.WSClient) + + reportEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseReportTotalBurnedTxFees) + Expect(err).Should(BeNil()) + utils.ExpectBigEqual(reportEvent.BurnAddressBalance, burnedTxFeesBalanceDest) + + burnedTxFeesBalanceSource, err := subnetA.WSClient.BalanceAt(ctx, burnedTxFeeAddress, nil) + Expect(err).Should(BeNil()) + Expect(burnedTxFeesBalanceSource.Cmp(common.Big0) > 0).Should(BeTrue()) + + sourceChainReceipt, err := utils.RelayMessage(ctx, destChainReceipt.BlockHash, destChainReceipt.BlockNumber, subnetB, subnetA) + Expect(err).Should(BeNil()) + + burnEvent, err := utils.GetEventFromLogs(sourceChainReceipt.Logs, nativeTokenSource.ParseBurnTokens) + Expect(err).Should(BeNil()) + utils.ExpectBigEqual(burnedTxFeesBalanceDest, burnEvent.Amount) + + burnedTxFeesBalanceSource2, err := subnetA.WSClient.BalanceAt(ctx, burnedTxFeeAddress, nil) + Expect(err).Should(BeNil()) + Expect(burnedTxFeesBalanceSource2.Cmp(big.NewInt(0).Add(burnedTxFeesBalanceSource, burnEvent.Amount)) >= 0).Should(BeTrue()) + } } -func checkUnlockNativeEvent(logs []*types.Log, nativeTokenSource *nativetokensource.NativeTokenSource, recipient common.Address, value uint64) { +func checkUnlockNativeEvent(logs []*types.Log, nativeTokenSource *nativetokensource.NativeTokenSource, recipient common.Address, value *big.Int) { unlockEvent, err := utils.GetEventFromLogs(logs, nativeTokenSource.ParseUnlockTokens) Expect(err).Should(BeNil()) Expect(unlockEvent.Recipient).Should(Equal(recipient)) - Expect(unlockEvent.Amount.Uint64()).Should(Equal(value)) + Expect(unlockEvent.Amount.Cmp(value)).Should(BeZero()) } -func checkCollateralEvent(logs []*types.Log, nativeTokenDestination *nativetokendestination.NativeTokenDestination, collateralAdded uint64, collateralRemaining uint64) { +func checkCollateralEvent(logs []*types.Log, nativeTokenDestination *nativetokendestination.NativeTokenDestination, collateralAdded *big.Int, collateralRemaining *big.Int) { collateralEvent, err := utils.GetEventFromLogs(logs, nativeTokenDestination.ParseCollateralAdded) Expect(err).Should(BeNil()) - Expect(collateralEvent.Amount.Uint64()).Should(Equal(collateralAdded)) - Expect(collateralEvent.Remaining.Uint64()).Should(Equal(collateralRemaining)) + Expect(collateralEvent.Amount.Cmp(collateralAdded)).Should(BeZero()) + Expect(collateralEvent.Remaining.Cmp(collateralEvent.Remaining)).Should(BeZero()) } -func checkMintEvent(logs []*types.Log, nativeTokenDestination *nativetokendestination.NativeTokenDestination, recipient common.Address, value uint64) { +func checkMintEvent(logs []*types.Log, nativeTokenDestination *nativetokendestination.NativeTokenDestination, recipient common.Address, value *big.Int) { mintEvent, err := utils.GetEventFromLogs(logs, nativeTokenDestination.ParseNativeTokensMinted) Expect(err).Should(BeNil()) Expect(mintEvent.Recipient).Should(Equal(recipient)) - Expect(mintEvent.Amount.Uint64()).Should(Equal(value)) + Expect(mintEvent.Amount.Cmp(value)).Should(BeZero()) +} + +func checkReserveImbalance(value *big.Int, nativeTokenDestination *nativetokendestination.NativeTokenDestination) { + imbalance, err := nativeTokenDestination.CurrentReserveImbalance(&bind.CallOpts{}) + Expect(err).Should(BeNil()) + utils.ExpectBigEqual(imbalance, value) } diff --git a/tests/utils/utils.go b/tests/utils/utils.go index 5adbe26c0..763b2945a 100644 --- a/tests/utils/utils.go +++ b/tests/utils/utils.go @@ -236,7 +236,7 @@ func WaitForTransactionSuccess(ctx context.Context, txHash common.Hash, client e } func WaitForTransaction(ctx context.Context, txHash common.Hash, client ethclient.Client) *types.Receipt { - cctx, cancel := context.WithTimeout(ctx, 20 * time.Second) + cctx, cancel := context.WithTimeout(ctx, 20*time.Second) defer cancel() // Loop until we find the transaction or time out @@ -312,7 +312,12 @@ func RelayMessage( Expect(err).Should(BeNil()) // Check the transaction logs for the ReceiveCrossChainMessage event emitted by the Teleporter contract receiveEvent, err := GetEventFromLogs(receipt.Logs, bind.ParseReceiveCrossChainMessage) - Expect(err).Should(BeNil()) + if err != nil { + // If we didn't find the ReceiveCrossChainMessage event, trace the transaction. + // We compare it with the empty string so that ginkgo will print it out for us. + trace := TraceTransaction(ctx, receipt.TxHash, destination) + Expect(trace).Should(Equal("")) + } Expect(receiveEvent.OriginChainID[:]).Should(Equal(source.BlockchainID[:])) // Check for a successful execution of the teleporter message. @@ -389,10 +394,10 @@ func PrivateKeyToAddress(k *ecdsa.PrivateKey) common.Address { } // Throws a Gomega error if there is a mismatch -func CheckBalance(ctx context.Context, addr common.Address, expectedBalance uint64, wsClient ethclient.Client) { - bal, err :=wsClient.BalanceAt(ctx, addr, nil) +func CheckBalance(ctx context.Context, addr common.Address, expectedBalance *big.Int, wsClient ethclient.Client) { + bal, err := wsClient.BalanceAt(ctx, addr, nil) Expect(err).Should(BeNil()) - Expect(bal.Uint64()).Should(Equal(expectedBalance)) + ExpectBigEqual(bal, expectedBalance) } func TraceTransaction(ctx context.Context, txHash common.Hash, subnetInfo SubnetTestInfo) string { @@ -429,3 +434,16 @@ func DeployContract(ctx context.Context, byteCodeFileName string, deployerPK *ec Expect(err).Should(BeNil()) Expect(len(code)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode } + +func ExpectBigEqual(v1 *big.Int, v2 *big.Int) { + // Compare strings, so gomega will print the numbers if they differ + Expect(v1.String()).Should(Equal(v2.String())) +} + +func BigIntSub(v1 *big.Int, v2 *big.Int) *big.Int { + return big.NewInt(0).Sub(v1, v2) +} + +func BigIntMul(v1 *big.Int, v2 *big.Int) *big.Int { + return big.NewInt(0).Mul(v1, v2) +} From c471cef30822be3c73b770d792da0ca01118b736 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 20 Nov 2023 16:34:57 -0500 Subject: [PATCH 127/183] Regenerate abi files --- .../ERC20TokenSource/ERC20TokenSource.go | 26 ++++---- .../NativeTokenDestination.go | 64 ++++++++++++++++++- .../NativeTokenSource/NativeTokenSource.go | 26 ++++---- 3 files changed, 89 insertions(+), 27 deletions(-) diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go index 06add0d6e..3cd83dab8 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go @@ -31,7 +31,7 @@ var ( // ERC20TokenSourceMetaData contains all meta data concerning the ERC20TokenSource contract. var ERC20TokenSourceMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"erc20ContractAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"transferAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BLACKHOLE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationChainBurnedBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"erc20ContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"erc20ContractAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"transferAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationChainBurnedBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"erc20ContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // ERC20TokenSourceABI is the input ABI used to generate the binding from. @@ -180,12 +180,12 @@ func (_ERC20TokenSource *ERC20TokenSourceTransactorRaw) Transact(opts *bind.Tran return _ERC20TokenSource.Contract.contract.Transact(opts, method, params...) } -// BLACKHOLEADDRESS is a free data retrieval call binding the contract method 0xd3681114. +// BURNEDTXFEESADDRESS is a free data retrieval call binding the contract method 0xc452165e. // -// Solidity: function BLACKHOLE_ADDRESS() view returns(address) -func (_ERC20TokenSource *ERC20TokenSourceCaller) BLACKHOLEADDRESS(opts *bind.CallOpts) (common.Address, error) { +// Solidity: function BURNED_TX_FEES_ADDRESS() view returns(address) +func (_ERC20TokenSource *ERC20TokenSourceCaller) BURNEDTXFEESADDRESS(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _ERC20TokenSource.contract.Call(opts, &out, "BLACKHOLE_ADDRESS") + err := _ERC20TokenSource.contract.Call(opts, &out, "BURNED_TX_FEES_ADDRESS") if err != nil { return *new(common.Address), err @@ -197,18 +197,18 @@ func (_ERC20TokenSource *ERC20TokenSourceCaller) BLACKHOLEADDRESS(opts *bind.Cal } -// BLACKHOLEADDRESS is a free data retrieval call binding the contract method 0xd3681114. +// BURNEDTXFEESADDRESS is a free data retrieval call binding the contract method 0xc452165e. // -// Solidity: function BLACKHOLE_ADDRESS() view returns(address) -func (_ERC20TokenSource *ERC20TokenSourceSession) BLACKHOLEADDRESS() (common.Address, error) { - return _ERC20TokenSource.Contract.BLACKHOLEADDRESS(&_ERC20TokenSource.CallOpts) +// Solidity: function BURNED_TX_FEES_ADDRESS() view returns(address) +func (_ERC20TokenSource *ERC20TokenSourceSession) BURNEDTXFEESADDRESS() (common.Address, error) { + return _ERC20TokenSource.Contract.BURNEDTXFEESADDRESS(&_ERC20TokenSource.CallOpts) } -// BLACKHOLEADDRESS is a free data retrieval call binding the contract method 0xd3681114. +// BURNEDTXFEESADDRESS is a free data retrieval call binding the contract method 0xc452165e. // -// Solidity: function BLACKHOLE_ADDRESS() view returns(address) -func (_ERC20TokenSource *ERC20TokenSourceCallerSession) BLACKHOLEADDRESS() (common.Address, error) { - return _ERC20TokenSource.Contract.BLACKHOLEADDRESS(&_ERC20TokenSource.CallOpts) +// Solidity: function BURNED_TX_FEES_ADDRESS() view returns(address) +func (_ERC20TokenSource *ERC20TokenSourceCallerSession) BURNEDTXFEESADDRESS() (common.Address, error) { + return _ERC20TokenSource.Contract.BURNEDTXFEESADDRESS(&_ERC20TokenSource.CallOpts) } // MINTNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xb6171f73. diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go index 5a66a5a8b..c6f73fdf7 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go @@ -37,7 +37,7 @@ type TeleporterFeeInfo struct { // NativeTokenDestinationMetaData contains all meta data concerning the NativeTokenDestination contract. var NativeTokenDestinationMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialReserveImbalance_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"addedBy\",\"type\":\"address\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"burnAddressBalance\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"ReportTotalBurnedTxFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"REPORT_BURNED_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"reportTotalBurnedTxFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalMinted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialReserveImbalance_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"addedBy\",\"type\":\"address\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"burnAddressBalance\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"ReportTotalBurnedTxFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BLACKHOLE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REPORT_BURNED_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"reportTotalBurnedTxFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalMinted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", } // NativeTokenDestinationABI is the input ABI used to generate the binding from. @@ -186,6 +186,68 @@ func (_NativeTokenDestination *NativeTokenDestinationTransactorRaw) Transact(opt return _NativeTokenDestination.Contract.contract.Transact(opts, method, params...) } +// BLACKHOLEADDRESS is a free data retrieval call binding the contract method 0xd3681114. +// +// Solidity: function BLACKHOLE_ADDRESS() view returns(address) +func (_NativeTokenDestination *NativeTokenDestinationCaller) BLACKHOLEADDRESS(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _NativeTokenDestination.contract.Call(opts, &out, "BLACKHOLE_ADDRESS") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// BLACKHOLEADDRESS is a free data retrieval call binding the contract method 0xd3681114. +// +// Solidity: function BLACKHOLE_ADDRESS() view returns(address) +func (_NativeTokenDestination *NativeTokenDestinationSession) BLACKHOLEADDRESS() (common.Address, error) { + return _NativeTokenDestination.Contract.BLACKHOLEADDRESS(&_NativeTokenDestination.CallOpts) +} + +// BLACKHOLEADDRESS is a free data retrieval call binding the contract method 0xd3681114. +// +// Solidity: function BLACKHOLE_ADDRESS() view returns(address) +func (_NativeTokenDestination *NativeTokenDestinationCallerSession) BLACKHOLEADDRESS() (common.Address, error) { + return _NativeTokenDestination.Contract.BLACKHOLEADDRESS(&_NativeTokenDestination.CallOpts) +} + +// BURNEDTXFEESADDRESS is a free data retrieval call binding the contract method 0xc452165e. +// +// Solidity: function BURNED_TX_FEES_ADDRESS() view returns(address) +func (_NativeTokenDestination *NativeTokenDestinationCaller) BURNEDTXFEESADDRESS(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _NativeTokenDestination.contract.Call(opts, &out, "BURNED_TX_FEES_ADDRESS") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// BURNEDTXFEESADDRESS is a free data retrieval call binding the contract method 0xc452165e. +// +// Solidity: function BURNED_TX_FEES_ADDRESS() view returns(address) +func (_NativeTokenDestination *NativeTokenDestinationSession) BURNEDTXFEESADDRESS() (common.Address, error) { + return _NativeTokenDestination.Contract.BURNEDTXFEESADDRESS(&_NativeTokenDestination.CallOpts) +} + +// BURNEDTXFEESADDRESS is a free data retrieval call binding the contract method 0xc452165e. +// +// Solidity: function BURNED_TX_FEES_ADDRESS() view returns(address) +func (_NativeTokenDestination *NativeTokenDestinationCallerSession) BURNEDTXFEESADDRESS() (common.Address, error) { + return _NativeTokenDestination.Contract.BURNEDTXFEESADDRESS(&_NativeTokenDestination.CallOpts) +} + // REPORTBURNEDTOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xd3095126. // // Solidity: function REPORT_BURNED_TOKENS_REQUIRED_GAS() view returns(uint256) diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go index 8a01880ba..4cc169a41 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go @@ -37,7 +37,7 @@ type TeleporterFeeInfo struct { // NativeTokenSourceMetaData contains all meta data concerning the NativeTokenSource contract. var NativeTokenSourceMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BLACKHOLE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationChainBurnedBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationChainBurnedBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", } // NativeTokenSourceABI is the input ABI used to generate the binding from. @@ -186,12 +186,12 @@ func (_NativeTokenSource *NativeTokenSourceTransactorRaw) Transact(opts *bind.Tr return _NativeTokenSource.Contract.contract.Transact(opts, method, params...) } -// BLACKHOLEADDRESS is a free data retrieval call binding the contract method 0xd3681114. +// BURNEDTXFEESADDRESS is a free data retrieval call binding the contract method 0xc452165e. // -// Solidity: function BLACKHOLE_ADDRESS() view returns(address) -func (_NativeTokenSource *NativeTokenSourceCaller) BLACKHOLEADDRESS(opts *bind.CallOpts) (common.Address, error) { +// Solidity: function BURNED_TX_FEES_ADDRESS() view returns(address) +func (_NativeTokenSource *NativeTokenSourceCaller) BURNEDTXFEESADDRESS(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _NativeTokenSource.contract.Call(opts, &out, "BLACKHOLE_ADDRESS") + err := _NativeTokenSource.contract.Call(opts, &out, "BURNED_TX_FEES_ADDRESS") if err != nil { return *new(common.Address), err @@ -203,18 +203,18 @@ func (_NativeTokenSource *NativeTokenSourceCaller) BLACKHOLEADDRESS(opts *bind.C } -// BLACKHOLEADDRESS is a free data retrieval call binding the contract method 0xd3681114. +// BURNEDTXFEESADDRESS is a free data retrieval call binding the contract method 0xc452165e. // -// Solidity: function BLACKHOLE_ADDRESS() view returns(address) -func (_NativeTokenSource *NativeTokenSourceSession) BLACKHOLEADDRESS() (common.Address, error) { - return _NativeTokenSource.Contract.BLACKHOLEADDRESS(&_NativeTokenSource.CallOpts) +// Solidity: function BURNED_TX_FEES_ADDRESS() view returns(address) +func (_NativeTokenSource *NativeTokenSourceSession) BURNEDTXFEESADDRESS() (common.Address, error) { + return _NativeTokenSource.Contract.BURNEDTXFEESADDRESS(&_NativeTokenSource.CallOpts) } -// BLACKHOLEADDRESS is a free data retrieval call binding the contract method 0xd3681114. +// BURNEDTXFEESADDRESS is a free data retrieval call binding the contract method 0xc452165e. // -// Solidity: function BLACKHOLE_ADDRESS() view returns(address) -func (_NativeTokenSource *NativeTokenSourceCallerSession) BLACKHOLEADDRESS() (common.Address, error) { - return _NativeTokenSource.Contract.BLACKHOLEADDRESS(&_NativeTokenSource.CallOpts) +// Solidity: function BURNED_TX_FEES_ADDRESS() view returns(address) +func (_NativeTokenSource *NativeTokenSourceCallerSession) BURNEDTXFEESADDRESS() (common.Address, error) { + return _NativeTokenSource.Contract.BURNEDTXFEESADDRESS(&_NativeTokenSource.CallOpts) } // MINTNATIVETOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xb6171f73. From b0445f7d702eda4d9b82ca332908d3ef866d2f94 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 21 Nov 2023 09:32:06 -0500 Subject: [PATCH 128/183] Increase gas limit for burn reporting --- .../NativeTokenBridge/NativeTokenDestination.sol | 2 +- tests/utils/utils.go | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index eb5043038..5db7fe038 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -35,7 +35,7 @@ contract NativeTokenDestination is INativeMinter(0x0200000000000000000000000000000000000001); uint256 public constant TRANSFER_NATIVE_TOKENS_REQUIRED_GAS = 100_000; - uint256 public constant REPORT_BURNED_TOKENS_REQUIRED_GAS = 50_000; + uint256 public constant REPORT_BURNED_TOKENS_REQUIRED_GAS = 100_000; bytes32 public immutable sourceBlockchainID; address public immutable nativeTokenSourceAddress; // The first `initialReserveImbalance` tokens sent to this subnet will not be minted. diff --git a/tests/utils/utils.go b/tests/utils/utils.go index 763b2945a..261b35848 100644 --- a/tests/utils/utils.go +++ b/tests/utils/utils.go @@ -322,6 +322,12 @@ func RelayMessage( // Check for a successful execution of the teleporter message. _, err = GetEventFromLogs(receipt.Logs, bind.ParseMessageExecuted) + if err != nil { + // If we didn't find the ReceiveCrossChainMessage event, trace the transaction. + // We compare it with the empty string so that ginkgo will print it out for us. + trace := TraceTransaction(ctx, receipt.TxHash, destination) + fmt.Println("TRACE ", trace) + } return receipt, err } From ebdb01d795db4c45fc6757553a1f613ed55ff519 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Wed, 22 Nov 2023 11:36:20 -0500 Subject: [PATCH 129/183] Update teleporter fee info field name --- .../NativeTokenDestination/NativeTokenDestination.go | 4 ++-- .../NativeTokenBridge/NativeTokenSource/NativeTokenSource.go | 4 ++-- .../NativeTokenBridge/ERC20TokenSource.sol | 2 +- .../NativeTokenBridge/NativeTokenDestination.sol | 4 ++-- .../NativeTokenBridge/NativeTokenSource.sol | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go index c6f73fdf7..1c4abaaf0 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go @@ -31,13 +31,13 @@ var ( // TeleporterFeeInfo is an auto generated low-level Go binding around an user-defined struct. type TeleporterFeeInfo struct { - ContractAddress common.Address + FeeTokenAddress common.Address Amount *big.Int } // NativeTokenDestinationMetaData contains all meta data concerning the NativeTokenDestination contract. var NativeTokenDestinationMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialReserveImbalance_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"addedBy\",\"type\":\"address\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"burnAddressBalance\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"ReportTotalBurnedTxFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BLACKHOLE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REPORT_BURNED_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"reportTotalBurnedTxFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalMinted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialReserveImbalance_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"addedBy\",\"type\":\"address\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"burnAddressBalance\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"ReportTotalBurnedTxFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BLACKHOLE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REPORT_BURNED_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"reportTotalBurnedTxFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalMinted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", } // NativeTokenDestinationABI is the input ABI used to generate the binding from. diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go index 4cc169a41..0616ab3a7 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go @@ -31,13 +31,13 @@ var ( // TeleporterFeeInfo is an auto generated low-level Go binding around an user-defined struct. type TeleporterFeeInfo struct { - ContractAddress common.Address + FeeTokenAddress common.Address Amount *big.Int } // NativeTokenSourceMetaData contains all meta data concerning the NativeTokenSource contract. var NativeTokenSourceMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationChainBurnedBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationChainBurnedBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", } // NativeTokenSourceABI is the input ABI used to generate the binding from. diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol index dd696232d..a33a87b02 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol @@ -166,7 +166,7 @@ contract ERC20TokenSource is destinationChainID: destinationBlockchainID, destinationAddress: nativeTokenDestinationAddress, feeInfo: TeleporterFeeInfo({ - contractAddress: erc20ContractAddress, + feeTokenAddress: erc20ContractAddress, amount: feeAmount }), requiredGasLimit: MINT_NATIVE_TOKENS_REQUIRED_GAS, diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index 5db7fe038..726a0bc85 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -175,11 +175,11 @@ contract NativeTokenDestination is uint256 adjustedFeeAmount = 0; if (feeInfo.amount > 0) { adjustedFeeAmount = SafeERC20TransferFrom.safeTransferFrom( - IERC20(feeInfo.contractAddress), + IERC20(feeInfo.feeTokenAddress), feeInfo.amount ); SafeERC20.safeIncreaseAllowance( - IERC20(feeInfo.contractAddress), + IERC20(feeInfo.feeTokenAddress), address(teleporterMessenger), adjustedFeeAmount ); diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index 3752c74e6..145f61ce1 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -134,11 +134,11 @@ contract NativeTokenSource is uint256 adjustedFeeAmount = 0; if (feeInfo.amount > 0) { adjustedFeeAmount = SafeERC20TransferFrom.safeTransferFrom( - IERC20(feeInfo.contractAddress), + IERC20(feeInfo.feeTokenAddress), feeInfo.amount ); SafeERC20.safeIncreaseAllowance( - IERC20(feeInfo.contractAddress), + IERC20(feeInfo.feeTokenAddress), address(teleporterMessenger), adjustedFeeAmount ); From a1c08bb47bdc457faf8115eece0faa35f7cc96a6 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Wed, 22 Nov 2023 11:40:59 -0500 Subject: [PATCH 130/183] Fix renamed fields --- tests/erc20_to_native_token_bridge.go | 2 +- tests/native_token_bridge.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/erc20_to_native_token_bridge.go b/tests/erc20_to_native_token_bridge.go index f3d11c405..e2ea2fc66 100644 --- a/tests/erc20_to_native_token_bridge.go +++ b/tests/erc20_to_native_token_bridge.go @@ -38,7 +38,7 @@ func ERC20ToNativeTokenBridge() { burnedTxFeeAddress = common.HexToAddress("0x0100000000000000000000000000000000000000") emptyDestFeeInfo = nativetokendestination.TeleporterFeeInfo{ - ContractAddress: common.Address{}, + FeeTokenAddress: common.Address{}, Amount: common.Big0, } ) diff --git a/tests/native_token_bridge.go b/tests/native_token_bridge.go index 4cdc658e2..3485c9ece 100644 --- a/tests/native_token_bridge.go +++ b/tests/native_token_bridge.go @@ -35,11 +35,11 @@ func NativeTokenBridge() { burnedTxFeeAddress = common.HexToAddress("0x0100000000000000000000000000000000000000") emptyDestFeeInfo = nativetokendestination.TeleporterFeeInfo{ - ContractAddress: common.Address{}, + FeeTokenAddress: common.Address{}, Amount: common.Big0, } emptySourceFeeInfo = nativetokensource.TeleporterFeeInfo{ - ContractAddress: common.Address{}, + FeeTokenAddress: common.Address{}, Amount: common.Big0, } ) From d723ef297718c40103d3566b242d89264800b1da Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Wed, 22 Nov 2023 12:32:10 -0500 Subject: [PATCH 131/183] review fixes --- .../CrossChainApplications/ERC20Bridge/BridgeToken.sol | 2 +- .../CrossChainApplications/ERC20Bridge/IERC20Bridge.sol | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/contracts/src/CrossChainApplications/ERC20Bridge/BridgeToken.sol b/contracts/src/CrossChainApplications/ERC20Bridge/BridgeToken.sol index 13ca7d384..da0734aed 100644 --- a/contracts/src/CrossChainApplications/ERC20Bridge/BridgeToken.sol +++ b/contracts/src/CrossChainApplications/ERC20Bridge/BridgeToken.sol @@ -7,7 +7,7 @@ pragma solidity 0.8.18; import {ERC20, ERC20Burnable} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; -/**tran +/** * @dev BridgeToken is an ERC20Burnable token contract that is associated with a specific native chain bridge and asset, and is only mintable by the bridge contract on this chain. */ contract BridgeToken is ERC20Burnable { diff --git a/contracts/src/CrossChainApplications/ERC20Bridge/IERC20Bridge.sol b/contracts/src/CrossChainApplications/ERC20Bridge/IERC20Bridge.sol index 9fad94262..ee928e160 100644 --- a/contracts/src/CrossChainApplications/ERC20Bridge/IERC20Bridge.sol +++ b/contracts/src/CrossChainApplications/ERC20Bridge/IERC20Bridge.sol @@ -11,14 +11,14 @@ import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; * @dev Interface that describes functionalities for a cross-chain ERC20 bridge. */ interface IERC20Bridge { - + /** + * @dev Enum representing the action to take on receiving a Teleporter message. + */ enum BridgeAction { Create, Mint, Transfer - } /** - * @dev Enum representing the action to take on receiving a Teleporter message. - */ + } /** * @dev Emitted when tokens are locked in this bridge contract to be bridged to another chain. From a4c11b0e3e1d57a07a91cf874ddc9e3a258979a2 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 27 Nov 2023 09:11:44 -0500 Subject: [PATCH 132/183] Rename destinationChainBurnedBalance to destinationBurnedTotal --- .../ERC20TokenSource/ERC20TokenSource.go | 26 +++++++++---------- .../NativeTokenSource/NativeTokenSource.go | 26 +++++++++---------- .../NativeTokenBridge/ERC20TokenSource.sol | 14 +++++----- .../NativeTokenBridge/NativeTokenSource.sol | 14 +++++----- 4 files changed, 40 insertions(+), 40 deletions(-) diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go index 3cd83dab8..326a49ac0 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go @@ -31,7 +31,7 @@ var ( // ERC20TokenSourceMetaData contains all meta data concerning the ERC20TokenSource contract. var ERC20TokenSourceMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"erc20ContractAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"transferAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationChainBurnedBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"erc20ContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"erc20ContractAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"transferAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBurnedTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"erc20ContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // ERC20TokenSourceABI is the input ABI used to generate the binding from. @@ -273,12 +273,12 @@ func (_ERC20TokenSource *ERC20TokenSourceCallerSession) DestinationBlockchainID( return _ERC20TokenSource.Contract.DestinationBlockchainID(&_ERC20TokenSource.CallOpts) } -// DestinationChainBurnedBalance is a free data retrieval call binding the contract method 0xd98d180d. +// DestinationBurnedTotal is a free data retrieval call binding the contract method 0x55db3e9e. // -// Solidity: function destinationChainBurnedBalance() view returns(uint256) -func (_ERC20TokenSource *ERC20TokenSourceCaller) DestinationChainBurnedBalance(opts *bind.CallOpts) (*big.Int, error) { +// Solidity: function destinationBurnedTotal() view returns(uint256) +func (_ERC20TokenSource *ERC20TokenSourceCaller) DestinationBurnedTotal(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _ERC20TokenSource.contract.Call(opts, &out, "destinationChainBurnedBalance") + err := _ERC20TokenSource.contract.Call(opts, &out, "destinationBurnedTotal") if err != nil { return *new(*big.Int), err @@ -290,18 +290,18 @@ func (_ERC20TokenSource *ERC20TokenSourceCaller) DestinationChainBurnedBalance(o } -// DestinationChainBurnedBalance is a free data retrieval call binding the contract method 0xd98d180d. +// DestinationBurnedTotal is a free data retrieval call binding the contract method 0x55db3e9e. // -// Solidity: function destinationChainBurnedBalance() view returns(uint256) -func (_ERC20TokenSource *ERC20TokenSourceSession) DestinationChainBurnedBalance() (*big.Int, error) { - return _ERC20TokenSource.Contract.DestinationChainBurnedBalance(&_ERC20TokenSource.CallOpts) +// Solidity: function destinationBurnedTotal() view returns(uint256) +func (_ERC20TokenSource *ERC20TokenSourceSession) DestinationBurnedTotal() (*big.Int, error) { + return _ERC20TokenSource.Contract.DestinationBurnedTotal(&_ERC20TokenSource.CallOpts) } -// DestinationChainBurnedBalance is a free data retrieval call binding the contract method 0xd98d180d. +// DestinationBurnedTotal is a free data retrieval call binding the contract method 0x55db3e9e. // -// Solidity: function destinationChainBurnedBalance() view returns(uint256) -func (_ERC20TokenSource *ERC20TokenSourceCallerSession) DestinationChainBurnedBalance() (*big.Int, error) { - return _ERC20TokenSource.Contract.DestinationChainBurnedBalance(&_ERC20TokenSource.CallOpts) +// Solidity: function destinationBurnedTotal() view returns(uint256) +func (_ERC20TokenSource *ERC20TokenSourceCallerSession) DestinationBurnedTotal() (*big.Int, error) { + return _ERC20TokenSource.Contract.DestinationBurnedTotal(&_ERC20TokenSource.CallOpts) } // Erc20ContractAddress is a free data retrieval call binding the contract method 0xe486df15. diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go index 0616ab3a7..40ef95a3a 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go @@ -37,7 +37,7 @@ type TeleporterFeeInfo struct { // NativeTokenSourceMetaData contains all meta data concerning the NativeTokenSource contract. var NativeTokenSourceMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationChainBurnedBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBurnedTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", } // NativeTokenSourceABI is the input ABI used to generate the binding from. @@ -279,12 +279,12 @@ func (_NativeTokenSource *NativeTokenSourceCallerSession) DestinationBlockchainI return _NativeTokenSource.Contract.DestinationBlockchainID(&_NativeTokenSource.CallOpts) } -// DestinationChainBurnedBalance is a free data retrieval call binding the contract method 0xd98d180d. +// DestinationBurnedTotal is a free data retrieval call binding the contract method 0x55db3e9e. // -// Solidity: function destinationChainBurnedBalance() view returns(uint256) -func (_NativeTokenSource *NativeTokenSourceCaller) DestinationChainBurnedBalance(opts *bind.CallOpts) (*big.Int, error) { +// Solidity: function destinationBurnedTotal() view returns(uint256) +func (_NativeTokenSource *NativeTokenSourceCaller) DestinationBurnedTotal(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _NativeTokenSource.contract.Call(opts, &out, "destinationChainBurnedBalance") + err := _NativeTokenSource.contract.Call(opts, &out, "destinationBurnedTotal") if err != nil { return *new(*big.Int), err @@ -296,18 +296,18 @@ func (_NativeTokenSource *NativeTokenSourceCaller) DestinationChainBurnedBalance } -// DestinationChainBurnedBalance is a free data retrieval call binding the contract method 0xd98d180d. +// DestinationBurnedTotal is a free data retrieval call binding the contract method 0x55db3e9e. // -// Solidity: function destinationChainBurnedBalance() view returns(uint256) -func (_NativeTokenSource *NativeTokenSourceSession) DestinationChainBurnedBalance() (*big.Int, error) { - return _NativeTokenSource.Contract.DestinationChainBurnedBalance(&_NativeTokenSource.CallOpts) +// Solidity: function destinationBurnedTotal() view returns(uint256) +func (_NativeTokenSource *NativeTokenSourceSession) DestinationBurnedTotal() (*big.Int, error) { + return _NativeTokenSource.Contract.DestinationBurnedTotal(&_NativeTokenSource.CallOpts) } -// DestinationChainBurnedBalance is a free data retrieval call binding the contract method 0xd98d180d. +// DestinationBurnedTotal is a free data retrieval call binding the contract method 0x55db3e9e. // -// Solidity: function destinationChainBurnedBalance() view returns(uint256) -func (_NativeTokenSource *NativeTokenSourceCallerSession) DestinationChainBurnedBalance() (*big.Int, error) { - return _NativeTokenSource.Contract.DestinationChainBurnedBalance(&_NativeTokenSource.CallOpts) +// Solidity: function destinationBurnedTotal() view returns(uint256) +func (_NativeTokenSource *NativeTokenSourceCallerSession) DestinationBurnedTotal() (*big.Int, error) { + return _NativeTokenSource.Contract.DestinationBurnedTotal(&_NativeTokenSource.CallOpts) } // NativeTokenDestinationAddress is a free data retrieval call binding the contract method 0xb8c9091a. diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol index a33a87b02..7b05e2ad5 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol @@ -27,7 +27,7 @@ contract ERC20TokenSource is uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 100_000; // Used to keep track of tokens burned through transactions on the destination chain. They can // be reported to this contract to burn an equivalent number of tokens on this chain. - uint256 public destinationChainBurnedBalance = 0; + uint256 public destinationBurnedTotal = 0; bytes32 public immutable destinationBlockchainID; address public immutable nativeTokenDestinationAddress; address public immutable erc20ContractAddress; @@ -115,7 +115,7 @@ contract ERC20TokenSource is _unlockTokens(recipient, amount); } else if (action == SourceAction.Burn) { uint256 newBurnBalance = abi.decode(actionData, (uint256)); - _updateDestinationChainBurnedBalance(newBurnBalance); + _updatedestinationBurnedTotal(newBurnBalance); } else { revert("ERC20TokenSource: invalid action"); } @@ -212,15 +212,15 @@ contract ERC20TokenSource is } /** - * @dev Update destinationChainBurnedBalance sent from destination chain + * @dev Update destinationBurnedTotal sent from destination chain */ - function _updateDestinationChainBurnedBalance( + function _updatedestinationBurnedTotal( uint256 newBurnBalance ) private { - if (newBurnBalance > destinationChainBurnedBalance) { - uint256 difference = newBurnBalance - destinationChainBurnedBalance; + if (newBurnBalance > destinationBurnedTotal) { + uint256 difference = newBurnBalance - destinationBurnedTotal; _burnTokens(difference); - destinationChainBurnedBalance = newBurnBalance; + destinationBurnedTotal = newBurnBalance; } } } diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index 145f61ce1..92699658a 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -28,7 +28,7 @@ contract NativeTokenSource is uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 100_000; // Used to keep track of tokens burned through transactions on the destination chain. They can // be reported to this contract to burn an equivalent number of tokens on this chain. - uint256 public destinationChainBurnedBalance = 0; + uint256 public destinationBurnedTotal = 0; bytes32 public immutable destinationBlockchainID; address public immutable nativeTokenDestinationAddress; @@ -108,7 +108,7 @@ contract NativeTokenSource is _unlockTokens(recipient, amount); } else if (action == SourceAction.Burn) { uint256 newBurnBalance = abi.decode(actionData, (uint256)); - _updateDestinationChainBurnedBalance(newBurnBalance); + _updatedestinationBurnedTotal(newBurnBalance); } else { revert("NativeTokenSource: invalid action"); } @@ -187,15 +187,15 @@ contract NativeTokenSource is } /** - * @dev Update destinationChainBurnedBalance sent from destination chain + * @dev Update destinationBurnedTotal sent from destination chain */ - function _updateDestinationChainBurnedBalance( + function _updatedestinationBurnedTotal( uint256 newBurnBalance ) private { - if (newBurnBalance > destinationChainBurnedBalance) { - uint256 difference = newBurnBalance - destinationChainBurnedBalance; + if (newBurnBalance > destinationBurnedTotal) { + uint256 difference = newBurnBalance - destinationBurnedTotal; _burnTokens(difference); - destinationChainBurnedBalance = newBurnBalance; + destinationBurnedTotal = newBurnBalance; } } } From ae0e39781f313cc88533231f394561b56f08dad7 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 27 Nov 2023 09:14:50 -0500 Subject: [PATCH 133/183] Rename newBurnedBalance to newBurnedTotal --- .../NativeTokenBridge/ERC20TokenSource.sol | 14 +++++++------- .../NativeTokenBridge/NativeTokenSource.sol | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol index 7b05e2ad5..993d951a8 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol @@ -27,7 +27,7 @@ contract ERC20TokenSource is uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 100_000; // Used to keep track of tokens burned through transactions on the destination chain. They can // be reported to this contract to burn an equivalent number of tokens on this chain. - uint256 public destinationBurnedTotal = 0; + uint256 public destinationBurnedTotal; bytes32 public immutable destinationBlockchainID; address public immutable nativeTokenDestinationAddress; address public immutable erc20ContractAddress; @@ -114,8 +114,8 @@ contract ERC20TokenSource is ); _unlockTokens(recipient, amount); } else if (action == SourceAction.Burn) { - uint256 newBurnBalance = abi.decode(actionData, (uint256)); - _updatedestinationBurnedTotal(newBurnBalance); + uint256 newBurnTotal = abi.decode(actionData, (uint256)); + _updatedestinationBurnedTotal(newBurnTotal); } else { revert("ERC20TokenSource: invalid action"); } @@ -215,12 +215,12 @@ contract ERC20TokenSource is * @dev Update destinationBurnedTotal sent from destination chain */ function _updatedestinationBurnedTotal( - uint256 newBurnBalance + uint256 newBurnTotal ) private { - if (newBurnBalance > destinationBurnedTotal) { - uint256 difference = newBurnBalance - destinationBurnedTotal; + if (newBurnTotal > destinationBurnedTotal) { + uint256 difference = newBurnTotal - destinationBurnedTotal; _burnTokens(difference); - destinationBurnedTotal = newBurnBalance; + destinationBurnedTotal = newBurnTotal; } } } diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index 92699658a..2914ee4d3 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -28,7 +28,7 @@ contract NativeTokenSource is uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 100_000; // Used to keep track of tokens burned through transactions on the destination chain. They can // be reported to this contract to burn an equivalent number of tokens on this chain. - uint256 public destinationBurnedTotal = 0; + uint256 public destinationBurnedTotal; bytes32 public immutable destinationBlockchainID; address public immutable nativeTokenDestinationAddress; @@ -107,8 +107,8 @@ contract NativeTokenSource is ); _unlockTokens(recipient, amount); } else if (action == SourceAction.Burn) { - uint256 newBurnBalance = abi.decode(actionData, (uint256)); - _updatedestinationBurnedTotal(newBurnBalance); + uint256 newBurnTotal = abi.decode(actionData, (uint256)); + _updatedestinationBurnedTotal(newBurnTotal); } else { revert("NativeTokenSource: invalid action"); } @@ -190,12 +190,12 @@ contract NativeTokenSource is * @dev Update destinationBurnedTotal sent from destination chain */ function _updatedestinationBurnedTotal( - uint256 newBurnBalance + uint256 newBurnTotal ) private { - if (newBurnBalance > destinationBurnedTotal) { - uint256 difference = newBurnBalance - destinationBurnedTotal; + if (newBurnTotal > destinationBurnedTotal) { + uint256 difference = newBurnTotal - destinationBurnedTotal; _burnTokens(difference); - destinationBurnedTotal = newBurnBalance; + destinationBurnedTotal = newBurnTotal; } } } From 12b9702cb82a600ae59fed3e54aa7526011c7448 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 27 Nov 2023 09:18:42 -0500 Subject: [PATCH 134/183] Add comment describing updating burn total --- .../NativeTokenBridge/NativeTokenSource.sol | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index 2914ee4d3..5bf10ec70 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -188,6 +188,9 @@ contract NativeTokenSource is /** * @dev Update destinationBurnedTotal sent from destination chain + * If the new burned total is less than the highest known burned total, this transaction is a no-op. + * The burned total on the destination will only ever increase, but new totals may be relayed to this + * chain out of order. */ function _updatedestinationBurnedTotal( uint256 newBurnTotal From 4bed474879dba5c2f78e68afdd0e6747df2e477f Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 27 Nov 2023 09:19:19 -0500 Subject: [PATCH 135/183] Update contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol Co-authored-by: minghinmatthewlam Signed-off-by: Geoff Stuart --- .../NativeTokenBridge/IERC20TokenSource.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol index 4c2d1580a..8231b5e24 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol @@ -22,8 +22,8 @@ interface IERC20TokenSource { ); /** - * @dev Locks ERC20 tokens on the source contract chain, and sends a message to the destination - * contract to mint corresponding tokens. + * @dev Locks ERC20 tokens on the source contract chain, and sends a message to mint the + * corresponding native tokens on the destination chain. */ function transferToDestination( address recipient, From 22e5cfc75c2a440889ffa0ea3ae762fc241264bb Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 27 Nov 2023 09:20:01 -0500 Subject: [PATCH 136/183] Fix comment --- .../NativeTokenBridge/IERC20TokenSource.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol index 4c2d1580a..acf190d65 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol @@ -7,7 +7,7 @@ pragma solidity 0.8.18; /** * @dev Interface that describes functionalities for a contract that will lock ERC20 tokens and send a - * Teleporter message to a {INativeTokenDestination} contract to mint native tokens on that chain. + * Teleporter message to a {INativeTokenDestination} contract to mint native tokens on the destination chain. */ interface IERC20TokenSource { /** From 30519d81253b83ecb3cbad556964f3e340eca360 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 27 Nov 2023 09:34:38 -0500 Subject: [PATCH 137/183] Review comments --- .../NativeTokenDestination.go | 28 +++++++++---------- .../NativeTokenSource/NativeTokenSource.go | 12 ++++---- .../NativeTokenBridge/ERC20TokenSource.sol | 4 +-- .../INativeTokenDestination.sol | 20 ++++++------- .../NativeTokenBridge/INativeTokenSource.sol | 4 +-- .../NativeTokenBridge/ITokenSource.sol | 4 +++ .../NativeTokenDestination.sol | 5 ++-- .../NativeTokenBridge/NativeTokenSource.sol | 4 +-- 8 files changed, 39 insertions(+), 42 deletions(-) diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go index 1c4abaaf0..cda53c6db 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go @@ -37,7 +37,7 @@ type TeleporterFeeInfo struct { // NativeTokenDestinationMetaData contains all meta data concerning the NativeTokenDestination contract. var NativeTokenDestinationMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialReserveImbalance_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"addedBy\",\"type\":\"address\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"burnAddressBalance\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"ReportTotalBurnedTxFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BLACKHOLE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REPORT_BURNED_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"reportTotalBurnedTxFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalMinted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialReserveImbalance_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"burnAddressBalance\",\"type\":\"uint256\"}],\"name\":\"ReportTotalBurnedTxFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BLACKHOLE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REPORT_BURNED_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"reportTotalBurnedTxFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalMinted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", } // NativeTokenDestinationABI is the input ABI used to generate the binding from. @@ -692,13 +692,13 @@ func (it *NativeTokenDestinationCollateralAddedIterator) Close() error { type NativeTokenDestinationCollateralAdded struct { Amount *big.Int Remaining *big.Int - AddedBy common.Address + Sender common.Address Raw types.Log // Blockchain specific contextual infos } // FilterCollateralAdded is a free log retrieval operation binding the contract event 0x66c12a5fefbc1f35dd64a1d9b069fc5bda187e6f68812c58a330b77b2a695ba9. // -// Solidity: event CollateralAdded(uint256 amount, uint256 remaining, address addedBy) +// Solidity: event CollateralAdded(uint256 amount, uint256 remaining, address sender) func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterCollateralAdded(opts *bind.FilterOpts) (*NativeTokenDestinationCollateralAddedIterator, error) { logs, sub, err := _NativeTokenDestination.contract.FilterLogs(opts, "CollateralAdded") @@ -710,7 +710,7 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterCollateralA // WatchCollateralAdded is a free log subscription operation binding the contract event 0x66c12a5fefbc1f35dd64a1d9b069fc5bda187e6f68812c58a330b77b2a695ba9. // -// Solidity: event CollateralAdded(uint256 amount, uint256 remaining, address addedBy) +// Solidity: event CollateralAdded(uint256 amount, uint256 remaining, address sender) func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchCollateralAdded(opts *bind.WatchOpts, sink chan<- *NativeTokenDestinationCollateralAdded) (event.Subscription, error) { logs, sub, err := _NativeTokenDestination.contract.WatchLogs(opts, "CollateralAdded") @@ -747,7 +747,7 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchCollateralAd // ParseCollateralAdded is a log parse operation binding the contract event 0x66c12a5fefbc1f35dd64a1d9b069fc5bda187e6f68812c58a330b77b2a695ba9. // -// Solidity: event CollateralAdded(uint256 amount, uint256 remaining, address addedBy) +// Solidity: event CollateralAdded(uint256 amount, uint256 remaining, address sender) func (_NativeTokenDestination *NativeTokenDestinationFilterer) ParseCollateralAdded(log types.Log) (*NativeTokenDestinationCollateralAdded, error) { event := new(NativeTokenDestinationCollateralAdded) if err := _NativeTokenDestination.contract.UnpackLog(event, "CollateralAdded", log); err != nil { @@ -971,14 +971,14 @@ func (it *NativeTokenDestinationReportTotalBurnedTxFeesIterator) Close() error { // NativeTokenDestinationReportTotalBurnedTxFees represents a ReportTotalBurnedTxFees event raised by the NativeTokenDestination contract. type NativeTokenDestinationReportTotalBurnedTxFees struct { - BurnAddressBalance *big.Int TeleporterMessageID *big.Int + BurnAddressBalance *big.Int Raw types.Log // Blockchain specific contextual infos } // FilterReportTotalBurnedTxFees is a free log retrieval operation binding the contract event 0x2550fa6041684d40e635e29e93dde9017d70c25b46aa88393317b5182ed6ae7c. // -// Solidity: event ReportTotalBurnedTxFees(uint256 burnAddressBalance, uint256 indexed teleporterMessageID) +// Solidity: event ReportTotalBurnedTxFees(uint256 indexed teleporterMessageID, uint256 burnAddressBalance) func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterReportTotalBurnedTxFees(opts *bind.FilterOpts, teleporterMessageID []*big.Int) (*NativeTokenDestinationReportTotalBurnedTxFeesIterator, error) { var teleporterMessageIDRule []interface{} @@ -995,7 +995,7 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterReportTotal // WatchReportTotalBurnedTxFees is a free log subscription operation binding the contract event 0x2550fa6041684d40e635e29e93dde9017d70c25b46aa88393317b5182ed6ae7c. // -// Solidity: event ReportTotalBurnedTxFees(uint256 burnAddressBalance, uint256 indexed teleporterMessageID) +// Solidity: event ReportTotalBurnedTxFees(uint256 indexed teleporterMessageID, uint256 burnAddressBalance) func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchReportTotalBurnedTxFees(opts *bind.WatchOpts, sink chan<- *NativeTokenDestinationReportTotalBurnedTxFees, teleporterMessageID []*big.Int) (event.Subscription, error) { var teleporterMessageIDRule []interface{} @@ -1037,7 +1037,7 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchReportTotalB // ParseReportTotalBurnedTxFees is a log parse operation binding the contract event 0x2550fa6041684d40e635e29e93dde9017d70c25b46aa88393317b5182ed6ae7c. // -// Solidity: event ReportTotalBurnedTxFees(uint256 burnAddressBalance, uint256 indexed teleporterMessageID) +// Solidity: event ReportTotalBurnedTxFees(uint256 indexed teleporterMessageID, uint256 burnAddressBalance) func (_NativeTokenDestination *NativeTokenDestinationFilterer) ParseReportTotalBurnedTxFees(log types.Log) (*NativeTokenDestinationReportTotalBurnedTxFees, error) { event := new(NativeTokenDestinationReportTotalBurnedTxFees) if err := _NativeTokenDestination.contract.UnpackLog(event, "ReportTotalBurnedTxFees", log); err != nil { @@ -1118,14 +1118,14 @@ func (it *NativeTokenDestinationTransferToSourceIterator) Close() error { type NativeTokenDestinationTransferToSource struct { Sender common.Address Recipient common.Address - Amount *big.Int TeleporterMessageID *big.Int + Amount *big.Int Raw types.Log // Blockchain specific contextual infos } // FilterTransferToSource is a free log retrieval operation binding the contract event 0x0322cbb1d3c23f6dbf1deddb3b4ef3ce0f93ae6eec7b44e4f395804104466d14. // -// Solidity: event TransferToSource(address indexed sender, address indexed recipient, uint256 amount, uint256 indexed teleporterMessageID) +// Solidity: event TransferToSource(address indexed sender, address indexed recipient, uint256 indexed teleporterMessageID, uint256 amount) func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterTransferToSource(opts *bind.FilterOpts, sender []common.Address, recipient []common.Address, teleporterMessageID []*big.Int) (*NativeTokenDestinationTransferToSourceIterator, error) { var senderRule []interface{} @@ -1136,7 +1136,6 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterTransferToS for _, recipientItem := range recipient { recipientRule = append(recipientRule, recipientItem) } - var teleporterMessageIDRule []interface{} for _, teleporterMessageIDItem := range teleporterMessageID { teleporterMessageIDRule = append(teleporterMessageIDRule, teleporterMessageIDItem) @@ -1151,7 +1150,7 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterTransferToS // WatchTransferToSource is a free log subscription operation binding the contract event 0x0322cbb1d3c23f6dbf1deddb3b4ef3ce0f93ae6eec7b44e4f395804104466d14. // -// Solidity: event TransferToSource(address indexed sender, address indexed recipient, uint256 amount, uint256 indexed teleporterMessageID) +// Solidity: event TransferToSource(address indexed sender, address indexed recipient, uint256 indexed teleporterMessageID, uint256 amount) func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchTransferToSource(opts *bind.WatchOpts, sink chan<- *NativeTokenDestinationTransferToSource, sender []common.Address, recipient []common.Address, teleporterMessageID []*big.Int) (event.Subscription, error) { var senderRule []interface{} @@ -1162,7 +1161,6 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchTransferToSo for _, recipientItem := range recipient { recipientRule = append(recipientRule, recipientItem) } - var teleporterMessageIDRule []interface{} for _, teleporterMessageIDItem := range teleporterMessageID { teleporterMessageIDRule = append(teleporterMessageIDRule, teleporterMessageIDItem) @@ -1202,7 +1200,7 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchTransferToSo // ParseTransferToSource is a log parse operation binding the contract event 0x0322cbb1d3c23f6dbf1deddb3b4ef3ce0f93ae6eec7b44e4f395804104466d14. // -// Solidity: event TransferToSource(address indexed sender, address indexed recipient, uint256 amount, uint256 indexed teleporterMessageID) +// Solidity: event TransferToSource(address indexed sender, address indexed recipient, uint256 indexed teleporterMessageID, uint256 amount) func (_NativeTokenDestination *NativeTokenDestinationFilterer) ParseTransferToSource(log types.Log) (*NativeTokenDestinationTransferToSource, error) { event := new(NativeTokenDestinationTransferToSource) if err := _NativeTokenDestination.contract.UnpackLog(event, "TransferToSource", log); err != nil { diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go index 40ef95a3a..97631b07a 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go @@ -37,7 +37,7 @@ type TeleporterFeeInfo struct { // NativeTokenSourceMetaData contains all meta data concerning the NativeTokenSource contract. var NativeTokenSourceMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBurnedTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBurnedTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", } // NativeTokenSourceABI is the input ABI used to generate the binding from. @@ -619,14 +619,14 @@ func (it *NativeTokenSourceTransferToDestinationIterator) Close() error { type NativeTokenSourceTransferToDestination struct { Sender common.Address Recipient common.Address - Amount *big.Int TeleporterMessageID *big.Int + Amount *big.Int Raw types.Log // Blockchain specific contextual infos } // FilterTransferToDestination is a free log retrieval operation binding the contract event 0x2b4e8f08417773e367064a6aea9ca2df303a60876676f70b6c3c5e66b314ca5a. // -// Solidity: event TransferToDestination(address indexed sender, address indexed recipient, uint256 amount, uint256 indexed teleporterMessageID) +// Solidity: event TransferToDestination(address indexed sender, address indexed recipient, uint256 indexed teleporterMessageID, uint256 amount) func (_NativeTokenSource *NativeTokenSourceFilterer) FilterTransferToDestination(opts *bind.FilterOpts, sender []common.Address, recipient []common.Address, teleporterMessageID []*big.Int) (*NativeTokenSourceTransferToDestinationIterator, error) { var senderRule []interface{} @@ -637,7 +637,6 @@ func (_NativeTokenSource *NativeTokenSourceFilterer) FilterTransferToDestination for _, recipientItem := range recipient { recipientRule = append(recipientRule, recipientItem) } - var teleporterMessageIDRule []interface{} for _, teleporterMessageIDItem := range teleporterMessageID { teleporterMessageIDRule = append(teleporterMessageIDRule, teleporterMessageIDItem) @@ -652,7 +651,7 @@ func (_NativeTokenSource *NativeTokenSourceFilterer) FilterTransferToDestination // WatchTransferToDestination is a free log subscription operation binding the contract event 0x2b4e8f08417773e367064a6aea9ca2df303a60876676f70b6c3c5e66b314ca5a. // -// Solidity: event TransferToDestination(address indexed sender, address indexed recipient, uint256 amount, uint256 indexed teleporterMessageID) +// Solidity: event TransferToDestination(address indexed sender, address indexed recipient, uint256 indexed teleporterMessageID, uint256 amount) func (_NativeTokenSource *NativeTokenSourceFilterer) WatchTransferToDestination(opts *bind.WatchOpts, sink chan<- *NativeTokenSourceTransferToDestination, sender []common.Address, recipient []common.Address, teleporterMessageID []*big.Int) (event.Subscription, error) { var senderRule []interface{} @@ -663,7 +662,6 @@ func (_NativeTokenSource *NativeTokenSourceFilterer) WatchTransferToDestination( for _, recipientItem := range recipient { recipientRule = append(recipientRule, recipientItem) } - var teleporterMessageIDRule []interface{} for _, teleporterMessageIDItem := range teleporterMessageID { teleporterMessageIDRule = append(teleporterMessageIDRule, teleporterMessageIDItem) @@ -703,7 +701,7 @@ func (_NativeTokenSource *NativeTokenSourceFilterer) WatchTransferToDestination( // ParseTransferToDestination is a log parse operation binding the contract event 0x2b4e8f08417773e367064a6aea9ca2df303a60876676f70b6c3c5e66b314ca5a. // -// Solidity: event TransferToDestination(address indexed sender, address indexed recipient, uint256 amount, uint256 indexed teleporterMessageID) +// Solidity: event TransferToDestination(address indexed sender, address indexed recipient, uint256 indexed teleporterMessageID, uint256 amount) func (_NativeTokenSource *NativeTokenSourceFilterer) ParseTransferToDestination(log types.Log) (*NativeTokenSourceTransferToDestination, error) { event := new(NativeTokenSourceTransferToDestination) if err := _NativeTokenSource.contract.UnpackLog(event, "TransferToDestination", log); err != nil { diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol index 993d951a8..81055f329 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol @@ -214,9 +214,7 @@ contract ERC20TokenSource is /** * @dev Update destinationBurnedTotal sent from destination chain */ - function _updatedestinationBurnedTotal( - uint256 newBurnTotal - ) private { + function _updatedestinationBurnedTotal(uint256 newBurnTotal) private { if (newBurnTotal > destinationBurnedTotal) { uint256 difference = newBurnTotal - destinationBurnedTotal; _burnTokens(difference); diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol index 80fef3fb1..b58d4b246 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol @@ -18,14 +18,14 @@ interface INativeTokenDestination { event TransferToSource( address indexed sender, address indexed recipient, - uint256 amount, - uint256 indexed teleporterMessageID + uint256 indexed teleporterMessageID, + uint256 amount ); /** * @dev Emitted when tokens are not minted in order to collateralize the source contract. */ - event CollateralAdded(uint256 amount, uint256 remaining, address addedBy); + event CollateralAdded(uint256 amount, uint256 remaining, address sender); /** * @dev Emitted when minting native tokens. @@ -33,11 +33,11 @@ interface INativeTokenDestination { event NativeTokensMinted(address indexed recipient, uint256 amount); /** - * @dev Emitted when minting reporting total burned tx fees to source chain. + * @dev Emitted when reporting total burned tx fees to source chain. */ event ReportTotalBurnedTxFees( - uint256 burnAddressBalance, - uint256 indexed teleporterMessageID + uint256 indexed teleporterMessageID, + uint256 burnAddressBalance ); /** @@ -51,14 +51,14 @@ interface INativeTokenDestination { ) external payable; /** - * @dev Returns true if currentTokenImbalance is 0. When this is true, all tokens sent to - * this chain will be minted, and sending tokens to the source chain is allowed. + * @dev Returns true if the reserve imbalance for this contract has been accounted for. + * When this is true, all tokens sent to this chain will be minted, and sending tokens + * to the source chain is allowed. */ function isCollateralized() external view returns (bool); /** - * @dev Returns the total number of tokens minted + initialReserveImbalance - - * total tokens burned through fees and transferring back to the source chain. + * @dev Returns a best-estimate (upper bound) of tokens in circulation on this chain. */ function totalSupply() external view returns (uint256); } diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol index 95c861a97..2836c8dc2 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol @@ -18,8 +18,8 @@ interface INativeTokenSource { event TransferToDestination( address indexed sender, address indexed recipient, - uint256 amount, - uint256 indexed teleporterMessageID + uint256 indexed teleporterMessageID, + uint256 amount ); /** diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/ITokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/ITokenSource.sol index 40a553cc6..b572add16 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/ITokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/ITokenSource.sol @@ -5,6 +5,10 @@ pragma solidity 0.8.18; +/** + * @dev Interface for common functionality needed for different `TokenSource` contracts such as + * `NativeTokenSource` and `ERC20TokenSource`. + */ interface ITokenSource { /** * @dev Enum representing the action to take on receiving a Teleporter message. diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index 726a0bc85..92eb2b25d 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -29,6 +29,7 @@ contract NativeTokenDestination is // Designated Blackhole Address. Tokens are sent here to be "burned" before sending an unlock // message to the source chain. Different from the burned tx fee address so they can be // tracked separately. + // Defined at https://github.com/ava-labs/subnet-evm/blob/e23ab058d039ff9c8469c89b139d21d52c4bd283/constants/constants.go address public constant BLACKHOLE_ADDRESS = 0x0100000000000000000000000000000000000001; INativeMinter private immutable _nativeMinter = @@ -129,7 +130,7 @@ contract NativeTokenDestination is emit CollateralAdded({ amount: currentReserveImbalance, remaining: 0, - addedBy: senderAddress + sender: senderAddress }); adjustedAmount = amount - currentReserveImbalance; currentReserveImbalance = 0; @@ -138,7 +139,7 @@ contract NativeTokenDestination is emit CollateralAdded({ amount: amount, remaining: currentReserveImbalance, - addedBy: senderAddress + sender: senderAddress }); return; } diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index 5bf10ec70..5a49ddc1d 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -192,9 +192,7 @@ contract NativeTokenSource is * The burned total on the destination will only ever increase, but new totals may be relayed to this * chain out of order. */ - function _updatedestinationBurnedTotal( - uint256 newBurnTotal - ) private { + function _updatedestinationBurnedTotal(uint256 newBurnTotal) private { if (newBurnTotal > destinationBurnedTotal) { uint256 difference = newBurnTotal - destinationBurnedTotal; _burnTokens(difference); From 69c3fab3df9ecf47109006563cb7914c5dda5405 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 28 Nov 2023 07:52:59 -0500 Subject: [PATCH 138/183] Update contracts/src/CrossChainApplications/NativeTokenBridge/README.md Co-authored-by: Michael Kaplan <55204436+michaelkaplan13@users.noreply.github.com> Signed-off-by: Geoff Stuart --- .../src/CrossChainApplications/NativeTokenBridge/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/README.md b/contracts/src/CrossChainApplications/NativeTokenBridge/README.md index 38baf3041..8db6816d7 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/README.md +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/README.md @@ -1,6 +1,6 @@ # Native-to-Native Token Bridge -A pair of smart contracts built on top of Teleporter to support using an ERC20 token or the native token of any `subnet-evm` chain as the native token for a given subnet. +Smart contracts built on top of Teleporter to support using an ERC20 token or the native token of any EVM-based subnet as the native token for another subnet. ## Design The native-to-native bridge is implemented using two primary contracts. From 5e0c5411803debf5f770cd0180fb21e6c61c0d9c Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 28 Nov 2023 07:53:36 -0500 Subject: [PATCH 139/183] Update contracts/src/CrossChainApplications/NativeTokenBridge/README.md Co-authored-by: Michael Kaplan <55204436+michaelkaplan13@users.noreply.github.com> Signed-off-by: Geoff Stuart --- .../src/CrossChainApplications/NativeTokenBridge/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/README.md b/contracts/src/CrossChainApplications/NativeTokenBridge/README.md index 8db6816d7..e6a38b679 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/README.md +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/README.md @@ -7,7 +7,7 @@ The native-to-native bridge is implemented using two primary contracts. ### `NativeTokenSource` - Lives on the Source chain. Pairs with exactly one `NativeTokenDestination` contract on a different chain. - Locks and unlocks native tokens on the Source chain corresponding to mints and burns on the destination chain. - - `transferToDestination`: transfers all tokens paid to this function call to `recipient` on the destination chain by locking them and instructing the destination chain to mint. Optionally takes the address of an ERC20 contract `feeContractAddress` as well as an amount `feeAmount` that will be used as the relayer-incentivisation for the teleporter cross-chain call. Also allows for the caller to specify `allowedRelayerAddresses`. + - `transferToDestination`: transfers all tokens paid to this function call to `recipient` on the destination chain by locking them and instructing the destination chain to mint. Optionally takes the address of an ERC20 contract `feeContractAddress` as well as an amount `feeAmount` that will be used as the relayer-incentivization for the teleporter cross-chain call. Also allows for the caller to specify `allowedRelayerAddresses`. - `receiveTeleporterMessage`: unlocks tokens on the source chain when instructed to by the `NativeTokenDestination` contract. ### `NativeTokenDestination` - Lives on the Destination chain. Pairs with exactly one `NativeTokenSource` contract on a different chain. From cd9a06f16a59d68f403e9c0bbd5c07ba9cd79e2c Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 28 Nov 2023 07:54:46 -0500 Subject: [PATCH 140/183] Update contracts/src/CrossChainApplications/NativeTokenBridge/README.md Co-authored-by: Michael Kaplan <55204436+michaelkaplan13@users.noreply.github.com> Signed-off-by: Geoff Stuart --- .../src/CrossChainApplications/NativeTokenBridge/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/README.md b/contracts/src/CrossChainApplications/NativeTokenBridge/README.md index e6a38b679..9681fc1eb 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/README.md +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/README.md @@ -5,7 +5,7 @@ Smart contracts built on top of Teleporter to support using an ERC20 token or th ## Design The native-to-native bridge is implemented using two primary contracts. ### `NativeTokenSource` - - Lives on the Source chain. Pairs with exactly one `NativeTokenDestination` contract on a different chain. + - Lives on the source chain. Pairs with exactly one `NativeTokenDestination` contract on the destination chain. - Locks and unlocks native tokens on the Source chain corresponding to mints and burns on the destination chain. - `transferToDestination`: transfers all tokens paid to this function call to `recipient` on the destination chain by locking them and instructing the destination chain to mint. Optionally takes the address of an ERC20 contract `feeContractAddress` as well as an amount `feeAmount` that will be used as the relayer-incentivization for the teleporter cross-chain call. Also allows for the caller to specify `allowedRelayerAddresses`. - `receiveTeleporterMessage`: unlocks tokens on the source chain when instructed to by the `NativeTokenDestination` contract. From 41e90f5dd8aeed9dd795d2f32b599c1d2091ab91 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 28 Nov 2023 07:55:01 -0500 Subject: [PATCH 141/183] Update contracts/src/CrossChainApplications/NativeTokenBridge/README.md Co-authored-by: Michael Kaplan <55204436+michaelkaplan13@users.noreply.github.com> Signed-off-by: Geoff Stuart --- .../src/CrossChainApplications/NativeTokenBridge/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/README.md b/contracts/src/CrossChainApplications/NativeTokenBridge/README.md index 9681fc1eb..4671e3fd3 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/README.md +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/README.md @@ -10,7 +10,7 @@ The native-to-native bridge is implemented using two primary contracts. - `transferToDestination`: transfers all tokens paid to this function call to `recipient` on the destination chain by locking them and instructing the destination chain to mint. Optionally takes the address of an ERC20 contract `feeContractAddress` as well as an amount `feeAmount` that will be used as the relayer-incentivization for the teleporter cross-chain call. Also allows for the caller to specify `allowedRelayerAddresses`. - `receiveTeleporterMessage`: unlocks tokens on the source chain when instructed to by the `NativeTokenDestination` contract. ### `NativeTokenDestination` - - Lives on the Destination chain. Pairs with exactly one `NativeTokenSource` contract on a different chain. + - Lives on the destination chain. Pairs with exactly one `NativeTokenSource` contract on the source chain. - Mints and burns native tokens on the Destination chain corresponding to locks and unlocks on the source chain. - `transferToSource`: transfers all tokens paid to this function call to `recipient` on the source chain by burning the tokens and instructing the source chain to unlock. Optionally takes the address of an ERC20 contract `feeContractAddress` as well as an amount `feeAmount` that will be used as the relayer-incentivisation for the teleporter cross-chain call. Also allows for the caller to specify `allowedRelayerAddresses`. - `receiveTeleporterMessage`: mints tokens on the destination chain when instructed to by the `NativeTokenDestination` contract. From f0d58574ecf60c531f1d67986e6431c2ba6d62e0 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 28 Nov 2023 07:55:18 -0500 Subject: [PATCH 142/183] Update contracts/src/CrossChainApplications/NativeTokenBridge/README.md Co-authored-by: Michael Kaplan <55204436+michaelkaplan13@users.noreply.github.com> Signed-off-by: Geoff Stuart --- .../src/CrossChainApplications/NativeTokenBridge/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/README.md b/contracts/src/CrossChainApplications/NativeTokenBridge/README.md index 4671e3fd3..2ff02a012 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/README.md +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/README.md @@ -18,7 +18,7 @@ The native-to-native bridge is implemented using two primary contracts. - `totalSupply`: Returns the best estimate of available native tokens on this chain. Equal to the `initialReserveImbalance` + `all tokens minted` - `all tokens in known burn address`. Known burn addresses include the burn address for this contract used when burning/unlocking, and the address for burned transaction fees. ### `Collateralizing the bridge` - - On initialization, the bridge will be undercollateralized by exactly the number of tokens minted in the genesis block on the destination chain. These tokens could theoretically be sent through the bridge, with no corresponding tokens able to be unlocked on the source chain. In order to avoid this problem, the `NativeTokenDestination` contract is initialized with the value for `initialReserveImbalance`, which should correspond to the number of tokens allocated in the genesis block for the destination chain. If `initialReserveImbalance` is not properly set, behaviour of this contract is undefined. The `NativeTokenDestination` contract will not mint tokens until it has received confirmation that at least `initialReserveImbalance` tokens have been locked on the source chain. It should be up to the contract deployer to ensure that the bridge is properly collateralized. Burning/unlocking is disabled until the bridge is properly collateralized. +On initialization, the bridge will be undercollateralized by exactly the number of tokens minted in the genesis block on the destination chain. These tokens could theoretically be sent through the bridge, with no corresponding tokens able to be unlocked on the source chain. In order to avoid this problem, the `NativeTokenDestination` contract is initialized with the value for `initialReserveImbalance`, which should correspond to the number of tokens allocated in the genesis block of the destination chain. If `initialReserveImbalance` is not properly set, behavior of this contract is undefined. The `NativeTokenDestination` contract will not mint tokens until it at least `initialReserveImbalance` tokens have been locked on the source chain. It is left to the contract deployer to ensure that the bridge is properly collateralized. Burning/unlocking is disabled until the bridge is properly collateralized. ### `Burning tokens spent as fees` - As tokens are burned for transaction fees on the destination chain, contract owners may want to relay this information to the source chain in order to burn an equivalent number of locked tokens there because these tokens will never be bridged back. From 22692872c23b88239579802c725841d06313ec3e Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 28 Nov 2023 10:03:56 -0500 Subject: [PATCH 143/183] typo --- .../NativeTokenBridge/ERC20TokenSource.sol | 4 ++-- .../NativeTokenBridge/NativeTokenSource.sol | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol index 81055f329..e776b052b 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol @@ -115,7 +115,7 @@ contract ERC20TokenSource is _unlockTokens(recipient, amount); } else if (action == SourceAction.Burn) { uint256 newBurnTotal = abi.decode(actionData, (uint256)); - _updatedestinationBurnedTotal(newBurnTotal); + _updateDestinationBurnedTotal(newBurnTotal); } else { revert("ERC20TokenSource: invalid action"); } @@ -214,7 +214,7 @@ contract ERC20TokenSource is /** * @dev Update destinationBurnedTotal sent from destination chain */ - function _updatedestinationBurnedTotal(uint256 newBurnTotal) private { + function _updateDestinationBurnedTotal(uint256 newBurnTotal) private { if (newBurnTotal > destinationBurnedTotal) { uint256 difference = newBurnTotal - destinationBurnedTotal; _burnTokens(difference); diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index 5a49ddc1d..21e066f43 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -108,7 +108,7 @@ contract NativeTokenSource is _unlockTokens(recipient, amount); } else if (action == SourceAction.Burn) { uint256 newBurnTotal = abi.decode(actionData, (uint256)); - _updatedestinationBurnedTotal(newBurnTotal); + _updateDestinationBurnedTotal(newBurnTotal); } else { revert("NativeTokenSource: invalid action"); } @@ -192,7 +192,7 @@ contract NativeTokenSource is * The burned total on the destination will only ever increase, but new totals may be relayed to this * chain out of order. */ - function _updatedestinationBurnedTotal(uint256 newBurnTotal) private { + function _updateDestinationBurnedTotal(uint256 newBurnTotal) private { if (newBurnTotal > destinationBurnedTotal) { uint256 difference = newBurnTotal - destinationBurnedTotal; _burnTokens(difference); From a1f538a797090fb07955037e477f26cfa19f4471 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 28 Nov 2023 10:08:14 -0500 Subject: [PATCH 144/183] Rename BLACKHOLE_ADDRESS to eliminate ambiguity --- .../NativeTokenBridge/ERC20TokenSource.sol | 2 +- .../NativeTokenBridge/NativeTokenDestination.sol | 15 +++++++-------- .../NativeTokenBridge/NativeTokenSource.sol | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol index e776b052b..0f0f9636f 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol @@ -200,7 +200,7 @@ contract ERC20TokenSource is } /** - * @dev Sends tokens to BLACKHOLE_ADDRESS. + * @dev Sends tokens to BURN_FOR_TRANSFER_ADDRESS. */ function _burnTokens(uint256 amount) private { SafeERC20.safeTransfer( diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index 92eb2b25d..696f47c8d 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -26,11 +26,10 @@ contract NativeTokenDestination is { // The address where the burned transaction fees are credited. address public constant BURNED_TX_FEES_ADDRESS = 0x0100000000000000000000000000000000000000; - // Designated Blackhole Address. Tokens are sent here to be "burned" before sending an unlock - // message to the source chain. Different from the burned tx fee address so they can be - // tracked separately. - // Defined at https://github.com/ava-labs/subnet-evm/blob/e23ab058d039ff9c8469c89b139d21d52c4bd283/constants/constants.go - address public constant BLACKHOLE_ADDRESS = 0x0100000000000000000000000000000000000001; + // Designated Blackhole Address for this contract. Tokens are sent here to be "burned" before + // sending an unlock message to the source chain. Different from the burned tx fee address so + // they can be tracked separately. + address public constant BURN_FOR_TRANSFER_ADDRESS = 0x0100000000000000000000000000000000000001; INativeMinter private immutable _nativeMinter = INativeMinter(0x0200000000000000000000000000000000000001); @@ -186,8 +185,8 @@ contract NativeTokenDestination is ); } - // Burn native token by sending to BLACKHOLE_ADDRESS - payable(BLACKHOLE_ADDRESS).transfer(msg.value); + // Burn native token by sending to BURN_FOR_TRANSFER_ADDRESS + payable(BURN_FOR_TRANSFER_ADDRESS).transfer(msg.value); uint256 messageID = teleporterMessenger.sendCrossChainMessage( TeleporterMessageInput({ @@ -251,7 +250,7 @@ contract NativeTokenDestination is */ function totalSupply() external view returns (uint256) { uint256 burned = address(BURNED_TX_FEES_ADDRESS).balance + - address(BLACKHOLE_ADDRESS).balance; + address(BURN_FOR_TRANSFER_ADDRESS).balance; // This scenario should never happen, but this check will prevent an underflow // where the contract would return a garbage value. diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index 21e066f43..073fe98d4 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -179,7 +179,7 @@ contract NativeTokenSource is } /** - * @dev Sends tokens to BLACKHOLE_ADDRESS. + * @dev Sends tokens to BURN_FOR_TRANSFER_ADDRESS. */ function _burnTokens(uint256 amount) private { payable(BURNED_TX_FEES_ADDRESS).transfer(amount); From 1276b2732c1181cbba27344ef545bcab98f1aab2 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 28 Nov 2023 10:10:06 -0500 Subject: [PATCH 145/183] Leave link for blackhole address --- .../NativeTokenBridge/ERC20TokenSource.sol | 2 ++ .../NativeTokenBridge/NativeTokenDestination.sol | 4 +++- .../NativeTokenBridge/NativeTokenSource.sol | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol index 0f0f9636f..b4178be6e 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol @@ -22,6 +22,8 @@ contract ERC20TokenSource is ReentrancyGuard { // The address where the burned transaction fees are credited. + gs// Defined as BLACKHOLE_ADDRESS at + // https://github.com/ava-labs/subnet-evm/blob/e23ab058d039ff9c8469c89b139d21d52c4bd283/constants/constants.go address public constant BURNED_TX_FEES_ADDRESS = 0x0100000000000000000000000000000000000000; uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 100_000; diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index 696f47c8d..835ce4a2f 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -24,7 +24,9 @@ contract NativeTokenDestination is INativeTokenDestination, ReentrancyGuard { - // The address where the burned transaction fees are credited. + // The address where the burned transaction fees are credited. + // Defined as BLACKHOLE_ADDRESS at + // https://github.com/ava-labs/subnet-evm/blob/e23ab058d039ff9c8469c89b139d21d52c4bd283/constants/constants.go address public constant BURNED_TX_FEES_ADDRESS = 0x0100000000000000000000000000000000000000; // Designated Blackhole Address for this contract. Tokens are sent here to be "burned" before // sending an unlock message to the source chain. Different from the burned tx fee address so diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index 073fe98d4..4d6d4abd9 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -23,6 +23,8 @@ contract NativeTokenSource is ReentrancyGuard { // The address where the burned transaction fees are credited. + // Defined as BLACKHOLE_ADDRESS at + // https://github.com/ava-labs/subnet-evm/blob/e23ab058d039ff9c8469c89b139d21d52c4bd283/constants/constants.go address public constant BURNED_TX_FEES_ADDRESS = 0x0100000000000000000000000000000000000000; uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 100_000; From fc1f418eb194c07bc3674a7332f22a5936d890bc Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 28 Nov 2023 10:11:04 -0500 Subject: [PATCH 146/183] Regenerate abi --- .../NativeTokenDestination.go | 50 +++++++++---------- .../NativeTokenBridge/ERC20TokenSource.sol | 2 +- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go index cda53c6db..e55bf92b6 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go @@ -37,7 +37,7 @@ type TeleporterFeeInfo struct { // NativeTokenDestinationMetaData contains all meta data concerning the NativeTokenDestination contract. var NativeTokenDestinationMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialReserveImbalance_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"burnAddressBalance\",\"type\":\"uint256\"}],\"name\":\"ReportTotalBurnedTxFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BLACKHOLE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REPORT_BURNED_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"reportTotalBurnedTxFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalMinted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialReserveImbalance_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"burnAddressBalance\",\"type\":\"uint256\"}],\"name\":\"ReportTotalBurnedTxFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"BURN_FOR_TRANSFER_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REPORT_BURNED_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"reportTotalBurnedTxFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalMinted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", } // NativeTokenDestinationABI is the input ABI used to generate the binding from. @@ -186,12 +186,12 @@ func (_NativeTokenDestination *NativeTokenDestinationTransactorRaw) Transact(opt return _NativeTokenDestination.Contract.contract.Transact(opts, method, params...) } -// BLACKHOLEADDRESS is a free data retrieval call binding the contract method 0xd3681114. +// BURNEDTXFEESADDRESS is a free data retrieval call binding the contract method 0xc452165e. // -// Solidity: function BLACKHOLE_ADDRESS() view returns(address) -func (_NativeTokenDestination *NativeTokenDestinationCaller) BLACKHOLEADDRESS(opts *bind.CallOpts) (common.Address, error) { +// Solidity: function BURNED_TX_FEES_ADDRESS() view returns(address) +func (_NativeTokenDestination *NativeTokenDestinationCaller) BURNEDTXFEESADDRESS(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _NativeTokenDestination.contract.Call(opts, &out, "BLACKHOLE_ADDRESS") + err := _NativeTokenDestination.contract.Call(opts, &out, "BURNED_TX_FEES_ADDRESS") if err != nil { return *new(common.Address), err @@ -203,26 +203,26 @@ func (_NativeTokenDestination *NativeTokenDestinationCaller) BLACKHOLEADDRESS(op } -// BLACKHOLEADDRESS is a free data retrieval call binding the contract method 0xd3681114. +// BURNEDTXFEESADDRESS is a free data retrieval call binding the contract method 0xc452165e. // -// Solidity: function BLACKHOLE_ADDRESS() view returns(address) -func (_NativeTokenDestination *NativeTokenDestinationSession) BLACKHOLEADDRESS() (common.Address, error) { - return _NativeTokenDestination.Contract.BLACKHOLEADDRESS(&_NativeTokenDestination.CallOpts) +// Solidity: function BURNED_TX_FEES_ADDRESS() view returns(address) +func (_NativeTokenDestination *NativeTokenDestinationSession) BURNEDTXFEESADDRESS() (common.Address, error) { + return _NativeTokenDestination.Contract.BURNEDTXFEESADDRESS(&_NativeTokenDestination.CallOpts) } -// BLACKHOLEADDRESS is a free data retrieval call binding the contract method 0xd3681114. +// BURNEDTXFEESADDRESS is a free data retrieval call binding the contract method 0xc452165e. // -// Solidity: function BLACKHOLE_ADDRESS() view returns(address) -func (_NativeTokenDestination *NativeTokenDestinationCallerSession) BLACKHOLEADDRESS() (common.Address, error) { - return _NativeTokenDestination.Contract.BLACKHOLEADDRESS(&_NativeTokenDestination.CallOpts) +// Solidity: function BURNED_TX_FEES_ADDRESS() view returns(address) +func (_NativeTokenDestination *NativeTokenDestinationCallerSession) BURNEDTXFEESADDRESS() (common.Address, error) { + return _NativeTokenDestination.Contract.BURNEDTXFEESADDRESS(&_NativeTokenDestination.CallOpts) } -// BURNEDTXFEESADDRESS is a free data retrieval call binding the contract method 0xc452165e. +// BURNFORTRANSFERADDRESS is a free data retrieval call binding the contract method 0xa2a95017. // -// Solidity: function BURNED_TX_FEES_ADDRESS() view returns(address) -func (_NativeTokenDestination *NativeTokenDestinationCaller) BURNEDTXFEESADDRESS(opts *bind.CallOpts) (common.Address, error) { +// Solidity: function BURN_FOR_TRANSFER_ADDRESS() view returns(address) +func (_NativeTokenDestination *NativeTokenDestinationCaller) BURNFORTRANSFERADDRESS(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _NativeTokenDestination.contract.Call(opts, &out, "BURNED_TX_FEES_ADDRESS") + err := _NativeTokenDestination.contract.Call(opts, &out, "BURN_FOR_TRANSFER_ADDRESS") if err != nil { return *new(common.Address), err @@ -234,18 +234,18 @@ func (_NativeTokenDestination *NativeTokenDestinationCaller) BURNEDTXFEESADDRESS } -// BURNEDTXFEESADDRESS is a free data retrieval call binding the contract method 0xc452165e. +// BURNFORTRANSFERADDRESS is a free data retrieval call binding the contract method 0xa2a95017. // -// Solidity: function BURNED_TX_FEES_ADDRESS() view returns(address) -func (_NativeTokenDestination *NativeTokenDestinationSession) BURNEDTXFEESADDRESS() (common.Address, error) { - return _NativeTokenDestination.Contract.BURNEDTXFEESADDRESS(&_NativeTokenDestination.CallOpts) +// Solidity: function BURN_FOR_TRANSFER_ADDRESS() view returns(address) +func (_NativeTokenDestination *NativeTokenDestinationSession) BURNFORTRANSFERADDRESS() (common.Address, error) { + return _NativeTokenDestination.Contract.BURNFORTRANSFERADDRESS(&_NativeTokenDestination.CallOpts) } -// BURNEDTXFEESADDRESS is a free data retrieval call binding the contract method 0xc452165e. +// BURNFORTRANSFERADDRESS is a free data retrieval call binding the contract method 0xa2a95017. // -// Solidity: function BURNED_TX_FEES_ADDRESS() view returns(address) -func (_NativeTokenDestination *NativeTokenDestinationCallerSession) BURNEDTXFEESADDRESS() (common.Address, error) { - return _NativeTokenDestination.Contract.BURNEDTXFEESADDRESS(&_NativeTokenDestination.CallOpts) +// Solidity: function BURN_FOR_TRANSFER_ADDRESS() view returns(address) +func (_NativeTokenDestination *NativeTokenDestinationCallerSession) BURNFORTRANSFERADDRESS() (common.Address, error) { + return _NativeTokenDestination.Contract.BURNFORTRANSFERADDRESS(&_NativeTokenDestination.CallOpts) } // REPORTBURNEDTOKENSREQUIREDGAS is a free data retrieval call binding the contract method 0xd3095126. diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol index b4178be6e..5ab3db339 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol @@ -22,7 +22,7 @@ contract ERC20TokenSource is ReentrancyGuard { // The address where the burned transaction fees are credited. - gs// Defined as BLACKHOLE_ADDRESS at + // Defined as BLACKHOLE_ADDRESS at // https://github.com/ava-labs/subnet-evm/blob/e23ab058d039ff9c8469c89b139d21d52c4bd283/constants/constants.go address public constant BURNED_TX_FEES_ADDRESS = 0x0100000000000000000000000000000000000000; From 737e890dbc7e6653ae0957d25032e999346466b6 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 28 Nov 2023 12:26:38 -0500 Subject: [PATCH 147/183] Fix test --- tests/utils/utils.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/utils/utils.go b/tests/utils/utils.go index 261b35848..ab872be84 100644 --- a/tests/utils/utils.go +++ b/tests/utils/utils.go @@ -318,7 +318,7 @@ func RelayMessage( trace := TraceTransaction(ctx, receipt.TxHash, destination) Expect(trace).Should(Equal("")) } - Expect(receiveEvent.OriginChainID[:]).Should(Equal(source.BlockchainID[:])) + Expect(receiveEvent.OriginBlockchainID[:]).Should(Equal(source.BlockchainID[:])) // Check for a successful execution of the teleporter message. _, err = GetEventFromLogs(receipt.Logs, bind.ParseMessageExecuted) From 0742eadcd1f0bcd03c6a733f42c2316502d99f55 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Wed, 29 Nov 2023 10:08:36 -0500 Subject: [PATCH 148/183] merge --- tests/e2e_test.go | 10 +- tests/erc20_to_native_token_bridge.go | 57 ++++++----- tests/native_token_bridge.go | 61 ++++++------ tests/utils/utils.go | 135 ++++---------------------- 4 files changed, 83 insertions(+), 180 deletions(-) diff --git a/tests/e2e_test.go b/tests/e2e_test.go index bbc9a4951..930b1786d 100644 --- a/tests/e2e_test.go +++ b/tests/e2e_test.go @@ -54,10 +54,12 @@ var _ = ginkgo.Describe("[Teleporter integration tests]", func() { // Cross-chain application tests ginkgo.It("Example cross chain messenger", ExampleMessengerGinkgo) ginkgo.It("ERC20 bridge multihop", ERC20BridgeMultihopGinkgo) - - ginkgo.It("Send a message from Subnet A to Subnet B", BasicOneWaySend) - ginkgo.It("Send native tokens from subnet A to B and back", NativeTokenBridge) - ginkgo.It("Send ERC20 tokens from subnet A to Native tokens on subnet B and back", ERC20ToNativeTokenBridge) + ginkgo.It("Send native tokens from subnet A to B and back", func() { + NativeTokenBridge(&network.LocalNetwork{}) + }) + ginkgo.It("Send ERC20 tokens from subnet A to Native tokens on subnet B and back", func() { + ERC20ToNativeTokenBridge(&network.LocalNetwork{}) + }) // Teleporter tests ginkgo.It("Send a message from Subnet A to Subnet B, and one from B to A", func() { diff --git a/tests/erc20_to_native_token_bridge.go b/tests/erc20_to_native_token_bridge.go index e2ea2fc66..f568c0696 100644 --- a/tests/erc20_to_native_token_bridge.go +++ b/tests/erc20_to_native_token_bridge.go @@ -12,13 +12,14 @@ import ( exampleerc20 "github.com/ava-labs/teleporter/abi-bindings/go/Mocks/ExampleERC20" "github.com/ava-labs/teleporter/tests/utils" deploymentUtils "github.com/ava-labs/teleporter/utils/deployment-utils" + "github.com/ava-labs/teleporter/tests/network" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/log" . "github.com/onsi/gomega" ) -func ERC20ToNativeTokenBridge() { +func ERC20ToNativeTokenBridge(network network.Network) { const ( // Each test file needs a unique deployer that must be funded with tokens to deploy deployerKeyStr = "ca7269c1fe2a5b86884a119aa516b8d5b641670b83aac0ebf9f2d71affcc12e4" @@ -43,9 +44,10 @@ func ERC20ToNativeTokenBridge() { } ) - subnetA := utils.GetSubnetATestInfo() - subnetB := utils.GetSubnetBTestInfo() - teleporterContractAddress := utils.GetTeleporterContractAddress() + subnets := network.GetSubnetsInfo() + subnetA := subnets[0] + subnetB := subnets[1] + teleporterContractAddress := network.GetTeleporterContractAddress() // Info we need to calculate for the test deployerPK, err := crypto.HexToECDSA(deployerKeyStr) @@ -78,16 +80,16 @@ func ERC20ToNativeTokenBridge() { log.Info("Finished deploying contracts") // Create abi objects to call the contract with - nativeTokenDestination, err := nativetokendestination.NewNativeTokenDestination(bridgeContractAddress, subnetB.WSClient) + nativeTokenDestination, err := nativetokendestination.NewNativeTokenDestination(bridgeContractAddress, subnetB.ChainWSClient) Expect(err).Should(BeNil()) - erc20TokenSource, err := erc20tokensource.NewERC20TokenSource(bridgeContractAddress, subnetA.WSClient) + erc20TokenSource, err := erc20tokensource.NewERC20TokenSource(bridgeContractAddress, subnetA.ChainWSClient) Expect(err).Should(BeNil()) - exampleERC20, err := exampleerc20.NewExampleERC20(exampleERC20ContractAddress, subnetA.WSClient) + exampleERC20, err := exampleerc20.NewExampleERC20(exampleERC20ContractAddress, subnetA.ChainWSClient) Expect(err).Should(BeNil()) // Helper function sendTokensToSource := func(valueToSend *big.Int, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { - transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, subnetB.ChainID) + transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, subnetB.ChainIDInt) Expect(err).Should(BeNil()) transactor.Value = valueToSend @@ -95,35 +97,33 @@ func ERC20ToNativeTokenBridge() { Expect(err).Should(BeNil()) log.Info("Sent TransferToSource transaction on destination chain", "sourceChainID", subnetA.BlockchainID, "txHash", tx.Hash().Hex()) - sourceChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetB.WSClient) + sourceChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetB) transferEvent, err := utils.GetEventFromLogs(sourceChainReceipt.Logs, nativeTokenDestination.ParseTransferToSource) Expect(err).Should(BeNil()) utils.ExpectBigEqual(transferEvent.Amount, valueToSend) - receipt, err := utils.RelayMessage(ctx, sourceChainReceipt.BlockHash, sourceChainReceipt.BlockNumber, subnetB, subnetA) - Expect(err).Should(BeNil()) + receipt := network.RelayMessage(ctx, sourceChainReceipt, subnetB, subnetA, true) return receipt } // Helper function sendTokensToDestination := func(valueToSend *big.Int, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { - transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, subnetA.ChainID) + transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, subnetA.ChainIDInt) Expect(err).Should(BeNil()) tx, err := erc20TokenSource.TransferToDestination(transactor, toAddress, valueToSend, big.NewInt(0), []common.Address{}) Expect(err).Should(BeNil()) log.Info("Sent TransferToDestination transaction on source chain", "destinationChainID", subnetB.BlockchainID, "txHash", tx.Hash().Hex()) - sourceChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetA.WSClient) + sourceChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetA) transferEvent, err := utils.GetEventFromLogs(sourceChainReceipt.Logs, erc20TokenSource.ParseTransferToDestination) Expect(err).Should(BeNil()) utils.ExpectBigEqual(transferEvent.TransferAmount, valueToSend) - receipt, err := utils.RelayMessage(ctx, sourceChainReceipt.BlockHash, sourceChainReceipt.BlockNumber, subnetA, subnetB) - Expect(err).Should(BeNil()) + receipt := network.RelayMessage(ctx, sourceChainReceipt, subnetA, subnetB, true) return receipt } @@ -132,18 +132,18 @@ func ERC20ToNativeTokenBridge() { bal, err := exampleERC20.BalanceOf(nil, deployerAddress) Expect(err).Should(BeNil()) - transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetA.ChainID) + transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetA.ChainIDInt) Expect(err).Should(BeNil()) tx, err := exampleERC20.Approve(transactor, bridgeContractAddress, bal) Expect(err).Should(BeNil()) - utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetA.WSClient) + utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetA) } { // Transfer some tokens A -> B // Check starting balance is 0 - utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.ChainWSClient) checkReserveImbalance(initialReserveImbalance, nativeTokenDestination) @@ -159,14 +159,14 @@ func ERC20ToNativeTokenBridge() { checkReserveImbalance(intermediateReserveImbalance, nativeTokenDestination) // Check intermediate balance, no tokens should be minted because we haven't collateralized - utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.ChainWSClient) } { // Fail to Transfer tokens B -> A because bridge is not collateralized // Check starting balance is 0 - utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.ChainWSClient) - transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetB.ChainID) + transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetB.ChainIDInt) Expect(err).Should(BeNil()) transactor.Value = valueToSend @@ -176,12 +176,12 @@ func ERC20ToNativeTokenBridge() { checkReserveImbalance(intermediateReserveImbalance, nativeTokenDestination) // Check we failed to send because we're not collateralized - utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.ChainWSClient) } { // Transfer more tokens A -> B to collateralize the bridge // Check starting balance is 0 - utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.ChainWSClient) checkReserveImbalance(intermediateReserveImbalance, nativeTokenDestination) @@ -198,7 +198,7 @@ func ERC20ToNativeTokenBridge() { checkReserveImbalance(common.Big0, nativeTokenDestination) // We should have minted the excess coins after checking the collateral - utils.CheckBalance(ctx, tokenReceiverAddress, valueToSend, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, valueToSend, subnetB.ChainWSClient) } { // Transfer tokens B -> A @@ -212,16 +212,16 @@ func ERC20ToNativeTokenBridge() { } { // Check reporting of burned tx fees to Source Chain - burnedTxFeesBalanceDest, err := subnetB.WSClient.BalanceAt(ctx, burnedTxFeeAddress, nil) + burnedTxFeesBalanceDest, err := subnetB.ChainWSClient.BalanceAt(ctx, burnedTxFeeAddress, nil) Expect(err).Should(BeNil()) Expect(burnedTxFeesBalanceDest.Cmp(common.Big0) > 0).Should(BeTrue()) - transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetB.ChainID) + transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetB.ChainIDInt) Expect(err).Should(BeNil()) tx, err := nativeTokenDestination.ReportTotalBurnedTxFees(transactor, emptyDestFeeInfo, []common.Address{}) Expect(err).Should(BeNil()) - destChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetB.WSClient) + destChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetB) reportEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseReportTotalBurnedTxFees) Expect(err).Should(BeNil()) @@ -231,8 +231,7 @@ func ERC20ToNativeTokenBridge() { Expect(err).Should(BeNil()) utils.ExpectBigEqual(burnedTxFeesBalanceSource, common.Big0) - sourceChainReceipt, err := utils.RelayMessage(ctx, destChainReceipt.BlockHash, destChainReceipt.BlockNumber, subnetB, subnetA) - Expect(err).Should(BeNil()) + sourceChainReceipt := network.RelayMessage(ctx, destChainReceipt, subnetB, subnetA, true) burnEvent, err := utils.GetEventFromLogs(sourceChainReceipt.Logs, erc20TokenSource.ParseBurnTokens) Expect(err).Should(BeNil()) diff --git a/tests/native_token_bridge.go b/tests/native_token_bridge.go index 3485c9ece..2093ae844 100644 --- a/tests/native_token_bridge.go +++ b/tests/native_token_bridge.go @@ -11,13 +11,14 @@ import ( nativetokensource "github.com/ava-labs/teleporter/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource" "github.com/ava-labs/teleporter/tests/utils" deploymentUtils "github.com/ava-labs/teleporter/utils/deployment-utils" + "github.com/ava-labs/teleporter/tests/network" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/log" . "github.com/onsi/gomega" ) -func NativeTokenBridge() { +func NativeTokenBridge(network network.Network) { const ( // Each test file needs a unique deployer that must be funded with tokens to deploy @@ -44,9 +45,10 @@ func NativeTokenBridge() { } ) - subnetA := utils.GetSubnetATestInfo() - subnetB := utils.GetSubnetBTestInfo() - teleporterContractAddress := utils.GetTeleporterContractAddress() + subnets := network.GetSubnetsInfo() + subnetA := subnets[0] + subnetB := subnets[1] + teleporterContractAddress := network.GetTeleporterContractAddress() // Info we need to calculate for the test deployerPK, err := crypto.HexToECDSA(deployerKeyStr) @@ -74,58 +76,56 @@ func NativeTokenBridge() { } // Create abi objects to call the contract with - nativeTokenDestination, err := nativetokendestination.NewNativeTokenDestination(bridgeContractAddress, subnetB.WSClient) + nativeTokenDestination, err := nativetokendestination.NewNativeTokenDestination(bridgeContractAddress, subnetB.ChainWSClient) Expect(err).Should(BeNil()) - nativeTokenSource, err := nativetokensource.NewNativeTokenSource(bridgeContractAddress, subnetA.WSClient) + nativeTokenSource, err := nativetokensource.NewNativeTokenSource(bridgeContractAddress, subnetA.ChainWSClient) Expect(err).Should(BeNil()) // Helper function sendTokensToSource := func(valueToSend *big.Int, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { - transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, subnetB.ChainID) + transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, subnetB.ChainIDInt) Expect(err).Should(BeNil()) transactor.Value = valueToSend tx, err := nativeTokenDestination.TransferToSource(transactor, toAddress, emptyDestFeeInfo, []common.Address{}) Expect(err).Should(BeNil()) - log.Info("Sent TransferToSource transaction on destination chain", "sourceChainID", subnetA.BlockchainID, "txHash", tx.Hash().Hex()) + log.Info("Sent TransferToSource transaction on destination chain", "sourceBlockchainID", subnetA.BlockchainID, "txHash", tx.Hash().Hex()) - destChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetB.WSClient) + destChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetB) transferEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseTransferToSource) Expect(err).Should(BeNil()) utils.ExpectBigEqual(transferEvent.Amount, valueToSend) - receipt, err := utils.RelayMessage(ctx, destChainReceipt.BlockHash, destChainReceipt.BlockNumber, subnetB, subnetA) - Expect(err).Should(BeNil()) + receipt := network.RelayMessage(ctx, destChainReceipt, subnetB, subnetA, true) return receipt } // Helper function sendTokensToDestination := func(valueToSend *big.Int, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { - transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, subnetA.ChainID) + transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, subnetA.ChainIDInt) Expect(err).Should(BeNil()) transactor.Value = valueToSend tx, err := nativeTokenSource.TransferToDestination(transactor, toAddress, emptySourceFeeInfo, []common.Address{}) Expect(err).Should(BeNil()) - log.Info("Sent TransferToDestination transaction on source chain", "destinationChainID", subnetB.BlockchainID, "txHash", tx.Hash().Hex()) + log.Info("Sent TransferToDestination transaction on source chain", "destinationBlockchainID", subnetB.BlockchainID, "txHash", tx.Hash().Hex()) - sourceChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetA.WSClient) + sourceChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetA) transferEvent, err := utils.GetEventFromLogs(sourceChainReceipt.Logs, nativeTokenSource.ParseTransferToDestination) Expect(err).Should(BeNil()) utils.ExpectBigEqual(transferEvent.Amount, valueToSend) - receipt, err := utils.RelayMessage(ctx, sourceChainReceipt.BlockHash, sourceChainReceipt.BlockNumber, subnetA, subnetB) - Expect(err).Should(BeNil()) + receipt:= network.RelayMessage(ctx, sourceChainReceipt, subnetA, subnetB, true) return receipt } { // Transfer some tokens A -> B // Check starting balance is 0 - utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.ChainWSClient) checkReserveImbalance(initialReserveImbalance, nativeTokenDestination) @@ -138,14 +138,14 @@ func NativeTokenBridge() { Expect(err).ShouldNot(BeNil()) // Check intermediate balance, no tokens should be minted because we haven't collateralized - utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.ChainWSClient) } { // Fail to Transfer tokens B -> A because bridge is not collateralized // Check starting balance is 0 - utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetA.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetA.ChainWSClient) - transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetB.ChainID) + transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetB.ChainIDInt) Expect(err).Should(BeNil()) transactor.Value = valueToSend @@ -154,12 +154,12 @@ func NativeTokenBridge() { Expect(err).ShouldNot(BeNil()) // Check we should fail to send because we're not collateralized - utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetA.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetA.ChainWSClient) } { // Transfer more tokens A -> B to collateralize the bridge // Check starting balance is 0 - utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.ChainWSClient) checkReserveImbalance(big.NewInt(0).Sub(initialReserveImbalance, valueToSend), nativeTokenDestination) destChainReceipt := sendTokensToDestination(initialReserveImbalance, deployerPK, tokenReceiverAddress) @@ -169,7 +169,7 @@ func NativeTokenBridge() { checkReserveImbalance(common.Big0, nativeTokenDestination) // We should have minted the excess coins after checking the collateral - utils.CheckBalance(ctx, tokenReceiverAddress, valueToSend, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, valueToSend, subnetB.ChainWSClient) } { // Transfer tokens B -> A @@ -177,37 +177,36 @@ func NativeTokenBridge() { checkUnlockNativeEvent(sourceChainReceipt.Logs, nativeTokenSource, tokenReceiverAddress, valueToReturn) - utils.CheckBalance(ctx, tokenReceiverAddress, valueToReturn, subnetA.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, valueToReturn, subnetA.ChainWSClient) } { // Check reporting of burned tx fees to Source Chain - burnedTxFeesBalanceDest, err := subnetB.WSClient.BalanceAt(ctx, burnedTxFeeAddress, nil) + burnedTxFeesBalanceDest, err := subnetB.ChainWSClient.BalanceAt(ctx, burnedTxFeeAddress, nil) Expect(err).Should(BeNil()) Expect(burnedTxFeesBalanceDest.Cmp(common.Big0) > 0).Should(BeTrue()) - transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetB.ChainID) + transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetB.ChainIDInt) Expect(err).Should(BeNil()) tx, err := nativeTokenDestination.ReportTotalBurnedTxFees(transactor, emptyDestFeeInfo, []common.Address{}) Expect(err).Should(BeNil()) - destChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetB.WSClient) + destChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetB) reportEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseReportTotalBurnedTxFees) Expect(err).Should(BeNil()) utils.ExpectBigEqual(reportEvent.BurnAddressBalance, burnedTxFeesBalanceDest) - burnedTxFeesBalanceSource, err := subnetA.WSClient.BalanceAt(ctx, burnedTxFeeAddress, nil) + burnedTxFeesBalanceSource, err := subnetA.ChainWSClient.BalanceAt(ctx, burnedTxFeeAddress, nil) Expect(err).Should(BeNil()) Expect(burnedTxFeesBalanceSource.Cmp(common.Big0) > 0).Should(BeTrue()) - sourceChainReceipt, err := utils.RelayMessage(ctx, destChainReceipt.BlockHash, destChainReceipt.BlockNumber, subnetB, subnetA) - Expect(err).Should(BeNil()) + sourceChainReceipt := network.RelayMessage(ctx, destChainReceipt, subnetB, subnetA, true) burnEvent, err := utils.GetEventFromLogs(sourceChainReceipt.Logs, nativeTokenSource.ParseBurnTokens) Expect(err).Should(BeNil()) utils.ExpectBigEqual(burnedTxFeesBalanceDest, burnEvent.Amount) - burnedTxFeesBalanceSource2, err := subnetA.WSClient.BalanceAt(ctx, burnedTxFeeAddress, nil) + burnedTxFeesBalanceSource2, err := subnetA.ChainWSClient.BalanceAt(ctx, burnedTxFeeAddress, nil) Expect(err).Should(BeNil()) Expect(burnedTxFeesBalanceSource2.Cmp(big.NewInt(0).Add(burnedTxFeesBalanceSource, burnEvent.Amount)) >= 0).Should(BeTrue()) } diff --git a/tests/utils/utils.go b/tests/utils/utils.go index 4523b0ae0..265e27f4c 100644 --- a/tests/utils/utils.go +++ b/tests/utils/utils.go @@ -13,12 +13,14 @@ import ( "strings" "time" + deploymentUtils "github.com/ava-labs/teleporter/utils/deployment-utils" + exampleerc20 "github.com/ava-labs/teleporter/abi-bindings/go/Mocks/ExampleERC20" + teleportermessenger "github.com/ava-labs/teleporter/abi-bindings/go/Teleporter/TeleporterMessenger" + gasUtils "github.com/ava-labs/teleporter/utils/gas-utils" + "github.com/ava-labs/avalanchego/ids" avalancheWarp "github.com/ava-labs/avalanchego/vms/platformvm/warp" "github.com/ava-labs/subnet-evm/accounts/abi" - warpBackend "github.com/ava-labs/subnet-evm/warp" - deploymentUtils "github.com/ava-labs/teleporter/utils/deployment-utils" - "github.com/ava-labs/subnet-evm/accounts/abi/bind" "github.com/ava-labs/subnet-evm/core/types" "github.com/ava-labs/subnet-evm/eth/tracers" @@ -27,9 +29,6 @@ import ( predicateutils "github.com/ava-labs/subnet-evm/predicate" "github.com/ava-labs/subnet-evm/rpc" "github.com/ava-labs/subnet-evm/x/warp" - exampleerc20 "github.com/ava-labs/teleporter/abi-bindings/go/Mocks/ExampleERC20" - teleportermessenger "github.com/ava-labs/teleporter/abi-bindings/go/Teleporter/TeleporterMessenger" - gasUtils "github.com/ava-labs/teleporter/utils/gas-utils" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/log" @@ -292,7 +291,7 @@ func CreateSendCrossChainMessageTransaction( data, err := teleportermessenger.PackSendCrossChainMessage(input) Expect(err).Should(BeNil()) - gasFeeCap, gasTipCap, nonce := calculateTxParams(ctx, source.ChainWSClient, PrivateKeyToAddress(relayerKey)) + gasFeeCap, gasTipCap, nonce := CalculateTxParams(ctx, source, PrivateKeyToAddress(relayerKey)) // Send a transaction to the Teleporter contract tx := types.NewTx(&types.DynamicFeeTx{ @@ -367,7 +366,7 @@ func CreateReceiveCrossChainMessageTransaction( callData, err := teleportermessenger.PackReceiveCrossChainMessage(0, PrivateKeyToAddress(relayerKey)) Expect(err).Should(BeNil()) - gasFeeCap, gasTipCap, nonce := calculateTxParams(ctx, subnetInfo.ChainWSClient, PrivateKeyToAddress(relayerKey)) + gasFeeCap, gasTipCap, nonce := CalculateTxParams(ctx, subnetInfo, PrivateKeyToAddress(relayerKey)) destinationTx := predicateutils.NewPredicateTx( subnetInfo.ChainIDInt, @@ -383,7 +382,7 @@ func CreateReceiveCrossChainMessageTransaction( signedMessage.Bytes(), ) - return SignTransaction(destinationTx, fundedKey, subnetInfo.ChainIDInt) + return SignTransaction(destinationTx, relayerKey, subnetInfo.ChainIDInt) } func CreateNativeTransferTransaction( @@ -409,42 +408,26 @@ func CreateNativeTransferTransaction( return SignTransaction(tx, fromKey, subnetInfo.ChainIDInt) } -func WaitForTransaction(ctx context.Context, txHash common.Hash, subnetInfo SubnetTestInfo) *types.Receipt { - cctx, cancel := context.WithTimeout(ctx, 10*time.Second) - defer cancel() - - // Loop until we find the transaction or time out - for { - receipt, err := subnetInfo.ChainRPCClient.TransactionReceipt(cctx, txHash) - if err == nil { - return receipt - } else { - log.Info("Waiting for transaction", "hash", txHash.Hex()) - time.Sleep(200 * time.Millisecond) - } - } -} - -func SendAndWaitForTransaction(ctx context.Context, tx *types.Transaction, client ethclient.Client) *types.Receipt { - err := client.SendTransaction(ctx, tx) +func SendAndWaitForTransaction(ctx context.Context, tx *types.Transaction, subnetInfo SubnetTestInfo) *types.Receipt { + err := subnetInfo.ChainWSClient.SendTransaction(ctx, tx) Expect(err).Should(BeNil()) - return WaitForTransaction(ctx, tx.Hash(), client) + return WaitForTransaction(ctx, tx.Hash(), subnetInfo) } -func WaitForTransactionSuccess(ctx context.Context, txHash common.Hash, client ethclient.Client) *types.Receipt { - receipt := WaitForTransaction(ctx, txHash, client) +func WaitForTransactionSuccess(ctx context.Context, txHash common.Hash, subnetInfo SubnetTestInfo) *types.Receipt { + receipt := WaitForTransaction(ctx, txHash, subnetInfo) Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) return receipt } -func WaitForTransaction(ctx context.Context, txHash common.Hash, client ethclient.Client) *types.Receipt { +func WaitForTransaction(ctx context.Context, txHash common.Hash, subnetInfo SubnetTestInfo) *types.Receipt { cctx, cancel := context.WithTimeout(ctx, 20*time.Second) defer cancel() // Loop until we find the transaction or time out for { - receipt, err := client.TransactionReceipt(cctx, txHash) + receipt, err := subnetInfo.ChainRPCClient.TransactionReceipt(cctx, txHash) if err == nil { return receipt } else { @@ -455,86 +438,6 @@ func WaitForTransaction(ctx context.Context, txHash common.Hash, client ethclien } } -// Constructs the aggregate signature, packs the Teleporter message, and relays to the destination -// Returns the receipt on the destination chain, and an error if the teleporter message failed to execute. -func RelayMessage( - ctx context.Context, - sourceBlockHash common.Hash, - sourceBlockNumber *big.Int, - source SubnetTestInfo, - destination SubnetTestInfo, -) (*types.Receipt, error) { - - log.Info("Fetching relevant warp logs from the newly produced block") - logs, err := source.ChainWSClient.FilterLogs(ctx, interfaces.FilterQuery{ - BlockHash: &sourceBlockHash, - Addresses: []common.Address{warp.Module.Address}, - }) - Expect(err).Should(BeNil()) - Expect(len(logs)).Should(Equal(1)) - - // Check for relevant warp log from subscription and ensure that it matches - // the log extracted from the last block. - txLog := logs[0] - log.Info("Parsing logData as unsigned warp message") - unsignedMsg, err := warp.UnpackSendWarpEventDataToMessage(txLog.Data) - Expect(err).Should(BeNil()) - - // Set local variables for the duration of the test - unsignedWarpMessageID := unsignedMsg.ID() - unsignedWarpMsg := unsignedMsg - log.Info("Parsed unsignedWarpMsg", "unsignedWarpMessageID", unsignedWarpMessageID, "unsignedWarpMessage", unsignedWarpMsg) - - // Loop over each client on chain A to ensure they all have time to accept the block. - // Note: if we did not confirm this here, the next stage could be racy since it assumes every node - // has accepted the block. - WaitForAllValidatorsToAcceptBlock(ctx, source.NodeURIs, source.BlockchainID, sourceBlockNumber.Uint64()) - - // Get the aggregate signature for the Warp message - log.Info("Fetching aggregate signature from the source chain validators") - warpClient, err := warpBackend.NewClient(source.NodeURIs[0], source.BlockchainID.String()) - Expect(err).Should(BeNil()) - signedWarpMessageBytes, err := warpClient.GetMessageAggregateSignature(ctx, unsignedWarpMessageID, params.WarpQuorumDenominator) - Expect(err).Should(BeNil()) - - // Construct the transaction to send the Warp message to the destination chain - signedTx := CreateReceiveCrossChainMessageTransaction( - ctx, - signedWarpMessageBytes, - big.NewInt(1), - teleporterContractAddress, - fundedKey, - destination.ChainWSClient, - destination.ChainIDInt, - ) - - log.Info("Sending transaction to destination chain") - receipt := SendAndWaitForTransaction(ctx, signedTx, destination.ChainWSClient) - - bind, err := teleportermessenger.NewTeleporterMessenger(teleporterContractAddress, source.ChainWSClient) - Expect(err).Should(BeNil()) - // Check the transaction logs for the ReceiveCrossChainMessage event emitted by the Teleporter contract - receiveEvent, err := GetEventFromLogs(receipt.Logs, bind.ParseReceiveCrossChainMessage) - if err != nil { - // If we didn't find the ReceiveCrossChainMessage event, trace the transaction. - // We compare it with the empty string so that ginkgo will print it out for us. - trace := TraceTransaction(ctx, receipt.TxHash, destination) - Expect(trace).Should(Equal("")) - } - Expect(receiveEvent.OriginBlockchainID[:]).Should(Equal(source.BlockchainID[:])) - - // Check for a successful execution of the teleporter message. - _, err = GetEventFromLogs(receipt.Logs, bind.ParseMessageExecuted) - if err != nil { - // If we didn't find the ReceiveCrossChainMessage event, trace the transaction. - // We compare it with the empty string so that ginkgo will print it out for us. - trace := TraceTransaction(ctx, receipt.TxHash, destination) - fmt.Println("TRACE ", trace) - } - - return receipt, err -} - // // Event getters // @@ -591,10 +494,10 @@ func createNativeTransferTransaction( recipient common.Address, amount *big.Int, ) *types.Transaction { - gasFeeCap, gasTipCap, nonce := calculateTxParams(ctx, network.ChainWSClient, PrivateKeyToAddress(senderKey)) + gasFeeCap, gasTipCap, nonce := CalculateTxParams(ctx, network, PrivateKeyToAddress(senderKey)) tx := types.NewTx(&types.DynamicFeeTx{ - ChainID: network.ChainID, + ChainID: network.ChainIDInt, Nonce: nonce, To: &recipient, Gas: NativeTransferGas, @@ -603,7 +506,7 @@ func createNativeTransferTransaction( Value: amount, }) - return signTransaction(tx, senderKey, network.ChainID) + return SignTransaction(tx, senderKey, network.ChainIDInt) } func PrivateKeyToAddress(k *ecdsa.PrivateKey) common.Address { @@ -639,7 +542,7 @@ func DeployContract(ctx context.Context, byteCodeFileName string, deployerPK *ec byteCode, err := deploymentUtils.ExtractByteCode(byteCodeFileName) Expect(err).Should(BeNil()) Expect(len(byteCode) > 0).Should(BeTrue()) - transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetInfo.ChainID) + transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetInfo.ChainIDInt) Expect(err).Should(BeNil()) contractAddress, tx, _, err := bind.DeployContract(transactor, *abi, byteCode, subnetInfo.ChainWSClient, constructorArgs...) Expect(err).Should(BeNil()) From 64571c4d133fd9a7aecb74beeb3c3669e777fa42 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Wed, 29 Nov 2023 10:12:53 -0500 Subject: [PATCH 149/183] abigen --- .../ERC20TokenSource/ERC20TokenSource.go | 22 +++++++++++++++++++ .../NativeTokenDestination.go | 22 +++++++++++++++++++ .../NativeTokenSource/NativeTokenSource.go | 22 +++++++++++++++++++ 3 files changed, 66 insertions(+) diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go index 326a49ac0..0ab0f6a53 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go @@ -32,12 +32,34 @@ var ( // ERC20TokenSourceMetaData contains all meta data concerning the ERC20TokenSource contract. var ERC20TokenSourceMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"erc20ContractAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"transferAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBurnedTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"erc20ContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + Bin: "0x6101006040523480156200001257600080fd5b50604051620016f3380380620016f383398101604081905262000035916200031b565b60016000556001600160a01b038416620000b15760405162461bcd60e51b815260206004820152603260248201527f4552433230546f6b656e536f757263653a207a65726f2054656c65706f727465604482015271724d657373656e676572206164647265737360701b60648201526084015b60405180910390fd5b6001600160a01b03841660e05282620001105760405162461bcd60e51b815260206004820152602b6024820152600080516020620016d383398151915260448201526a1bdb8818da185a5b88125160aa1b6064820152608401620000a8565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000163573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200018991906200036f565b8303620001ff5760405162461bcd60e51b815260206004820152603460248201527f4552433230546f6b656e536f757263653a2063616e6e6f74206272696467652060448201527f776974682073616d6520626c6f636b636861696e0000000000000000000000006064820152608401620000a8565b60808390526001600160a01b038216620002715760405162461bcd60e51b81526020600482015260336024820152600080516020620016d383398151915260448201527f6f6e20636f6e74726163742061646472657373000000000000000000000000006064820152608401620000a8565b6001600160a01b0380831660a0528116620002e85760405162461bcd60e51b815260206004820152603060248201527f4552433230546f6b656e536f757263653a20696e76616c69642045524332302060448201526f636f6e7472616374206164647265737360801b6064820152608401620000a8565b6001600160a01b031660c0525062000389915050565b80516001600160a01b03811681146200031657600080fd5b919050565b600080600080608085870312156200033257600080fd5b6200033d85620002fe565b9350602085015192506200035460408601620002fe565b91506200036460608601620002fe565b905092959194509250565b6000602082840312156200038257600080fd5b5051919050565b60805160a05160c05160e0516112be620004156000396000818160f50152818161029c015281816102d301526104ee015260008181610183015281816101e30152818161027b0152818161036d01528181610a590152610c3801526000818161013e015281816103330152610606015260008181609d0152818161030d015261058301526112be6000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063b6171f7311610066578063b6171f731461012f578063b8c9091a14610139578063c452165e14610160578063c868efaa1461016b578063e486df151461017e57600080fd5b806341d3014d1461009857806355db3e9e146100d257806387a2edba146100db5780639b3e5803146100f0575b600080fd5b6100bf7f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b6100bf60015481565b6100ee6100e9366004610e3d565b6101a5565b005b6101177f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100c9565b6100bf620186a081565b6101177f000000000000000000000000000000000000000000000000000000000000000081565b610117600160981b81565b6100ee610179366004610ed6565b6104db565b6101177f000000000000000000000000000000000000000000000000000000000000000081565b6101ad610786565b6001600160a01b0385166101dc5760405162461bcd60e51b81526004016101d390610f5f565b60405180910390fd5b60006102087f0000000000000000000000000000000000000000000000000000000000000000866107df565b90508381116102705760405162461bcd60e51b815260206004820152602e60248201527f4552433230546f6b656e536f757263653a20696e73756666696369656e74206160448201526d191a9d5cdd195908185b5bdd5b9d60921b60648201526084016101d3565b83156102c1576102c17f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000086610949565b60006102cd8583610fbd565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316815260200160405180604001604052807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031681526020018b8152508152602001620186a08152602001888880806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250604080516001600160a01b038e166020808301919091529181018890529101906060016040516020818303038152906040528152506040518263ffffffff1660e01b81526004016104339190611064565b6020604051808303816000875af1158015610452573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047691906110e2565b60408051848152602081018990529081018290529091506001600160a01b0389169033907f51f5c55ca5f8f5fde6736f19d1d035a8c67fe18c30d445cea44c4816c6a525a09060600160405180910390a35050506104d46001600055565b5050505050565b6104e3610786565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146105815760405162461bcd60e51b815260206004820152603b60248201527f4552433230546f6b656e536f757263653a20756e617574686f72697a6564205460448201527f656c65706f727465724d657373656e67657220636f6e7472616374000000000060648201526084016101d3565b7f000000000000000000000000000000000000000000000000000000000000000084146106045760405162461bcd60e51b815260206004820152602b60248201527f4552433230546f6b656e536f757263653a20696e76616c69642064657374696e60448201526a30ba34b7b71031b430b4b760a91b60648201526084016101d3565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316146106935760405162461bcd60e51b815260206004820152602560248201527f4552433230546f6b656e536f757263653a20756e617574686f72697a6564207360448201526432b73232b960d91b60648201526084016101d3565b6000806106a283850185611111565b909250905060008260018111156106bb576106bb6111d9565b036106ec57600080828060200190518101906106d791906111ef565b915091506106e58282610a2e565b5050610774565b6001826001811115610700576107006111d9565b0361072c5760008180602001905181019061071b91906110e2565b905061072681610ac5565b50610774565b60405162461bcd60e51b815260206004820181905260248201527f4552433230546f6b656e536f757263653a20696e76616c696420616374696f6e60448201526064016101d3565b50506107806001600055565b50505050565b6002600054036107d85760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101d3565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015610828573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084c91906110e2565b90506108636001600160a01b038516333086610af4565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa1580156108aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ce91906110e2565b90508181116109345760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016101d3565b61093e8282610fbd565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa15801561099a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109be91906110e2565b6109c8919061121d565b6040516001600160a01b03851660248201526044810182905290915061078090859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610b2c565b6001600160a01b038216610a545760405162461bcd60e51b81526004016101d390610f5f565b610a7f7f00000000000000000000000000000000000000000000000000000000000000008383610c03565b604080516001600160a01b0384168152602081018390527f55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407910160405180910390a15050565b600154811115610af157600060015482610adf9190610fbd565b9050610aea81610c33565b5060018190555b50565b6040516001600160a01b03808516602483015283166044820152606481018290526107809085906323b872dd60e01b906084016109f7565b6000610b81826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c989092919063ffffffff16565b805190915015610bfe5780806020019051810190610b9f9190611230565b610bfe5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016101d3565b505050565b6040516001600160a01b038316602482015260448101829052610bfe90849063a9059cbb60e01b906064016109f7565b610c627f0000000000000000000000000000000000000000000000000000000000000000600160981b83610c03565b6040518181527f2cd3fd70cd5a5d6d805e90d22741aa1a84590ace7cf01b244719558d266143829060200160405180910390a150565b6060610ca78484600085610caf565b949350505050565b606082471015610d105760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016101d3565b600080866001600160a01b03168587604051610d2c9190611259565b60006040518083038185875af1925050503d8060008114610d69576040519150601f19603f3d011682016040523d82523d6000602084013e610d6e565b606091505b5091509150610d7f87838387610d8a565b979650505050505050565b60608315610df9578251600003610df2576001600160a01b0385163b610df25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101d3565b5081610ca7565b610ca78383815115610e0e5781518083602001fd5b8060405162461bcd60e51b81526004016101d39190611275565b6001600160a01b0381168114610af157600080fd5b600080600080600060808688031215610e5557600080fd5b8535610e6081610e28565b94506020860135935060408601359250606086013567ffffffffffffffff80821115610e8b57600080fd5b818801915088601f830112610e9f57600080fd5b813581811115610eae57600080fd5b8960208260051b8501011115610ec357600080fd5b9699959850939650602001949392505050565b60008060008060608587031215610eec57600080fd5b843593506020850135610efe81610e28565b9250604085013567ffffffffffffffff80821115610f1b57600080fd5b818701915087601f830112610f2f57600080fd5b813581811115610f3e57600080fd5b886020828501011115610f5057600080fd5b95989497505060200194505050565b60208082526028908201527f4552433230546f6b656e536f757263653a207a65726f20726563697069656e74604082015267206164647265737360c01b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b8181038181111561094357610943610fa7565b600081518084526020808501945080840160005b838110156110095781516001600160a01b031687529582019590820190600101610fe4565b509495945050505050565b60005b8381101561102f578181015183820152602001611017565b50506000910152565b60008151808452611050816020860160208601611014565b601f01601f19169290920160200192915050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526110c5610100840182610fd0565b905060a0840151601f198483030160e085015261093e8282611038565b6000602082840312156110f457600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561112457600080fd5b82356002811061113357600080fd5b9150602083013567ffffffffffffffff8082111561115057600080fd5b818501915085601f83011261116457600080fd5b813581811115611176576111766110fb565b604051601f8201601f19908116603f0116810190838211818310171561119e5761119e6110fb565b816040528281528860208487010111156111b757600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b634e487b7160e01b600052602160045260246000fd5b6000806040838503121561120257600080fd5b825161120d81610e28565b6020939093015192949293505050565b8082018082111561094357610943610fa7565b60006020828403121561124257600080fd5b8151801515811461125257600080fd5b9392505050565b6000825161126b818460208701611014565b9190910192915050565b602081526000611252602083018461103856fea2646970667358221220d90cc4126b15e5abc660ddbae6b59c0246158b8acd424c01f28dad310862316d64736f6c634300081200334552433230546f6b656e536f757263653a207a65726f2064657374696e617469", } // ERC20TokenSourceABI is the input ABI used to generate the binding from. // Deprecated: Use ERC20TokenSourceMetaData.ABI instead. var ERC20TokenSourceABI = ERC20TokenSourceMetaData.ABI +// ERC20TokenSourceBin is the compiled bytecode used for deploying new contracts. +// Deprecated: Use ERC20TokenSourceMetaData.Bin instead. +var ERC20TokenSourceBin = ERC20TokenSourceMetaData.Bin + +// DeployERC20TokenSource deploys a new Ethereum contract, binding an instance of ERC20TokenSource to it. +func DeployERC20TokenSource(auth *bind.TransactOpts, backend bind.ContractBackend, teleporterMessengerAddress common.Address, destinationBlockchainID_ [32]byte, nativeTokenDestinationAddress_ common.Address, erc20ContractAddress_ common.Address) (common.Address, *types.Transaction, *ERC20TokenSource, error) { + parsed, err := ERC20TokenSourceMetaData.GetAbi() + if err != nil { + return common.Address{}, nil, nil, err + } + if parsed == nil { + return common.Address{}, nil, nil, errors.New("GetABI returned nil") + } + + address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(ERC20TokenSourceBin), backend, teleporterMessengerAddress, destinationBlockchainID_, nativeTokenDestinationAddress_, erc20ContractAddress_) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &ERC20TokenSource{ERC20TokenSourceCaller: ERC20TokenSourceCaller{contract: contract}, ERC20TokenSourceTransactor: ERC20TokenSourceTransactor{contract: contract}, ERC20TokenSourceFilterer: ERC20TokenSourceFilterer{contract: contract}}, nil +} + // ERC20TokenSource is an auto generated Go binding around an Ethereum contract. type ERC20TokenSource struct { ERC20TokenSourceCaller // Read-only binding to the contract diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go index e55bf92b6..1edec64e1 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go @@ -38,12 +38,34 @@ type TeleporterFeeInfo struct { // NativeTokenDestinationMetaData contains all meta data concerning the NativeTokenDestination contract. var NativeTokenDestinationMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialReserveImbalance_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"burnAddressBalance\",\"type\":\"uint256\"}],\"name\":\"ReportTotalBurnedTxFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"BURN_FOR_TRANSFER_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REPORT_BURNED_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"reportTotalBurnedTxFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalMinted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", + Bin: "0x61012060405273020000000000000000000000000000000000000160805260006002553480156200002f57600080fd5b5060405162001b4c38038062001b4c8339810160408190526200005291620002d7565b60016000556001600160a01b038416620000d95760405162461bcd60e51b815260206004820152603860248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2054656c60448201527f65706f727465724d657373656e6765722061646472657373000000000000000060648201526084015b60405180910390fd5b6001600160a01b03841661010052826200013a5760405162461bcd60e51b815260206004820152602c602482015260008051602062001b2c83398151915260448201526b1c98d94818da185a5b88125160a21b6064820152608401620000d0565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200018d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001b3919062000320565b8303620002295760405162461bcd60e51b815260206004820152603a60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a2063616e6e6f74206260448201527f726964676520776974682073616d6520626c6f636b636861696e0000000000006064820152608401620000d0565b60a08390526001600160a01b0382166200029b5760405162461bcd60e51b8152602060048201526034602482015260008051602062001b2c83398151915260448201527f72636520636f6e747261637420616464726573730000000000000000000000006064820152608401620000d0565b6001600160a01b0390911660c05260e0819052600155506200033a9050565b80516001600160a01b0381168114620002d257600080fd5b919050565b60008060008060808587031215620002ee57600080fd5b620002f985620002ba565b9350602085015192506200031060408601620002ba565b6060959095015193969295505050565b6000602082840312156200033357600080fd5b5051919050565b60805160a05160c05160e05161010051611759620003d3600039600081816102440152818161040c015281816106a50152818161070201526109120152600081816102100152818161030401526103b90152600081816101b10152818161046c015281816107620152610a3501526000818161013c015281816104460152818161073c01526109b101526000610c6d01526117596000f3fe6080604052600436106100e75760003560e01c80638ac7dd201161008a578063ab28523011610059578063ab28523014610297578063c452165e146102ae578063c868efaa146102c6578063d30951261461029757600080fd5b80638ac7dd20146101fe5780639b3e580314610232578063a2309ff814610266578063a2a950171461027c57600080fd5b80633a94fe51116100c65780633a94fe511461015e57806349e3284e146101805780635d93f9af1461019f57806375846562146101eb57600080fd5b8062d872ae146100ec57806318160ddd1461011557806329b7b3fd1461012a575b600080fd5b3480156100f857600080fd5b5061010260015481565b6040519081526020015b60405180910390f35b34801561012157600080fd5b506101026102e6565b34801561013657600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561016a57600080fd5b5061017e6101793660046112d7565b6103f5565b005b34801561018c57600080fd5b506001546040519015815260200161010c565b3480156101ab57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010c565b61017e6101f9366004611343565b6105d0565b34801561020a57600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561023e57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b34801561027257600080fd5b5061010260025481565b34801561028857600080fd5b506101d36001600160981b0181565b3480156102a357600080fd5b50610102620186a081565b3480156102ba57600080fd5b506101d3600160981b81565b3480156102d257600080fd5b5061017e6102e13660046113a7565b6108ff565b6000806103006001600160981b0131600160981b31611446565b90507f00000000000000000000000000000000000000000000000000000000000000006002546103309190611446565b8111156103b65760405162461bcd60e51b815260206004820152604360248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20464154414c202d2060448201527f636f6e74726163742068617320746f6b656e7320756e6163636f756e746564206064820152623337b960e91b608482015260a4015b60405180910390fd5b807f00000000000000000000000000000000000000000000000000000000000000006002546103e59190611446565b6103ef9190611459565b91505090565b6000600160981b6001600160a01b031631905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906104aa919061146c565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505050908252506040805160208082018990528251808303820181528284019093529092019161051c91600191606001611522565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161054a919061159d565b6020604051808303816000875af1158015610569573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058d919061161b565b9050807f2550fa6041684d40e635e29e93dde9017d70c25b46aa88393317b5182ed6ae7c836040516105c191815260200190565b60405180910390a25050505050565b6105d8610d2c565b6001600160a01b0384166105fe5760405162461bcd60e51b81526004016103ad90611634565b6001541561066b5760405162461bcd60e51b815260206004820152603460248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20636f6e7472616374604482015273081d5b99195c98dbdb1b185d195c985b1a5e995960621b60648201526084016103ad565b60006020840135156106ca576106916106876020860186611682565b8560200135610d85565b90506106ca6106a36020860186611682565b7f000000000000000000000000000000000000000000000000000000000000000083610eef565b6040516001600160981b01903480156108fc02916000818181858888f193505050501580156106fd573d6000803e3d6000fd5b5060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906107a0919061146c565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250938552505060405160209384019361080e92508d913491016001600160a01b03929092168252602082015260400190565b60408051601f198184030181529082905261082c9291602001611522565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161085a919061159d565b6020604051808303816000875af1158015610879573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061089d919061161b565b905080866001600160a01b0316336001600160a01b03167f0322cbb1d3c23f6dbf1deddb3b4ef3ce0f93ae6eec7b44e4f395804104466d14346040516108e591815260200190565b60405180910390a450506108f96001600055565b50505050565b610907610d2c565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146109af5760405162461bcd60e51b815260206004820152604160248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201527f697a65642054656c65706f727465724d657373656e67657220636f6e747261636064820152601d60fa1b608482015260a4016103ad565b7f00000000000000000000000000000000000000000000000000000000000000008414610a335760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20696e76616c69642060448201526b39b7bab931b29031b430b4b760a11b60648201526084016103ad565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031614610ac85760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201526a34bd32b21039b2b73232b960a91b60648201526084016103ad565b600080610ad7838501856116a6565b90925090506001600160a01b038216610b025760405162461bcd60e51b81526004016103ad90611634565b80600003610b665760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2074726160448201526a6e736665722076616c756560a81b60648201526084016103ad565b600154819015610c4757600154821115610bdd5760015460408051918252600060208301526001600160a01b03881682820152517f66c12a5fefbc1f35dd64a1d9b069fc5bda187e6f68812c58a330b77b2a695ba99181900360600190a1600154610bd19083611459565b60006001559050610c47565b8160016000828254610bef9190611459565b90915550506001546040805184815260208101929092526001600160a01b03881682820152517f66c12a5fefbc1f35dd64a1d9b069fc5bda187e6f68812c58a330b77b2a695ba99181900360600190a1505050610d22565b6040516327ad555d60e11b81526001600160a01b038481166004830152602482018390527f00000000000000000000000000000000000000000000000000000000000000001690634f5aaaba90604401600060405180830381600087803b158015610cb157600080fd5b505af1158015610cc5573d6000803e3d6000fd5b505050508060026000828254610cdb9190611446565b90915550506040518181526001600160a01b038416907fd949ea0e9d5db53492d77f28fd5467fb2f6c4f5b88e3350e3c36729b76e99cf29060200160405180910390a25050505b6108f96001600055565b600260005403610d7e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016103ad565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015610dce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df2919061161b565b9050610e096001600160a01b038516333086610fd4565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610e50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e74919061161b565b9050818111610eda5760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016103ad565b610ee48282611459565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610f40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f64919061161b565b610f6e9190611446565b6040516001600160a01b0385166024820152604481018290529091506108f990859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261100c565b6040516001600160a01b03808516602483015283166044820152606481018290526108f99085906323b872dd60e01b90608401610f9d565b6000611061826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166110e39092919063ffffffff16565b8051909150156110de578080602001905181019061107f91906116d2565b6110de5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103ad565b505050565b60606110f284846000856110fa565b949350505050565b60608247101561115b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016103ad565b600080866001600160a01b0316858760405161117791906116f4565b60006040518083038185875af1925050503d80600081146111b4576040519150601f19603f3d011682016040523d82523d6000602084013e6111b9565b606091505b50915091506111ca878383876111d5565b979650505050505050565b6060831561124457825160000361123d576001600160a01b0385163b61123d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103ad565b50816110f2565b6110f283838151156112595781518083602001fd5b8060405162461bcd60e51b81526004016103ad9190611710565b60006040828403121561128557600080fd5b50919050565b60008083601f84011261129d57600080fd5b50813567ffffffffffffffff8111156112b557600080fd5b6020830191508360208260051b85010111156112d057600080fd5b9250929050565b6000806000606084860312156112ec57600080fd5b6112f68585611273565b9250604084013567ffffffffffffffff81111561131257600080fd5b61131e8682870161128b565b9497909650939450505050565b6001600160a01b038116811461134057600080fd5b50565b6000806000806080858703121561135957600080fd5b84356113648161132b565b93506113738660208701611273565b9250606085013567ffffffffffffffff81111561138f57600080fd5b61139b8782880161128b565b95989497509550505050565b600080600080606085870312156113bd57600080fd5b8435935060208501356113cf8161132b565b9250604085013567ffffffffffffffff808211156113ec57600080fd5b818701915087601f83011261140057600080fd5b81358181111561140f57600080fd5b88602082850101111561142157600080fd5b95989497505060200194505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610ee957610ee9611430565b81810381811115610ee957610ee9611430565b60006040828403121561147e57600080fd5b6040516040810181811067ffffffffffffffff821117156114af57634e487b7160e01b600052604160045260246000fd5b60405282356114bd8161132b565b81526020928301359281019290925250919050565b60005b838110156114ed5781810151838201526020016114d5565b50506000910152565b6000815180845261150e8160208601602086016114d2565b601f01601f19169290920160200192915050565b60006002841061154257634e487b7160e01b600052602160045260246000fd5b838252604060208301526110f260408301846114f6565b600081518084526020808501945080840160005b838110156115925781516001600160a01b03168752958201959082019060010161156d565b509495945050505050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526115fe610100840182611559565b905060a0840151601f198483030160e0850152610ee482826114f6565b60006020828403121561162d57600080fd5b5051919050565b6020808252602e908201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2072656360408201526d697069656e74206164647265737360901b606082015260800190565b60006020828403121561169457600080fd5b813561169f8161132b565b9392505050565b600080604083850312156116b957600080fd5b82356116c48161132b565b946020939093013593505050565b6000602082840312156116e457600080fd5b8151801515811461169f57600080fd5b600082516117068184602087016114d2565b9190910192915050565b60208152600061169f60208301846114f656fea26469706673582212202e12a8ebb7466abc217cf86709f71e9b451ca1cd29a79690f73c276914f44a5e64736f6c634300081200334e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20736f75", } // NativeTokenDestinationABI is the input ABI used to generate the binding from. // Deprecated: Use NativeTokenDestinationMetaData.ABI instead. var NativeTokenDestinationABI = NativeTokenDestinationMetaData.ABI +// NativeTokenDestinationBin is the compiled bytecode used for deploying new contracts. +// Deprecated: Use NativeTokenDestinationMetaData.Bin instead. +var NativeTokenDestinationBin = NativeTokenDestinationMetaData.Bin + +// DeployNativeTokenDestination deploys a new Ethereum contract, binding an instance of NativeTokenDestination to it. +func DeployNativeTokenDestination(auth *bind.TransactOpts, backend bind.ContractBackend, teleporterMessengerAddress common.Address, sourceBlockchainID_ [32]byte, nativeTokenSourceAddress_ common.Address, initialReserveImbalance_ *big.Int) (common.Address, *types.Transaction, *NativeTokenDestination, error) { + parsed, err := NativeTokenDestinationMetaData.GetAbi() + if err != nil { + return common.Address{}, nil, nil, err + } + if parsed == nil { + return common.Address{}, nil, nil, errors.New("GetABI returned nil") + } + + address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(NativeTokenDestinationBin), backend, teleporterMessengerAddress, sourceBlockchainID_, nativeTokenSourceAddress_, initialReserveImbalance_) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &NativeTokenDestination{NativeTokenDestinationCaller: NativeTokenDestinationCaller{contract: contract}, NativeTokenDestinationTransactor: NativeTokenDestinationTransactor{contract: contract}, NativeTokenDestinationFilterer: NativeTokenDestinationFilterer{contract: contract}}, nil +} + // NativeTokenDestination is an auto generated Go binding around an Ethereum contract. type NativeTokenDestination struct { NativeTokenDestinationCaller // Read-only binding to the contract diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go index 97631b07a..8437ffce9 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go @@ -38,12 +38,34 @@ type TeleporterFeeInfo struct { // NativeTokenSourceMetaData contains all meta data concerning the NativeTokenSource contract. var NativeTokenSourceMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBurnedTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", + Bin: "0x60e06040523480156200001157600080fd5b5060405162001643380380620016438339810160408190526200003491620002ae565b60016000556001600160a01b038316620000bb5760405162461bcd60e51b815260206004820152603360248201527f4e6174697665546f6b656e536f757263653a207a65726f2054656c65706f727460448201527f65724d657373656e67657220616464726573730000000000000000000000000060648201526084015b60405180910390fd5b6001600160a01b03831660c052816200011b5760405162461bcd60e51b815260206004820152602c60248201526000805160206200162383398151915260448201526b1a5bdb8818da185a5b88125160a21b6064820152608401620000b2565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200016e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001949190620002ef565b82036200020a5760405162461bcd60e51b815260206004820152603560248201527f4e6174697665546f6b656e536f757263653a2063616e6e6f742062726964676560448201527f20776974682073616d6520626c6f636b636861696e00000000000000000000006064820152608401620000b2565b60808290526001600160a01b0381166200027c5760405162461bcd60e51b815260206004820152603460248201526000805160206200162383398151915260448201527f696f6e20636f6e747261637420616464726573730000000000000000000000006064820152608401620000b2565b6001600160a01b031660a05250620003099050565b80516001600160a01b0381168114620002a957600080fd5b919050565b600080600060608486031215620002c457600080fd5b620002cf8462000291565b925060208401519150620002e66040850162000291565b90509250925092565b6000602082840312156200030257600080fd5b5051919050565b60805160a05160c0516112bb620003686000396000818160ef0152818161027001528181610299015261048c015260008181610167015281816102f901526105a50152600081816092015281816102d3015261052101526112bb6000f3fe60806040526004361061007b5760003560e01c8063b6171f731161004e578063b6171f731461013e578063b8c9091a14610155578063c452165e14610189578063c868efaa146101a157600080fd5b806341d3014d1461008057806355db3e9e146100c75780639b3e5803146100dd578063ad0aee2514610129575b600080fd5b34801561008c57600080fd5b506100b47f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b3480156100d357600080fd5b506100b460015481565b3480156100e957600080fd5b506101117f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100be565b61013c610137366004610e01565b6101c1565b005b34801561014a57600080fd5b506100b4620186a081565b34801561016157600080fd5b506101117f000000000000000000000000000000000000000000000000000000000000000081565b34801561019557600080fd5b50610111600160981b81565b3480156101ad57600080fd5b5061013c6101bc366004610ea0565b610479565b6101c961072a565b6001600160a01b0384166102365760405162461bcd60e51b815260206004820152602960248201527f4e6174697665546f6b656e536f757263653a207a65726f20657263697069656e60448201526874206164647265737360b81b60648201526084015b60405180910390fd5b60006020840135156102955761025c6102526020860186610f1a565b8560200135610783565b905061029561026e6020860186610f1a565b7f0000000000000000000000000000000000000000000000000000000000000000836108ed565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906103379190610f85565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505050908252506040516020918201916103a6918c913491016001600160a01b03929092168252602082015260400190565b6040516020818303038152906040528152506040518263ffffffff1660e01b81526004016103d49190611071565b6020604051808303816000875af11580156103f3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041791906110ef565b905080866001600160a01b0316336001600160a01b03167f2b4e8f08417773e367064a6aea9ca2df303a60876676f70b6c3c5e66b314ca5a3460405161045f91815260200190565b60405180910390a450506104736001600055565b50505050565b61048161072a565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461051f5760405162461bcd60e51b815260206004820152603c60248201527f4e6174697665546f6b656e536f757263653a20756e617574686f72697a65642060448201527f74656c65706f727465724d657373656e67657220636f6e747261637400000000606482015260840161022d565b7f000000000000000000000000000000000000000000000000000000000000000084146105a35760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e536f757263653a20696e76616c696420646573746960448201526b3730ba34b7b71031b430b4b760a11b606482015260840161022d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316146106335760405162461bcd60e51b815260206004820152602660248201527f4e6174697665546f6b656e536f757263653a20756e617574686f72697a65642060448201526539b2b73232b960d11b606482015260840161022d565b60008061064283850185611108565b9092509050600082600181111561065b5761065b6111b4565b0361068c576000808280602001905181019061067791906111ca565b9150915061068582826109d2565b505061071e565b60018260018111156106a0576106a06111b4565b036106cc576000818060200190518101906106bb91906110ef565b90506106c681610ab6565b5061071e565b60405162461bcd60e51b815260206004820152602160248201527f4e6174697665546f6b656e536f757263653a20696e76616c696420616374696f6044820152603760f91b606482015260840161022d565b50506104736001600055565b60026000540361077c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161022d565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa1580156107cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f091906110ef565b90506108076001600160a01b038516333086610ae5565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa15801561084e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061087291906110ef565b90508181116108d85760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b606482015260840161022d565b6108e2828261120e565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa15801561093e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061096291906110ef565b61096c9190611221565b6040516001600160a01b03851660248201526044810182905290915061047390859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610b1d565b6001600160a01b038216610a395760405162461bcd60e51b815260206004820152602860248201527f4552433230546f6b656e536f757263653a207a65726f20726563697069656e74604482015267206164647265737360c01b606482015260840161022d565b6040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015610a6f573d6000803e3d6000fd5b50604080516001600160a01b0384168152602081018390527f55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407910160405180910390a15050565b600154811115610ae257600060015482610ad0919061120e565b9050610adb81610bf4565b5060018190555b50565b6040516001600160a01b03808516602483015283166044820152606481018290526104739085906323b872dd60e01b9060840161099b565b6000610b72826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c5c9092919063ffffffff16565b805190915015610bef5780806020019051810190610b909190611234565b610bef5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161022d565b505050565b604051600160981b9082156108fc029083906000818181858888f19350505050158015610c25573d6000803e3d6000fd5b506040518181527f2cd3fd70cd5a5d6d805e90d22741aa1a84590ace7cf01b244719558d266143829060200160405180910390a150565b6060610c6b8484600085610c73565b949350505050565b606082471015610cd45760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161022d565b600080866001600160a01b03168587604051610cf09190611256565b60006040518083038185875af1925050503d8060008114610d2d576040519150601f19603f3d011682016040523d82523d6000602084013e610d32565b606091505b5091509150610d4387838387610d4e565b979650505050505050565b60608315610dbd578251600003610db6576001600160a01b0385163b610db65760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161022d565b5081610c6b565b610c6b8383815115610dd25781518083602001fd5b8060405162461bcd60e51b815260040161022d9190611272565b6001600160a01b0381168114610ae257600080fd5b6000806000808486036080811215610e1857600080fd5b8535610e2381610dec565b94506040601f1982011215610e3757600080fd5b50602085019250606085013567ffffffffffffffff80821115610e5957600080fd5b818701915087601f830112610e6d57600080fd5b813581811115610e7c57600080fd5b8860208260051b8501011115610e9157600080fd5b95989497505060200194505050565b60008060008060608587031215610eb657600080fd5b843593506020850135610ec881610dec565b9250604085013567ffffffffffffffff80821115610ee557600080fd5b818701915087601f830112610ef957600080fd5b813581811115610f0857600080fd5b886020828501011115610e9157600080fd5b600060208284031215610f2c57600080fd5b8135610f3781610dec565b9392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610f7d57610f7d610f3e565b604052919050565b600060408284031215610f9757600080fd5b6040516040810181811067ffffffffffffffff82111715610fba57610fba610f3e565b6040528235610fc881610dec565b81526020928301359281019290925250919050565b600081518084526020808501945080840160005b838110156110165781516001600160a01b031687529582019590820190600101610ff1565b509495945050505050565b60005b8381101561103c578181015183820152602001611024565b50506000910152565b6000815180845261105d816020860160208601611021565b601f01601f19169290920160200192915050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526110d2610100840182610fdd565b905060a0840151601f198483030160e08501526108e28282611045565b60006020828403121561110157600080fd5b5051919050565b6000806040838503121561111b57600080fd5b82356002811061112a57600080fd5b915060208381013567ffffffffffffffff8082111561114857600080fd5b818601915086601f83011261115c57600080fd5b81358181111561116e5761116e610f3e565b611180601f8201601f19168501610f54565b9150808252878482850101111561119657600080fd5b80848401858401376000848284010152508093505050509250929050565b634e487b7160e01b600052602160045260246000fd5b600080604083850312156111dd57600080fd5b82516111e881610dec565b6020939093015192949293505050565b634e487b7160e01b600052601160045260246000fd5b818103818111156108e7576108e76111f8565b808201808211156108e7576108e76111f8565b60006020828403121561124657600080fd5b81518015158114610f3757600080fd5b60008251611268818460208701611021565b9190910192915050565b602081526000610f37602083018461104556fea2646970667358221220e8cbdf2ffcdd9a41fcf7f19146c49a2513c9847816ef7fceeb854242be953f7c64736f6c634300081200334e6174697665546f6b656e536f757263653a207a65726f2064657374696e6174", } // NativeTokenSourceABI is the input ABI used to generate the binding from. // Deprecated: Use NativeTokenSourceMetaData.ABI instead. var NativeTokenSourceABI = NativeTokenSourceMetaData.ABI +// NativeTokenSourceBin is the compiled bytecode used for deploying new contracts. +// Deprecated: Use NativeTokenSourceMetaData.Bin instead. +var NativeTokenSourceBin = NativeTokenSourceMetaData.Bin + +// DeployNativeTokenSource deploys a new Ethereum contract, binding an instance of NativeTokenSource to it. +func DeployNativeTokenSource(auth *bind.TransactOpts, backend bind.ContractBackend, teleporterMessengerAddress common.Address, destinationBlockchainID_ [32]byte, nativeTokenDestinationAddress_ common.Address) (common.Address, *types.Transaction, *NativeTokenSource, error) { + parsed, err := NativeTokenSourceMetaData.GetAbi() + if err != nil { + return common.Address{}, nil, nil, err + } + if parsed == nil { + return common.Address{}, nil, nil, errors.New("GetABI returned nil") + } + + address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(NativeTokenSourceBin), backend, teleporterMessengerAddress, destinationBlockchainID_, nativeTokenDestinationAddress_) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &NativeTokenSource{NativeTokenSourceCaller: NativeTokenSourceCaller{contract: contract}, NativeTokenSourceTransactor: NativeTokenSourceTransactor{contract: contract}, NativeTokenSourceFilterer: NativeTokenSourceFilterer{contract: contract}}, nil +} + // NativeTokenSource is an auto generated Go binding around an Ethereum contract. type NativeTokenSource struct { NativeTokenSourceCaller // Read-only binding to the contract From 68a322d7eb1a9ae9209871e120c993ef07aa6368 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Wed, 29 Nov 2023 10:22:56 -0500 Subject: [PATCH 150/183] run goimports --- tests/erc20_to_native_token_bridge.go | 22 +++++++++++----------- tests/native_token_bridge.go | 4 ++-- tests/utils/utils.go | 22 ---------------------- 3 files changed, 13 insertions(+), 35 deletions(-) diff --git a/tests/erc20_to_native_token_bridge.go b/tests/erc20_to_native_token_bridge.go index f568c0696..40797328b 100644 --- a/tests/erc20_to_native_token_bridge.go +++ b/tests/erc20_to_native_token_bridge.go @@ -10,9 +10,9 @@ import ( erc20tokensource "github.com/ava-labs/teleporter/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource" nativetokendestination "github.com/ava-labs/teleporter/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination" exampleerc20 "github.com/ava-labs/teleporter/abi-bindings/go/Mocks/ExampleERC20" + "github.com/ava-labs/teleporter/tests/network" "github.com/ava-labs/teleporter/tests/utils" deploymentUtils "github.com/ava-labs/teleporter/utils/deployment-utils" - "github.com/ava-labs/teleporter/tests/network" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/log" @@ -28,10 +28,10 @@ func ERC20ToNativeTokenBridge(network network.Network) { NativeTokenDestinationByteCodeFile = "./contracts/out/NativeTokenDestination.sol/NativeTokenDestination.json" ) var ( - initialReserveImbalance = big.NewInt(0).Mul(big.NewInt(1e15), big.NewInt(1e9)) - valueToSend = big.NewInt(0).Div(initialReserveImbalance, big.NewInt(4)) + initialReserveImbalance = big.NewInt(0).Mul(big.NewInt(1e15), big.NewInt(1e9)) + valueToSend = big.NewInt(0).Div(initialReserveImbalance, big.NewInt(4)) intermediateReserveImbalance = utils.BigIntSub(initialReserveImbalance, valueToSend) - valueToReturn = big.NewInt(0).Div(valueToSend, big.NewInt(4)) + valueToReturn = big.NewInt(0).Div(valueToSend, big.NewInt(4)) ctx = context.Background() deployerAddress = common.HexToAddress("0x539447ab8Be7e927bE8E005663C81ff2AE951337") @@ -71,7 +71,7 @@ func ERC20ToNativeTokenBridge(network network.Network) { nativeTokenDestinationAbi, err := nativetokendestination.NativeTokenDestinationMetaData.GetAbi() Expect(err).Should(BeNil()) - utils.DeployContract(ctx, NativeTokenDestinationByteCodeFile, deployerPK, subnetB, nativeTokenDestinationAbi, teleporterContractAddress, subnetA.BlockchainID, bridgeContractAddress,initialReserveImbalance) + utils.DeployContract(ctx, NativeTokenDestinationByteCodeFile, deployerPK, subnetB, nativeTokenDestinationAbi, teleporterContractAddress, subnetA.BlockchainID, bridgeContractAddress, initialReserveImbalance) exampleERC20Abi, err := exampleerc20.ExampleERC20MetaData.GetAbi() Expect(err).Should(BeNil()) @@ -159,12 +159,12 @@ func ERC20ToNativeTokenBridge(network network.Network) { checkReserveImbalance(intermediateReserveImbalance, nativeTokenDestination) // Check intermediate balance, no tokens should be minted because we haven't collateralized - utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.ChainWSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.ChainWSClient) } { // Fail to Transfer tokens B -> A because bridge is not collateralized // Check starting balance is 0 - utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.ChainWSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.ChainWSClient) transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetB.ChainIDInt) Expect(err).Should(BeNil()) @@ -176,12 +176,12 @@ func ERC20ToNativeTokenBridge(network network.Network) { checkReserveImbalance(intermediateReserveImbalance, nativeTokenDestination) // Check we failed to send because we're not collateralized - utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.ChainWSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.ChainWSClient) } { // Transfer more tokens A -> B to collateralize the bridge // Check starting balance is 0 - utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.ChainWSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.ChainWSClient) checkReserveImbalance(intermediateReserveImbalance, nativeTokenDestination) @@ -237,14 +237,14 @@ func ERC20ToNativeTokenBridge(network network.Network) { Expect(err).Should(BeNil()) utils.ExpectBigEqual(burnedTxFeesBalanceDest, burnEvent.Amount) - burnedTxFeesBalanceSource2, err := exampleERC20.BalanceOf(nil, burnedTxFeeAddress) + burnedTxFeesBalanceSource2, err := exampleERC20.BalanceOf(nil, burnedTxFeeAddress) Expect(err).Should(BeNil()) utils.ExpectBigEqual(burnedTxFeesBalanceSource2, burnEvent.Amount) } } func checkUnlockERC20Event(logs []*types.Log, erc20TokenSource *erc20tokensource.ERC20TokenSource, recipient common.Address, value *big.Int) { - unlockEvent, err := utils.GetEventFromLogs(logs, erc20TokenSource.ParseUnlockTokens) + unlockEvent, err := utils.GetEventFromLogs(logs, erc20TokenSource.ParseUnlockTokens) Expect(err).Should(BeNil()) Expect(unlockEvent.Recipient).Should(Equal(recipient)) utils.ExpectBigEqual(unlockEvent.Amount, value) diff --git a/tests/native_token_bridge.go b/tests/native_token_bridge.go index 2093ae844..731d9540a 100644 --- a/tests/native_token_bridge.go +++ b/tests/native_token_bridge.go @@ -9,9 +9,9 @@ import ( "github.com/ava-labs/subnet-evm/core/types" nativetokendestination "github.com/ava-labs/teleporter/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination" nativetokensource "github.com/ava-labs/teleporter/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource" + "github.com/ava-labs/teleporter/tests/network" "github.com/ava-labs/teleporter/tests/utils" deploymentUtils "github.com/ava-labs/teleporter/utils/deployment-utils" - "github.com/ava-labs/teleporter/tests/network" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/log" @@ -118,7 +118,7 @@ func NativeTokenBridge(network network.Network) { Expect(err).Should(BeNil()) utils.ExpectBigEqual(transferEvent.Amount, valueToSend) - receipt:= network.RelayMessage(ctx, sourceChainReceipt, subnetA, subnetB, true) + receipt := network.RelayMessage(ctx, sourceChainReceipt, subnetA, subnetB, true) return receipt } diff --git a/tests/utils/utils.go b/tests/utils/utils.go index 265e27f4c..b9e7051b1 100644 --- a/tests/utils/utils.go +++ b/tests/utils/utils.go @@ -487,28 +487,6 @@ func CalculateTxParams( return gasFeeCap, gasTipCap, nonce } -func createNativeTransferTransaction( - ctx context.Context, - network SubnetTestInfo, - senderKey *ecdsa.PrivateKey, - recipient common.Address, - amount *big.Int, -) *types.Transaction { - gasFeeCap, gasTipCap, nonce := CalculateTxParams(ctx, network, PrivateKeyToAddress(senderKey)) - - tx := types.NewTx(&types.DynamicFeeTx{ - ChainID: network.ChainIDInt, - Nonce: nonce, - To: &recipient, - Gas: NativeTransferGas, - GasFeeCap: gasFeeCap, - GasTipCap: gasTipCap, - Value: amount, - }) - - return SignTransaction(tx, senderKey, network.ChainIDInt) -} - func PrivateKeyToAddress(k *ecdsa.PrivateKey) common.Address { return crypto.PubkeyToAddress(k.PublicKey) } From 9ba19e30bd0d0305c348d0acca737ed0de22f2c4 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Wed, 29 Nov 2023 10:42:31 -0500 Subject: [PATCH 151/183] format --- .../TeleporterMessenger/packing_test.go | 8 +- tests/erc20_to_native_token_bridge.go | 149 +++++++++++-- tests/native_token_bridge.go | 206 +++++++++++++++--- tests/utils/utils.go | 2 +- utils/deployment-utils/deployment_utils.go | 55 ++++- 5 files changed, 347 insertions(+), 73 deletions(-) diff --git a/abi-bindings/go/Teleporter/TeleporterMessenger/packing_test.go b/abi-bindings/go/Teleporter/TeleporterMessenger/packing_test.go index a586c4c07..0b1569c3a 100644 --- a/abi-bindings/go/Teleporter/TeleporterMessenger/packing_test.go +++ b/abi-bindings/go/Teleporter/TeleporterMessenger/packing_test.go @@ -14,11 +14,11 @@ import ( func createTestTeleporterMessage(messageID int64) TeleporterMessage { m := TeleporterMessage{ - MessageID: big.NewInt(messageID), - SenderAddress: common.HexToAddress("0x0123456789abcdef0123456789abcdef01234567"), + MessageID: big.NewInt(messageID), + SenderAddress: common.HexToAddress("0x0123456789abcdef0123456789abcdef01234567"), DestinationBlockchainID: [32]byte{1, 2, 3, 4}, - DestinationAddress: common.HexToAddress("0x0123456789abcdef0123456789abcdef01234567"), - RequiredGasLimit: big.NewInt(2), + DestinationAddress: common.HexToAddress("0x0123456789abcdef0123456789abcdef01234567"), + RequiredGasLimit: big.NewInt(2), AllowedRelayerAddresses: []common.Address{ common.HexToAddress("0x0123456789abcdef0123456789abcdef01234567"), }, diff --git a/tests/erc20_to_native_token_bridge.go b/tests/erc20_to_native_token_bridge.go index 40797328b..60f001225 100644 --- a/tests/erc20_to_native_token_bridge.go +++ b/tests/erc20_to_native_token_bridge.go @@ -67,11 +67,31 @@ func ERC20ToNativeTokenBridge(network network.Network) { // in the genesis file for the subnet. This will allow it to call the native minter precompile. erc20TokenSourceAbi, err := erc20tokensource.ERC20TokenSourceMetaData.GetAbi() Expect(err).Should(BeNil()) - utils.DeployContract(ctx, ERC20TokenSourceByteCodeFile, deployerPK, subnetA, erc20TokenSourceAbi, teleporterContractAddress, subnetB.BlockchainID, bridgeContractAddress, exampleERC20ContractAddress) + utils.DeployContract( + ctx, + ERC20TokenSourceByteCodeFile, + deployerPK, + subnetA, + erc20TokenSourceAbi, + teleporterContractAddress, + subnetB.BlockchainID, + bridgeContractAddress, + exampleERC20ContractAddress, + ) nativeTokenDestinationAbi, err := nativetokendestination.NativeTokenDestinationMetaData.GetAbi() Expect(err).Should(BeNil()) - utils.DeployContract(ctx, NativeTokenDestinationByteCodeFile, deployerPK, subnetB, nativeTokenDestinationAbi, teleporterContractAddress, subnetA.BlockchainID, bridgeContractAddress, initialReserveImbalance) + utils.DeployContract( + ctx, + NativeTokenDestinationByteCodeFile, + deployerPK, + subnetB, + nativeTokenDestinationAbi, + teleporterContractAddress, + subnetA.BlockchainID, + bridgeContractAddress, + initialReserveImbalance, + ) exampleERC20Abi, err := exampleerc20.ExampleERC20MetaData.GetAbi() Expect(err).Should(BeNil()) @@ -80,11 +100,20 @@ func ERC20ToNativeTokenBridge(network network.Network) { log.Info("Finished deploying contracts") // Create abi objects to call the contract with - nativeTokenDestination, err := nativetokendestination.NewNativeTokenDestination(bridgeContractAddress, subnetB.ChainWSClient) + nativeTokenDestination, err := nativetokendestination.NewNativeTokenDestination( + bridgeContractAddress, + subnetB.ChainWSClient, + ) Expect(err).Should(BeNil()) - erc20TokenSource, err := erc20tokensource.NewERC20TokenSource(bridgeContractAddress, subnetA.ChainWSClient) + erc20TokenSource, err := erc20tokensource.NewERC20TokenSource( + bridgeContractAddress, + subnetA.ChainWSClient, + ) Expect(err).Should(BeNil()) - exampleERC20, err := exampleerc20.NewExampleERC20(exampleERC20ContractAddress, subnetA.ChainWSClient) + exampleERC20, err := exampleerc20.NewExampleERC20( + exampleERC20ContractAddress, + subnetA.ChainWSClient, + ) Expect(err).Should(BeNil()) // Helper function @@ -93,13 +122,27 @@ func ERC20ToNativeTokenBridge(network network.Network) { Expect(err).Should(BeNil()) transactor.Value = valueToSend - tx, err := nativeTokenDestination.TransferToSource(transactor, toAddress, emptyDestFeeInfo, []common.Address{}) + tx, err := nativeTokenDestination.TransferToSource( + transactor, + toAddress, + emptyDestFeeInfo, + []common.Address{}, + ) Expect(err).Should(BeNil()) - log.Info("Sent TransferToSource transaction on destination chain", "sourceChainID", subnetA.BlockchainID, "txHash", tx.Hash().Hex()) + log.Info( + "Sent TransferToSource transaction on destination chain", + "sourceChainID", + subnetA.BlockchainID, + "txHash", + tx.Hash().Hex(), + ) sourceChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetB) - transferEvent, err := utils.GetEventFromLogs(sourceChainReceipt.Logs, nativeTokenDestination.ParseTransferToSource) + transferEvent, err := utils.GetEventFromLogs( + sourceChainReceipt.Logs, + nativeTokenDestination.ParseTransferToSource, + ) Expect(err).Should(BeNil()) utils.ExpectBigEqual(transferEvent.Amount, valueToSend) @@ -113,13 +156,28 @@ func ERC20ToNativeTokenBridge(network network.Network) { transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, subnetA.ChainIDInt) Expect(err).Should(BeNil()) - tx, err := erc20TokenSource.TransferToDestination(transactor, toAddress, valueToSend, big.NewInt(0), []common.Address{}) + tx, err := erc20TokenSource.TransferToDestination( + transactor, + toAddress, + valueToSend, + big.NewInt(0), + []common.Address{}, + ) Expect(err).Should(BeNil()) - log.Info("Sent TransferToDestination transaction on source chain", "destinationChainID", subnetB.BlockchainID, "txHash", tx.Hash().Hex()) + log.Info( + "Sent TransferToDestination transaction on source chain", + "destinationChainID", + subnetB.BlockchainID, + "txHash", + tx.Hash().Hex(), + ) sourceChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetA) - transferEvent, err := utils.GetEventFromLogs(sourceChainReceipt.Logs, erc20TokenSource.ParseTransferToDestination) + transferEvent, err := utils.GetEventFromLogs( + sourceChainReceipt.Logs, + erc20TokenSource.ParseTransferToDestination, + ) Expect(err).Should(BeNil()) utils.ExpectBigEqual(transferEvent.TransferAmount, valueToSend) @@ -149,11 +207,17 @@ func ERC20ToNativeTokenBridge(network network.Network) { destChainReceipt := sendTokensToDestination(valueToSend, deployerPK, tokenReceiverAddress) - collateralEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseCollateralAdded) + collateralEvent, err := utils.GetEventFromLogs( + destChainReceipt.Logs, + nativeTokenDestination.ParseCollateralAdded, + ) Expect(err).Should(BeNil()) utils.ExpectBigEqual(collateralEvent.Amount, valueToSend) - _, err = utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseNativeTokensMinted) + _, err = utils.GetEventFromLogs( + destChainReceipt.Logs, + nativeTokenDestination.ParseNativeTokensMinted, + ) Expect(err).ShouldNot(BeNil()) checkReserveImbalance(intermediateReserveImbalance, nativeTokenDestination) @@ -170,7 +234,12 @@ func ERC20ToNativeTokenBridge(network network.Network) { Expect(err).Should(BeNil()) transactor.Value = valueToSend - _, err = nativeTokenDestination.TransferToSource(transactor, tokenReceiverAddress, emptyDestFeeInfo, []common.Address{}) + _, err = nativeTokenDestination.TransferToSource( + transactor, + tokenReceiverAddress, + emptyDestFeeInfo, + []common.Address{}, + ) Expect(err).ShouldNot(BeNil()) checkReserveImbalance(intermediateReserveImbalance, nativeTokenDestination) @@ -185,13 +254,23 @@ func ERC20ToNativeTokenBridge(network network.Network) { checkReserveImbalance(intermediateReserveImbalance, nativeTokenDestination) - destChainReceipt := sendTokensToDestination(initialReserveImbalance, deployerPK, tokenReceiverAddress) + destChainReceipt := sendTokensToDestination( + initialReserveImbalance, + deployerPK, + tokenReceiverAddress, + ) - collateralEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseCollateralAdded) + collateralEvent, err := utils.GetEventFromLogs( + destChainReceipt.Logs, + nativeTokenDestination.ParseCollateralAdded, + ) Expect(err).Should(BeNil()) Expect(collateralEvent.Amount).Should(Equal(intermediateReserveImbalance)) - mintEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseNativeTokensMinted) + mintEvent, err := utils.GetEventFromLogs( + destChainReceipt.Logs, + nativeTokenDestination.ParseNativeTokensMinted, + ) Expect(err).Should(BeNil()) utils.ExpectBigEqual(mintEvent.Amount, valueToSend) @@ -204,7 +283,12 @@ func ERC20ToNativeTokenBridge(network network.Network) { { // Transfer tokens B -> A sourceChainReceipt := sendTokensToSource(valueToReturn, deployerPK, tokenReceiverAddress) - checkUnlockERC20Event(sourceChainReceipt.Logs, erc20TokenSource, tokenReceiverAddress, valueToReturn) + checkUnlockERC20Event( + sourceChainReceipt.Logs, + erc20TokenSource, + tokenReceiverAddress, + valueToReturn, + ) bal, err := exampleERC20.BalanceOf(nil, tokenReceiverAddress) Expect(err).Should(BeNil()) @@ -212,18 +296,29 @@ func ERC20ToNativeTokenBridge(network network.Network) { } { // Check reporting of burned tx fees to Source Chain - burnedTxFeesBalanceDest, err := subnetB.ChainWSClient.BalanceAt(ctx, burnedTxFeeAddress, nil) + burnedTxFeesBalanceDest, err := subnetB.ChainWSClient.BalanceAt( + ctx, + burnedTxFeeAddress, + nil, + ) Expect(err).Should(BeNil()) Expect(burnedTxFeesBalanceDest.Cmp(common.Big0) > 0).Should(BeTrue()) transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetB.ChainIDInt) Expect(err).Should(BeNil()) - tx, err := nativeTokenDestination.ReportTotalBurnedTxFees(transactor, emptyDestFeeInfo, []common.Address{}) + tx, err := nativeTokenDestination.ReportTotalBurnedTxFees( + transactor, + emptyDestFeeInfo, + []common.Address{}, + ) Expect(err).Should(BeNil()) destChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetB) - reportEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseReportTotalBurnedTxFees) + reportEvent, err := utils.GetEventFromLogs( + destChainReceipt.Logs, + nativeTokenDestination.ParseReportTotalBurnedTxFees, + ) Expect(err).Should(BeNil()) utils.ExpectBigEqual(reportEvent.BurnAddressBalance, burnedTxFeesBalanceDest) @@ -233,7 +328,10 @@ func ERC20ToNativeTokenBridge(network network.Network) { sourceChainReceipt := network.RelayMessage(ctx, destChainReceipt, subnetB, subnetA, true) - burnEvent, err := utils.GetEventFromLogs(sourceChainReceipt.Logs, erc20TokenSource.ParseBurnTokens) + burnEvent, err := utils.GetEventFromLogs( + sourceChainReceipt.Logs, + erc20TokenSource.ParseBurnTokens, + ) Expect(err).Should(BeNil()) utils.ExpectBigEqual(burnedTxFeesBalanceDest, burnEvent.Amount) @@ -243,7 +341,12 @@ func ERC20ToNativeTokenBridge(network network.Network) { } } -func checkUnlockERC20Event(logs []*types.Log, erc20TokenSource *erc20tokensource.ERC20TokenSource, recipient common.Address, value *big.Int) { +func checkUnlockERC20Event( + logs []*types.Log, + erc20TokenSource *erc20tokensource.ERC20TokenSource, + recipient common.Address, + value *big.Int, +) { unlockEvent, err := utils.GetEventFromLogs(logs, erc20TokenSource.ParseUnlockTokens) Expect(err).Should(BeNil()) Expect(unlockEvent.Recipient).Should(Equal(recipient)) diff --git a/tests/native_token_bridge.go b/tests/native_token_bridge.go index 731d9540a..170404c3c 100644 --- a/tests/native_token_bridge.go +++ b/tests/native_token_bridge.go @@ -65,20 +65,45 @@ func NativeTokenBridge(network network.Network) { // in the genesis file for the subnet. This will allow it to call the native minter precompile. erc20TokenSourceAbi, err := nativetokensource.NativeTokenSourceMetaData.GetAbi() Expect(err).Should(BeNil()) - utils.DeployContract(ctx, NativeTokenSourceByteCodeFile, deployerPK, subnetA, erc20TokenSourceAbi, teleporterContractAddress, subnetB.BlockchainID, bridgeContractAddress) + utils.DeployContract( + ctx, + NativeTokenSourceByteCodeFile, + deployerPK, + subnetA, + erc20TokenSourceAbi, + teleporterContractAddress, + subnetB.BlockchainID, + bridgeContractAddress, + ) Expect(err).Should(BeNil()) nativeTokenDestinationAbi, err := nativetokendestination.NativeTokenDestinationMetaData.GetAbi() Expect(err).Should(BeNil()) - utils.DeployContract(ctx, NativeTokenDestinationByteCodeFile, deployerPK, subnetB, nativeTokenDestinationAbi, teleporterContractAddress, subnetA.BlockchainID, bridgeContractAddress, initialReserveImbalance) + utils.DeployContract( + ctx, + NativeTokenDestinationByteCodeFile, + deployerPK, + subnetB, + nativeTokenDestinationAbi, + teleporterContractAddress, + subnetA.BlockchainID, + bridgeContractAddress, + initialReserveImbalance, + ) log.Info("Finished deploying Bridge contracts") } // Create abi objects to call the contract with - nativeTokenDestination, err := nativetokendestination.NewNativeTokenDestination(bridgeContractAddress, subnetB.ChainWSClient) + nativeTokenDestination, err := nativetokendestination.NewNativeTokenDestination( + bridgeContractAddress, + subnetB.ChainWSClient, + ) Expect(err).Should(BeNil()) - nativeTokenSource, err := nativetokensource.NewNativeTokenSource(bridgeContractAddress, subnetA.ChainWSClient) + nativeTokenSource, err := nativetokensource.NewNativeTokenSource( + bridgeContractAddress, + subnetA.ChainWSClient, + ) Expect(err).Should(BeNil()) // Helper function @@ -87,13 +112,27 @@ func NativeTokenBridge(network network.Network) { Expect(err).Should(BeNil()) transactor.Value = valueToSend - tx, err := nativeTokenDestination.TransferToSource(transactor, toAddress, emptyDestFeeInfo, []common.Address{}) + tx, err := nativeTokenDestination.TransferToSource( + transactor, + toAddress, + emptyDestFeeInfo, + []common.Address{}, + ) Expect(err).Should(BeNil()) - log.Info("Sent TransferToSource transaction on destination chain", "sourceBlockchainID", subnetA.BlockchainID, "txHash", tx.Hash().Hex()) + log.Info( + "Sent TransferToSource transaction on destination chain", + "sourceBlockchainID", + subnetA.BlockchainID, + "txHash", + tx.Hash().Hex(), + ) destChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetB) - transferEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseTransferToSource) + transferEvent, err := utils.GetEventFromLogs( + destChainReceipt.Logs, + nativeTokenDestination.ParseTransferToSource, + ) Expect(err).Should(BeNil()) utils.ExpectBigEqual(transferEvent.Amount, valueToSend) @@ -108,13 +147,27 @@ func NativeTokenBridge(network network.Network) { Expect(err).Should(BeNil()) transactor.Value = valueToSend - tx, err := nativeTokenSource.TransferToDestination(transactor, toAddress, emptySourceFeeInfo, []common.Address{}) + tx, err := nativeTokenSource.TransferToDestination( + transactor, + toAddress, + emptySourceFeeInfo, + []common.Address{}, + ) Expect(err).Should(BeNil()) - log.Info("Sent TransferToDestination transaction on source chain", "destinationBlockchainID", subnetB.BlockchainID, "txHash", tx.Hash().Hex()) + log.Info( + "Sent TransferToDestination transaction on source chain", + "destinationBlockchainID", + subnetB.BlockchainID, + "txHash", + tx.Hash().Hex(), + ) sourceChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetA) - transferEvent, err := utils.GetEventFromLogs(sourceChainReceipt.Logs, nativeTokenSource.ParseTransferToDestination) + transferEvent, err := utils.GetEventFromLogs( + sourceChainReceipt.Logs, + nativeTokenSource.ParseTransferToDestination, + ) Expect(err).Should(BeNil()) utils.ExpectBigEqual(transferEvent.Amount, valueToSend) @@ -131,10 +184,21 @@ func NativeTokenBridge(network network.Network) { destChainReceipt := sendTokensToDestination(valueToSend, deployerPK, tokenReceiverAddress) - checkCollateralEvent(destChainReceipt.Logs, nativeTokenDestination, valueToSend, big.NewInt(0).Sub(initialReserveImbalance, valueToSend)) - checkReserveImbalance(big.NewInt(0).Sub(initialReserveImbalance, valueToSend), nativeTokenDestination) - - _, err = utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseNativeTokensMinted) + checkCollateralEvent( + destChainReceipt.Logs, + nativeTokenDestination, + valueToSend, + big.NewInt(0).Sub(initialReserveImbalance, valueToSend), + ) + checkReserveImbalance( + big.NewInt(0).Sub(initialReserveImbalance, valueToSend), + nativeTokenDestination, + ) + + _, err = utils.GetEventFromLogs( + destChainReceipt.Logs, + nativeTokenDestination.ParseNativeTokensMinted, + ) Expect(err).ShouldNot(BeNil()) // Check intermediate balance, no tokens should be minted because we haven't collateralized @@ -150,7 +214,12 @@ func NativeTokenBridge(network network.Network) { transactor.Value = valueToSend // This transfer should revert because the bridge isn't collateralized - _, err = nativeTokenDestination.TransferToSource(transactor, tokenReceiverAddress, emptyDestFeeInfo, []common.Address{}) + _, err = nativeTokenDestination.TransferToSource( + transactor, + tokenReceiverAddress, + emptyDestFeeInfo, + []common.Address{}, + ) Expect(err).ShouldNot(BeNil()) // Check we should fail to send because we're not collateralized @@ -160,12 +229,29 @@ func NativeTokenBridge(network network.Network) { { // Transfer more tokens A -> B to collateralize the bridge // Check starting balance is 0 utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.ChainWSClient) - checkReserveImbalance(big.NewInt(0).Sub(initialReserveImbalance, valueToSend), nativeTokenDestination) - - destChainReceipt := sendTokensToDestination(initialReserveImbalance, deployerPK, tokenReceiverAddress) - - checkCollateralEvent(destChainReceipt.Logs, nativeTokenDestination, big.NewInt(0).Sub(initialReserveImbalance, valueToSend), common.Big0) - checkMintEvent(destChainReceipt.Logs, nativeTokenDestination, tokenReceiverAddress, valueToSend) + checkReserveImbalance( + big.NewInt(0).Sub(initialReserveImbalance, valueToSend), + nativeTokenDestination, + ) + + destChainReceipt := sendTokensToDestination( + initialReserveImbalance, + deployerPK, + tokenReceiverAddress, + ) + + checkCollateralEvent( + destChainReceipt.Logs, + nativeTokenDestination, + big.NewInt(0).Sub(initialReserveImbalance, valueToSend), + common.Big0, + ) + checkMintEvent( + destChainReceipt.Logs, + nativeTokenDestination, + tokenReceiverAddress, + valueToSend, + ) checkReserveImbalance(common.Big0, nativeTokenDestination) // We should have minted the excess coins after checking the collateral @@ -175,65 +261,117 @@ func NativeTokenBridge(network network.Network) { { // Transfer tokens B -> A sourceChainReceipt := sendTokensToSource(valueToReturn, deployerPK, tokenReceiverAddress) - checkUnlockNativeEvent(sourceChainReceipt.Logs, nativeTokenSource, tokenReceiverAddress, valueToReturn) + checkUnlockNativeEvent( + sourceChainReceipt.Logs, + nativeTokenSource, + tokenReceiverAddress, + valueToReturn, + ) utils.CheckBalance(ctx, tokenReceiverAddress, valueToReturn, subnetA.ChainWSClient) } { // Check reporting of burned tx fees to Source Chain - burnedTxFeesBalanceDest, err := subnetB.ChainWSClient.BalanceAt(ctx, burnedTxFeeAddress, nil) + burnedTxFeesBalanceDest, err := subnetB.ChainWSClient.BalanceAt( + ctx, + burnedTxFeeAddress, + nil, + ) Expect(err).Should(BeNil()) Expect(burnedTxFeesBalanceDest.Cmp(common.Big0) > 0).Should(BeTrue()) transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetB.ChainIDInt) Expect(err).Should(BeNil()) - tx, err := nativeTokenDestination.ReportTotalBurnedTxFees(transactor, emptyDestFeeInfo, []common.Address{}) + tx, err := nativeTokenDestination.ReportTotalBurnedTxFees( + transactor, + emptyDestFeeInfo, + []common.Address{}, + ) Expect(err).Should(BeNil()) destChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetB) - reportEvent, err := utils.GetEventFromLogs(destChainReceipt.Logs, nativeTokenDestination.ParseReportTotalBurnedTxFees) + reportEvent, err := utils.GetEventFromLogs( + destChainReceipt.Logs, + nativeTokenDestination.ParseReportTotalBurnedTxFees, + ) Expect(err).Should(BeNil()) utils.ExpectBigEqual(reportEvent.BurnAddressBalance, burnedTxFeesBalanceDest) - burnedTxFeesBalanceSource, err := subnetA.ChainWSClient.BalanceAt(ctx, burnedTxFeeAddress, nil) + burnedTxFeesBalanceSource, err := subnetA.ChainWSClient.BalanceAt( + ctx, + burnedTxFeeAddress, + nil, + ) Expect(err).Should(BeNil()) Expect(burnedTxFeesBalanceSource.Cmp(common.Big0) > 0).Should(BeTrue()) sourceChainReceipt := network.RelayMessage(ctx, destChainReceipt, subnetB, subnetA, true) - burnEvent, err := utils.GetEventFromLogs(sourceChainReceipt.Logs, nativeTokenSource.ParseBurnTokens) + burnEvent, err := utils.GetEventFromLogs( + sourceChainReceipt.Logs, + nativeTokenSource.ParseBurnTokens, + ) Expect(err).Should(BeNil()) utils.ExpectBigEqual(burnedTxFeesBalanceDest, burnEvent.Amount) - burnedTxFeesBalanceSource2, err := subnetA.ChainWSClient.BalanceAt(ctx, burnedTxFeeAddress, nil) + burnedTxFeesBalanceSource2, err := subnetA.ChainWSClient.BalanceAt( + ctx, + burnedTxFeeAddress, + nil, + ) Expect(err).Should(BeNil()) - Expect(burnedTxFeesBalanceSource2.Cmp(big.NewInt(0).Add(burnedTxFeesBalanceSource, burnEvent.Amount)) >= 0).Should(BeTrue()) + Expect( + burnedTxFeesBalanceSource2.Cmp( + big.NewInt(0).Add(burnedTxFeesBalanceSource, burnEvent.Amount), + ) >= 0, + ).Should(BeTrue()) } } -func checkUnlockNativeEvent(logs []*types.Log, nativeTokenSource *nativetokensource.NativeTokenSource, recipient common.Address, value *big.Int) { +func checkUnlockNativeEvent( + logs []*types.Log, + nativeTokenSource *nativetokensource.NativeTokenSource, + recipient common.Address, + value *big.Int, +) { unlockEvent, err := utils.GetEventFromLogs(logs, nativeTokenSource.ParseUnlockTokens) Expect(err).Should(BeNil()) Expect(unlockEvent.Recipient).Should(Equal(recipient)) Expect(unlockEvent.Amount.Cmp(value)).Should(BeZero()) } -func checkCollateralEvent(logs []*types.Log, nativeTokenDestination *nativetokendestination.NativeTokenDestination, collateralAdded *big.Int, collateralRemaining *big.Int) { - collateralEvent, err := utils.GetEventFromLogs(logs, nativeTokenDestination.ParseCollateralAdded) +func checkCollateralEvent( + logs []*types.Log, + nativeTokenDestination *nativetokendestination.NativeTokenDestination, + collateralAdded *big.Int, + collateralRemaining *big.Int, +) { + collateralEvent, err := utils.GetEventFromLogs( + logs, + nativeTokenDestination.ParseCollateralAdded, + ) Expect(err).Should(BeNil()) Expect(collateralEvent.Amount.Cmp(collateralAdded)).Should(BeZero()) Expect(collateralEvent.Remaining.Cmp(collateralEvent.Remaining)).Should(BeZero()) } -func checkMintEvent(logs []*types.Log, nativeTokenDestination *nativetokendestination.NativeTokenDestination, recipient common.Address, value *big.Int) { +func checkMintEvent( + logs []*types.Log, + nativeTokenDestination *nativetokendestination.NativeTokenDestination, + recipient common.Address, + value *big.Int, +) { mintEvent, err := utils.GetEventFromLogs(logs, nativeTokenDestination.ParseNativeTokensMinted) Expect(err).Should(BeNil()) Expect(mintEvent.Recipient).Should(Equal(recipient)) Expect(mintEvent.Amount.Cmp(value)).Should(BeZero()) } -func checkReserveImbalance(value *big.Int, nativeTokenDestination *nativetokendestination.NativeTokenDestination) { +func checkReserveImbalance( + value *big.Int, + nativeTokenDestination *nativetokendestination.NativeTokenDestination, +) { imbalance, err := nativeTokenDestination.CurrentReserveImbalance(&bind.CallOpts{}) Expect(err).Should(BeNil()) utils.ExpectBigEqual(imbalance, value) diff --git a/tests/utils/utils.go b/tests/utils/utils.go index b9e7051b1..d426cce5d 100644 --- a/tests/utils/utils.go +++ b/tests/utils/utils.go @@ -13,9 +13,9 @@ import ( "strings" "time" - deploymentUtils "github.com/ava-labs/teleporter/utils/deployment-utils" exampleerc20 "github.com/ava-labs/teleporter/abi-bindings/go/Mocks/ExampleERC20" teleportermessenger "github.com/ava-labs/teleporter/abi-bindings/go/Teleporter/TeleporterMessenger" + deploymentUtils "github.com/ava-labs/teleporter/utils/deployment-utils" gasUtils "github.com/ava-labs/teleporter/utils/gas-utils" "github.com/ava-labs/avalanchego/ids" diff --git a/utils/deployment-utils/deployment_utils.go b/utils/deployment-utils/deployment_utils.go index 734a55df8..43d18ebd2 100644 --- a/utils/deployment-utils/deployment_utils.go +++ b/utils/deployment-utils/deployment_utils.go @@ -31,7 +31,9 @@ const ( ) var ( - vValue = big.NewInt(27) // Must be less than 35 to be considered non-EIP155 + vValue = big.NewInt( + 27, + ) // Must be less than 35 to be considered non-EIP155 contractCreationGasPrice = big.NewInt(2500000000000) // 2500 nAVAX/gas ) @@ -86,11 +88,16 @@ func ExtractByteCode(byteCodeFileName string) ([]byte, error) { // Constructs a keyless transaction using Nick's method // Optionally writes the transaction, deployer address, and contract address to file // Returns the transaction bytes, deployer address, and contract address -func ConstructKeylessTransaction(byteCodeFileName string, writeFile bool) ([]byte, common.Address, common.Address, error) { +func ConstructKeylessTransaction( + byteCodeFileName string, + writeFile bool, +) ([]byte, common.Address, common.Address, error) { // Convert the R and S values (which must be the same) from hex. rsValue, ok := new(big.Int).SetString(rsValueHex, 16) if !ok { - return nil, common.Address{}, common.Address{}, errors.New("Failed to convert R and S value to big.Int.") + return nil, common.Address{}, common.Address{}, errors.New( + "Failed to convert R and S value to big.Int.", + ) } byteCode, err := ExtractByteCode(byteCodeFileName) @@ -114,13 +121,19 @@ func ConstructKeylessTransaction(byteCodeFileName string, writeFile bool) ([]byt // Recover the "sender" address of the transaction. senderAddress, err := types.HomesteadSigner{}.Sender(contractCreationTx) if err != nil { - return nil, common.Address{}, common.Address{}, errors.Wrap(err, "Failed to recover the sender address of transaction") + return nil, common.Address{}, common.Address{}, errors.Wrap( + err, + "Failed to recover the sender address of transaction", + ) } // Serialize the raw transaction and sender address. contractCreationTxBytes, err := contractCreationTx.MarshalBinary() if err != nil { - return nil, common.Address{}, common.Address{}, errors.Wrap(err, "Failed to serialize raw transaction") + return nil, common.Address{}, common.Address{}, errors.Wrap( + err, + "Failed to serialize raw transaction", + ) } contractCreationTxString := "0x" + hex.EncodeToString(contractCreationTxBytes) senderAddressString := senderAddress.Hex() // "0x" prepended by Hex() already. @@ -128,7 +141,10 @@ func ConstructKeylessTransaction(byteCodeFileName string, writeFile bool) ([]byt // Derive the resulting contract address given that it will be deployed from the sender address using the nonce of 0. contractAddress, err := DeriveEVMContractAddress(senderAddress, 0) if err != nil { - return nil, common.Address{}, common.Address{}, errors.Wrap(err, "Failed to derive contract address") + return nil, common.Address{}, common.Address{}, errors.Wrap( + err, + "Failed to derive contract address", + ) } contractAddressString := contractAddress.Hex() // "0x" prepended by Hex() already. @@ -138,19 +154,36 @@ func ConstructKeylessTransaction(byteCodeFileName string, writeFile bool) ([]byt log.Println("Teleporter Messenger Universal Contract Address: ", contractAddressString) if writeFile { - err = os.WriteFile(contractCreationTxFileName, []byte(contractCreationTxString), fs.ModePerm) + err = os.WriteFile( + contractCreationTxFileName, + []byte(contractCreationTxString), + fs.ModePerm, + ) if err != nil { - return nil, common.Address{}, common.Address{}, errors.Wrap(err, "Failed to write to contract creation tx file") + return nil, common.Address{}, common.Address{}, errors.Wrap( + err, + "Failed to write to contract creation tx file", + ) } err = os.WriteFile(contractCreationAddrFileName, []byte(senderAddressString), fs.ModePerm) if err != nil { - return nil, common.Address{}, common.Address{}, errors.Wrap(err, "Failed to write to deployer address file") + return nil, common.Address{}, common.Address{}, errors.Wrap( + err, + "Failed to write to deployer address file", + ) } - err = os.WriteFile(universalContractAddressFileName, []byte(contractAddressString), fs.ModePerm) + err = os.WriteFile( + universalContractAddressFileName, + []byte(contractAddressString), + fs.ModePerm, + ) if err != nil { - return nil, common.Address{}, common.Address{}, errors.Wrap(err, "Failed to write to contract address") + return nil, common.Address{}, common.Address{}, errors.Wrap( + err, + "Failed to write to contract address", + ) } } return contractCreationTxBytes, senderAddress, contractAddress, nil From dd0674eb4479e8252f01f997635a06a37b4c9706 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Wed, 29 Nov 2023 11:07:32 -0500 Subject: [PATCH 152/183] format --- go.work.sum | 476 ++++++++++++++++++ tests/erc20_to_native_token_bridge.go | 12 +- tests/native_token_bridge.go | 6 +- tests/utils/utils.go | 17 +- .../contractDeploymentTools.go | 1 - 5 files changed, 506 insertions(+), 6 deletions(-) diff --git a/go.work.sum b/go.work.sum index 6fc0d705c..18b2cb86c 100644 --- a/go.work.sum +++ b/go.work.sum @@ -19,12 +19,14 @@ cloud.google.com/go v0.107.0/go.mod h1:wpc2eNrD7hXUTy8EKS10jkxpZBjASrORK7goS+3YX cloud.google.com/go v0.110.0 h1:Zc8gqp3+a9/Eyph2KDmcGaPtbKRIoqq4YTlL4NMD0Ys= cloud.google.com/go v0.110.0/go.mod h1:SJnCLqQ0FCFGSZMUNUf84MV3Aia54kn7pi8st7tMzaY= cloud.google.com/go v0.110.2/go.mod h1:k04UEeEtb6ZBRTv3dZz4CeJC3jKGxyhl0sAiVVquxiw= +cloud.google.com/go v0.110.4 h1:1JYyxKMN9hd5dR2MYTPWkGUgcoxVVhg0LKNKEo0qvmk= cloud.google.com/go v0.110.4/go.mod h1:+EYjdK8e5RME/VY/qLCAtuyALQ9q67dvuum8i+H5xsI= cloud.google.com/go/accessapproval v1.4.0/go.mod h1:zybIuC3KpDOvotz59lFe5qxRZx6C75OtwbisN56xYB4= cloud.google.com/go/accessapproval v1.5.0 h1:/nTivgnV/n1CaAeo+ekGexTYUsKEU9jUVkoY5359+3Q= cloud.google.com/go/accessapproval v1.5.0/go.mod h1:HFy3tuiGvMdcd/u+Cu5b9NkO1pEICJ46IR82PoUdplw= cloud.google.com/go/accessapproval v1.6.0 h1:x0cEHro/JFPd7eS4BlEWNTMecIj2HdXjOVB5BtvwER0= cloud.google.com/go/accessapproval v1.6.0/go.mod h1:R0EiYnwV5fsRFiKZkPHr6mwyk2wxUJ30nL4j2pcFY2E= +cloud.google.com/go/accessapproval v1.7.1 h1:/5YjNhR6lzCvmJZAnByYkfEgWjfAKwYP6nkuTk6nKFE= cloud.google.com/go/accessapproval v1.7.1/go.mod h1:JYczztsHRMK7NTXb6Xw+dwbs/WnOJxbo/2mTI+Kgg68= cloud.google.com/go/accesscontextmanager v1.3.0/go.mod h1:TgCBehyr5gNMz7ZaH9xubp+CE8dkrszb4oK9CWyvD4o= cloud.google.com/go/accesscontextmanager v1.4.0 h1:CFhNhU7pcD11cuDkQdrE6PQJgv0EXNKNv06jIzbLlCU= @@ -32,6 +34,7 @@ cloud.google.com/go/accesscontextmanager v1.4.0/go.mod h1:/Kjh7BBu/Gh83sv+K60vN9 cloud.google.com/go/accesscontextmanager v1.6.0/go.mod h1:8XCvZWfYw3K/ji0iVnp+6pu7huxoQTLmxAbVjbloTtM= cloud.google.com/go/accesscontextmanager v1.7.0 h1:MG60JgnEoawHJrbWw0jGdv6HLNSf6gQvYRiXpuzqgEA= cloud.google.com/go/accesscontextmanager v1.7.0/go.mod h1:CEGLewx8dwa33aDAZQujl7Dx+uYhS0eay198wB/VumQ= +cloud.google.com/go/accesscontextmanager v1.8.1 h1:WIAt9lW9AXtqw/bnvrEUaE8VG/7bAAeMzRCBGMkc4+w= cloud.google.com/go/accesscontextmanager v1.8.1/go.mod h1:JFJHfvuaTC+++1iL1coPiG1eu5D24db2wXCDWDjIrxo= cloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY= cloud.google.com/go/aiplatform v1.27.0 h1:DBi3Jk9XjCJ4pkkLM4NqKgj3ozUL1wq4l+d3/jTGXAI= @@ -39,28 +42,33 @@ cloud.google.com/go/aiplatform v1.27.0/go.mod h1:Bvxqtl40l0WImSb04d0hXFU7gDOiq9j cloud.google.com/go/aiplatform v1.35.0/go.mod h1:7MFT/vCaOyZT/4IIFfxH4ErVg/4ku6lKv3w0+tFTgXQ= cloud.google.com/go/aiplatform v1.37.0 h1:zTw+suCVchgZyO+k847wjzdVjWmrAuehxdvcZvJwfGg= cloud.google.com/go/aiplatform v1.37.0/go.mod h1:IU2Cv29Lv9oCn/9LkFiiuKfwrRTq+QQMbW+hPCxJGZw= +cloud.google.com/go/aiplatform v1.45.0 h1:FLTOQdXDqigyOPYrGGE5AiTpDyRROIZrPU1eXfKzKTY= cloud.google.com/go/aiplatform v1.45.0/go.mod h1:Iu2Q7sC7QGhXUeOhAj/oCK9a+ULz1O4AotZiqjQ8MYA= cloud.google.com/go/analytics v0.12.0 h1:NKw6PpQi6V1O+KsjuTd+bhip9d0REYu4NevC45vtGp8= cloud.google.com/go/analytics v0.12.0/go.mod h1:gkfj9h6XRf9+TS4bmuhPEShsh3hH8PAZzm/41OOhQd4= cloud.google.com/go/analytics v0.18.0/go.mod h1:ZkeHGQlcIPkw0R/GW+boWHhCOR43xz9RN/jn7WcqfIE= cloud.google.com/go/analytics v0.19.0 h1:LqAo3tAh2FU9+w/r7vc3hBjU23Kv7GhO/PDIW7kIYgM= cloud.google.com/go/analytics v0.19.0/go.mod h1:k8liqf5/HCnOUkbawNtrWWc+UAzyDlW89doe8TtoDsE= +cloud.google.com/go/analytics v0.21.2 h1:T400N/hkELka6OsgK20JYoit0xvKnZtWoe36ft4wGBs= cloud.google.com/go/analytics v0.21.2/go.mod h1:U8dcUtmDmjrmUTnnnRnI4m6zKn/yaA5N9RlEkYFHpQo= cloud.google.com/go/apigateway v1.3.0/go.mod h1:89Z8Bhpmxu6AmUxuVRg/ECRGReEdiP3vQtk4Z1J9rJk= cloud.google.com/go/apigateway v1.4.0 h1:IIoXKR7FKrEAQhMTz5hK2wiDz2WNFHS7eVr/L1lE/rM= cloud.google.com/go/apigateway v1.4.0/go.mod h1:pHVY9MKGaH9PQ3pJ4YLzoj6U5FUDeDFBllIz7WmzJoc= cloud.google.com/go/apigateway v1.5.0 h1:ZI9mVO7x3E9RK/BURm2p1aw9YTBSCQe3klmyP1WxWEg= cloud.google.com/go/apigateway v1.5.0/go.mod h1:GpnZR3Q4rR7LVu5951qfXPJCHquZt02jf7xQx7kpqN8= +cloud.google.com/go/apigateway v1.6.1 h1:aBSwCQPcp9rZ0zVEUeJbR623palnqtvxJlUyvzsKGQc= cloud.google.com/go/apigateway v1.6.1/go.mod h1:ufAS3wpbRjqfZrzpvLC2oh0MFlpRJm2E/ts25yyqmXA= cloud.google.com/go/apigeeconnect v1.3.0/go.mod h1:G/AwXFAKo0gIXkPTVfZDd2qA1TxBXJ3MgMRBQkIi9jc= cloud.google.com/go/apigeeconnect v1.4.0 h1:AONoTYJviyv1vS4IkvWzq69gEVdvHx35wKXc+e6wjZQ= cloud.google.com/go/apigeeconnect v1.4.0/go.mod h1:kV4NwOKqjvt2JYR0AoIWo2QGfoRtn/pkS3QlHp0Ni04= cloud.google.com/go/apigeeconnect v1.5.0 h1:sWOmgDyAsi1AZ48XRHcATC0tsi9SkPT7DA/+VCfkaeA= cloud.google.com/go/apigeeconnect v1.5.0/go.mod h1:KFaCqvBRU6idyhSNyn3vlHXc8VMDJdRmwDF6JyFRqZ8= +cloud.google.com/go/apigeeconnect v1.6.1 h1:6u/jj0P2c3Mcm+H9qLsXI7gYcTiG9ueyQL3n6vCmFJM= cloud.google.com/go/apigeeconnect v1.6.1/go.mod h1:C4awq7x0JpLtrlQCr8AzVIzAaYgngRqWf9S5Uhg+wWs= cloud.google.com/go/apigeeregistry v0.5.0/go.mod h1:YR5+s0BVNZfVOUkMa5pAR2xGd0A473vA5M7j247o1wM= cloud.google.com/go/apigeeregistry v0.6.0 h1:E43RdhhCxdlV+I161gUY2rI4eOaMzHTA5kNkvRsFXvc= cloud.google.com/go/apigeeregistry v0.6.0/go.mod h1:BFNzW7yQVLZ3yj0TKcwzb8n25CFBri51GVGOEUcgQsc= +cloud.google.com/go/apigeeregistry v0.7.1 h1:hgq0ANLDx7t2FDZDJQrCMtCtddR/pjCqVuvQWGrQbXw= cloud.google.com/go/apigeeregistry v0.7.1/go.mod h1:1XgyjZye4Mqtw7T9TsY4NW10U7BojBvG4RMD+vRDrIw= cloud.google.com/go/apikeys v0.5.0/go.mod h1:5aQfwY4D+ewMMWScd3hm2en3hCj+BROlyrt3ytS7KLI= cloud.google.com/go/apikeys v0.6.0 h1:B9CdHFZTFjVti89tmyXXrO+7vSNo2jvZuHG8zD5trdQ= @@ -71,11 +79,13 @@ cloud.google.com/go/appengine v1.5.0/go.mod h1:TfasSozdkFI0zeoxW3PTBLiNqRmzraodC cloud.google.com/go/appengine v1.6.0/go.mod h1:hg6i0J/BD2cKmDJbaFSYHFyZkgBEfQrDg/X0V5fJn84= cloud.google.com/go/appengine v1.7.1 h1:aBGDKmRIaRRoWJ2tAoN0oVSHoWLhtO9aj/NvUyP4aYs= cloud.google.com/go/appengine v1.7.1/go.mod h1:IHLToyb/3fKutRysUlFO0BPt5j7RiQ45nrzEJmKTo6E= +cloud.google.com/go/appengine v1.8.1 h1:J+aaUZ6IbTpBegXbmEsh8qZZy864ZVnOoWyfa1XSNbI= cloud.google.com/go/appengine v1.8.1/go.mod h1:6NJXGLVhZCN9aQ/AEDvmfzKEfoYBlfB80/BHiKVputY= cloud.google.com/go/area120 v0.6.0 h1:TCMhwWEWhCn8d44/Zs7UCICTWje9j3HuV6nVGMjdpYw= cloud.google.com/go/area120 v0.6.0/go.mod h1:39yFJqWVgm0UZqWTOdqkLhjoC7uFfgXRC8g/ZegeAh0= cloud.google.com/go/area120 v0.7.1 h1:ugckkFh4XkHJMPhTIx0CyvdoBxmOpMe8rNs4Ok8GAag= cloud.google.com/go/area120 v0.7.1/go.mod h1:j84i4E1RboTWjKtZVWXPqvK5VHQFJRF2c1Nm69pWm9k= +cloud.google.com/go/area120 v0.8.1 h1:wiOq3KDpdqXmaHzvZwKdpoM+3lDcqsI2Lwhyac7stss= cloud.google.com/go/area120 v0.8.1/go.mod h1:BVfZpGpB7KFVNxPiQBuHkX6Ed0rS51xIgmGyjrAfzsg= cloud.google.com/go/artifactregistry v1.7.0/go.mod h1:mqTOFOnGZx8EtSqK/ZWcsm/4U8B77rbcLP6ruDU2Ixk= cloud.google.com/go/artifactregistry v1.8.0/go.mod h1:w3GQXkJX8hiKN0v+at4b0qotwijQbYUqF2GWkZzAhC0= @@ -84,6 +94,7 @@ cloud.google.com/go/artifactregistry v1.9.0/go.mod h1:2K2RqvA2CYvAeARHRkLDhMDJ3O cloud.google.com/go/artifactregistry v1.11.2/go.mod h1:nLZns771ZGAwVLzTX/7Al6R9ehma4WUEhZGWV6CeQNQ= cloud.google.com/go/artifactregistry v1.13.0 h1:o1Q80vqEB6Qp8WLEH3b8FBLNUCrGQ4k5RFj0sn/sgO8= cloud.google.com/go/artifactregistry v1.13.0/go.mod h1:uy/LNfoOIivepGhooAUpL1i30Hgee3Cu0l4VTWHUC08= +cloud.google.com/go/artifactregistry v1.14.1 h1:k6hNqab2CubhWlGcSzunJ7kfxC7UzpAfQ1UPb9PDCKI= cloud.google.com/go/artifactregistry v1.14.1/go.mod h1:nxVdG19jTaSTu7yA7+VbWL346r3rIdkZ142BSQqhn5E= cloud.google.com/go/asset v1.7.0/go.mod h1:YbENsRK4+xTiL+Ofoj5Ckf+O17kJtgp3Y3nn4uzZz5s= cloud.google.com/go/asset v1.9.0/go.mod h1:83MOE6jEJBMqFKadM9NLRcs80Gdw76qGuHn8m3h8oHQ= @@ -92,6 +103,7 @@ cloud.google.com/go/asset v1.10.0/go.mod h1:pLz7uokL80qKhzKr4xXGvBQXnzHn5evJAEAt cloud.google.com/go/asset v1.11.1/go.mod h1:fSwLhbRvC9p9CXQHJ3BgFeQNM4c9x10lqlrdEUYXlJo= cloud.google.com/go/asset v1.13.0 h1:YAsssO08BqZ6mncbb6FPlj9h6ACS7bJQUOlzciSfbNk= cloud.google.com/go/asset v1.13.0/go.mod h1:WQAMyYek/b7NBpYq/K4KJWcRqzoalEsxz/t/dTk4THw= +cloud.google.com/go/asset v1.14.1 h1:vlHdznX70eYW4V1y1PxocvF6tEwxJTTarwIGwOhFF3U= cloud.google.com/go/asset v1.14.1/go.mod h1:4bEJ3dnHCqWCDbWJ/6Vn7GVI9LerSi7Rfdi03hd+WTQ= cloud.google.com/go/assuredworkloads v1.6.0/go.mod h1:yo2YOk37Yc89Rsd5QMVECvjaMKymF9OP+QXWlKXUkXw= cloud.google.com/go/assuredworkloads v1.8.0/go.mod h1:AsX2cqyNCOvEQC8RMPnoc0yEarXQk6WEKkxYfL6kGIo= @@ -99,6 +111,7 @@ cloud.google.com/go/assuredworkloads v1.9.0 h1:hhIdCOowsT1GG5eMCIA0OwK6USRuYTou/ cloud.google.com/go/assuredworkloads v1.9.0/go.mod h1:kFuI1P78bplYtT77Tb1hi0FMxM0vVpRC7VVoJC3ZoT0= cloud.google.com/go/assuredworkloads v1.10.0 h1:VLGnVFta+N4WM+ASHbhc14ZOItOabDLH1MSoDv+Xuag= cloud.google.com/go/assuredworkloads v1.10.0/go.mod h1:kwdUQuXcedVdsIaKgKTp9t0UJkE5+PAVNhdQm4ZVq2E= +cloud.google.com/go/assuredworkloads v1.11.1 h1:yaO0kwS+SnhVSTF7BqTyVGt3DTocI6Jqo+S3hHmCwNk= cloud.google.com/go/assuredworkloads v1.11.1/go.mod h1:+F04I52Pgn5nmPG36CWFtxmav6+7Q+c5QyJoL18Lry0= cloud.google.com/go/automl v1.6.0/go.mod h1:ugf8a6Fx+zP0D59WLhqgTDsQI9w07o64uf/Is3Nh5p8= cloud.google.com/go/automl v1.7.0/go.mod h1:RL9MYCCsJEOmt0Wf3z9uzG0a7adTT1fe+aObgSpkCt8= @@ -106,6 +119,7 @@ cloud.google.com/go/automl v1.8.0 h1:BMioyXSbg7d7xLibn47cs0elW6RT780IUWr42W8rp2Q cloud.google.com/go/automl v1.8.0/go.mod h1:xWx7G/aPEe/NP+qzYXktoBSDfjO+vnKMGgsApGJJquM= cloud.google.com/go/automl v1.12.0 h1:50VugllC+U4IGl3tDNcZaWvApHBTrn/TvyHDJ0wM+Uw= cloud.google.com/go/automl v1.12.0/go.mod h1:tWDcHDp86aMIuHmyvjuKeeHEGq76lD7ZqfGLN6B0NuU= +cloud.google.com/go/automl v1.13.1 h1:iP9iQurb0qbz+YOOMfKSEjhONA/WcoOIjt6/m+6pIgo= cloud.google.com/go/automl v1.13.1/go.mod h1:1aowgAHWYZU27MybSCFiukPO7xnyawv7pt3zK4bheQE= cloud.google.com/go/baremetalsolution v0.3.0/go.mod h1:XOrocE+pvK1xFfleEnShBlNAXf+j5blPPxrhjKgnIFc= cloud.google.com/go/baremetalsolution v0.4.0 h1:g9KO6SkakcYPcc/XjAzeuUrEOXlYPnMpuiaywYaGrmQ= @@ -123,6 +137,7 @@ cloud.google.com/go/beyondcorp v0.3.0/go.mod h1:E5U5lcrcXMsCuoDNyGrpyTm/hn7ne941 cloud.google.com/go/beyondcorp v0.4.0/go.mod h1:3ApA0mbhHx6YImmuubf5pyW8srKnCEPON32/5hj+RmM= cloud.google.com/go/beyondcorp v0.5.0 h1:UkY2BTZkEUAVrgqnSdOJ4p3y9ZRBPEe1LkjgC8Bj/Pc= cloud.google.com/go/beyondcorp v0.5.0/go.mod h1:uFqj9X+dSfrheVp7ssLTaRHd2EHqSL4QZmH4e8WXGGU= +cloud.google.com/go/beyondcorp v0.6.1 h1:doSatyJyIY1ffqsHuv5DiPSYoXZRIUrJYLArWLZqE/E= cloud.google.com/go/beyondcorp v0.6.1/go.mod h1:YhxDWw946SCbmcWo3fAhw3V4XZMSpQ/VYfcKGAEU8/4= cloud.google.com/go/bigquery v1.42.0/go.mod h1:8dRTJxhtG+vwBKzE5OseQn/hiydoQN3EedCaOdYmxRA= cloud.google.com/go/bigquery v1.44.0 h1:Wi4dITi+cf9VYp4VH2T9O41w0kCW0uQTELq2Z6tukN0= @@ -130,6 +145,7 @@ cloud.google.com/go/bigquery v1.44.0/go.mod h1:0Y33VqXTEsbamHJvJHdFmtqHvMIY28aK1 cloud.google.com/go/bigquery v1.48.0/go.mod h1:QAwSz+ipNgfL5jxiaK7weyOhzdoAy1zFm0Nf1fysJac= cloud.google.com/go/bigquery v1.50.0 h1:RscMV6LbnAmhAzD893Lv9nXXy2WCaJmbxYPWDLbGqNQ= cloud.google.com/go/bigquery v1.50.0/go.mod h1:YrleYEh2pSEbgTBZYMJ5SuSr0ML3ypjRB1zgf7pvQLU= +cloud.google.com/go/bigquery v1.52.0 h1:JKLNdxI0N+TIUWD6t9KN646X27N5dQWq9dZbbTWZ8hc= cloud.google.com/go/bigquery v1.52.0/go.mod h1:3b/iXjRQGU4nKa87cXeg6/gogLjO8C6PmuM8i5Bi/u4= cloud.google.com/go/bigtable v1.2.0 h1:F4cCmA4nuV84V5zYQ3MKY+M1Cw1avHDuf3S/LcZPA9c= cloud.google.com/go/billing v1.5.0/go.mod h1:mztb1tBc3QekhjSgmpf/CV4LzWXLzCArwpLmP2Gm88s= @@ -139,6 +155,7 @@ cloud.google.com/go/billing v1.7.0/go.mod h1:q457N3Hbj9lYwwRbnlD7vUpyjq6u5U1RAOA cloud.google.com/go/billing v1.12.0/go.mod h1:yKrZio/eu+okO/2McZEbch17O5CB5NpZhhXG6Z766ss= cloud.google.com/go/billing v1.13.0 h1:JYj28UYF5w6VBAh0gQYlgHJ/OD1oA+JgW29YZQU+UHM= cloud.google.com/go/billing v1.13.0/go.mod h1:7kB2W9Xf98hP9Sr12KfECgfGclsH3CQR0R08tnRlRbc= +cloud.google.com/go/billing v1.16.0 h1:1iktEAIZ2uA6KpebC235zi/rCXDdDYQ0bTXTNetSL80= cloud.google.com/go/billing v1.16.0/go.mod h1:y8vx09JSSJG02k5QxbycNRrN7FGZB6F3CAcgum7jvGA= cloud.google.com/go/binaryauthorization v1.2.0/go.mod h1:86WKkJHtRcv5ViNABtYMhhNWRrD1Vpi//uKEy7aYEfI= cloud.google.com/go/binaryauthorization v1.3.0/go.mod h1:lRZbKgjDIIQvzYQS1p99A7/U1JqvqeZg0wiI5tp6tg0= @@ -146,12 +163,14 @@ cloud.google.com/go/binaryauthorization v1.4.0 h1:pL70vXWn9TitQYXBWTK2abHl2JHLwk cloud.google.com/go/binaryauthorization v1.4.0/go.mod h1:tsSPQrBd77VLplV70GUhBf/Zm3FsKmgSqgm4UmiDItk= cloud.google.com/go/binaryauthorization v1.5.0 h1:d3pMDBCCNivxt5a4eaV7FwL7cSH0H7RrEnFrTb1QKWs= cloud.google.com/go/binaryauthorization v1.5.0/go.mod h1:OSe4OU1nN/VswXKRBmciKpo9LulY41gch5c68htf3/Q= +cloud.google.com/go/binaryauthorization v1.6.1 h1:cAkOhf1ic92zEN4U1zRoSupTmwmxHfklcp1X7CCBKvE= cloud.google.com/go/binaryauthorization v1.6.1/go.mod h1:TKt4pa8xhowwffiBmbrbcxijJRZED4zrqnwZ1lKH51U= cloud.google.com/go/certificatemanager v1.3.0/go.mod h1:n6twGDvcUBFu9uBgt4eYvvf3sQ6My8jADcOVwHmzadg= cloud.google.com/go/certificatemanager v1.4.0 h1:tzbR4UHBbgsewMWUD93JHi8EBi/gHBoSAcY1/sThFGk= cloud.google.com/go/certificatemanager v1.4.0/go.mod h1:vowpercVFyqs8ABSmrdV+GiFf2H/ch3KyudYQEMM590= cloud.google.com/go/certificatemanager v1.6.0 h1:5C5UWeSt8Jkgp7OWn2rCkLmYurar/vIWIoSQ2+LaTOc= cloud.google.com/go/certificatemanager v1.6.0/go.mod h1:3Hh64rCKjRAX8dXgRAyOcY5vQ/fE1sh8o+Mdd6KPgY8= +cloud.google.com/go/certificatemanager v1.7.1 h1:uKsohpE0hiobx1Eak9jNcPCznwfB6gvyQCcS28Ah9E8= cloud.google.com/go/certificatemanager v1.7.1/go.mod h1:iW8J3nG6SaRYImIa+wXQ0g8IgoofDFRp5UMzaNk1UqI= cloud.google.com/go/channel v1.8.0/go.mod h1:W5SwCXDJsq/rg3tn3oG0LOxpAo6IMxNa09ngphpSlnk= cloud.google.com/go/channel v1.9.0 h1:pNuUlZx0Jb0Ts9P312bmNMuH5IiFWIR4RUtLb70Ke5s= @@ -159,6 +178,7 @@ cloud.google.com/go/channel v1.9.0/go.mod h1:jcu05W0my9Vx4mt3/rEHpfxc9eKi9XwsdDL cloud.google.com/go/channel v1.11.0/go.mod h1:IdtI0uWGqhEeatSB62VOoJ8FSUhJ9/+iGkJVqp74CGE= cloud.google.com/go/channel v1.12.0 h1:GpcQY5UJKeOekYgsX3QXbzzAc/kRGtBq43fTmyKe6Uw= cloud.google.com/go/channel v1.12.0/go.mod h1:VkxCGKASi4Cq7TbXxlaBezonAYpp1GCnKMY6tnMQnLU= +cloud.google.com/go/channel v1.16.0 h1:dqRkK2k7Ll/HHeYGxv18RrfhozNxuTJRkspW0iaFZoY= cloud.google.com/go/channel v1.16.0/go.mod h1:eN/q1PFSl5gyu0dYdmxNXscY/4Fi7ABmeHCJNf/oHmc= cloud.google.com/go/cloudbuild v1.3.0/go.mod h1:WequR4ULxlqvMsjDEEEFnOG5ZSRSgWOywXYDb1vPE6U= cloud.google.com/go/cloudbuild v1.4.0 h1:TAAmCmAlOJ4uNBu6zwAjwhyl/7fLHHxIEazVhr3QBbQ= @@ -166,12 +186,14 @@ cloud.google.com/go/cloudbuild v1.4.0/go.mod h1:5Qwa40LHiOXmz3386FrjrYM93rM/hdRr cloud.google.com/go/cloudbuild v1.7.0/go.mod h1:zb5tWh2XI6lR9zQmsm1VRA+7OCuve5d8S+zJUul8KTg= cloud.google.com/go/cloudbuild v1.9.0 h1:GHQCjV4WlPPVU/j3Rlpc8vNIDwThhd1U9qSY/NPZdko= cloud.google.com/go/cloudbuild v1.9.0/go.mod h1:qK1d7s4QlO0VwfYn5YuClDGg2hfmLZEb4wQGAbIgL1s= +cloud.google.com/go/cloudbuild v1.10.1 h1:N6Tl7Xhi0+GWGdt0i2WwaLZKgKeGP4m9A/cERzZcU5k= cloud.google.com/go/cloudbuild v1.10.1/go.mod h1:lyJg7v97SUIPq4RC2sGsz/9tNczhyv2AjML/ci4ulzU= cloud.google.com/go/clouddms v1.3.0/go.mod h1:oK6XsCDdW4Ib3jCCBugx+gVjevp2TMXFtgxvPSee3OM= cloud.google.com/go/clouddms v1.4.0 h1:UhzHIlgFfMr6luVYVNydw/pl9/U5kgtjCMJHnSvoVws= cloud.google.com/go/clouddms v1.4.0/go.mod h1:Eh7sUGCC+aKry14O1NRljhjyrr0NFC0G2cjwX0cByRk= cloud.google.com/go/clouddms v1.5.0 h1:E7v4TpDGUyEm1C/4KIrpVSOCTm0P6vWdHT0I4mostRA= cloud.google.com/go/clouddms v1.5.0/go.mod h1:QSxQnhikCLUw13iAbffF2CZxAER3xDGNHjsTAkQJcQA= +cloud.google.com/go/clouddms v1.6.1 h1:rjR1nV6oVf2aNNB7B5uz1PDIlBjlOiBgR+q5n7bbB7M= cloud.google.com/go/clouddms v1.6.1/go.mod h1:Ygo1vL52Ov4TBZQquhz5fiw2CQ58gvu+PlS6PVXCpZI= cloud.google.com/go/cloudtasks v1.6.0/go.mod h1:C6Io+sxuke9/KNRkbQpihnW93SWDU3uXt92nu85HkYI= cloud.google.com/go/cloudtasks v1.7.0/go.mod h1:ImsfdYWwlWNJbdgPIIGJWC+gemEGTBK/SunNQQNCAb4= @@ -180,6 +202,7 @@ cloud.google.com/go/cloudtasks v1.8.0/go.mod h1:gQXUIwCSOI4yPVK7DgTVFiiP0ZW/eQky cloud.google.com/go/cloudtasks v1.9.0/go.mod h1:w+EyLsVkLWHcOaqNEyvcKAsWp9p29dL6uL9Nst1cI7Y= cloud.google.com/go/cloudtasks v1.10.0 h1:uK5k6abf4yligFgYFnG0ni8msai/dSv6mDmiBulU0hU= cloud.google.com/go/cloudtasks v1.10.0/go.mod h1:NDSoTLkZ3+vExFEWu2UJV1arUyzVDAiZtdWcsUyNwBs= +cloud.google.com/go/cloudtasks v1.11.1 h1:zyF35LjQyVQQnWbglmVDbsgOHqkbkaxTeRDisEJsXtE= cloud.google.com/go/cloudtasks v1.11.1/go.mod h1:a9udmnou9KO2iulGscKR0qBYjreuX8oHwpmFsKspEvM= cloud.google.com/go/compute v0.1.0/go.mod h1:GAesmwr110a34z04OlxYkATPBEfVhkymfTBXtfbBFow= cloud.google.com/go/compute v1.3.0/go.mod h1:cCZiE1NHEtai4wiufUhW8I8S1JKkAnhnQJWM7YD99wM= @@ -197,6 +220,7 @@ cloud.google.com/go/compute v1.19.0 h1:+9zda3WGgW1ZSTlVppLCYFIr48Pa35q1uG2N1itbC cloud.google.com/go/compute v1.19.0/go.mod h1:rikpw2y+UMidAe9tISo04EHNOIf42RLYF/q8Bs93scU= cloud.google.com/go/compute v1.19.3/go.mod h1:qxvISKp/gYnXkSAD1ppcSOveRAmzxicEv/JlizULFrI= cloud.google.com/go/compute v1.20.1/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= +cloud.google.com/go/compute v1.21.0 h1:JNBsyXVoOoNJtTQcnEY5uYpZIbeCTYIeDe0Xh1bySMk= cloud.google.com/go/compute v1.21.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= cloud.google.com/go/compute/metadata v0.2.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= cloud.google.com/go/compute/metadata v0.2.1 h1:efOwf5ymceDhK6PKMnnrTHP4pppY5L22mle96M1yP48= @@ -208,6 +232,7 @@ cloud.google.com/go/contactcenterinsights v1.4.0 h1:tTQLI/ZvguUf9Hv+36BkG2+/PeC8 cloud.google.com/go/contactcenterinsights v1.4.0/go.mod h1:L2YzkGbPsv+vMQMCADxJoT9YiTTnSEd6fEvCeHTYVck= cloud.google.com/go/contactcenterinsights v1.6.0 h1:jXIpfcH/VYSE1SYcPzO0n1VVb+sAamiLOgCw45JbOQk= cloud.google.com/go/contactcenterinsights v1.6.0/go.mod h1:IIDlT6CLcDoyv79kDv8iWxMSTZhLxSCofVV5W6YFM/w= +cloud.google.com/go/contactcenterinsights v1.9.1 h1:hy4L0bc3fQNZZrhPjuoH62RiisD5B71/S1OZNunsTRk= cloud.google.com/go/contactcenterinsights v1.9.1/go.mod h1:bsg/R7zGLYMVxFFzfh9ooLTruLRCG9fnzhH9KznHhbM= cloud.google.com/go/container v1.6.0/go.mod h1:Xazp7GjJSeUYo688S+6J5V+n/t+G5sKBTFkKNudGRxg= cloud.google.com/go/container v1.7.0 h1:nbEK/59GyDRKKlo1SqpohY1TK8LmJ2XNcvS9Gyom2A0= @@ -215,12 +240,14 @@ cloud.google.com/go/container v1.7.0/go.mod h1:Dp5AHtmothHGX3DwwIHPgq45Y8KmNsgN3 cloud.google.com/go/container v1.13.1/go.mod h1:6wgbMPeQRw9rSnKBCAJXnds3Pzj03C4JHamr8asWKy4= cloud.google.com/go/container v1.15.0 h1:NKlY/wCDapfVZlbVVaeuu2UZZED5Dy1z4Zx1KhEzm8c= cloud.google.com/go/container v1.15.0/go.mod h1:ft+9S0WGjAyjDggg5S06DXj+fHJICWg8L7isCQe9pQA= +cloud.google.com/go/container v1.22.1 h1:WKBegIfJJc+CL2PIgNpQuvLgGW/CoGJjge5Yjpc0YuU= cloud.google.com/go/container v1.22.1/go.mod h1:lTNExE2R7f+DLbAN+rJiKTisauFCaoDq6NURZ83eVH4= cloud.google.com/go/containeranalysis v0.6.0 h1:2824iym832ljKdVpCBnpqm5K94YT/uHTVhNF+dRTXPI= cloud.google.com/go/containeranalysis v0.6.0/go.mod h1:HEJoiEIu+lEXM+k7+qLCci0h33lX3ZqoYFdmPcoO7s4= cloud.google.com/go/containeranalysis v0.7.0/go.mod h1:9aUL+/vZ55P2CXfuZjS4UjQ9AgXoSw8Ts6lemfmxBxI= cloud.google.com/go/containeranalysis v0.9.0 h1:EQ4FFxNaEAg8PqQCO7bVQfWz9NVwZCUKaM1b3ycfx3U= cloud.google.com/go/containeranalysis v0.9.0/go.mod h1:orbOANbwk5Ejoom+s+DUCTTJ7IBdBQJDcSylAx/on9s= +cloud.google.com/go/containeranalysis v0.10.1 h1:SM/ibWHWp4TYyJMwrILtcBtYKObyupwOVeceI9pNblw= cloud.google.com/go/containeranalysis v0.10.1/go.mod h1:Ya2jiILITMY68ZLPaogjmOMNkwsDrWBSTyBubGXO7j0= cloud.google.com/go/datacatalog v1.6.0/go.mod h1:+aEyF8JKg+uXcIdAmmaMUmZ3q1b/lKLtXCmXdnc0lbc= cloud.google.com/go/datacatalog v1.7.0/go.mod h1:9mEl4AuDYWw81UGc41HonIHH7/sn52H0/tc8f8ZbZIE= @@ -229,11 +256,13 @@ cloud.google.com/go/datacatalog v1.8.0/go.mod h1:KYuoVOv9BM8EYz/4eMFxrr4DUKhGIOX cloud.google.com/go/datacatalog v1.12.0/go.mod h1:CWae8rFkfp6LzLumKOnmVh4+Zle4A3NXLzVJ1d1mRm0= cloud.google.com/go/datacatalog v1.13.0 h1:4H5IJiyUE0X6ShQBqgFFZvGGcrwGVndTwUSLP4c52gw= cloud.google.com/go/datacatalog v1.13.0/go.mod h1:E4Rj9a5ZtAxcQJlEBTLgMTphfP11/lNaAshpoBgemX8= +cloud.google.com/go/datacatalog v1.14.1 h1:cFPBt8V5V2T3mu/96tc4nhcMB+5cYcpwjBfn79bZDI8= cloud.google.com/go/datacatalog v1.14.1/go.mod h1:d2CevwTG4yedZilwe+v3E3ZBDRMobQfSG/a6cCCN5R4= cloud.google.com/go/dataflow v0.7.0 h1:CW3541Fm7KPTyZjJdnX6NtaGXYFn5XbFC5UcjgALKvU= cloud.google.com/go/dataflow v0.7.0/go.mod h1:PX526vb4ijFMesO1o202EaUmouZKBpjHsTlCtB4parQ= cloud.google.com/go/dataflow v0.8.0 h1:eYyD9o/8Nm6EttsKZaEGD84xC17bNgSKCu0ZxwqUbpg= cloud.google.com/go/dataflow v0.8.0/go.mod h1:Rcf5YgTKPtQyYz8bLYhFoIV/vP39eL7fWNcSOyFfLJE= +cloud.google.com/go/dataflow v0.9.1 h1:VzG2tqsk/HbmOtq/XSfdF4cBvUWRK+S+oL9k4eWkENQ= cloud.google.com/go/dataflow v0.9.1/go.mod h1:Wp7s32QjYuQDWqJPFFlnBKhkAtiFpMTdg00qGbnIHVw= cloud.google.com/go/dataform v0.4.0/go.mod h1:fwV6Y4Ty2yIFL89huYlEkwUPtS7YZinZbzzj5S9FzCE= cloud.google.com/go/dataform v0.5.0 h1:vLwowLF2ZB5J5gqiZCzv076lDI/Rd7zYQQFu5XO1PSg= @@ -241,17 +270,20 @@ cloud.google.com/go/dataform v0.5.0/go.mod h1:GFUYRe8IBa2hcomWplodVmUx/iTL0Frsau cloud.google.com/go/dataform v0.6.0/go.mod h1:QPflImQy33e29VuapFdf19oPbE4aYTJxr31OAPV+ulA= cloud.google.com/go/dataform v0.7.0 h1:Dyk+fufup1FR6cbHjFpMuP4SfPiF3LI3JtoIIALoq48= cloud.google.com/go/dataform v0.7.0/go.mod h1:7NulqnVozfHvWUBpMDfKMUESr+85aJsC/2O0o3jWPDE= +cloud.google.com/go/dataform v0.8.1 h1:xcWso0hKOoxeW72AjBSIp/UfkvpqHNzzS0/oygHlcqY= cloud.google.com/go/dataform v0.8.1/go.mod h1:3BhPSiw8xmppbgzeBbmDvmSWlwouuJkXsXsb8UBih9M= cloud.google.com/go/datafusion v1.4.0/go.mod h1:1Zb6VN+W6ALo85cXnM1IKiPw+yQMKMhB9TsTSRDo/38= cloud.google.com/go/datafusion v1.5.0 h1:j5m2hjWovTZDTQak4MJeXAR9yN7O+zMfULnjGw/OOLg= cloud.google.com/go/datafusion v1.5.0/go.mod h1:Kz+l1FGHB0J+4XF2fud96WMmRiq/wj8N9u007vyXZ2w= cloud.google.com/go/datafusion v1.6.0 h1:sZjRnS3TWkGsu1LjYPFD/fHeMLZNXDK6PDHi2s2s/bk= cloud.google.com/go/datafusion v1.6.0/go.mod h1:WBsMF8F1RhSXvVM8rCV3AeyWVxcC2xY6vith3iw3S+8= +cloud.google.com/go/datafusion v1.7.1 h1:eX9CZoyhKQW6g1Xj7+RONeDj1mV8KQDKEB9KLELX9/8= cloud.google.com/go/datafusion v1.7.1/go.mod h1:KpoTBbFmoToDExJUso/fcCiguGDk7MEzOWXUsJo0wsI= cloud.google.com/go/datalabeling v0.6.0 h1:dp8jOF21n/7jwgo/uuA0RN8hvLcKO4q6s/yvwevs2ZM= cloud.google.com/go/datalabeling v0.6.0/go.mod h1:WqdISuk/+WIGeMkpw/1q7bK/tFEZxsrFJOJdY2bXvTQ= cloud.google.com/go/datalabeling v0.7.0 h1:ch4qA2yvddGRUrlfwrNJCr79qLqhS9QBwofPHfFlDIk= cloud.google.com/go/datalabeling v0.7.0/go.mod h1:WPQb1y08RJbmpM3ww0CSUAGweL0SxByuW2E+FU+wXcM= +cloud.google.com/go/datalabeling v0.8.1 h1:zxsCD/BLKXhNuRssen8lVXChUj8VxF3ofN06JfdWOXw= cloud.google.com/go/datalabeling v0.8.1/go.mod h1:XS62LBSVPbYR54GfYQsPXZjTW8UxCK2fkDciSrpRFdY= cloud.google.com/go/dataplex v1.3.0/go.mod h1:hQuRtDg+fCiFgC8j0zV222HvzFQdRd+SVX8gdmFcZzA= cloud.google.com/go/dataplex v1.4.0 h1:cNxeA2DiWliQGi21kPRqnVeQ5xFhNoEjPRt1400Pm8Y= @@ -259,6 +291,7 @@ cloud.google.com/go/dataplex v1.4.0/go.mod h1:X51GfLXEMVJ6UN47ESVqvlsRplbLhcsAt0 cloud.google.com/go/dataplex v1.5.2/go.mod h1:cVMgQHsmfRoI5KFYq4JtIBEUbYwc3c7tXmIDhRmNNVQ= cloud.google.com/go/dataplex v1.6.0 h1:RvoZ5T7gySwm1CHzAw7yY1QwwqaGswunmqEssPxU/AM= cloud.google.com/go/dataplex v1.6.0/go.mod h1:bMsomC/aEJOSpHXdFKFGQ1b0TDPIeL28nJObeO1ppRs= +cloud.google.com/go/dataplex v1.8.1 h1:RvUH/k3Qi5AOXUAmQVsNCcND9qwJJq3biMSPngO0TQY= cloud.google.com/go/dataplex v1.8.1/go.mod h1:7TyrDT6BCdI8/38Uvp0/ZxBslOslP2X2MPDucliyvSE= cloud.google.com/go/dataproc v1.7.0/go.mod h1:CKAlMjII9H90RXaMpSxQ8EU6dQx6iAYNPcYPOkSbi8s= cloud.google.com/go/dataproc v1.8.0 h1:gVOqNmElfa6n/ccG/QDlfurMWwrK3ezvy2b2eDoCmS0= @@ -269,11 +302,13 @@ cloud.google.com/go/dataqna v0.6.0 h1:gx9jr41ytcA3dXkbbd409euEaWtofCVXYBvJz3iYm1 cloud.google.com/go/dataqna v0.6.0/go.mod h1:1lqNpM7rqNLVgWBJyk5NF6Uen2PHym0jtVJonplVsDA= cloud.google.com/go/dataqna v0.7.0 h1:yFzi/YU4YAdjyo7pXkBE2FeHbgz5OQQBVDdbErEHmVQ= cloud.google.com/go/dataqna v0.7.0/go.mod h1:Lx9OcIIeqCrw1a6KdO3/5KMP1wAmTc0slZWwP12Qq3c= +cloud.google.com/go/dataqna v0.8.1 h1:ITpUJep04hC9V7C+gcK390HO++xesQFSUJ7S4nSnF3U= cloud.google.com/go/dataqna v0.8.1/go.mod h1:zxZM0Bl6liMePWsHA8RMGAfmTG34vJMapbHAxQ5+WA8= cloud.google.com/go/datastore v1.10.0 h1:4siQRf4zTiAVt/oeH4GureGkApgb2vtPQAtOmhpqQwE= cloud.google.com/go/datastore v1.10.0/go.mod h1:PC5UzAmDEkAmkfaknstTYbNpgE49HAgW2J1gcgUfmdM= cloud.google.com/go/datastore v1.11.0 h1:iF6I/HaLs3Ado8uRKMvZRvF/ZLkWaWE9i8AiHzbC774= cloud.google.com/go/datastore v1.11.0/go.mod h1:TvGxBIHCS50u8jzG+AW/ppf87v1of8nwzFNgEZU1D3c= +cloud.google.com/go/datastore v1.12.1 h1:i8HMKsqg/Sl3ZlOTGl471Z8j2uKtbRDT9VXJUIVlMik= cloud.google.com/go/datastore v1.12.1/go.mod h1:KjdB88W897MRITkvWWJrg2OUtrR5XVj1EoLgSp6/N70= cloud.google.com/go/datastream v1.3.0/go.mod h1:cqlOX8xlyYF/uxhiKn6Hbv6WjwPPuI9W2M9SAXwaLLQ= cloud.google.com/go/datastream v1.4.0/go.mod h1:h9dpzScPhDTs5noEMQVWP8Wx8AFBRyS0s8KWPx/9r0g= @@ -282,6 +317,7 @@ cloud.google.com/go/datastream v1.5.0/go.mod h1:6TZMMNPwjUqZHBKPQ1wwXpb0d5VDVPl2 cloud.google.com/go/datastream v1.6.0/go.mod h1:6LQSuswqLa7S4rPAOZFVjHIG3wJIjZcZrw8JDEDJuIs= cloud.google.com/go/datastream v1.7.0 h1:BBCBTnWMDwwEzQQmipUXxATa7Cm7CA/gKjKcR2w35T0= cloud.google.com/go/datastream v1.7.0/go.mod h1:uxVRMm2elUSPuh65IbZpzJNMbuzkcvu5CjMqVIUHrww= +cloud.google.com/go/datastream v1.9.1 h1:BxAt9Tvi1hoEqI4fvyXh/Oc8vd7b5aCZb3bzewh8Dvg= cloud.google.com/go/datastream v1.9.1/go.mod h1:hqnmr8kdUBmrnk65k5wNRoHSCYksvpdZIcZIEl8h43Q= cloud.google.com/go/deploy v1.4.0/go.mod h1:5Xghikd4VrmMLNaF6FiRFDlHb59VM59YoDQnOUdsH/c= cloud.google.com/go/deploy v1.5.0 h1:kI6dxt8Ml0is/x7YZjLveTvR7YPzXAUD/8wQZ2nH5zA= @@ -289,6 +325,7 @@ cloud.google.com/go/deploy v1.5.0/go.mod h1:ffgdD0B89tToyW/U/D2eL0jN2+IEV/3EMuXH cloud.google.com/go/deploy v1.6.0/go.mod h1:f9PTHehG/DjCom3QH0cntOVRm93uGBDt2vKzAPwpXQI= cloud.google.com/go/deploy v1.8.0 h1:otshdKEbmsi1ELYeCKNYppwV0UH5xD05drSdBm7ouTk= cloud.google.com/go/deploy v1.8.0/go.mod h1:z3myEJnA/2wnB4sgjqdMfgxCA0EqC3RBTNcVPs93mtQ= +cloud.google.com/go/deploy v1.11.0 h1:rp+Sf2bWuqJYBuygQl6diFAdvlR8kklhD+stDvyl1zM= cloud.google.com/go/deploy v1.11.0/go.mod h1:tKuSUV5pXbn67KiubiUNUejqLs4f5cxxiCNCeyl0F2g= cloud.google.com/go/dialogflow v1.16.1/go.mod h1:po6LlzGfK+smoSmTBnbkIZY2w8ffjz/RcGSS+sh1el0= cloud.google.com/go/dialogflow v1.18.0/go.mod h1:trO7Zu5YdyEuR+BhSNOqJezyFQ3aUzz0njv7sMx/iek= @@ -297,12 +334,14 @@ cloud.google.com/go/dialogflow v1.19.0/go.mod h1:JVmlG1TwykZDtxtTXujec4tQ+D8SBFM cloud.google.com/go/dialogflow v1.31.0/go.mod h1:cuoUccuL1Z+HADhyIA7dci3N5zUssgpBJmCzI6fNRB4= cloud.google.com/go/dialogflow v1.32.0 h1:uVlKKzp6G/VtSW0E7IH1Y5o0H48/UOCmqksG2riYCwQ= cloud.google.com/go/dialogflow v1.32.0/go.mod h1:jG9TRJl8CKrDhMEcvfcfFkkpp8ZhgPz3sBGmAUYJ2qE= +cloud.google.com/go/dialogflow v1.38.0 h1:kP0t9SX0w3Fbs1q36mSZ3GQuyOgauVhdNXw0wK4cmOI= cloud.google.com/go/dialogflow v1.38.0/go.mod h1:L7jnH+JL2mtmdChzAIcXQHXMvQkE3U4hTaNltEuxXn4= cloud.google.com/go/dlp v1.6.0/go.mod h1:9eyB2xIhpU0sVwUixfBubDoRwP+GjeUoxxeueZmqvmM= cloud.google.com/go/dlp v1.7.0 h1:9I4BYeJSVKoSKgjr70fLdRDumqcUeVmHV4fd5f9LR6Y= cloud.google.com/go/dlp v1.7.0/go.mod h1:68ak9vCiMBjbasxeVD17hVPxDEck+ExiHavX8kiHG+Q= cloud.google.com/go/dlp v1.9.0 h1:1JoJqezlgu6NWCroBxr4rOZnwNFILXr4cB9dMaSKO4A= cloud.google.com/go/dlp v1.9.0/go.mod h1:qdgmqgTyReTz5/YNSSuueR8pl7hO0o9bQ39ZhtgkWp4= +cloud.google.com/go/dlp v1.10.1 h1:tF3wsJ2QulRhRLWPzWVkeDz3FkOGVoMl6cmDUHtfYxw= cloud.google.com/go/dlp v1.10.1/go.mod h1:IM8BWz1iJd8njcNcG0+Kyd9OPnqnRNkDV8j42VT5KOI= cloud.google.com/go/documentai v1.8.0/go.mod h1:xGHNEB7CtsnySCNrCFdCyyMz44RhFEEX2Q7UD0c5IhU= cloud.google.com/go/documentai v1.9.0/go.mod h1:FS5485S8R00U10GhgBC0aNGrJxBP8ZVpEeJ7PQDZd6k= @@ -311,11 +350,13 @@ cloud.google.com/go/documentai v1.10.0/go.mod h1:vod47hKQIPeCfN2QS/jULIvQTugbmdc cloud.google.com/go/documentai v1.16.0/go.mod h1:o0o0DLTEZ+YnJZ+J4wNfTxmDVyrkzFvttBXXtYRMHkM= cloud.google.com/go/documentai v1.18.0 h1:KM3Xh0QQyyEdC8Gs2vhZfU+rt6OCPF0dwVwxKgLmWfI= cloud.google.com/go/documentai v1.18.0/go.mod h1:F6CK6iUH8J81FehpskRmhLq/3VlwQvb7TvwOceQ2tbs= +cloud.google.com/go/documentai v1.20.0 h1:DK9nDulPQgdy3pJIYjMIRrFSAe/Ch3TpfHVn83aV/Gk= cloud.google.com/go/documentai v1.20.0/go.mod h1:yJkInoMcK0qNAEdRnqY/D5asy73tnPe88I1YTZT+a8E= cloud.google.com/go/domains v0.7.0 h1:pu3JIgC1rswIqi5romW0JgNO6CTUydLYX8zyjiAvO1c= cloud.google.com/go/domains v0.7.0/go.mod h1:PtZeqS1xjnXuRPKE/88Iru/LdfoRyEHYA9nFQf4UKpg= cloud.google.com/go/domains v0.8.0 h1:2ti/o9tlWL4N+wIuWUNH+LbfgpwxPr8J1sv9RHA4bYQ= cloud.google.com/go/domains v0.8.0/go.mod h1:M9i3MMDzGFXsydri9/vW+EWz9sWb4I6WyHqdlAk0idE= +cloud.google.com/go/domains v0.9.1 h1:rqz6KY7mEg7Zs/69U6m6LMbB7PxFDWmT3QWNXIqhHm0= cloud.google.com/go/domains v0.9.1/go.mod h1:aOp1c0MbejQQ2Pjf1iJvnVyT+z6R6s8pX66KaCSDYfE= cloud.google.com/go/edgecontainer v0.1.0/go.mod h1:WgkZ9tp10bFxqO8BLPqv2LlfmQF1X8lZqwW4r1BTajk= cloud.google.com/go/edgecontainer v0.2.0 h1:hd6J2n5dBBRuAqnNUEsKWrp6XNPKsaxwwIyzOPZTokk= @@ -323,6 +364,7 @@ cloud.google.com/go/edgecontainer v0.2.0/go.mod h1:RTmLijy+lGpQ7BXuTDa4C4ssxyXT3 cloud.google.com/go/edgecontainer v0.3.0/go.mod h1:FLDpP4nykgwwIfcLt6zInhprzw0lEi2P1fjO6Ie0qbc= cloud.google.com/go/edgecontainer v1.0.0 h1:O0YVE5v+O0Q/ODXYsQHmHb+sYM8KNjGZw2pjX2Ws41c= cloud.google.com/go/edgecontainer v1.0.0/go.mod h1:cttArqZpBB2q58W/upSG++ooo6EsblxDIolxa3jSjbY= +cloud.google.com/go/edgecontainer v1.1.1 h1:zhHWnLzg6AqzE+I3gzJqiIwHfjEBhWctNQEzqb+FaRo= cloud.google.com/go/edgecontainer v1.1.1/go.mod h1:O5bYcS//7MELQZs3+7mabRqoWQhXCzenBu0R8bz2rwk= cloud.google.com/go/errorreporting v0.3.0 h1:kj1XEWMu8P0qlLhm3FwcaFsUvXChV/OraZwA70trRR0= cloud.google.com/go/errorreporting v0.3.0/go.mod h1:xsP2yaAp+OAW4OIm60An2bbLpqIhKXdWR/tawvl7QzU= @@ -331,6 +373,7 @@ cloud.google.com/go/essentialcontacts v1.4.0 h1:b6csrQXCHKQmfo9h3dG/pHyoEh+fQG1Y cloud.google.com/go/essentialcontacts v1.4.0/go.mod h1:8tRldvHYsmnBCHdFpvU+GL75oWiBKl80BiqlFh9tp+8= cloud.google.com/go/essentialcontacts v1.5.0 h1:gIzEhCoOT7bi+6QZqZIzX1Erj4SswMPIteNvYVlu+pM= cloud.google.com/go/essentialcontacts v1.5.0/go.mod h1:ay29Z4zODTuwliK7SnX8E86aUF2CTzdNtvv42niCX0M= +cloud.google.com/go/essentialcontacts v1.6.2 h1:OEJ0MLXXCW/tX1fkxzEZOsv/wRfyFsvDVNaHWBAvoV0= cloud.google.com/go/essentialcontacts v1.6.2/go.mod h1:T2tB6tX+TRak7i88Fb2N9Ok3PvY3UNbUsMag9/BARh4= cloud.google.com/go/eventarc v1.7.0/go.mod h1:6ctpF3zTnaQCxUjHUdcfgcA1A2T309+omHZth7gDfmc= cloud.google.com/go/eventarc v1.8.0 h1:AgCqrmMMIcel5WWKkzz5EkCUKC3Rl5LNMMYsS+LvsI0= @@ -338,6 +381,7 @@ cloud.google.com/go/eventarc v1.8.0/go.mod h1:imbzxkyAU4ubfsaKYdQg04WS1NvncblHEu cloud.google.com/go/eventarc v1.10.0/go.mod h1:u3R35tmZ9HvswGRBnF48IlYgYeBcPUCjkr4BTdem2Kw= cloud.google.com/go/eventarc v1.11.0 h1:fsJmNeqvqtk74FsaVDU6cH79lyZNCYP8Rrv7EhaB/PU= cloud.google.com/go/eventarc v1.11.0/go.mod h1:PyUjsUKPWoRBCHeOxZd/lbOOjahV41icXyUY5kSTvVY= +cloud.google.com/go/eventarc v1.12.1 h1:8ZAkv7MTnAhix5kSw+Cm/xVzG8+OhC+flZGL9iRdpQA= cloud.google.com/go/eventarc v1.12.1/go.mod h1:mAFCW6lukH5+IZjkvrEss+jmt2kOdYlN8aMx3sRJiAI= cloud.google.com/go/filestore v1.3.0/go.mod h1:+qbvHGvXU1HaKX2nD0WEPo92TP/8AQuCVEBXNY9z0+w= cloud.google.com/go/filestore v1.4.0 h1:yjKOpzvqtDmL5AXbKttLc8j0hL20kuC1qPdy5HPcxp0= @@ -345,9 +389,11 @@ cloud.google.com/go/filestore v1.4.0/go.mod h1:PaG5oDfo9r224f8OYXURtAsY+Fbyq/bLY cloud.google.com/go/filestore v1.5.0/go.mod h1:FqBXDWBp4YLHqRnVGveOkHDf8svj9r5+mUDLupOWEDs= cloud.google.com/go/filestore v1.6.0 h1:ckTEXN5towyTMu4q0uQ1Mde/JwTHur0gXs8oaIZnKfw= cloud.google.com/go/filestore v1.6.0/go.mod h1:di5unNuss/qfZTw2U9nhFqo8/ZDSc466dre85Kydllg= +cloud.google.com/go/filestore v1.7.1 h1:Eiz8xZzMJc5ppBWkuaod/PUdUZGCFR8ku0uS+Ah2fRw= cloud.google.com/go/filestore v1.7.1/go.mod h1:y10jsorq40JJnjR/lQ8AfFbbcGlw3g+Dp8oN7i7FjV4= cloud.google.com/go/firestore v1.9.0 h1:IBlRyxgGySXu5VuW0RgGFlTtLukSnNkpDiEOMkQkmpA= cloud.google.com/go/firestore v1.9.0/go.mod h1:HMkjKHNTtRyZNiMzu7YAsLr9K3X2udY2AMwDaMEQiiE= +cloud.google.com/go/firestore v1.11.0 h1:PPgtwcYUOXV2jFe1bV3nda3RCrOa8cvBjTOn2MQVfW8= cloud.google.com/go/firestore v1.11.0/go.mod h1:b38dKhgzlmNNGTNZZwe7ZRFEuRab1Hay3/DBsIGKKy4= cloud.google.com/go/functions v1.7.0/go.mod h1:+d+QBcWM+RsrgZfV9xo6KfA1GlzJfxcfZcRPEhDDfzg= cloud.google.com/go/functions v1.8.0/go.mod h1:RTZ4/HsQjIqIYP9a9YPbU+QFoQsAlYgrwOXJWHn1POY= @@ -356,6 +402,7 @@ cloud.google.com/go/functions v1.9.0/go.mod h1:Y+Dz8yGguzO3PpIjhLTbnqV1CWmgQ5Uwt cloud.google.com/go/functions v1.10.0/go.mod h1:0D3hEOe3DbEvCXtYOZHQZmD+SzYsi1YbI7dGvHfldXw= cloud.google.com/go/functions v1.13.0 h1:pPDqtsXG2g9HeOQLoquLbmvmb82Y4Ezdo1GXuotFoWg= cloud.google.com/go/functions v1.13.0/go.mod h1:EU4O007sQm6Ef/PwRsI8N2umygGqPBS/IZQKBQBcJ3c= +cloud.google.com/go/functions v1.15.1 h1:LtAyqvO1TFmNLcROzHZhV0agEJfBi+zfMZsF4RT/a7U= cloud.google.com/go/functions v1.15.1/go.mod h1:P5yNWUTkyU+LvW/S9O6V+V423VZooALQlqoXdoPz5AE= cloud.google.com/go/gaming v1.6.0/go.mod h1:YMU1GEvA39Qt3zWGyAVA9bpYz/yAhTvaQ1t2sK4KPUA= cloud.google.com/go/gaming v1.7.0/go.mod h1:LrB8U7MHdGgFG851iHAfqUdLcKBdQ55hzXy9xBJz0+w= @@ -363,6 +410,8 @@ cloud.google.com/go/gaming v1.8.0 h1:97OAEQtDazAJD7yh/kvQdSCQuTKdR0O+qWAJBZJ4xiA cloud.google.com/go/gaming v1.8.0/go.mod h1:xAqjS8b7jAVW0KFYeRUxngo9My3f33kFmua++Pi+ggM= cloud.google.com/go/gaming v1.9.0 h1:7vEhFnZmd931Mo7sZ6pJy7uQPDxF7m7v8xtBheG08tc= cloud.google.com/go/gaming v1.9.0/go.mod h1:Fc7kEmCObylSWLO334NcO+O9QMDyz+TKC4v1D7X+Bc0= +cloud.google.com/go/gaming v1.10.1 h1:5qZmZEWzMf8GEFgm9NeC3bjFRpt7x4S6U7oLbxaf7N8= +cloud.google.com/go/gaming v1.10.1/go.mod h1:XQQvtfP8Rb9Rxnxm5wFVpAp9zCQkJi2bLIb7iHGwB3s= cloud.google.com/go/gkebackup v0.2.0/go.mod h1:XKvv/4LfG829/B8B7xRkk8zRrOEbKtEam6yNfuQNH60= cloud.google.com/go/gkebackup v0.3.0 h1:4K+jiv4ocqt1niN8q5Imd8imRoXBHTrdnJVt/uFFxF4= cloud.google.com/go/gkebackup v0.3.0/go.mod h1:n/E671i1aOQvUxT541aTkCwExO/bTer2HDlj4TsBRAo= @@ -372,25 +421,31 @@ cloud.google.com/go/gkeconnect v0.6.0 h1:zAcvDa04tTnGdu6TEZewaLN2tdMtUOJJ7fEceUL cloud.google.com/go/gkeconnect v0.6.0/go.mod h1:Mln67KyU/sHJEBY8kFZ0xTeyPtzbq9StAVvEULYK16A= cloud.google.com/go/gkeconnect v0.7.0 h1:gXYKciHS/Lgq0GJ5Kc9SzPA35NGc3yqu6SkjonpEr2Q= cloud.google.com/go/gkeconnect v0.7.0/go.mod h1:SNfmVqPkaEi3bF/B3CNZOAYPYdg7sU+obZ+QTky2Myw= +cloud.google.com/go/gkeconnect v0.8.1 h1:a1ckRvVznnuvDWESM2zZDzSVFvggeBaVY5+BVB8tbT0= cloud.google.com/go/gkeconnect v0.8.1/go.mod h1:KWiK1g9sDLZqhxB2xEuPV8V9NYzrqTUmQR9shJHpOZw= cloud.google.com/go/gkehub v0.10.0 h1:JTcTaYQRGsVm+qkah7WzHb6e9sf1C0laYdRPn9aN+vg= cloud.google.com/go/gkehub v0.10.0/go.mod h1:UIPwxI0DsrpsVoWpLB0stwKCP+WFVG9+y977wO+hBH0= cloud.google.com/go/gkehub v0.11.0/go.mod h1:JOWHlmN+GHyIbuWQPl47/C2RFhnFKH38jH9Ascu3n0E= cloud.google.com/go/gkehub v0.12.0 h1:TqCSPsEBQ6oZSJgEYZ3XT8x2gUadbvfwI32YB0kuHCs= cloud.google.com/go/gkehub v0.12.0/go.mod h1:djiIwwzTTBrF5NaXCGv3mf7klpEMcST17VBTVVDcuaw= +cloud.google.com/go/gkehub v0.14.1 h1:2BLSb8i+Co1P05IYCKATXy5yaaIw/ZqGvVSBTLdzCQo= cloud.google.com/go/gkehub v0.14.1/go.mod h1:VEXKIJZ2avzrbd7u+zeMtW00Y8ddk/4V9511C9CQGTY= cloud.google.com/go/gkemulticloud v0.3.0/go.mod h1:7orzy7O0S+5kq95e4Hpn7RysVA7dPs8W/GgfUtsPbrA= cloud.google.com/go/gkemulticloud v0.4.0 h1:8F1NhJj8ucNj7lK51UZMtAjSWTgP1zO18XF6vkfiPPU= cloud.google.com/go/gkemulticloud v0.4.0/go.mod h1:E9gxVBnseLWCk24ch+P9+B2CoDFJZTyIgLKSalC7tuI= cloud.google.com/go/gkemulticloud v0.5.0 h1:8I84Q4vl02rJRsFiinBxl7WCozfdLlUVBQuSrqr9Wtk= cloud.google.com/go/gkemulticloud v0.5.0/go.mod h1:W0JDkiyi3Tqh0TJr//y19wyb1yf8llHVto2Htf2Ja3Y= +cloud.google.com/go/gkemulticloud v0.6.1 h1:vg81EW3GQ4RO4PT1MdNHE8aF87EiohZp/WwMWfUTTR0= cloud.google.com/go/gkemulticloud v0.6.1/go.mod h1:kbZ3HKyTsiwqKX7Yw56+wUGwwNZViRnxWK2DVknXWfw= cloud.google.com/go/grafeas v0.2.0 h1:CYjC+xzdPvbV65gi6Dr4YowKcmLo045pm18L0DhdELM= +cloud.google.com/go/grafeas v0.3.0 h1:oyTL/KjiUeBs9eYLw/40cpSZglUC+0F7X4iu/8t7NWs= +cloud.google.com/go/grafeas v0.3.0/go.mod h1:P7hgN24EyONOTMyeJH6DxG4zD7fwiYa5Q6GUgyFSOU8= cloud.google.com/go/gsuiteaddons v1.3.0/go.mod h1:EUNK/J1lZEZO8yPtykKxLXI6JSVN2rg9bN8SXOa0bgM= cloud.google.com/go/gsuiteaddons v1.4.0 h1:TGT2oGmO5q3VH6SjcrlgPUWI0njhYv4kywLm6jag0to= cloud.google.com/go/gsuiteaddons v1.4.0/go.mod h1:rZK5I8hht7u7HxFQcFei0+AtfS9uSushomRlg+3ua1o= cloud.google.com/go/gsuiteaddons v1.5.0 h1:1mvhXqJzV0Vg5Fa95QwckljODJJfDFXV4pn+iL50zzA= cloud.google.com/go/gsuiteaddons v1.5.0/go.mod h1:TFCClYLd64Eaa12sFVmUyG62tk4mdIsI7pAnSXRkcFo= +cloud.google.com/go/gsuiteaddons v1.6.1 h1:mi9jxZpzVjLQibTS/XfPZvl+Jr6D5Bs8pGqUjllRb00= cloud.google.com/go/gsuiteaddons v1.6.1/go.mod h1:CodrdOqRZcLp5WOwejHWYBjZvfY0kOphkAKpF/3qdZY= cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= cloud.google.com/go/iam v0.6.0/go.mod h1:+1AH33ueBne5MzYccyMHtEKqLE4/kJOibtffMHDMFMc= @@ -400,6 +455,7 @@ cloud.google.com/go/iam v0.8.0/go.mod h1:lga0/y3iH6CX7sYqypWJ33hf7kkfXJag67naqGE cloud.google.com/go/iam v0.12.0/go.mod h1:knyHGviacl11zrtZUoDuYpDgLjvr28sLQaG0YB2GYAY= cloud.google.com/go/iam v0.13.0 h1:+CmB+K0J/33d0zSQ9SlFWUeCCEn5XJA0ZMZ3pHE9u8k= cloud.google.com/go/iam v0.13.0/go.mod h1:ljOg+rcNfzZ5d6f1nAUJ8ZIxOaZUVoS14bKCtaLZ/D0= +cloud.google.com/go/iam v1.1.1 h1:lW7fzj15aVIXYHREOqjRBV9PsH0Z6u8Y46a1YGvQP4Y= cloud.google.com/go/iam v1.1.1/go.mod h1:A5avdyVL2tCppe4unb0951eI9jreack+RJ0/d+KUZOU= cloud.google.com/go/iap v1.4.0/go.mod h1:RGFwRJdihTINIe4wZ2iCP0zF/qu18ZwyKxrhMhygBEc= cloud.google.com/go/iap v1.5.0 h1:BGEXovwejOCt1zDk8hXq0bOhhRu9haXKWXXXp2B4wBM= @@ -407,12 +463,14 @@ cloud.google.com/go/iap v1.5.0/go.mod h1:UH/CGgKd4KyohZL5Pt0jSKE4m3FR51qg6FKQ/z/ cloud.google.com/go/iap v1.6.0/go.mod h1:NSuvI9C/j7UdjGjIde7t7HBz+QTwBcapPE07+sSRcLk= cloud.google.com/go/iap v1.7.1 h1:PxVHFuMxmSZyfntKXHXhd8bo82WJ+LcATenq7HLdVnU= cloud.google.com/go/iap v1.7.1/go.mod h1:WapEwPc7ZxGt2jFGB/C/bm+hP0Y6NXzOYGjpPnmMS74= +cloud.google.com/go/iap v1.8.1 h1:X1tcp+EoJ/LGX6cUPt3W2D4H2Kbqq0pLAsldnsCjLlE= cloud.google.com/go/iap v1.8.1/go.mod h1:sJCbeqg3mvWLqjZNsI6dfAtbbV1DL2Rl7e1mTyXYREQ= cloud.google.com/go/ids v1.1.0/go.mod h1:WIuwCaYVOzHIj2OhN9HAwvW+DBdmUAdcWlFxRl+KubM= cloud.google.com/go/ids v1.2.0 h1:LncHK4HHucb5Du310X8XH9/ICtMwZ2PCfK0ScjWiJoY= cloud.google.com/go/ids v1.2.0/go.mod h1:5WXvp4n25S0rA/mQWAg1YEEBBq6/s+7ml1RDCW1IrcY= cloud.google.com/go/ids v1.3.0 h1:fodnCDtOXuMmS8LTC2y3h8t24U8F3eKWfhi+3LY6Qf0= cloud.google.com/go/ids v1.3.0/go.mod h1:JBdTYwANikFKaDP6LtW5JAi4gubs57SVNQjemdt6xV4= +cloud.google.com/go/ids v1.4.1 h1:khXYmSoDDhWGEVxHl4c4IgbwSRR+qE/L4hzP3vaU9Hc= cloud.google.com/go/ids v1.4.1/go.mod h1:np41ed8YMU8zOgv53MMMoCntLTn2lF+SUzlM+O3u/jw= cloud.google.com/go/iot v1.3.0/go.mod h1:r7RGh2B61+B8oz0AGE+J72AhA0G7tdXItODWsaA2oLs= cloud.google.com/go/iot v1.4.0 h1:Y9+oZT9jD4GUZzORXTU45XsnQrhxmDT+TFbPil6pRVQ= @@ -420,6 +478,7 @@ cloud.google.com/go/iot v1.4.0/go.mod h1:dIDxPOn0UvNDUMD8Ger7FIaTuvMkj+aGk94RPP0 cloud.google.com/go/iot v1.5.0/go.mod h1:mpz5259PDl3XJthEmh9+ap0affn/MqNSP4My77Qql9o= cloud.google.com/go/iot v1.6.0 h1:39W5BFSarRNZfVG0eXI5LYux+OVQT8GkgpHCnrZL2vM= cloud.google.com/go/iot v1.6.0/go.mod h1:IqdAsmE2cTYYNO1Fvjfzo9po179rAtJeVGUvkLN3rLE= +cloud.google.com/go/iot v1.7.1 h1:yrH0OSmicD5bqGBoMlWG8UltzdLkYzNUwNVUVz7OT54= cloud.google.com/go/iot v1.7.1/go.mod h1:46Mgw7ev1k9KqK1ao0ayW9h0lI+3hxeanz+L1zmbbbk= cloud.google.com/go/kms v1.5.0/go.mod h1:QJS2YY0eJGBg3mnDfuaCyLauWwBJiHRboYxJ++1xJNg= cloud.google.com/go/kms v1.6.0 h1:OWRZzrPmOZUzurjI2FBGtgY2mB1WaJkqhw6oIwSj0Yg= @@ -427,6 +486,7 @@ cloud.google.com/go/kms v1.6.0/go.mod h1:Jjy850yySiasBUDi6KFUwUv2n1+o7QZFyuUJg6O cloud.google.com/go/kms v1.9.0/go.mod h1:qb1tPTgfF9RQP8e1wq4cLFErVuTJv7UsSC915J8dh3w= cloud.google.com/go/kms v1.10.1 h1:7hm1bRqGCA1GBRQUrp831TwJ9TWhP+tvLuP497CQS2g= cloud.google.com/go/kms v1.10.1/go.mod h1:rIWk/TryCkR59GMC3YtHtXeLzd634lBbKenvyySAyYI= +cloud.google.com/go/kms v1.12.1 h1:xZmZuwy2cwzsocmKDOPu4BL7umg8QXagQx6fKVmf45U= cloud.google.com/go/kms v1.12.1/go.mod h1:c9J991h5DTl+kg7gi3MYomh12YEENGrf48ee/N/2CDM= cloud.google.com/go/language v1.6.0/go.mod h1:6dJ8t3B+lUYfStgls25GusK04NLh3eDLQnWM3mdEbhI= cloud.google.com/go/language v1.7.0/go.mod h1:DJ6dYN/W+SQOjF8e1hLQXMF21AkH2w9wiPzPCJa2MIE= @@ -434,11 +494,13 @@ cloud.google.com/go/language v1.8.0 h1:3Wa+IUMamL4JH3Zd3cDZUHpwyqplTACt6UZKRD2eC cloud.google.com/go/language v1.8.0/go.mod h1:qYPVHf7SPoNNiCL2Dr0FfEFNil1qi3pQEyygwpgVKB8= cloud.google.com/go/language v1.9.0 h1:7Ulo2mDk9huBoBi8zCE3ONOoBrL6UXfAI71CLQ9GEIM= cloud.google.com/go/language v1.9.0/go.mod h1:Ns15WooPM5Ad/5no/0n81yUetis74g3zrbeJBE+ptUY= +cloud.google.com/go/language v1.10.1 h1:3MXeGEv8AlX+O2LyV4pO4NGpodanc26AmXwOuipEym0= cloud.google.com/go/language v1.10.1/go.mod h1:CPp94nsdVNiQEt1CNjF5WkTcisLiHPyIbMhvR8H2AW0= cloud.google.com/go/lifesciences v0.6.0 h1:tIqhivE2LMVYkX0BLgG7xL64oNpDaFFI7teunglt1tI= cloud.google.com/go/lifesciences v0.6.0/go.mod h1:ddj6tSX/7BOnhxCSd3ZcETvtNr8NZ6t/iPhY2Tyfu08= cloud.google.com/go/lifesciences v0.8.0 h1:uWrMjWTsGjLZpCTWEAzYvyXj+7fhiZST45u9AgasasI= cloud.google.com/go/lifesciences v0.8.0/go.mod h1:lFxiEOMqII6XggGbOnKiyZ7IBwoIqA84ClvoezaA/bo= +cloud.google.com/go/lifesciences v0.9.1 h1:axkANGx1wiBXHiPcJZAE+TDjjYoJRIDzbHC/WYllCBU= cloud.google.com/go/lifesciences v0.9.1/go.mod h1:hACAOd1fFbCGLr/+weUKRAJas82Y4vrL3O5326N//Wc= cloud.google.com/go/logging v1.6.1 h1:ZBsZK+JG+oCDT+vaxwqF2egKNRjz8soXiS6Xv79benI= cloud.google.com/go/logging v1.6.1/go.mod h1:5ZO0mHHbvm8gEmeEUHrmDlTDSu5imF6MUP9OfilNXBw= @@ -450,12 +512,14 @@ cloud.google.com/go/longrunning v0.3.0/go.mod h1:qth9Y41RRSUE69rDcOn6DdK3HfQfsUI cloud.google.com/go/longrunning v0.4.1 h1:v+yFJOfKC3yZdY6ZUI933pIYdhyhV8S3NpWrXWmg7jM= cloud.google.com/go/longrunning v0.4.1/go.mod h1:4iWDqhBZ70CvZ6BfETbvam3T8FMvLK+eFj0E6AaRQTo= cloud.google.com/go/longrunning v0.5.0/go.mod h1:0JNuqRShmscVAhIACGtskSAWtqtOoPkwP0YF1oVEchc= +cloud.google.com/go/longrunning v0.5.1 h1:Fr7TXftcqTudoyRJa113hyaqlGdiBQkp0Gq7tErFDWI= cloud.google.com/go/longrunning v0.5.1/go.mod h1:spvimkwdz6SPWKEt/XBij79E9fiTkHSQl/fRUUQJYJc= cloud.google.com/go/managedidentities v1.3.0/go.mod h1:UzlW3cBOiPrzucO5qWkNkh0w33KFtBJU281hacNvsdE= cloud.google.com/go/managedidentities v1.4.0 h1:3Kdajn6X25yWQFhFCErmKSYTSvkEd3chJROny//F1A0= cloud.google.com/go/managedidentities v1.4.0/go.mod h1:NWSBYbEMgqmbZsLIyKvxrYbtqOsxY1ZrGM+9RgDqInM= cloud.google.com/go/managedidentities v1.5.0 h1:ZRQ4k21/jAhrHBVKl/AY7SjgzeJwG1iZa+mJ82P+VNg= cloud.google.com/go/managedidentities v1.5.0/go.mod h1:+dWcZ0JlUmpuxpIDfyP5pP5y0bLdRwOS4Lp7gMni/LA= +cloud.google.com/go/managedidentities v1.6.1 h1:2/qZuOeLgUHorSdxSQGtnOu9xQkBn37+j+oZQv/KHJY= cloud.google.com/go/managedidentities v1.6.1/go.mod h1:h/irGhTN2SkZ64F43tfGPMbHnypMbu4RB3yl8YcuEak= cloud.google.com/go/maps v0.1.0 h1:kLReRbclTgJefw2fcCbdLPLhPj0U6UUWN10ldG8sdOU= cloud.google.com/go/maps v0.1.0/go.mod h1:BQM97WGyfw9FWEmQMpZ5T6cpovXXSd1cGmFma94eubI= @@ -466,6 +530,7 @@ cloud.google.com/go/mediatranslation v0.6.0 h1:qAJzpxmEX+SeND10Y/4868L5wfZpo4Y3B cloud.google.com/go/mediatranslation v0.6.0/go.mod h1:hHdBCTYNigsBxshbznuIMFNe5QXEowAuNmmC7h8pu5w= cloud.google.com/go/mediatranslation v0.7.0 h1:anPxH+/WWt8Yc3EdoEJhPMBRF7EhIdz426A+tuoA0OU= cloud.google.com/go/mediatranslation v0.7.0/go.mod h1:LCnB/gZr90ONOIQLgSXagp8XUW1ODs2UmUMvcgMfI2I= +cloud.google.com/go/mediatranslation v0.8.1 h1:50cF7c1l3BanfKrpnTCaTvhf+Fo6kdF21DG0byG7gYU= cloud.google.com/go/mediatranslation v0.8.1/go.mod h1:L/7hBdEYbYHQJhX2sldtTO5SZZ1C1vkapubj0T2aGig= cloud.google.com/go/memcache v1.5.0/go.mod h1:dk3fCK7dVo0cUU2c36jKb4VqKPS22BTkf81Xq617aWM= cloud.google.com/go/memcache v1.6.0/go.mod h1:XS5xB0eQZdHtTuTF9Hf8eJkKtR3pVRCcvJwtm68T3rA= @@ -473,6 +538,7 @@ cloud.google.com/go/memcache v1.7.0 h1:yLxUzJkZVSH2kPaHut7k+7sbIBFpvSh1LW9qjM2JD cloud.google.com/go/memcache v1.7.0/go.mod h1:ywMKfjWhNtkQTxrWxCkCFkoPjLHPW6A7WOTVI8xy3LY= cloud.google.com/go/memcache v1.9.0 h1:8/VEmWCpnETCrBwS3z4MhT+tIdKgR1Z4Tr2tvYH32rg= cloud.google.com/go/memcache v1.9.0/go.mod h1:8oEyzXCu+zo9RzlEaEjHl4KkgjlNDaXbCQeQWlzNFJM= +cloud.google.com/go/memcache v1.10.1 h1:7lkLsF0QF+Mre0O/NvkD9Q5utUNwtzvIYjrOLOs0HO0= cloud.google.com/go/memcache v1.10.1/go.mod h1:47YRQIarv4I3QS5+hoETgKO40InqzLP6kpNLvyXuyaA= cloud.google.com/go/metastore v1.6.0/go.mod h1:6cyQTls8CWXzk45G55x57DVQ9gWg7RiH65+YgPsNh9s= cloud.google.com/go/metastore v1.7.0/go.mod h1:s45D0B4IlsINu87/AsWiEVYbLaIMeUSoxlKKDqBGFS8= @@ -480,6 +546,7 @@ cloud.google.com/go/metastore v1.8.0 h1:3KcShzqWdqxrDEXIBWpYJpOOrgpDj+HlBi07Grot cloud.google.com/go/metastore v1.8.0/go.mod h1:zHiMc4ZUpBiM7twCIFQmJ9JMEkDSyZS9U12uf7wHqSI= cloud.google.com/go/metastore v1.10.0 h1:QCFhZVe2289KDBQ7WxaHV2rAmPrmRAdLC6gbjUd3HPo= cloud.google.com/go/metastore v1.10.0/go.mod h1:fPEnH3g4JJAk+gMRnrAnoqyv2lpUCqJPWOodSaf45Eo= +cloud.google.com/go/metastore v1.11.1 h1:sF2yYgo2P4b3hJP2LlIZoafZixtabF/fnORDDMkFeqQ= cloud.google.com/go/metastore v1.11.1/go.mod h1:uZuSo80U3Wd4zi6C22ZZliOUJ3XeM/MlYi/z5OAOWRA= cloud.google.com/go/monitoring v1.7.0/go.mod h1:HpYse6kkGo//7p6sT0wsIC6IBDET0RhIsnmlA53dvEk= cloud.google.com/go/monitoring v1.8.0 h1:c9riaGSPQ4dUKWB+M1Fl0N+iLxstMbCktdEwYSPGDvA= @@ -487,6 +554,7 @@ cloud.google.com/go/monitoring v1.8.0/go.mod h1:E7PtoMJ1kQXWxPjB6mv2fhC5/15jInuu cloud.google.com/go/monitoring v1.12.0/go.mod h1:yx8Jj2fZNEkL/GYZyTLS4ZtZEZN8WtDEiEqG4kLK50w= cloud.google.com/go/monitoring v1.13.0 h1:2qsrgXGVoRXpP7otZ14eE1I568zAa92sJSDPyOJvwjM= cloud.google.com/go/monitoring v1.13.0/go.mod h1:k2yMBAB1H9JT/QETjNkgdCGD9bPF712XiLTVr+cBrpw= +cloud.google.com/go/monitoring v1.15.1 h1:65JhLMd+JiYnXr6j5Z63dUYCuOg770p8a/VC+gil/58= cloud.google.com/go/monitoring v1.15.1/go.mod h1:lADlSAlFdbqQuwwpaImhsJXu1QSdd3ojypXrFSMr2rM= cloud.google.com/go/networkconnectivity v1.5.0/go.mod h1:3GzqJx7uhtlM3kln0+x5wyFvuVH1pIBJjhCpjzSt75o= cloud.google.com/go/networkconnectivity v1.6.0/go.mod h1:OJOoEXW+0LAxHh89nXd64uGG+FbQoeH8DtxCHVOMlaM= @@ -495,18 +563,21 @@ cloud.google.com/go/networkconnectivity v1.7.0/go.mod h1:RMuSbkdbPwNMQjB5HBWD5Mp cloud.google.com/go/networkconnectivity v1.10.0/go.mod h1:UP4O4sWXJG13AqrTdQCD9TnLGEbtNRqjuaaA7bNjF5E= cloud.google.com/go/networkconnectivity v1.11.0 h1:ZD6b4Pk1jEtp/cx9nx0ZYcL3BKqDa+KixNDZ6Bjs1B8= cloud.google.com/go/networkconnectivity v1.11.0/go.mod h1:iWmDD4QF16VCDLXUqvyspJjIEtBR/4zq5hwnY2X3scM= +cloud.google.com/go/networkconnectivity v1.12.1 h1:LnrYM6lBEeTq+9f2lR4DjBhv31EROSAQi/P5W4Q0AEc= cloud.google.com/go/networkconnectivity v1.12.1/go.mod h1:PelxSWYM7Sh9/guf8CFhi6vIqf19Ir/sbfZRUwXh92E= cloud.google.com/go/networkmanagement v1.4.0/go.mod h1:Q9mdLLRn60AsOrPc8rs8iNV6OHXaGcDdsIQe1ohekq8= cloud.google.com/go/networkmanagement v1.5.0 h1:mDHA3CDW00imTvC5RW6aMGsD1bH+FtKwZm/52BxaiMg= cloud.google.com/go/networkmanagement v1.5.0/go.mod h1:ZnOeZ/evzUdUsnvRt792H0uYEnHQEMaz+REhhzJRcf4= cloud.google.com/go/networkmanagement v1.6.0 h1:8KWEUNGcpSX9WwZXq7FtciuNGPdPdPN/ruDm769yAEM= cloud.google.com/go/networkmanagement v1.6.0/go.mod h1:5pKPqyXjB/sgtvB5xqOemumoQNB7y95Q7S+4rjSOPYY= +cloud.google.com/go/networkmanagement v1.8.0 h1:/3xP37eMxnyvkfLrsm1nv1b2FbMMSAEAOlECTvoeCq4= cloud.google.com/go/networkmanagement v1.8.0/go.mod h1:Ho/BUGmtyEqrttTgWEe7m+8vDdK74ibQc+Be0q7Fof0= cloud.google.com/go/networksecurity v0.6.0 h1:qDEX/3sipg9dS5JYsAY+YvgTjPR63cozzAWop8oZS94= cloud.google.com/go/networksecurity v0.6.0/go.mod h1:Q5fjhTr9WMI5mbpRYEbiexTzROf7ZbDzvzCrNl14nyU= cloud.google.com/go/networksecurity v0.7.0/go.mod h1:mAnzoxx/8TBSyXEeESMy9OOYwo1v+gZ5eMRnsT5bC8k= cloud.google.com/go/networksecurity v0.8.0 h1:sOc42Ig1K2LiKlzG71GUVloeSJ0J3mffEBYmvu+P0eo= cloud.google.com/go/networksecurity v0.8.0/go.mod h1:B78DkqsxFG5zRSVuwYFRZ9Xz8IcQ5iECsNrPn74hKHU= +cloud.google.com/go/networksecurity v0.9.1 h1:TBLEkMp3AE+6IV/wbIGRNTxnqLXHCTEQWoxRVC18TzY= cloud.google.com/go/networksecurity v0.9.1/go.mod h1:MCMdxOKQ30wsBI1eI659f9kEp4wuuAueoC9AJKSPWZQ= cloud.google.com/go/notebooks v1.3.0/go.mod h1:bFR5lj07DtCPC7YAAJ//vHskFBxA5JzYlH68kXVdk34= cloud.google.com/go/notebooks v1.4.0/go.mod h1:4QPMngcwmgb6uw7Po99B2xv5ufVoIQ7nOGDyL4P8AgA= @@ -515,24 +586,28 @@ cloud.google.com/go/notebooks v1.5.0/go.mod h1:q8mwhnP9aR8Hpfnrc5iN5IBhrXUy8S2vu cloud.google.com/go/notebooks v1.7.0/go.mod h1:PVlaDGfJgj1fl1S3dUwhFMXFgfYGhYQt2164xOMONmE= cloud.google.com/go/notebooks v1.8.0 h1:Kg2K3K7CbSXYJHZ1aGQpf1xi5x2GUvQWf2sFVuiZh8M= cloud.google.com/go/notebooks v1.8.0/go.mod h1:Lq6dYKOYOWUCTvw5t2q1gp1lAp0zxAxRycayS0iJcqQ= +cloud.google.com/go/notebooks v1.9.1 h1:CUqMNEtv4EHFnbogV+yGHQH5iAQLmijOx191innpOcs= cloud.google.com/go/notebooks v1.9.1/go.mod h1:zqG9/gk05JrzgBt4ghLzEepPHNwE5jgPcHZRKhlC1A8= cloud.google.com/go/optimization v1.1.0/go.mod h1:5po+wfvX5AQlPznyVEZjGJTMr4+CAkJf2XSTQOOl9l4= cloud.google.com/go/optimization v1.2.0 h1:7PxOq9VTT7TMib/6dMoWpMvWS2E4dJEvtYzjvBreaec= cloud.google.com/go/optimization v1.2.0/go.mod h1:Lr7SOHdRDENsh+WXVmQhQTrzdu9ybg0NecjHidBq6xs= cloud.google.com/go/optimization v1.3.1 h1:dj8O4VOJRB4CUwZXdmwNViH1OtI0WtWL867/lnYH248= cloud.google.com/go/optimization v1.3.1/go.mod h1:IvUSefKiwd1a5p0RgHDbWCIbDFgKuEdB+fPPuP0IDLI= +cloud.google.com/go/optimization v1.4.1 h1:pEwOAmO00mxdbesCRSsfj8Sd4rKY9kBrYW7Vd3Pq7cA= cloud.google.com/go/optimization v1.4.1/go.mod h1:j64vZQP7h9bO49m2rVaTVoNM0vEBEN5eKPUPbZyXOrk= cloud.google.com/go/orchestration v1.3.0/go.mod h1:Sj5tq/JpWiB//X/q3Ngwdl5K7B7Y0KZ7bfv0wL6fqVA= cloud.google.com/go/orchestration v1.4.0 h1:39d6tqvNjd/wsSub1Bn4cEmrYcet5Ur6xpaN+SxOxtY= cloud.google.com/go/orchestration v1.4.0/go.mod h1:6W5NLFWs2TlniBphAViZEVhrXRSMgUGDfW7vrWKvsBk= cloud.google.com/go/orchestration v1.6.0 h1:Vw+CEXo8M/FZ1rb4EjcLv0gJqqw89b7+g+C/EmniTb8= cloud.google.com/go/orchestration v1.6.0/go.mod h1:M62Bevp7pkxStDfFfTuCOaXgaaqRAga1yKyoMtEoWPQ= +cloud.google.com/go/orchestration v1.8.1 h1:KmN18kE/xa1n91cM5jhCh7s1/UfIguSCisw7nTMUzgE= cloud.google.com/go/orchestration v1.8.1/go.mod h1:4sluRF3wgbYVRqz7zJ1/EUNc90TTprliq9477fGobD8= cloud.google.com/go/orgpolicy v1.4.0/go.mod h1:xrSLIV4RePWmP9P3tBl8S93lTmlAxjm06NSm2UTmKvE= cloud.google.com/go/orgpolicy v1.5.0 h1:erF5PHqDZb6FeFrUHiYj2JK2BMhsk8CyAg4V4amJ3rE= cloud.google.com/go/orgpolicy v1.5.0/go.mod h1:hZEc5q3wzwXJaKrsx5+Ewg0u1LxJ51nNFlext7Tanwc= cloud.google.com/go/orgpolicy v1.10.0 h1:XDriMWug7sd0kYT1QKofRpRHzjad0bK8Q8uA9q+XrU4= cloud.google.com/go/orgpolicy v1.10.0/go.mod h1:w1fo8b7rRqlXlIJbVhOMPrwVljyuW5mqssvBtU18ONc= +cloud.google.com/go/orgpolicy v1.11.1 h1:I/7dHICQkNwym9erHqmlb50LRU588NPCvkfIY0Bx9jI= cloud.google.com/go/orgpolicy v1.11.1/go.mod h1:8+E3jQcpZJQliP+zaFfayC2Pg5bmhuLK755wKhIIUCE= cloud.google.com/go/osconfig v1.8.0/go.mod h1:EQqZLu5w5XA7eKizepumcvWx+m8mJUhEwiPqWiZeEdg= cloud.google.com/go/osconfig v1.9.0/go.mod h1:Yx+IeIZJ3bdWmzbQU4fxNl8xsZ4amB+dygAwFPlvnNo= @@ -540,6 +615,7 @@ cloud.google.com/go/osconfig v1.10.0 h1:NO0RouqCOM7M2S85Eal6urMSSipWwHU8evzwS+si cloud.google.com/go/osconfig v1.10.0/go.mod h1:uMhCzqC5I8zfD9zDEAfvgVhDS8oIjySWh+l4WK6GnWw= cloud.google.com/go/osconfig v1.11.0 h1:PkSQx4OHit5xz2bNyr11KGcaFccL5oqglFPdTboyqwQ= cloud.google.com/go/osconfig v1.11.0/go.mod h1:aDICxrur2ogRd9zY5ytBLV89KEgT2MKB2L/n6x1ooPw= +cloud.google.com/go/osconfig v1.12.1 h1:dgyEHdfqML6cUW6/MkihNdTVc0INQst0qSE8Ou1ub9c= cloud.google.com/go/osconfig v1.12.1/go.mod h1:4CjBxND0gswz2gfYRCUoUzCm9zCABp91EeTtWXyz0tE= cloud.google.com/go/oslogin v1.5.0/go.mod h1:D260Qj11W2qx/HVF29zBg+0fd6YCSjSqLUkY/qEenQU= cloud.google.com/go/oslogin v1.6.0/go.mod h1:zOJ1O3+dTU8WPlGEkFSh7qeHPPSoxrcMbbK1Nm2iX70= @@ -547,11 +623,13 @@ cloud.google.com/go/oslogin v1.7.0 h1:pKGDPfeZHDybtw48WsnVLjoIPMi9Kw62kUE5TXCLCN cloud.google.com/go/oslogin v1.7.0/go.mod h1:e04SN0xO1UNJ1M5GP0vzVBFicIe4O53FOfcixIqTyXo= cloud.google.com/go/oslogin v1.9.0 h1:whP7vhpmc+ufZa90eVpkfbgzJRK/Xomjz+XCD4aGwWw= cloud.google.com/go/oslogin v1.9.0/go.mod h1:HNavntnH8nzrn8JCTT5fj18FuJLFJc4NaZJtBnQtKFs= +cloud.google.com/go/oslogin v1.10.1 h1:LdSuG3xBYu2Sgr3jTUULL1XCl5QBx6xwzGqzoDUw1j0= cloud.google.com/go/oslogin v1.10.1/go.mod h1:x692z7yAue5nE7CsSnoG0aaMbNoRJRXO4sn73R+ZqAs= cloud.google.com/go/phishingprotection v0.6.0 h1:OrwHLSRSZyaiOt3tnY33dsKSedxbMzsXvqB21okItNQ= cloud.google.com/go/phishingprotection v0.6.0/go.mod h1:9Y3LBLgy0kDTcYET8ZH3bq/7qni15yVUoAxiFxnlSUA= cloud.google.com/go/phishingprotection v0.7.0 h1:l6tDkT7qAEV49MNEJkEJTB6vOO/onbSOcNtAT09HPuA= cloud.google.com/go/phishingprotection v0.7.0/go.mod h1:8qJI4QKHoda/sb/7/YmMQ2omRLSLYSu9bU0EKCNI+Lk= +cloud.google.com/go/phishingprotection v0.8.1 h1:aK/lNmSd1vtbft/vLe2g7edXK72sIQbqr2QyrZN/iME= cloud.google.com/go/phishingprotection v0.8.1/go.mod h1:AxonW7GovcA8qdEk13NfHq9hNx5KPtfxXNeUxTDxB6I= cloud.google.com/go/policytroubleshooter v1.3.0/go.mod h1:qy0+VwANja+kKrjlQuOzmlvscn4RNsAc0e15GGqfMxg= cloud.google.com/go/policytroubleshooter v1.4.0 h1:NQklJuOUoz1BPP+Epjw81COx7IISWslkZubz/1i0UN8= @@ -559,24 +637,28 @@ cloud.google.com/go/policytroubleshooter v1.4.0/go.mod h1:DZT4BcRw3QoO8ota9xw/LK cloud.google.com/go/policytroubleshooter v1.5.0/go.mod h1:Rz1WfV+1oIpPdN2VvvuboLVRsB1Hclg3CKQ53j9l8vw= cloud.google.com/go/policytroubleshooter v1.6.0 h1:yKAGC4p9O61ttZUswaq9GAn1SZnEzTd0vUYXD7ZBT7Y= cloud.google.com/go/policytroubleshooter v1.6.0/go.mod h1:zYqaPTsmfvpjm5ULxAyD/lINQxJ0DDsnWOP/GZ7xzBc= +cloud.google.com/go/policytroubleshooter v1.7.1 h1:AZ2n6dw6OnYpDZAUk6WK1drupzTWNMRk/uatXEIDAsU= cloud.google.com/go/policytroubleshooter v1.7.1/go.mod h1:0NaT5v3Ag1M7U5r0GfDCpUFkWd9YqpubBWsQlhanRv0= cloud.google.com/go/privatecatalog v0.6.0 h1:Vz86uiHCtNGm1DeC32HeG2VXmOq5JRYA3VRPf8ZEcSg= cloud.google.com/go/privatecatalog v0.6.0/go.mod h1:i/fbkZR0hLN29eEWiiwue8Pb+GforiEIBnV9yrRUOKI= cloud.google.com/go/privatecatalog v0.7.0/go.mod h1:2s5ssIFO69F5csTXcwBP7NPFTZvps26xGzvQ2PQaBYg= cloud.google.com/go/privatecatalog v0.8.0 h1:EPEJ1DpEGXLDnmc7mnCAqFmkwUJbIsaLAiLHVOkkwtc= cloud.google.com/go/privatecatalog v0.8.0/go.mod h1:nQ6pfaegeDAq/Q5lrfCQzQLhubPiZhSaNhIgfJlnIXs= +cloud.google.com/go/privatecatalog v0.9.1 h1:B/18xGo+E0EMS9LOEQ0zXz7F2asMgmVgTYGSI89MHOA= cloud.google.com/go/privatecatalog v0.9.1/go.mod h1:0XlDXW2unJXdf9zFz968Hp35gl/bhF4twwpXZAW50JA= cloud.google.com/go/pubsub v1.27.1 h1:q+J/Nfr6Qx4RQeu3rJcnN48SNC0qzlYzSeqkPq93VHs= cloud.google.com/go/pubsub v1.27.1/go.mod h1:hQN39ymbV9geqBnfQq6Xf63yNhUAhv9CZhzp5O6qsW0= cloud.google.com/go/pubsub v1.28.0/go.mod h1:vuXFpwaVoIPQMGXqRyUQigu/AX1S3IWugR9xznmcXX8= cloud.google.com/go/pubsub v1.30.0 h1:vCge8m7aUKBJYOgrZp7EsNDf6QMd2CAlXZqWTn3yq6s= cloud.google.com/go/pubsub v1.30.0/go.mod h1:qWi1OPS0B+b5L+Sg6Gmc9zD1Y+HaM0MdUr7LsupY1P4= +cloud.google.com/go/pubsub v1.32.0 h1:JOEkgEYBuUTHSyHS4TcqOFuWr+vD6qO/imsFqShUCp4= cloud.google.com/go/pubsub v1.32.0/go.mod h1:f+w71I33OMyxf9VpMVcZbnG5KSUkCOUHYpFd5U1GdRc= cloud.google.com/go/pubsublite v1.5.0 h1:iqrD8vp3giTb7hI1q4TQQGj77cj8zzgmMPsTZtLnprM= cloud.google.com/go/pubsublite v1.5.0/go.mod h1:xapqNQ1CuLfGi23Yda/9l4bBCKz/wC3KIJ5gKcxveZg= cloud.google.com/go/pubsublite v1.6.0/go.mod h1:1eFCS0U11xlOuMFV/0iBqw3zP12kddMeCbj/F3FSj9k= cloud.google.com/go/pubsublite v1.7.0 h1:cb9fsrtpINtETHiJ3ECeaVzrfIVhcGjhhJEjybHXHao= cloud.google.com/go/pubsublite v1.7.0/go.mod h1:8hVMwRXfDfvGm3fahVbtDbiLePT3gpoiJYJY+vxWxVM= +cloud.google.com/go/pubsublite v1.8.1 h1:pX+idpWMIH30/K7c0epN6V703xpIcMXWRjKJsz0tYGY= cloud.google.com/go/pubsublite v1.8.1/go.mod h1:fOLdU4f5xldK4RGJrBMm+J7zMWNj/k4PxwEZXy39QS0= cloud.google.com/go/recaptchaenterprise v1.3.1 h1:u6EznTGzIdsyOsvm+Xkw0aSuKFXQlyjGE9a4exk6iNQ= cloud.google.com/go/recaptchaenterprise/v2 v2.2.0/go.mod h1:/Zu5jisWGeERrd5HnlS3EUGb/D335f9k51B/FVil0jk= @@ -586,11 +668,13 @@ cloud.google.com/go/recaptchaenterprise/v2 v2.5.0/go.mod h1:O8LzcHXN3rz0j+LBC91j cloud.google.com/go/recaptchaenterprise/v2 v2.6.0/go.mod h1:RPauz9jeLtB3JVzg6nCbe12qNoaa8pXc4d/YukAmcnA= cloud.google.com/go/recaptchaenterprise/v2 v2.7.0 h1:6iOCujSNJ0YS7oNymI64hXsjGq60T4FK1zdLugxbzvU= cloud.google.com/go/recaptchaenterprise/v2 v2.7.0/go.mod h1:19wVj/fs5RtYtynAPJdDTb69oW0vNHYDBTbB4NvMD9c= +cloud.google.com/go/recaptchaenterprise/v2 v2.7.2 h1:IGkbudobsTXAwmkEYOzPCQPApUCsN4Gbq3ndGVhHQpI= cloud.google.com/go/recaptchaenterprise/v2 v2.7.2/go.mod h1:kR0KjsJS7Jt1YSyWFkseQ756D45kaYNTlDPPaRAvDBU= cloud.google.com/go/recommendationengine v0.6.0 h1:6w+WxPf2LmUEqX0YyvfCoYb8aBYOcbIV25Vg6R0FLGw= cloud.google.com/go/recommendationengine v0.6.0/go.mod h1:08mq2umu9oIqc7tDy8sx+MNJdLG0fUi3vaSVbztHgJ4= cloud.google.com/go/recommendationengine v0.7.0 h1:VibRFCwWXrFebEWKHfZAt2kta6pS7Tlimsnms0fjv7k= cloud.google.com/go/recommendationengine v0.7.0/go.mod h1:1reUcE3GIu6MeBz/h5xZJqNLuuVjNg1lmWMPyjatzac= +cloud.google.com/go/recommendationengine v0.8.1 h1:nMr1OEVHuDambRn+/y4RmNAmnR/pXCuHtH0Y4tCgGRQ= cloud.google.com/go/recommendationengine v0.8.1/go.mod h1:MrZihWwtFYWDzE6Hz5nKcNz3gLizXVIDI/o3G1DLcrE= cloud.google.com/go/recommender v1.6.0/go.mod h1:+yETpm25mcoiECKh9DEScGzIRyDKpZ0cEhWGo+8bo+c= cloud.google.com/go/recommender v1.7.0/go.mod h1:XLHs/W+T8olwlGOgfQenXBTbIseGclClff6lhFVe9Bs= @@ -598,6 +682,7 @@ cloud.google.com/go/recommender v1.8.0 h1:9kMZQGeYfcOD/RtZfcNKGKtoex3DdoB4zRgYU/ cloud.google.com/go/recommender v1.8.0/go.mod h1:PkjXrTT05BFKwxaUxQmtIlrtj0kph108r02ZZQ5FE70= cloud.google.com/go/recommender v1.9.0 h1:ZnFRY5R6zOVk2IDS1Jbv5Bw+DExCI5rFumsTnMXiu/A= cloud.google.com/go/recommender v1.9.0/go.mod h1:PnSsnZY7q+VL1uax2JWkt/UegHssxjUVVCrX52CuEmQ= +cloud.google.com/go/recommender v1.10.1 h1:UKp94UH5/Lv2WXSQe9+FttqV07x/2p1hFTMMYVFtilg= cloud.google.com/go/recommender v1.10.1/go.mod h1:XFvrE4Suqn5Cq0Lf+mCP6oBHD/yRMA8XxP5sb7Q7gpA= cloud.google.com/go/redis v1.8.0/go.mod h1:Fm2szCDavWzBk2cDKxrkmWBqoCiL1+Ctwq7EyqBCA/A= cloud.google.com/go/redis v1.9.0/go.mod h1:HMYQuajvb2D0LvMgZmLDZW8V5aOC/WxstZHiy4g8OiA= @@ -605,6 +690,7 @@ cloud.google.com/go/redis v1.10.0 h1:/zTwwBKIAD2DEWTrXZp8WD9yD/gntReF/HkPssVYd0U cloud.google.com/go/redis v1.10.0/go.mod h1:ThJf3mMBQtW18JzGgh41/Wld6vnDDc/F/F35UolRZPM= cloud.google.com/go/redis v1.11.0 h1:JoAd3SkeDt3rLFAAxEvw6wV4t+8y4ZzfZcZmddqphQ8= cloud.google.com/go/redis v1.11.0/go.mod h1:/X6eicana+BWcUda5PpwZC48o37SiFVTFSs0fWAJ7uQ= +cloud.google.com/go/redis v1.13.1 h1:YrjQnCC7ydk+k30op7DSjSHw1yAYhqYXFcOq1bSXRYA= cloud.google.com/go/redis v1.13.1/go.mod h1:VP7DGLpE91M6bcsDdMuyCm2hIpB6Vp2hI090Mfd1tcg= cloud.google.com/go/resourcemanager v1.3.0/go.mod h1:bAtrTjZQFJkiWTPDb1WBjzvc6/kifjj4QBYuKCCoqKA= cloud.google.com/go/resourcemanager v1.4.0 h1:NDao6CHMwEZIaNsdWy+tuvHaavNeGP06o1tgrR0kLvU= @@ -612,12 +698,14 @@ cloud.google.com/go/resourcemanager v1.4.0/go.mod h1:MwxuzkumyTX7/a3n37gmsT3py7L cloud.google.com/go/resourcemanager v1.5.0/go.mod h1:eQoXNAiAvCf5PXxWxXjhKQoTMaUSNrEfg+6qdf/wots= cloud.google.com/go/resourcemanager v1.7.0 h1:NRM0p+RJkaQF9Ee9JMnUV9BQ2QBIOq/v8M+Pbv/wmCs= cloud.google.com/go/resourcemanager v1.7.0/go.mod h1:HlD3m6+bwhzj9XCouqmeiGuni95NTrExfhoSrkC/3EI= +cloud.google.com/go/resourcemanager v1.9.1 h1:QIAMfndPOHR6yTmMUB0ZN+HSeRmPjR/21Smq5/xwghI= cloud.google.com/go/resourcemanager v1.9.1/go.mod h1:dVCuosgrh1tINZ/RwBufr8lULmWGOkPS8gL5gqyjdT8= cloud.google.com/go/resourcesettings v1.3.0/go.mod h1:lzew8VfESA5DQ8gdlHwMrqZs1S9V87v3oCnKCWoOuQU= cloud.google.com/go/resourcesettings v1.4.0 h1:eTzOwB13WrfF0kuzG2ZXCfB3TLunSHBur4s+HFU6uSM= cloud.google.com/go/resourcesettings v1.4.0/go.mod h1:ldiH9IJpcrlC3VSuCGvjR5of/ezRrOxFtpJoJo5SmXg= cloud.google.com/go/resourcesettings v1.5.0 h1:8Dua37kQt27CCWHm4h/Q1XqCF6ByD7Ouu49xg95qJzI= cloud.google.com/go/resourcesettings v1.5.0/go.mod h1:+xJF7QSG6undsQDfsCJyqWXyBwUoJLhetkRMDRnIoXA= +cloud.google.com/go/resourcesettings v1.6.1 h1:Fdyq418U69LhvNPFdlEO29w+DRRjwDA4/pFamm4ksAg= cloud.google.com/go/resourcesettings v1.6.1/go.mod h1:M7mk9PIZrC5Fgsu1kZJci6mpgN8o0IUzVx3eJU3y4Jw= cloud.google.com/go/retail v1.9.0/go.mod h1:g6jb6mKuCS1QKnH/dpu7isX253absFl6iE92nHwlBUY= cloud.google.com/go/retail v1.10.0/go.mod h1:2gDk9HsL4HMS4oZwz6daui2/jmKvqShXKQuB2RZ+cCc= @@ -625,6 +713,7 @@ cloud.google.com/go/retail v1.11.0 h1:N9fa//ecFUOEPsW/6mJHfcapPV0wBSwIUwpVZB7MQ3 cloud.google.com/go/retail v1.11.0/go.mod h1:MBLk1NaWPmh6iVFSz9MeKG/Psyd7TAgm6y/9L2B4x9Y= cloud.google.com/go/retail v1.12.0 h1:1Dda2OpFNzIb4qWgFZjYlpP7sxX3aLeypKG6A3H4Yys= cloud.google.com/go/retail v1.12.0/go.mod h1:UMkelN/0Z8XvKymXFbD4EhFJlYKRx1FGhQkVPU5kF14= +cloud.google.com/go/retail v1.14.1 h1:gYBrb9u/Hc5s5lUTFXX1Vsbc/9BEvgtioY6ZKaK0DK8= cloud.google.com/go/retail v1.14.1/go.mod h1:y3Wv3Vr2k54dLNIrCzenyKG8g8dhvhncT2NcNjb/6gE= cloud.google.com/go/run v0.2.0/go.mod h1:CNtKsTA1sDcnqqIFR3Pb5Tq0usWxJJvsWOCPldRU3Do= cloud.google.com/go/run v0.3.0 h1:AWPuzU7Xtaj3Jf+QarDWIs6AJ5hM1VFQ+F6Q+VZ6OT4= @@ -639,6 +728,7 @@ cloud.google.com/go/scheduler v1.7.0/go.mod h1:jyCiBqWW956uBjjPMMuX09n3x37mtyPJe cloud.google.com/go/scheduler v1.8.0/go.mod h1:TCET+Y5Gp1YgHT8py4nlg2Sew8nUHMqcpousDgXJVQc= cloud.google.com/go/scheduler v1.9.0 h1:NpQAHtx3sulByTLe2dMwWmah8PWgeoieFPpJpArwFV0= cloud.google.com/go/scheduler v1.9.0/go.mod h1:yexg5t+KSmqu+njTIh3b7oYPheFtBWGcbVUYF1GGMIc= +cloud.google.com/go/scheduler v1.10.1 h1:yoZbZR8880KgPGLmACOMCiY2tPk+iX4V/dkxqTirlz8= cloud.google.com/go/scheduler v1.10.1/go.mod h1:R63Ldltd47Bs4gnhQkmNDse5w8gBRrhObZ54PxgR2Oo= cloud.google.com/go/secretmanager v1.6.0/go.mod h1:awVa/OXF6IiyaU1wQ34inzQNc4ISIDIrId8qE5QGgKA= cloud.google.com/go/secretmanager v1.8.0/go.mod h1:hnVgi/bN5MYHd3Gt0SPuTPPp5ENina1/LxM+2W9U9J4= @@ -646,6 +736,7 @@ cloud.google.com/go/secretmanager v1.9.0 h1:xE6uXljAC1kCR8iadt9+/blg1fvSbmenlsDN cloud.google.com/go/secretmanager v1.9.0/go.mod h1:b71qH2l1yHmWQHt9LC80akm86mX8AL6X1MA01dW8ht4= cloud.google.com/go/secretmanager v1.10.0 h1:pu03bha7ukxF8otyPKTFdDz+rr9sE3YauS5PliDXK60= cloud.google.com/go/secretmanager v1.10.0/go.mod h1:MfnrdvKMPNra9aZtQFvBcvRU54hbPD8/HayQdlUgJpU= +cloud.google.com/go/secretmanager v1.11.1 h1:cLTCwAjFh9fKvU6F13Y4L9vPcx9yiWPyWXE4+zkuEQs= cloud.google.com/go/secretmanager v1.11.1/go.mod h1:znq9JlXgTNdBeQk9TBW/FnR/W4uChEKGeqQWAJ8SXFw= cloud.google.com/go/security v1.8.0/go.mod h1:hAQOwgmaHhztFhiQ41CjDODdWP0+AE1B3sX4OFlq+GU= cloud.google.com/go/security v1.9.0/go.mod h1:6Ta1bO8LXI89nZnmnsZGp9lVoVWXqsVbIq/t9dzI+2Q= @@ -654,6 +745,7 @@ cloud.google.com/go/security v1.10.0/go.mod h1:QtOMZByJVlibUT2h9afNDWRZ1G96gVywH cloud.google.com/go/security v1.12.0/go.mod h1:rV6EhrpbNHrrxqlvW0BWAIawFWq3X90SduMJdFwtLB8= cloud.google.com/go/security v1.13.0 h1:PYvDxopRQBfYAXKAuDpFCKBvDOWPWzp9k/H5nB3ud3o= cloud.google.com/go/security v1.13.0/go.mod h1:Q1Nvxl1PAgmeW0y3HTt54JYIvUdtcpYKVfIB8AOMZ+0= +cloud.google.com/go/security v1.15.1 h1:jR3itwycg/TgGA0uIgTItcVhA55hKWiNJxaNNpQJaZE= cloud.google.com/go/security v1.15.1/go.mod h1:MvTnnbsWnehoizHi09zoiZob0iCHVcL4AUBj76h9fXA= cloud.google.com/go/securitycenter v1.14.0/go.mod h1:gZLAhtyKv85n52XYWt6RmeBdydyxfPeTrpToDPw4Auc= cloud.google.com/go/securitycenter v1.15.0/go.mod h1:PeKJ0t8MoFmmXLXWm41JidyzI3PJjd8sXWaVqg43WWk= @@ -662,6 +754,7 @@ cloud.google.com/go/securitycenter v1.16.0/go.mod h1:Q9GMaLQFUD+5ZTabrbujNWLtSLZ cloud.google.com/go/securitycenter v1.18.1/go.mod h1:0/25gAzCM/9OL9vVx4ChPeM/+DlfGQJDwBy/UC8AKK0= cloud.google.com/go/securitycenter v1.19.0 h1:AF3c2s3awNTMoBtMX3oCUoOMmGlYxGOeuXSYHNBkf14= cloud.google.com/go/securitycenter v1.19.0/go.mod h1:LVLmSg8ZkkyaNy4u7HCIshAngSQ8EcIRREP3xBnyfag= +cloud.google.com/go/securitycenter v1.23.0 h1:XOGJ9OpnDtqg8izd7gYk/XUhj8ytjIalyjjsR6oyG0M= cloud.google.com/go/securitycenter v1.23.0/go.mod h1:8pwQ4n+Y9WCWM278R8W3nF65QtY172h4S8aXyI9/hsQ= cloud.google.com/go/servicecontrol v1.4.0/go.mod h1:o0hUSJ1TXJAmi/7fLJAedOovnujSEvjKCAFNXPQ1RaU= cloud.google.com/go/servicecontrol v1.5.0 h1:ImIzbOu6y4jL6ob65I++QzvqgFaoAKgHOG+RU9/c4y8= @@ -676,6 +769,7 @@ cloud.google.com/go/servicedirectory v1.7.0/go.mod h1:5p/U5oyvgYGYejufvxhgwjL8UV cloud.google.com/go/servicedirectory v1.8.0/go.mod h1:srXodfhY1GFIPvltunswqXpVxFPpZjf8nkKQT7XcXaY= cloud.google.com/go/servicedirectory v1.9.0 h1:SJwk0XX2e26o25ObYUORXx6torSFiYgsGkWSkZgkoSU= cloud.google.com/go/servicedirectory v1.9.0/go.mod h1:29je5JjiygNYlmsGz8k6o+OZ8vd4f//bQLtvzkPPT/s= +cloud.google.com/go/servicedirectory v1.10.1 h1:J/0csas97yAQ+dcc7i8HqbaOA4KOfPu7BPhJdxYRhCk= cloud.google.com/go/servicedirectory v1.10.1/go.mod h1:Xv0YVH8s4pVOwfM/1eMTl0XJ6bzIOSLDt8f8eLaGOxQ= cloud.google.com/go/servicemanagement v1.4.0/go.mod h1:d8t8MDbezI7Z2R1O/wu8oTggo3BI2GKYbdG4y/SJTco= cloud.google.com/go/servicemanagement v1.5.0 h1:TpkCO5M7dhKSy1bKUD9o/sSEW/U1Gtx7opA1fsiMx0c= @@ -694,12 +788,14 @@ cloud.google.com/go/shell v1.4.0 h1:b1LFhFBgKsG252inyhtmsUUZwchqSz3WTvAIf3JFo4g= cloud.google.com/go/shell v1.4.0/go.mod h1:HDxPzZf3GkDdhExzD/gs8Grqk+dmYcEjGShZgYa9URw= cloud.google.com/go/shell v1.6.0 h1:wT0Uw7ib7+AgZST9eCDygwTJn4+bHMDtZo5fh7kGWDU= cloud.google.com/go/shell v1.6.0/go.mod h1:oHO8QACS90luWgxP3N9iZVuEiSF84zNyLytb+qE2f9A= +cloud.google.com/go/shell v1.7.1 h1:aHbwH9LSqs4r2rbay9f6fKEls61TAjT63jSyglsw7sI= cloud.google.com/go/shell v1.7.1/go.mod h1:u1RaM+huXFaTojTbW4g9P5emOrrmLE69KrxqQahKn4g= cloud.google.com/go/spanner v1.41.0 h1:NvdTpRwf7DTegbfFdPjAWyD7bOVu0VeMqcvR9aCQCAc= cloud.google.com/go/spanner v1.41.0/go.mod h1:MLYDBJR/dY4Wt7ZaMIQ7rXOTLjYrmxLE/5ve9vFfWos= cloud.google.com/go/spanner v1.44.0/go.mod h1:G8XIgYdOK+Fbcpbs7p2fiprDw4CaZX63whnSMLVBxjk= cloud.google.com/go/spanner v1.45.0 h1:7VdjZ8zj4sHbDw55atp5dfY6kn1j9sam9DRNpPQhqR4= cloud.google.com/go/spanner v1.45.0/go.mod h1:FIws5LowYz8YAE1J8fOS7DJup8ff7xJeetWEo5REA2M= +cloud.google.com/go/spanner v1.47.0 h1:aqiMP8dhsEXgn9K5EZBWxPG7dxIiyM2VaikqeU4iteg= cloud.google.com/go/spanner v1.47.0/go.mod h1:IXsJwVW2j4UKs0eYDqodab6HgGuA1bViSqW4uH9lfUI= cloud.google.com/go/speech v1.7.0/go.mod h1:KptqL+BAQIhMsj1kOP2la5DSEEerPDuOP/2mmkhHhZQ= cloud.google.com/go/speech v1.8.0/go.mod h1:9bYIl1/tjsAnMgKGHKmBZzXKEkGgtU+MpdDPTE9f7y0= @@ -708,6 +804,7 @@ cloud.google.com/go/speech v1.9.0/go.mod h1:xQ0jTcmnRFFM2RfX/U+rk6FQNUF6DQlydUSy cloud.google.com/go/speech v1.14.1/go.mod h1:gEosVRPJ9waG7zqqnsHpYTOoAS4KouMRLDFMekpJ0J0= cloud.google.com/go/speech v1.15.0 h1:JEVoWGNnTF128kNty7T4aG4eqv2z86yiMJPT9Zjp+iw= cloud.google.com/go/speech v1.15.0/go.mod h1:y6oH7GhqCaZANH7+Oe0BhgIogsNInLlz542tg3VqeYI= +cloud.google.com/go/speech v1.17.1 h1:KIV99afoYTJqA2qi8Cjbl5DpjSRzvqFgKcptGXg6kxw= cloud.google.com/go/speech v1.17.1/go.mod h1:8rVNzU43tQvxDaGvqOhpDqgkJTFowBpDvCJ14kGlJYo= cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y= cloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeLgDvXzfIXc= @@ -716,6 +813,7 @@ cloud.google.com/go/storage v1.27.0/go.mod h1:x9DOL8TK/ygDUMieqwfhdpQryTeEkhGKMi cloud.google.com/go/storage v1.28.1/go.mod h1:Qnisd4CqDdo6BGs2AD5LLnEsmSQ80wQ5ogcBBKhU86Y= cloud.google.com/go/storage v1.29.0 h1:6weCgzRvMg7lzuUurI4697AqIRPU1SvzHhynwpW31jI= cloud.google.com/go/storage v1.29.0/go.mod h1:4puEjyTKnku6gfKoTfNOU/W+a9JyuVNxjpS5GBrB8h4= +cloud.google.com/go/storage v1.30.1 h1:uOdMxAs8HExqBlnLtnQyP0YkvbiDpdGShGKtx6U/oNM= cloud.google.com/go/storage v1.30.1/go.mod h1:NfxhC0UJE1aXSx7CIIbCf7y9HKT7BiccwkR7+P7gN8E= cloud.google.com/go/storagetransfer v1.5.0/go.mod h1:dxNzUopWy7RQevYFHewchb29POFv3/AaBgnhqzqiK0w= cloud.google.com/go/storagetransfer v1.6.0 h1:fUe3OydbbvHcAYp07xY+2UpH4AermGbmnm7qdEj3tGE= @@ -723,6 +821,7 @@ cloud.google.com/go/storagetransfer v1.6.0/go.mod h1:y77xm4CQV/ZhFZH75PLEXY0ROiS cloud.google.com/go/storagetransfer v1.7.0/go.mod h1:8Giuj1QNb1kfLAiWM1bN6dHzfdlDAVC9rv9abHot2W4= cloud.google.com/go/storagetransfer v1.8.0 h1:5T+PM+3ECU3EY2y9Brv0Sf3oka8pKmsCfpQ07+91G9o= cloud.google.com/go/storagetransfer v1.8.0/go.mod h1:JpegsHHU1eXg7lMHkvf+KE5XDJ7EQu0GwNJbbVGanEw= +cloud.google.com/go/storagetransfer v1.10.0 h1:+ZLkeXx0K0Pk5XdDmG0MnUVqIR18lllsihU/yq39I8Q= cloud.google.com/go/storagetransfer v1.10.0/go.mod h1:DM4sTlSmGiNczmV6iZyceIh2dbs+7z2Ayg6YAiQlYfA= cloud.google.com/go/talent v1.2.0/go.mod h1:MoNF9bhFQbiJ6eFD3uSsg0uBALw4n4gaCaEjBw9zo8g= cloud.google.com/go/talent v1.3.0/go.mod h1:CmcxwJ/PKfRgd1pBjQgU6W3YBwiewmUzQYH5HHmSCmM= @@ -730,18 +829,21 @@ cloud.google.com/go/talent v1.4.0 h1:MrekAGxLqAeAol4Sc0allOVqUGO8j+Iim8NMvpiD7tM cloud.google.com/go/talent v1.4.0/go.mod h1:ezFtAgVuRf8jRsvyE6EwmbTK5LKciD4KVnHuDEFmOOA= cloud.google.com/go/talent v1.5.0 h1:nI9sVZPjMKiO2q3Uu0KhTDVov3Xrlpt63fghP9XjyEM= cloud.google.com/go/talent v1.5.0/go.mod h1:G+ODMj9bsasAEJkQSzO2uHQWXHHXUomArjWQQYkqK6c= +cloud.google.com/go/talent v1.6.2 h1:j46ZgD6N2YdpFPux9mc7OAf4YK3tiBCsbLKc8rQx+bU= cloud.google.com/go/talent v1.6.2/go.mod h1:CbGvmKCG61mkdjcqTcLOkb2ZN1SrQI8MDyma2l7VD24= cloud.google.com/go/texttospeech v1.4.0/go.mod h1:FX8HQHA6sEpJ7rCMSfXuzBcysDAuWusNNNvN9FELDd8= cloud.google.com/go/texttospeech v1.5.0 h1:ccPiHgTewxgyAeCWgQWvZvrLmbfQSFABTMAfrSPLPyY= cloud.google.com/go/texttospeech v1.5.0/go.mod h1:oKPLhR4n4ZdQqWKURdwxMy0uiTS1xU161C8W57Wkea4= cloud.google.com/go/texttospeech v1.6.0 h1:H4g1ULStsbVtalbZGktyzXzw6jP26RjVGYx9RaYjBzc= cloud.google.com/go/texttospeech v1.6.0/go.mod h1:YmwmFT8pj1aBblQOI3TfKmwibnsfvhIBzPXcW4EBovc= +cloud.google.com/go/texttospeech v1.7.1 h1:S/pR/GZT9p15R7Y2dk2OXD/3AufTct/NSxT4a7nxByw= cloud.google.com/go/texttospeech v1.7.1/go.mod h1:m7QfG5IXxeneGqTapXNxv2ItxP/FS0hCZBwXYqucgSk= cloud.google.com/go/tpu v1.3.0/go.mod h1:aJIManG0o20tfDQlRIej44FcwGGl/cD0oiRyMKG19IQ= cloud.google.com/go/tpu v1.4.0 h1:ztIdKoma1Xob2qm6QwNh4Xi9/e7N3IfvtwG5AcNsj1g= cloud.google.com/go/tpu v1.4.0/go.mod h1:mjZaX8p0VBgllCzF6wcU2ovUXN9TONFLd7iz227X2Xg= cloud.google.com/go/tpu v1.5.0 h1:/34T6CbSi+kTv5E19Q9zbU/ix8IviInZpzwz3rsFE+A= cloud.google.com/go/tpu v1.5.0/go.mod h1:8zVo1rYDFuW2l4yZVY0R0fb/v44xLh3llq7RuV61fPM= +cloud.google.com/go/tpu v1.6.1 h1:kQf1jgPY04UJBYYjNUO+3GrZtIb57MfGAW2bwgLbR3A= cloud.google.com/go/tpu v1.6.1/go.mod h1:sOdcHVIgDEEOKuqUoi6Fq53MKHJAtOwtz0GuKsWSH3E= cloud.google.com/go/trace v1.3.0/go.mod h1:FFUE83d9Ca57C+K8rDl/Ih8LwOzWIV1krKgxg6N0G28= cloud.google.com/go/trace v1.4.0 h1:qO9eLn2esajC9sxpqp1YKX37nXC3L4BfGnPS0Cx9dYo= @@ -749,6 +851,7 @@ cloud.google.com/go/trace v1.4.0/go.mod h1:UG0v8UBqzusp+z63o7FK74SdFE+AXpCLdFb1r cloud.google.com/go/trace v1.8.0/go.mod h1:zH7vcsbAhklH8hWFig58HvxcxyQbaIqMarMg9hn5ECA= cloud.google.com/go/trace v1.9.0 h1:olxC0QHC59zgJVALtgqfD9tGk0lfeCP5/AGXL3Px/no= cloud.google.com/go/trace v1.9.0/go.mod h1:lOQqpE5IaWY0Ixg7/r2SjixMuc6lfTFeO4QGM4dQWOk= +cloud.google.com/go/trace v1.10.1 h1:EwGdOLCNfYOOPtgqo+D2sDLZmRCEO1AagRTJCU6ztdg= cloud.google.com/go/trace v1.10.1/go.mod h1:gbtL94KE5AJLH3y+WVpfWILmqgc6dXcqgNXdOPAQTYk= cloud.google.com/go/translate v1.3.0/go.mod h1:gzMUwRjvOqj5i69y/LYLd8RrNQk+hOmIXTi9+nb3Djs= cloud.google.com/go/translate v1.4.0 h1:AOYOH3MspzJ/bH1YXzB+xTE8fMpn3mwhLjugwGXvMPI= @@ -756,6 +859,7 @@ cloud.google.com/go/translate v1.4.0/go.mod h1:06Dn/ppvLD6WvA5Rhdp029IX2Mi3Mn7fp cloud.google.com/go/translate v1.6.0/go.mod h1:lMGRudH1pu7I3n3PETiOB2507gf3HnfLV8qlkHZEyos= cloud.google.com/go/translate v1.7.0 h1:GvLP4oQ4uPdChBmBaUSa/SaZxCdyWELtlAaKzpHsXdA= cloud.google.com/go/translate v1.7.0/go.mod h1:lMGRudH1pu7I3n3PETiOB2507gf3HnfLV8qlkHZEyos= +cloud.google.com/go/translate v1.8.1 h1:7P75urEfnR/gU+7oYn5GuMsV9tJAiBGLJv06G10mM/E= cloud.google.com/go/translate v1.8.1/go.mod h1:d1ZH5aaOA0CNhWeXeC8ujd4tdCFw8XoNWRljklu5RHs= cloud.google.com/go/video v1.8.0/go.mod h1:sTzKFc0bUSByE8Yoh8X0mn8bMymItVGPfTuUBUyRgxk= cloud.google.com/go/video v1.9.0 h1:ttlvO4J5c1VGq6FkHqWPD/aH6PfdxujHt+muTJlW1Zk= @@ -763,6 +867,7 @@ cloud.google.com/go/video v1.9.0/go.mod h1:0RhNKFRF5v92f8dQt0yhaHrEuH95m068JYOvL cloud.google.com/go/video v1.13.0/go.mod h1:ulzkYlYgCp15N2AokzKjy7MQ9ejuynOJdf1tR5lGthk= cloud.google.com/go/video v1.15.0 h1:upIbnGI0ZgACm58HPjAeBMleW3sl5cT84AbYQ8PWOgM= cloud.google.com/go/video v1.15.0/go.mod h1:SkgaXwT+lIIAKqWAJfktHT/RbgjSuY6DobxEp0C5yTQ= +cloud.google.com/go/video v1.17.1 h1:gWi0caJILQb9VwZPq28R1Wrg5YMsoLIvtvKDSglcQL8= cloud.google.com/go/video v1.17.1/go.mod h1:9qmqPqw/Ib2tLqaeHgtakU+l5TcJxCJbhFXM7UJjVzU= cloud.google.com/go/videointelligence v1.7.0/go.mod h1:k8pI/1wAhjznARtVT9U1llUaFNPh7muw8QyOUpavru4= cloud.google.com/go/videointelligence v1.8.0/go.mod h1:dIcCn4gVDdS7yte/w+koiXn5dWVplOZkE+xwG9FgK+M= @@ -770,6 +875,7 @@ cloud.google.com/go/videointelligence v1.9.0 h1:RPFgVVXbI2b5vnrciZjtsUgpNKVtHO/W cloud.google.com/go/videointelligence v1.9.0/go.mod h1:29lVRMPDYHikk3v8EdPSaL8Ku+eMzDljjuvRs105XoU= cloud.google.com/go/videointelligence v1.10.0 h1:Uh5BdoET8XXqXX2uXIahGb+wTKbLkGH7s4GXR58RrG8= cloud.google.com/go/videointelligence v1.10.0/go.mod h1:LHZngX1liVtUhZvi2uNS0VQuOzNi2TkY1OakiuoUOjU= +cloud.google.com/go/videointelligence v1.11.1 h1:MBMWnkQ78GQnRz5lfdTAbBq/8QMCF3wahgtHh3s/J+k= cloud.google.com/go/videointelligence v1.11.1/go.mod h1:76xn/8InyQHarjTWsBR058SmlPCwQjgcvoW0aZykOvo= cloud.google.com/go/vision v1.2.0 h1:/CsSTkbmO9HC8iQpxbK8ATms3OQaX3YQUeTMGCxlaK4= cloud.google.com/go/vision/v2 v2.3.0/go.mod h1:UO61abBx9QRMFkNBbf1D8B1LXdS2cGiiCRx0vSpZoUo= @@ -779,6 +885,7 @@ cloud.google.com/go/vision/v2 v2.5.0/go.mod h1:MmaezXOOE+IWa+cS7OhRRLK2cNv1ZL98z cloud.google.com/go/vision/v2 v2.6.0/go.mod h1:158Hes0MvOS9Z/bDMSFpjwsUrZ5fPrdwuyyvKSGAGMY= cloud.google.com/go/vision/v2 v2.7.0 h1:8C8RXUJoflCI4yVdqhTy9tRyygSHmp60aP363z23HKg= cloud.google.com/go/vision/v2 v2.7.0/go.mod h1:H89VysHy21avemp6xcf9b9JvZHVehWbET0uT/bcuY/0= +cloud.google.com/go/vision/v2 v2.7.2 h1:ccK6/YgPfGHR/CyESz1mvIbsht5Y2xRsWCPqmTNydEw= cloud.google.com/go/vision/v2 v2.7.2/go.mod h1:jKa8oSYBWhYiXarHPvP4USxYANYUEdEsQrloLjrSwJU= cloud.google.com/go/vmmigration v1.2.0/go.mod h1:IRf0o7myyWFSmVR1ItrBSFLFD/rJkfDCUTO4vLlJvsE= cloud.google.com/go/vmmigration v1.3.0 h1:A2Tl2ZmwMRpvEmhV2ibISY85fmQR+Y5w9a0PlRz5P3s= @@ -786,18 +893,21 @@ cloud.google.com/go/vmmigration v1.3.0/go.mod h1:oGJ6ZgGPQOFdjHuocGcLqX4lc98YQ7Y cloud.google.com/go/vmmigration v1.5.0/go.mod h1:E4YQ8q7/4W9gobHjQg4JJSgXXSgY21nA5r8swQV+Xxc= cloud.google.com/go/vmmigration v1.6.0 h1:Azs5WKtfOC8pxvkyrDvt7J0/4DYBch0cVbuFfCCFt5k= cloud.google.com/go/vmmigration v1.6.0/go.mod h1:bopQ/g4z+8qXzichC7GW1w2MjbErL54rk3/C843CjfY= +cloud.google.com/go/vmmigration v1.7.1 h1:gnjIclgqbEMc+cF5IJuPxp53wjBIlqZ8h9hE8Rkwp7A= cloud.google.com/go/vmmigration v1.7.1/go.mod h1:WD+5z7a/IpZ5bKK//YmT9E047AD+rjycCAvyMxGJbro= cloud.google.com/go/vmwareengine v0.1.0 h1:JMPZaOT/gIUxVlTqSl/QQ32Y2k+r0stNeM1NSqhVP9o= cloud.google.com/go/vmwareengine v0.1.0/go.mod h1:RsdNEf/8UDvKllXhMz5J40XxDrNJNN4sagiox+OI208= cloud.google.com/go/vmwareengine v0.2.2/go.mod h1:sKdctNJxb3KLZkE/6Oui94iw/xs9PRNC2wnNLXsHvH8= cloud.google.com/go/vmwareengine v0.3.0 h1:b0NBu7S294l0gmtrT0nOJneMYgZapr5x9tVWvgDoVEM= cloud.google.com/go/vmwareengine v0.3.0/go.mod h1:wvoyMvNWdIzxMYSpH/R7y2h5h3WFkx6d+1TIsP39WGY= +cloud.google.com/go/vmwareengine v0.4.1 h1:roQrCAkaysVvXxFMuK26lORi+gablOY54htDtDDow0w= cloud.google.com/go/vmwareengine v0.4.1/go.mod h1:Px64x+BvjPZwWuc4HdmVhoygcXqEkGHXoa7uyfTgSI0= cloud.google.com/go/vpcaccess v1.4.0/go.mod h1:aQHVbTWDYUR1EbTApSVvMq1EnT57ppDmQzZ3imqIk4w= cloud.google.com/go/vpcaccess v1.5.0 h1:woHXXtnW8b9gLFdWO9HLPalAddBQ9V4LT+1vjKwR3W8= cloud.google.com/go/vpcaccess v1.5.0/go.mod h1:drmg4HLk9NkZpGfCmZ3Tz0Bwnm2+DKqViEpeEpOq0m8= cloud.google.com/go/vpcaccess v1.6.0 h1:FOe6CuiQD3BhHJWt7E8QlbBcaIzVRddupwJlp7eqmn4= cloud.google.com/go/vpcaccess v1.6.0/go.mod h1:wX2ILaNhe7TlVa4vC5xce1bCnqE3AeH27RV31lnmZes= +cloud.google.com/go/vpcaccess v1.7.1 h1:ram0GzjNWElmbxXMIzeOZUkQ9J8ZAahD6V8ilPGqX0Y= cloud.google.com/go/vpcaccess v1.7.1/go.mod h1:FogoD46/ZU+JUBX9D606X21EnxiszYi2tArQwLY4SXs= cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg= cloud.google.com/go/webrisk v1.6.0/go.mod h1:65sW9V9rOosnc9ZY7A7jsy1zoHS5W9IAXv6dGqhMQMc= @@ -805,12 +915,14 @@ cloud.google.com/go/webrisk v1.7.0 h1:ypSnpGlJnZSXbN9a13PDmAYvVekBLnGKxQ3Q9SMwnY cloud.google.com/go/webrisk v1.7.0/go.mod h1:mVMHgEYH0r337nmt1JyLthzMr6YxwN1aAIEc2fTcq7A= cloud.google.com/go/webrisk v1.8.0 h1:IY+L2+UwxcVm2zayMAtBhZleecdIFLiC+QJMzgb0kT0= cloud.google.com/go/webrisk v1.8.0/go.mod h1:oJPDuamzHXgUc+b8SiHRcVInZQuybnvEW72PqTc7sSg= +cloud.google.com/go/webrisk v1.9.1 h1:Ssy3MkOMOnyRV5H2bkMQ13Umv7CwB/kugo3qkAX83Fk= cloud.google.com/go/webrisk v1.9.1/go.mod h1:4GCmXKcOa2BZcZPn6DCEvE7HypmEJcJkr4mtM+sqYPc= cloud.google.com/go/websecurityscanner v1.3.0/go.mod h1:uImdKm2wyeXQevQJXeh8Uun/Ym1VqworNDlBXQevGMo= cloud.google.com/go/websecurityscanner v1.4.0 h1:y7yIFg/h/mO+5Y5aCOtVAnpGUOgqCH5rXQ2Oc8Oq2+g= cloud.google.com/go/websecurityscanner v1.4.0/go.mod h1:ebit/Fp0a+FWu5j4JOmJEV8S8CzdTkAS77oDsiSqYWQ= cloud.google.com/go/websecurityscanner v1.5.0 h1:AHC1xmaNMOZtNqxI9Rmm87IJEyPaRkOxeI0gpAacXGk= cloud.google.com/go/websecurityscanner v1.5.0/go.mod h1:Y6xdCPy81yi0SQnDY1xdNTNpfY1oAgXUlcfN3B3eSng= +cloud.google.com/go/websecurityscanner v1.6.1 h1:CfEF/vZ+xXyAR3zC9iaC/QRdf1MEgS20r5UR17Q4gOg= cloud.google.com/go/websecurityscanner v1.6.1/go.mod h1:Njgaw3rttgRHXzwCB8kgCYqv5/rGpFCsBOvPbYgszpg= cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= cloud.google.com/go/workflows v1.8.0/go.mod h1:ysGhmEajwZxGn1OhGOGKsTXc5PyxOc0vfKf5Af+to4M= @@ -818,10 +930,12 @@ cloud.google.com/go/workflows v1.9.0 h1:7Chpin9p50NTU8Tb7qk+I11U/IwVXmDhEoSsdccv cloud.google.com/go/workflows v1.9.0/go.mod h1:ZGkj1aFIOd9c8Gerkjjq7OW7I5+l6cSvT3ujaO/WwSA= cloud.google.com/go/workflows v1.10.0 h1:FfGp9w0cYnaKZJhUOMqCOJCYT/WlvYBfTQhFWV3sRKI= cloud.google.com/go/workflows v1.10.0/go.mod h1:fZ8LmRmZQWacon9UCX1r/g/DfAXx5VcPALq2CxzdePw= +cloud.google.com/go/workflows v1.11.1 h1:2akeQ/PgtRhrNuD/n1WvJd5zb7YyuDZrlOanBj2ihPg= cloud.google.com/go/workflows v1.11.1/go.mod h1:Z+t10G1wF7h8LgdY/EmRcQY8ptBD/nvofaL6FqlET6g= collectd.org v0.3.0 h1:iNBHGw1VvPJxH2B6RiFWFZ+vsjo1lCdRszBeOuwGi00= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9 h1:VpgP7xuJadIUuKccphEpTJnWhS2jkQyMt6Y7pJCD7fY= git.sr.ht/~sbinet/gg v0.3.1 h1:LNhjNn8DerC8f9DHLz6lS0YYul/b602DUxDgGkd/Aik= +git.sr.ht/~sbinet/gg v0.3.1/go.mod h1:KGYtlADtqsqANL9ueOFkWymvzUvLMQllU5Ixo+8v3pc= github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9 h1:HD8gA2tkByhMAwYaFAX9w2l7vxvBQ5NMoxDrkhqhtn4= github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1 h1:qoVeMsc9/fh/yhxVaA0obYjVH/oI/ihrOoMwsLS9KSA= github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= @@ -834,20 +948,24 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802 h1:1BDTz0u9nC3//pOC github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53 h1:sR+/8Yb4slttB4vD+b9btVEnWgL3Q00OBTzVT8B9C0c= github.com/CloudyKit/jet/v3 v3.0.0 h1:1PwO5w5VCtlUUl+KTOBsTGZlhjWkcybsGaAau52tOy8= github.com/CloudyKit/jet/v6 v6.1.0 h1:hvO96X345XagdH1fAoBjpBYG4a1ghhL/QzalkduPuXk= +github.com/CloudyKit/jet/v6 v6.1.0/go.mod h1:d3ypHeIRNo2+XyqnGA8s+aphtcVpjP5hPwP/Lzo7Ro4= github.com/DATA-DOG/go-sqlmock v1.3.3 h1:CWUqKXe0s8A2z6qCgkP4Kru7wC11YoAnoupUKFDnH08= github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/FactomProject/btcutilecc v0.0.0-20130527213604-d3a63a5752ec h1:1Qb69mGp/UtRPn422BH4/Y4Q3SLUrD9KHuDkm8iodFc= github.com/HdrHistogram/hdrhistogram-go v1.1.2 h1:5IcZpTvzydCQeHzK4Ef/D5rrSqwxob0t8PQPMybUNFM= +github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= github.com/Joker/hpp v1.0.0 h1:65+iuJYdRXv/XyN62C1uEmmOx3432rNG/rKlX6V7Kkc= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/Shopify/goreferrer v0.0.0-20220729165902-8cddb4f5de06 h1:KkH3I3sJuOLP3TjA/dfr4NAY8bghDwnXiU7cTKxQqo0= +github.com/Shopify/goreferrer v0.0.0-20220729165902-8cddb4f5de06/go.mod h1:7erjKLwalezA0k99cWs5L11HWOAPNjdUZ6RxH1BXbbM= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIOA6tDi6QXUemppXK3P9BI7mr2hd6gx8= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/aead/siphash v1.0.1 h1:FwHfE/T45KPKYuuSAKyyvE+oPWcaQ+CUmFW0bPlM+kg= github.com/ajg/form v1.5.1 h1:t9c7v8JUKu/XxOGBU0yjNpaMloxGEJhUkqFRq0ibGeU= github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b h1:slYM766cy2nI3BwyRiyQj/Ud48djTMtMebDqepE95rw= +github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b/go.mod h1:1KcenG0jGWcpt8ov532z81sp/kMMUG485J2InIOyADM= github.com/alecthomas/kingpin/v2 v2.3.1 h1:ANLJcKmQm4nIaog7xdr/id6FM6zm5hHnfZrvtKPxqGg= github.com/alecthomas/kingpin/v2 v2.3.1/go.mod h1:oYL5vtsvEHZGHxU7DMp32Dvx+qL+ptGn6lWaot2vCNE= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= @@ -855,85 +973,327 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafo github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 h1:s6gZFSlWYmbqAuRjVTiNNhvNRfY2Wxp9nhfyel4rklc= github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= +github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY= +github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= +github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg= +github.com/apache/arrow/go/v12 v12.0.0 h1:xtZE63VWl7qLdB0JObIXvvhGjoVNrQ9ciIHG2OK5cmc= +github.com/apache/arrow/go/v12 v12.0.0/go.mod h1:d+tV/eHZZ7Dz7RPrFKtPK02tpr+c9/PEd/zm8mDS9Vg= +github.com/apache/thrift v0.16.0 h1:qEy6UW60iVOlUy+b9ZR0d5WzUWYGOo4HfopoyBaNmoY= +github.com/apache/thrift v0.16.0/go.mod h1:PHK3hniurgQaNMZYaCLEqXKsYK8upmhPbmdP2FXSqgU= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e h1:QEF07wC0T1rKkctt1RINW/+RMTVmiwxETico2l3gxJA= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6 h1:G1bPvciwNyF7IUmKXNt9Ak3m6u9DE1rF+RmtIkBpVdA= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-metrics v0.4.0 h1:yCQqn7dwca4ITXb+CbubHmedzaQYHhNhrEXLYUeEe8Q= github.com/armon/go-metrics v0.4.0/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/ava-labs/ledger-avalanche/go v0.0.0-20230105152938-00a24d05a8c7 h1:EdxD90j5sClfL5Ngpz2TlnbnkNYdFPDXa0jDOjam65c= +github.com/ava-labs/ledger-avalanche/go v0.0.0-20230105152938-00a24d05a8c7/go.mod h1:XhiXSrh90sHUbkERzaxEftCmUz53eCijshDLZ4fByVM= +github.com/aws/aws-sdk-go-v2 v1.2.0 h1:BS+UYpbsElC82gB+2E2jiCBg36i8HlubTB/dO/moQ9c= +github.com/aws/aws-sdk-go-v2 v1.2.0/go.mod h1:zEQs02YRBw1DjK0PoJv3ygDYOFTre1ejlJWl8FwAuQo= +github.com/aws/aws-sdk-go-v2/config v1.1.1 h1:ZAoq32boMzcaTW9bcUacBswAmHTbvlvDJICgHFZuECo= +github.com/aws/aws-sdk-go-v2/config v1.1.1/go.mod h1:0XsVy9lBI/BCXm+2Tuvt39YmdHwS5unDQmxZOYe8F5Y= +github.com/aws/aws-sdk-go-v2/credentials v1.1.1 h1:NbvWIM1Mx6sNPTxowHgS2ewXCRp+NGTzUYb/96FZJbY= +github.com/aws/aws-sdk-go-v2/credentials v1.1.1/go.mod h1:mM2iIjwl7LULWtS6JCACyInboHirisUUdkBPoTHMOUo= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.0.2 h1:EtEU7WRaWliitZh2nmuxEXrN0Cb8EgPUFGIoTMeqbzI= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.0.2/go.mod h1:3hGg3PpiEjHnrkrlasTfxFqUsZ2GCk/fMUn4CbKgSkM= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.0.2 h1:4AH9fFjUlVktQMznF+YN33aWNXaR4VgDXyP28qokJC0= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.0.2/go.mod h1:45MfaXZ0cNbeuT0KQ1XJylq8A6+OpVV2E5kvY/Kq+u8= +github.com/aws/aws-sdk-go-v2/service/route53 v1.1.1 h1:cKr6St+CtC3/dl/rEBJvlk7A/IN5D5F02GNkGzfbtVU= +github.com/aws/aws-sdk-go-v2/service/route53 v1.1.1/go.mod h1:rLiOUrPLW/Er5kRcQ7NkwbjlijluLsrIbu/iyl35RO4= +github.com/aws/aws-sdk-go-v2/service/sso v1.1.1 h1:37QubsarExl5ZuCBlnRP+7l1tNwZPBSTqpTBrPH98RU= +github.com/aws/aws-sdk-go-v2/service/sso v1.1.1/go.mod h1:SuZJxklHxLAXgLTc1iFXbEWkXs7QRTQpCLGaKIprQW0= +github.com/aws/aws-sdk-go-v2/service/sts v1.1.1 h1:TJoIfnIFubCX0ACVeJ0w46HEH5MwjwYN4iFhuYIhfIY= +github.com/aws/aws-sdk-go-v2/service/sts v1.1.1/go.mod h1:Wi0EBZwiz/K44YliU0EKxqTCJGUfYTWXrrBwkq736bM= +github.com/aws/smithy-go v1.1.0 h1:D6CSsM3gdxaGaqXnPgOBCeL6Mophqzu7KJOu7zW78sU= +github.com/aws/smithy-go v1.1.0/go.mod h1:EzMw8dbp/YJL4A5/sbhGddag+NPT7q084agLbB9LgIw= +github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk= +github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= +github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible h1:Ppm0npCCsmuR9oQaBtRuZcmILVE74aXE+AmrJj8L2ns= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo= +github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d h1:yJzD/yFppdVCf6ApMkVy8cUxV0XrxdP9rVf6D87/Mng= +github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd h1:R/opQEbFEy9JGkIguV40SvRY1uliPX8ifOvi6ICsFCw= +github.com/btcsuite/goleveldb v1.0.0 h1:Tvd0BfvqX9o823q1j2UZ/epQo09eJh6dTcRp79ilIN4= +github.com/btcsuite/snappy-go v1.0.0 h1:ZxaA6lo2EpxGddsA8JwWOcxlzRybb444sgmeJQMJGQE= +github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 h1:R8vQdOQdZ9Y3SkEwmHoWBmX1DNXhXZqlTpq6s4tyJGc= +github.com/btcsuite/winsvc v1.0.0 h1:J9B4L7e3oqhXOcm+2IuNApwzQec85lE+QaikUcCs+dk= +github.com/census-instrumentation/opencensus-proto v0.4.1 h1:iKLQ0xPNFxR/2hzXZMrBo8f1j86j5WHzznCCQxV/b8g= github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= +github.com/chzyer/logex v1.2.0 h1:+eqR0HfOetur4tgnC8ftU5imRnhi4te+BadWS95c5AM= +github.com/chzyer/readline v1.5.0 h1:lSwwFrbNviGePhkewF1az4oLmcwqCZijQ2/Wi3BGHAI= +github.com/chzyer/test v0.0.0-20210722231415-061457976a23 h1:dZ0/VyGgQdVGAss6Ju0dt5P0QltE0SFY5Woh6hbIfiQ= +github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible h1:C29Ae4G5GtYyYMm1aztcyj/J5ckgJm2zwdDajFbx1NY= github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= +github.com/circonus-labs/circonusllhist v0.1.3 h1:TJH+oke8D16535+jHExHj4nQvzlZrj7ug5D7I/orNUA= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= +github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI= +github.com/cloudflare/cloudflare-go v0.14.0 h1:gFqGlGl/5f9UGXAaKapCGUfaTCgRKKnzu2VvzMZlOFA= +github.com/cloudflare/cloudflare-go v0.14.0/go.mod h1:EnwdgGMaFOruiPZRFSgn+TsQ3hQ7C/YWzIGLeu5c304= +github.com/cncf/udpa/go v0.0.0-20220112060539-c52dc94e7fbe h1:QQ3GSy+MqSHxm/d8nCtnAiZdYFd45cYZPs8vOOIYKfk= github.com/cncf/udpa/go v0.0.0-20220112060539-c52dc94e7fbe/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 h1:/inchEIKaYC1Akx+H+gqO04wryn5h75LSazbRlnya1k= github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2 h1:IKgmqgMQlVJIZj19CdocBeSfSaiCbEBZGKODaixqtHM= +github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2/go.mod h1:8BT+cPK6xvFOcRlk0R8eg+OTkcqI6baNH4xAkpiYVvQ= +github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0 h1:sDMmm+q/3+BukdIpxwO365v/Rbspp2Nt5XntgQRXq8Q= +github.com/coreos/etcd v3.3.10+incompatible h1:jFneRYjIvLMLhDLCzuTuU4rSJUjRplcJQ7pD7MnhC04= +github.com/coreos/go-etcd v2.0.0+incompatible h1:bXhRBIXoTm9BYHS3gE0TtQuyNZyeEMux2sDi4oo5YOo= +github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd/v22 v22.3.2 h1:D9/bQk5vlXQFZ6Kwuu6zaiXJ9oTPe68++AzAJc1DzSI= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= +github.com/crate-crypto/go-ipa v0.0.0-20220523130400-f11357ae11c7 h1:6IrxszG5G+O7zhtkWxq6+unVvnrm1fqV2Pe+T95DUzw= +github.com/crate-crypto/go-ipa v0.0.0-20220523130400-f11357ae11c7/go.mod h1:gFnFS95y8HstDP6P9pPwzrxOOC5TRDkwbM+ao15ChAI= +github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w= +github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c h1:/ovYnF02fwL0kvspmy9AuyKg1JhdTRUgPw4nUxd9oZM= +github.com/decred/dcrd/lru v1.0.0 h1:Kbsb1SFDsIlaupWPwsPp+dkxiBY1frcS07PCPgotKz8= +github.com/dgraph-io/badger v1.6.0 h1:DshxFxZWXUcO0xX476VJC07Xsr6ZCBVRHKZ93Oh7Evo= +github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= +github.com/dop251/goja_nodejs v0.0.0-20211022123610-8dd9abb0616d h1:W1n4DvpzZGOISgp7wWNtraLcHtnmnTwBlJidqtMIuwQ= +github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= +github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385 h1:clC1lXBpe2kTj2VHdaIu9ajZQe4kcEY9j0NsnDDBZ3o= +github.com/envoyproxy/go-control-plane v0.11.1 h1:wSUXTlLfiAQRWs2F+p+EKOY9rUyis1MyGqJ2DIk5HpM= github.com/envoyproxy/go-control-plane v0.11.1/go.mod h1:uhMcXKCQMEJHiAb0w+YGefQLaTEw+YhGluxZkrTmD0g= +github.com/envoyproxy/protoc-gen-validate v1.0.2 h1:QkIBuU5k+x7/QXPvPPnWXWlCdaBFApVqftFV6k087DA= github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7QWXpgx6x8QiMKdmN72jogE= +github.com/etcd-io/bbolt v1.3.3 h1:gSJmxrs37LgTqR/oyJBWok6k6SvXEUerFTbltIhXkBM= +github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072 h1:DddqAaWDpywytcG8w/qoQ5sAN8X12d3Z3koB0C3Rxsc= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= +github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= +github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= +github.com/fjl/gencodec v0.0.0-20230517082657-f9840df7b83e h1:bBLctRc7kr01YGvaDfgLbTwjFNW5jdp5y5rj8XXBHfY= +github.com/fjl/gencodec v0.0.0-20230517082657-f9840df7b83e/go.mod h1:AzA8Lj6YtixmJWL+wkKoBGsLWy9gFrAzi4g+5bCKwpY= +github.com/flosch/pongo2/v4 v4.0.2 h1:gv+5Pe3vaSVmiJvh/BZa82b7/00YUGm0PIyVVLop0Hw= +github.com/flosch/pongo2/v4 v4.0.2/go.mod h1:B5ObFANs/36VwxxlgKpdchIJHMvHB562PW+BWPhwZD8= github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= +github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61 h1:IZqZOB2fydHte3kUgxrzK5E1fW7RQGeDwE8F/ZZnUYc= +github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61/go.mod h1:Q0X6pkwTILDlzrGEckF6HKjXe48EgsY/l7K7vhY4MW8= +github.com/gavv/httpexpect v2.0.0+incompatible h1:1X9kcRshkSKEjNJJxX9Y9mQ5BRfbxU5kORdjhlA1yX8= +github.com/gballet/go-verkle v0.0.0-20220902153445-097bd83b7732 h1:AB7YjNrzlVHsYz06zCULVV2zYCEft82P86dSmtwxKL0= +github.com/gballet/go-verkle v0.0.0-20220902153445-097bd83b7732/go.mod h1:o/XfIXWi4/GqbQirfRm5uTbXMG5NpqxkxblnbZ+QM9I= +github.com/getkin/kin-openapi v0.61.0 h1:6awGqF5nG5zkVpMsAih1QH4VgzS8phTxECUWIFo7zko= +github.com/ghemawat/stream v0.0.0-20171120220530-696b145b53b9 h1:r5GgOLGbza2wVHRzK7aAj6lWZjfbAwiu/RDCVOKjRyM= +github.com/ghemawat/stream v0.0.0-20171120220530-696b145b53b9/go.mod h1:106OIgooyS7OzLDOpUGgm9fA3bQENb/cFSyyBmMoJDs= +github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= +github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= +github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= +github.com/gin-gonic/gin v1.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8= +github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk= +github.com/go-check/check v0.0.0-20180628173108-788fd7840127 h1:0gkP6mzaMqkmpcJYCFOLkIBwI7xFExG03bbkOkCvUPI= +github.com/go-chi/chi/v5 v5.0.0 h1:DBPx88FjZJH3FsICfDAfIfnb7XxKIYVGG6lOPlhENAg= +github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= +github.com/go-fonts/liberation v0.2.0 h1:jAkAWJP4S+OsrPLZM4/eC9iW7CtHy+HBXrEwZXWo5VM= +github.com/go-fonts/liberation v0.2.0/go.mod h1:K6qoJYypsmfVjWg8KOVDQhLc8UDgIK2HYqyqAO9z7GY= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1 h1:QbL/5oDUmRBzO9/Z7Seo6zf912W/a6Sr4Eu0G/3Jho0= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4 h1:WtGNWLvXpe6ZudgnXrq0barxBImvnnJoMEhXAzcbM0I= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0 h1:wDJmvq38kDhkVxi50ni9ykkdUr1PKgqKOoi01fa0Mdk= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= +github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= +github.com/go-latex/latex v0.0.0-20210823091927-c0d11ff05a81 h1:6zl3BbBhdnMkpSj2YY30qV3gDcVBGtFgVsV3+/i+mKQ= +github.com/go-latex/latex v0.0.0-20210823091927-c0d11ff05a81/go.mod h1:SX0U8uGpxhq9o2S/CELCSUxEWWAuoCUcVCQWv7G2OCk= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= +github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab h1:xveKWz2iaueeTaUgdetzel+U7exyigDYBryyVfV/rZk= +github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= +github.com/go-openapi/swag v0.19.5 h1:lTz6Ys4CmqqCQmZPBlbQENR1/GucA2bzYTE12Pw4tFY= +github.com/go-pdf/fpdf v0.6.0 h1:MlgtGIfsdMEEQJr2le6b/HNr1ZlQwxyWr77r2aj2U/8= +github.com/go-pdf/fpdf v0.6.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhOh5M= +github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= +github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= +github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= +github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= +github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJWXmqUsHwfTRRkQ= +github.com/go-playground/validator/v10 v10.11.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-test/deep v1.0.7/go.mod h1:QV8Hv/iy04NyLBxAdO9njL0iVPN1S4d/A3NVv1V36o8= +github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0= +github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= +github.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo= +github.com/goccy/go-json v0.9.11 h1:/pAaQDLHEoCq/5FFmSKBswWmK6H0e8g4159Kc/X/nqk= +github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/godbus/dbus/v5 v5.0.4 h1:9349emZab16e7zQvpmsbtjc18ykshndd8y2PG3sgJbA= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/status v1.1.0 h1:+eIkrewn5q6b30y+g/BJINVVdi2xH7je5MPJ3ZPK3JA= github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= +github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= +github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.4.4 h1:l75CXGRSwbaYNpl/Z2X1XIIAMSCquvXgpVZDhwEIJsc= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219 h1:utua3L2IbQJmauC5IXdEA547bcoU5dozgQAfc8Onsg4= +github.com/gomodule/redigo v1.7.1-0.20190724094224-574c33c3df38 h1:y0Wmhvml7cGnzPa9nocn/fMraMH/lMDdeG+rkx4VgYY= +github.com/google/flatbuffers v2.0.8+incompatible h1:ivUb1cGomAB101ZM1T0nOiWz9pSrTMoa9+EiY7igmkM= +github.com/google/flatbuffers v2.0.8+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk= +github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa h1:Q75Upo5UN4JbPFURXZ8nLKYUvF85dyFRop/vQ0Rv+64= +github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= +github.com/google/martian/v3 v3.3.2 h1:IqNFLAmvJOgVlpdEBiQbDc2EwKW77amAycfTuWKdfvw= github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= github.com/google/renameio v0.1.0 h1:GOZbcHa3HfsPKPlmyPyN2KEohoMXOhdMbHrvbpl2QaA= github.com/google/s2a-go v0.1.3/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= +github.com/google/s2a-go v0.1.4 h1:1kZ/sQM3srePvKs3tXAvQzo66XfcReoqFpIpIccE7Oc= github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= +github.com/google/subcommands v1.2.0 h1:vWQspBTo2nEqTUFita5/KeEWlUL8kQObDFbub/EN9oE= github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg= +github.com/googleapis/enterprise-certificate-proxy v0.2.3 h1:yk9/cqRKtT9wXZSsRH9aurXEpJX+U6FLtpYTdC3R06k= github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= github.com/googleapis/gax-go/v2 v2.7.0/go.mod h1:TEop28CZZQ2y+c0VxMUmu1lV+fQx57QpBWsYpwqHJx8= github.com/googleapis/gax-go/v2 v2.7.1/go.mod h1:4orTrqY6hXxxaUL4LHIPl6lGo8vAE38/qKbhSAKP6QI= github.com/googleapis/gax-go/v2 v2.8.0/go.mod h1:4orTrqY6hXxxaUL4LHIPl6lGo8vAE38/qKbhSAKP6QI= github.com/googleapis/gax-go/v2 v2.10.0/go.mod h1:4UOEnMCrxsSqQ940WnTiD6qJ63le2ev3xfyagutxiPw= +github.com/googleapis/gax-go/v2 v2.11.0 h1:9V9PWXEsWnPpQhu/PeQIkS4eGzMlTLGgt80cUUI8Ki4= github.com/googleapis/gax-go/v2 v2.11.0/go.mod h1:DxmR61SGKkGLa2xigwuZIQpkCI2S5iydzRfb3peWZJI= +github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8 h1:tlyzajkF3030q6M8SvmJSemC9DTHL/xaMa18b65+JM4= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= +github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY= +github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= +github.com/hashicorp/consul/api v1.20.0 h1:9IHTjNVSZ7MIwjlW3N3a7iGiykCMDpxZu8jsxFJh0yc= github.com/hashicorp/consul/api v1.20.0/go.mod h1:nR64eD44KQ59Of/ECwt2vUmIK2DKsDzAwTmwmLl8Wpo= +github.com/hashicorp/consul/sdk v0.13.1 h1:EygWVWWMczTzXGpO93awkHFzfUka6hLYJ0qhETd+6lY= +github.com/hashicorp/consul/sdk v0.13.1/go.mod h1:SW/mM4LbKfqmMvcFu8v+eiQQ7oitXEFeiBe9StxERb0= +github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= +github.com/hashicorp/go-hclog v1.2.0 h1:La19f8d7WIlm4ogzNHB0JGqs5AUDAZ2UfCY4sJXcJdM= github.com/hashicorp/go-hclog v1.2.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-msgpack v0.5.3 h1:zKjpN5BK/P5lMYrLmBHdBULWbJ0XpYR+7NGzqkZzoD4= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-multierror v1.1.0 h1:B9UzwGQJehnUY1yNrnwREHc3fGbC2xefo8g4TbElacI= github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= +github.com/hashicorp/go-retryablehttp v0.5.3 h1:QlWt0KvWT0lq8MFppF9tsJGF+ynG7ztc2KIPhzRGk7s= github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= +github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc= github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-sockaddr v1.0.2 h1:ztczhD1jLxIRjVejw8gFomI1BQZOe2WoVOu0SyteCQc= +github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A= +github.com/hashicorp/go-syslog v1.0.0 h1:KaodqZuhUoZereWVIYmpUgZysurB1kBLX2j0MwMrUAE= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE= +github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-version v1.2.1 h1:zEfKbn2+PDgroKdiOzqiE8rsmLqU2uwi5PB5pBJ3TkI= +github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.4 h1:sY0CMhFmjIPDMlTB+HfymFHCaYLhgifZ0QhjaYKD/UQ= github.com/hashicorp/mdns v1.0.4/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/YAJqrc= +github.com/hashicorp/memberlist v0.5.0 h1:EtYPN8DpAURiapus508I4n9CzHs2W+8NZGbmmR/prTM= github.com/hashicorp/memberlist v0.5.0/go.mod h1:yvyXLpo0QaGE59Y7hDTsTzDD25JYBZ4mHgHUZ8lrOI0= +github.com/hashicorp/serf v0.10.1 h1:Z1H2J60yRKvfDYAOZLd2MU0ND4AH/WDz7xYHDWQsIPY= github.com/hashicorp/serf v0.10.1/go.mod h1:yL2t6BqATOLGc5HF7qbFkTfXoPIY0WZdWHfEvMqbG+4= +github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= +github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150 h1:vlNjIqmUZ9CMAWsbURYl3a6wZbw7q5RHVvlXTNS/Bs8= +github.com/hydrogen18/memlistener v0.0.0-20200120041712-dcc25e7acd91 h1:KyZDvZ/GGn+r+Y3DKZ7UOQ/TP4xV6HNkrwiVMB1GnNY= +github.com/iancoleman/strcase v0.2.0 h1:05I4QRnGpI0m37iZQRuskXh+w77mr6Z41lwQzuHLwW0= +github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= +github.com/ianlancetaylor/demangle v0.0.0-20220319035150-800ac71e25c2 h1:rcanfLhLDA8nozr/K289V1zcntHr3V+SHlXwzz1ZI2g= +github.com/imkira/go-interpol v1.1.0 h1:KIiKr0VSG2CUW1hl1jpiyuzuJeKUUpC8iM1AIE7N1Vk= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/iris-contrib/blackfriday v2.0.0+incompatible h1:o5sHQHHm0ToHUlAJSTjW9UWicjJSDDauOOQ2AHuIVp4= +github.com/iris-contrib/go.uuid v2.0.0+incompatible h1:XZubAYg61/JwnJNbZilGjf3b3pB80+OQg2qf6c8BfWE= +github.com/iris-contrib/jade v1.1.4 h1:WoYdfyJFfZIUgqNAeOyRfTNQZOksSlZ6+FnXR3AEpX0= +github.com/iris-contrib/jade v1.1.4/go.mod h1:EDqR+ur9piDl6DUgs6qRrlfzmlx/D5UybogqrXvJTBE= +github.com/iris-contrib/pongo2 v0.0.1 h1:zGP7pW51oi5eQZMIlGA3I+FHY9/HOQWDB+572yin0to= +github.com/iris-contrib/schema v0.0.6 h1:CPSBLyx2e91H2yJzPuhGuifVRnZBBJ3pCOMbOvPZaTw= +github.com/iris-contrib/schema v0.0.6/go.mod h1:iYszG0IOsuIsfzjymw1kMzTL8YQcCWlm65f3wX8J5iA= +github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e h1:UvSe12bq+Uj2hWd8aOlwPmoZ+CITRFrdit+sDGfAg8U= +github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e/go.mod h1:G1CVv03EnqU1wYL2dFwXxW2An0az9JTl/ZsqXQeBlkU= +github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/jrick/logrotate v1.0.0 h1:lQ1bL/n9mBNeIXoTUoYRlK4dHuNJVofX9oWqBtPnSzI= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/jstemmer/go-junit-report v0.9.1 h1:6QPYqodiu3GuPL+7mfx+NwDdp2eTkp9IfEUpgAwUN0o= +github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 h1:uC1QfSlInpQF+M0ao65imhwqKnz3Q2z/d8PWZRMQvDM= +github.com/karalabe/usb v0.0.2 h1:M6QQBNxF+CQ8OFvxrT90BA0qBOXymndZnk5q235mFc4= +github.com/karalabe/usb v0.0.2/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= +github.com/kataras/blocks v0.0.7 h1:cF3RDY/vxnSRezc7vLFlQFTYXG/yAr1o7WImJuZbzC4= +github.com/kataras/blocks v0.0.7/go.mod h1:UJIU97CluDo0f+zEjbnbkeMRlvYORtmc1304EeyXf4I= +github.com/kataras/golog v0.1.7 h1:0TY5tHn5L5DlRIikepcaRR/6oInIr9AiWsxzt0vvlBE= +github.com/kataras/golog v0.1.7/go.mod h1:jOSQ+C5fUqsNSwurB/oAHq1IFSb0KI3l6GMa7xB6dZA= +github.com/kataras/iris/v12 v12.2.0-beta5 h1:grB/oCf5baZhmYIeDMfgN3LYrtEcmK8pbxlRvEZ2pgw= +github.com/kataras/iris/v12 v12.2.0-beta5/go.mod h1:q26aoWJ0Knx/00iPKg5iizDK7oQQSPjbD8np0XDh6dc= +github.com/kataras/neffos v0.0.14 h1:pdJaTvUG3NQfeMbbVCI8JT2T5goPldyyfUB2PJfh1Bs= +github.com/kataras/pio v0.0.11 h1:kqreJ5KOEXGMwHAWHDwIl+mjfNCPhAwZPa8gK7MKlyw= +github.com/kataras/pio v0.0.11/go.mod h1:38hH6SWH6m4DKSYmRhlrCJ5WItwWgCVrTNU62XZyUvI= +github.com/kataras/sitemap v0.0.6 h1:w71CRMMKYMJh6LR2wTgnk5hSgjVNB9KL60n5e2KHvLY= +github.com/kataras/sitemap v0.0.6/go.mod h1:dW4dOCNs896OR1HmG+dMLdT7JjDk7mYBzoIRwuj5jA4= +github.com/kataras/tunnel v0.0.4 h1:sCAqWuJV7nPzGrlb0os3j49lk2JhILT0rID38NHNLpA= +github.com/kataras/tunnel v0.0.4/go.mod h1:9FkU4LaeifdMWqZu7o20ojmW4B7hdhv2CMLwfnHGpYw= +github.com/kilic/bls12-381 v0.1.0 h1:encrdjqKMEvabVQ7qYOKu1OvhqpK4s47wDYtNiPtlp4= +github.com/kilic/bls12-381 v0.1.0/go.mod h1:vDTTHJONJ6G+P2R74EhnyotQDTliQDnFEwhdmfzw1ig= +github.com/kisielk/errcheck v1.5.0 h1:e8esj/e4R+SAOwFwN+n3zr0nYeCyeweozKfO23MvHzY= +github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg= +github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23 h1:FOOIBWrEkLgmlgGfMuZT83xIwfPDxEI2OHu6xUmJMFE= +github.com/klauspost/asmfmt v1.3.2 h1:4Ri7ox3EwapiOjCki+hw14RyKk201CN4rzyCJRFLpK4= +github.com/klauspost/asmfmt v1.3.2/go.mod h1:AG8TuvYojzulgDAMCnYn50l/5QV3Bs/tp6j0HLHbNSE= +github.com/klauspost/cpuid v1.2.1 h1:vJi+O/nMdFt0vqm8NZBI6wzALWdA2X+egi0ogNyrC/w= +github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4= +github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/fs v0.1.0 h1:Jskdu9ieNAYnjxsi0LbQp1ulIKZV1LAFgK1tWhpZgl8= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pty v1.1.1 h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw= +github.com/labstack/echo/v4 v4.9.0 h1:wPOF1CE6gvt/kmbMR4dGzWvHMPT+sAEUJOwOTtvITVY= +github.com/labstack/echo/v4 v4.9.0/go.mod h1:xkCDAdFCIf8jsFQ5NnbK7oqaF/yU1A1X20Ltm0OvSks= +github.com/labstack/gommon v0.3.1 h1:OomWaJXm7xR6L1HmEtGyQf26TEn7V6X88mktX9kee9o= +github.com/labstack/gommon v0.3.1/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM= github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= +github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= +github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= +github.com/lyft/protoc-gen-star/v2 v2.0.3 h1:/3+/2sWyXeMLzKd1bX+ixWKgEMsULrIivpDsuaF441o= +github.com/lyft/protoc-gen-star/v2 v2.0.3/go.mod h1:amey7yeodaJhXSbf/TlLvWiqQfLOSpEk//mLlc+axEk= +github.com/mailgun/raymond/v2 v2.0.46 h1:aOYHhvTpF5USySJ0o7cpPno/Uh2I5qg2115K25A+Ft4= +github.com/mailgun/raymond/v2 v2.0.46/go.mod h1:lsgvL50kgt1ylcFJYZiULi5fjPBkkhNfj4KA0W54Z18= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd h1:HvFwW+cm9bCbZ/+vuGNq7CRWXql8c0y8nGeYpqmpvmk= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= @@ -942,19 +1302,51 @@ github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= +github.com/mattn/goveralls v0.0.2 h1:7eJB6EqsPhRVxvwEXGnqdO2sJI0PTsrWoTMXEk9/OQc= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/mediocregopher/radix/v3 v3.4.2 h1:galbPBjIwmyREgwGCfQEN4X8lxbJnKBYurgz+VfcStA= +github.com/microcosm-cc/bluemonday v1.0.21 h1:dNH3e4PSyE4vNX+KlRGHT5KrSvjeUkoNPwEORjffHJg= +github.com/microcosm-cc/bluemonday v1.0.21/go.mod h1:ytNkv4RrDrLJ2pqlsSI46O6IVXmZOBBD4SaJyDwwTkM= github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= +github.com/miekg/dns v1.1.41 h1:WMszZWJG0XmzbK9FEmzH2TVcqYzFesusSIB41b8KHxY= github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= +github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8 h1:AMFGa4R4MiIpspGNG7Z948v4n35fFGB3RR3G/ry4FWs= +github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8/go.mod h1:mC1jAcsrzbxHt8iiaC+zU4b1ylILSosueou12R++wfY= +github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3 h1:+n/aFZefKZp7spd8DFdX7uMikMLXX4oubIzJF4kv/wI= +github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3/go.mod h1:RagcQ7I8IeTMnF8JTXieKnO4Z6JCsikNEzj0DwauVzE= +github.com/mitchellh/cli v1.1.0 h1:tEElEatulEHDeedTxwckzyYMA5c86fbmNIUL1hBIiTg= github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= +github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mmcloughlin/profile v0.1.1 h1:jhDmAqPyebOsVDOCICJoINoLb/AnLBaUw58nFzxWS2w= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/moul/http2curl v1.0.0 h1:dRMWoAtb+ePxMlLkrCbAqh4TlPHXvoGUSQ323/9Zahs= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/naoina/go-stringutil v0.1.0 h1:rCUeRUHjBjGTSHl0VC00jUPLz8/F9dDzYI70Hzifhks= +github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= +github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416 h1:shk/vn9oCoOTmwcouEdwIeOtOGA/ELRUw/GwvxwfT+0= +github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= +github.com/nats-io/jwt v0.3.0 h1:xdnzwFETV++jNc4W1mw//qFyJGb2ABOombmZJQS4+Qo= +github.com/nats-io/nats.go v1.9.1 h1:ik3HbLhZ0YABLto7iX80pZLPw/6dx3T+++MZJwLnMrQ= +github.com/nats-io/nkeys v0.1.0 h1:qMd4+pRHgdr1nAClu+2h/2a5F2TmKcCzjCDazVgRoX4= +github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= github.com/onsi/gomega v1.29.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= +github.com/otiai10/mint v1.5.1/go.mod h1:MJm72SBthJjz8qhefc4z1PYEieWmy8Bku7CjcAqyUSM= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pierrec/lz4/v4 v4.1.15 h1:MO0/ucJhngq7299dKLwIMtgTfbkoSPF6AoMYDd8Q4q0= +github.com/pierrec/lz4/v4 v4.1.15/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e h1:aoZm08cpOy4WuID//EZDgcC4zIxODThtZNPirFr42+A= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/sftp v1.13.1 h1:I2qBYMChEhIjOgazfJmV3/mZM256btk6wkCDRmW7JYs= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXqo= github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= @@ -969,21 +1361,79 @@ github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8b github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= +github.com/protolambda/bls12-381-util v0.0.0-20220416220906-d8552aa452c7 h1:cZC+usqsYgHtlBaGulVnZ1hfKAi8iWtujBnRLQE698c= +github.com/protolambda/bls12-381-util v0.0.0-20220416220906-d8552aa452c7/go.mod h1:IToEjHuttnUzwZI5KBSM/LOOW3qLbbrHOEfp3SbECGY= +github.com/rogpeppe/fastuuid v1.2.0 h1:Ppwyp6VYCF1nvBTXL3trRso7mXMlRrw9ooo375wvi2s= github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/ryanuber/columnize v2.1.0+incompatible h1:j1Wcmh8OrK4Q7GXY+V7SVSY8nUWQxHW5TkBe7YUl+2s= +github.com/sagikazarmark/crypt v0.10.0 h1:96E1qrToLBU6fGzo+PRRz7KGOc9FkYFiPnR3/zf8Smg= github.com/sagikazarmark/crypt v0.10.0/go.mod h1:gwTNHQVoOS3xp9Xvz5LLR+1AauC5M6880z5NWzdhOyQ= +github.com/sanity-io/litter v1.5.1/go.mod h1:5Z71SvaYy5kcGtyglXOC9rrUi3c1E8CamFWjQsazTh0= +github.com/schollz/closestmatch v2.1.0+incompatible h1:Uel2GXEpJqOWBrlyI+oY9LTiyyjYS17cCYRqP13/SHk= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= +github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= +github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= +github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= +github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.5/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/tdewolff/minify/v2 v2.12.4 h1:kejsHQMM17n6/gwdw53qsi6lg0TGddZADVyQOz1KMdE= +github.com/tdewolff/minify/v2 v2.12.4/go.mod h1:h+SRvSIX3kwgwTFOpSckvSxgax3uy8kZTSF1Ojrr3bk= +github.com/tdewolff/parse/v2 v2.6.4 h1:KCkDvNUMof10e3QExio9OPZJT8SbdKojLBumw8YZycQ= +github.com/tdewolff/parse/v2 v2.6.4/go.mod h1:woz0cgbLwFdtbjJu8PIKxhW05KplTFQkOdX78o+Jgrs= +github.com/thepudds/fzgen v0.4.2/go.mod h1:kHCWdsv5tdnt32NIHYDdgq083m6bMtaY0M+ipiO9xWE= +github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926 h1:G3dpKMzFDjgEh2q1Z7zUUtKa8ViPtH+ocF0bE0g00O8= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= +github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= +github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= +github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= +github.com/urfave/negroni v1.0.0 h1:kIimOitoypq34K7TG7DUaJ9kq/N4Ofuwi1sjz0KipXc= +github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= +github.com/valyala/fasthttp v1.40.0 h1:CRq/00MfruPGFLTQKY8b+8SfdK60TxNztjRMnH0t1Yc= +github.com/valyala/fasthttp v1.40.0/go.mod h1:t/G+3rLek+CyY9bnIE+YlMRddxVAAGjhxndDB4i4C0I= +github.com/valyala/fasttemplate v1.2.1 h1:TVEnxayobAdVkhQfrfes2IzOB6o+z4roRkPF52WA1u4= +github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a h1:0R4NLDRDZX6JcmhJgXi5E4b8Wg84ihbmUKp/GvSPEzc= +github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9znI5mJU= +github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= +github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= +github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= +github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= +github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= +github.com/xhit/go-str2duration v1.2.0 h1:BcV5u025cITWxEQKGWr1URRzrcXtu7uk8+luz3Yuhwc= +github.com/xhit/go-str2duration v1.2.0/go.mod h1:3cPSlfZlUHVlneIVfePFWcJZsuwf+P1v2SRTV4cUmp4= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77 h1:ESFSdwYZvkeru3RtdrYueztKhOBCSAAzS4Gf+k0tEow= +github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0 h1:6fRhSjgLCkTD3JnJxvaJ4Sj+TYblw757bqYgZaOq5ZY= +github.com/yosssi/ace v0.0.5 h1:tUkIP/BLdKqrlrPwcmH0shwEEhTRHoGnc1wFIWmaBUA= +github.com/yosssi/ace v0.0.5/go.mod h1:ALfIzm2vT7t5ZE7uoIZqF3TQ7SAOyupFZnkrF5id+K0= +github.com/yudai/gojsondiff v1.0.0 h1:27cbfqXLVEJ1o8I6v3y9lg8Ydm53EKqHXAOMxEGlCOA= +github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 h1:BHyfKlQyqbsFN5p3IfnEUduWvb9is428/nNb5L3U01M= +github.com/yudai/pp v2.0.1+incompatible h1:Q4//iY4pNF6yPLZIigmvcl7k/bPgrcTPIFIcmawg5bI= +github.com/yuin/goldmark v1.4.13 h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE= +github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0= +github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA= +github.com/zondax/hid v0.9.1 h1:gQe66rtmyZ8VeGFcOpbuH3r7erYtNEAezCAYu8LdkJo= +github.com/zondax/hid v0.9.1/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= +github.com/zondax/ledger-go v0.14.1 h1:Pip65OOl4iJ84WTpA4BKChvOufMhhbxED3BaihoZN4c= +github.com/zondax/ledger-go v0.14.1/go.mod h1:fZ3Dqg6qcdXWSOJFKMG8GCTnD7slO/RL2feOQv8K320= +go.etcd.io/etcd/api/v3 v3.5.9 h1:4wSsluwyTbGGmyjJktOf3wFQoTBIURXHnq9n/G/JQHs= go.etcd.io/etcd/api/v3 v3.5.9/go.mod h1:uyAal843mC8uUVSLWz6eHa/d971iDGnCRpmKd2Z+X8k= +go.etcd.io/etcd/client/pkg/v3 v3.5.9 h1:oidDC4+YEuSIQbsR94rY9gur91UPL6DnxDCIYd2IGsE= go.etcd.io/etcd/client/pkg/v3 v3.5.9/go.mod h1:y+CzeSmkMpWN2Jyu1npecjB9BBnABxGM4pN8cGuJeL4= +go.etcd.io/etcd/client/v2 v2.305.7 h1:AELPkjNR3/igjbO7CjyF1fPuVPjrblliiKj+Y6xSGOU= go.etcd.io/etcd/client/v2 v2.305.7/go.mod h1:GQGT5Z3TBuAQGvgPfhR7VPySu/SudxmEkRq9BgzFU6s= +go.etcd.io/etcd/client/v3 v3.5.9 h1:r5xghnU7CwbUxD/fbUtRyJGaYNfDun8sp/gTr1hew6E= go.etcd.io/etcd/client/v3 v3.5.9/go.mod h1:i/Eo5LrZ5IKqpbtpPDuaUnDOUv471oDg8cjQaUr2MbA= +go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= @@ -998,6 +1448,10 @@ golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3 golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= +golang.org/x/image v0.0.0-20220302094943-723b81ca9867 h1:TcHcE0vrmgzNH1v3ppjcMGbhG5+9fMuvOmUYwNEF4q4= +golang.org/x/image v0.0.0-20220302094943-723b81ca9867/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028 h1:4+4C/Iv2U4fMZBiMCc98MG1In4gJY5YRhtpDNeDeHWs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -1014,6 +1468,7 @@ golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.6.0/go.mod h1:ycmewcwgD4Rpr3eZJLSB4Kyyljb3qDh40vJ8STE5HKw= golang.org/x/oauth2 v0.7.0/go.mod h1:hPLQkd9LyjfXTiRohC/41GhcFqxisoUQ99sCUOHO9x4= golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE= +golang.org/x/oauth2 v0.10.0 h1:zHCpF2Khkwy4mMB4bv0U37YtJdTGW8jI0glAApi0Kh8= golang.org/x/oauth2 v0.10.0/go.mod h1:kTpgurOux7LqtuxjuyZa4Gj2gdezIt/jQtGnNFfypQI= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1041,11 +1496,16 @@ golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.12.0/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM= golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= +gonum.org/v1/plot v0.10.1 h1:dnifSs43YJuNMDzB7v8wV64O4ABBHReuAVAoBxqBqS4= +gonum.org/v1/plot v0.10.1/go.mod h1:VZW5OlhkL1mysU9vaqNHnsy86inf6Ot+jB3r+BczCEo= google.golang.org/api v0.103.0/go.mod h1:hGtW6nK1AC+d9si/UBhw8Xli+QMOf6xyNAyJw4qU9w0= google.golang.org/api v0.114.0/go.mod h1:ifYI2ZsFK6/uGddGfAD5BMxlnkBqCmqHSDUVi45N5Yg= google.golang.org/api v0.122.0/go.mod h1:gcitW0lvnyWjSp9nKxAbdHKIZ6vF4aajGueeslZOyms= +google.golang.org/api v0.126.0 h1:q4GJq+cAdMAC7XP7njvQ4tvohGLiSlytuL4BQxbIZ+o= google.golang.org/api v0.126.0/go.mod h1:mBwVAtz+87bEN6CbA1GtZPDOqY2R5ONPqJeIlvyo4Aw= +google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/genproto v0.0.0-20221201164419-0e50fba7f41c/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= google.golang.org/genproto v0.0.0-20230320184635-7606e756e683/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= @@ -1053,6 +1513,7 @@ google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:xZnkP7mR google.golang.org/genproto v0.0.0-20230706204954-ccb25ca9f130/go.mod h1:O9kGHb51iE/nOGvQaDUuadVYqovW56s5emA88lQnj6Y= google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/api v0.0.0-20230706204954-ccb25ca9f130/go.mod h1:mPBs5jNgx2GuQGvFwUvVKqtn6HsUw9nP64BedgvqEsQ= +google.golang.org/genproto/googleapis/bytestream v0.0.0-20230530153820-e85fd2cbaebc h1:g3hIDl0jRNd9PPTs2uBzYuaD5mQuwOkZY0vSc0LR32o= google.golang.org/genproto/googleapis/bytestream v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:ylj+BE99M198VPbBh6A8d9n3w8fChvyLK3wwBOjXBFA= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= google.golang.org/genproto/googleapis/rpc v0.0.0-20230706204954-ccb25ca9f130/go.mod h1:8mL13HKkDa+IuJ8yruA3ci0q+0vsUz4m//+ottjwS5o= @@ -1063,11 +1524,26 @@ google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwS google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 h1:M1YKkFIboKNieVO5DLUEVzQfGwJD30Nv2jfUgzb5UcE= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/errgo.v2 v2.1.0 h1:0vLT13EuvQ0hNvakwLuFZ/jYrLp5F3kcWHXdRggjCE8= +gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= +gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM= +gopkg.in/go-playground/validator.v8 v8.18.2 h1:lFB4DoMU6B626w8ny76MV7VX6W2VHct2GVOI3xgiMrQ= +gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce h1:xcEWjVhvbDy+nHP67nPDDpbYrY+ILlfndk4bRioVHaU= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +honnef.co/go/tools v0.0.1-2020.1.4 h1:UoveltGrhghAA7ePc+e+QYDHXrBps2PqFZiHkGR/xK8= +rsc.io/binaryregexp v0.2.0 h1:HfqmD5MEmC0zvwBuF187nq9mdnXjXsSivRiXN7SmRkE= +rsc.io/pdf v0.1.1 h1:k1MczvYDUvJBe93bYd7wrZLLUEcLZAuF824/I4e5Xr4= +rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= +rsc.io/quote/v3 v3.1.0 h1:9JKUTTIUgS6kzR9mK1YuGKv6Nl+DijDNIc0ghT58FaY= +rsc.io/sampler v1.3.0 h1:7uVkIFmeBqHfdjD+gZwtXXI+RODJ2Wc4O7MPEh/QiW4= +sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q= +sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= diff --git a/tests/erc20_to_native_token_bridge.go b/tests/erc20_to_native_token_bridge.go index 60f001225..0d5242027 100644 --- a/tests/erc20_to_native_token_bridge.go +++ b/tests/erc20_to_native_token_bridge.go @@ -117,7 +117,11 @@ func ERC20ToNativeTokenBridge(network network.Network) { Expect(err).Should(BeNil()) // Helper function - sendTokensToSource := func(valueToSend *big.Int, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { + sendTokensToSource := func( + valueToSend *big.Int, + fromKey *ecdsa.PrivateKey, + toAddress common.Address, + ) *types.Receipt { transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, subnetB.ChainIDInt) Expect(err).Should(BeNil()) transactor.Value = valueToSend @@ -152,7 +156,11 @@ func ERC20ToNativeTokenBridge(network network.Network) { } // Helper function - sendTokensToDestination := func(valueToSend *big.Int, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { + sendTokensToDestination := func( + valueToSend *big.Int, + fromKey *ecdsa.PrivateKey, + toAddress common.Address, + ) *types.Receipt { transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, subnetA.ChainIDInt) Expect(err).Should(BeNil()) diff --git a/tests/native_token_bridge.go b/tests/native_token_bridge.go index 170404c3c..8e3bbdd04 100644 --- a/tests/native_token_bridge.go +++ b/tests/native_token_bridge.go @@ -142,7 +142,11 @@ func NativeTokenBridge(network network.Network) { } // Helper function - sendTokensToDestination := func(valueToSend *big.Int, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { + sendTokensToDestination := func( + valueToSend *big.Int, + fromKey *ecdsa.PrivateKey, + toAddress common.Address, + ) *types.Receipt { transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, subnetA.ChainIDInt) Expect(err).Should(BeNil()) transactor.Value = valueToSend diff --git a/tests/utils/utils.go b/tests/utils/utils.go index d426cce5d..63c82fffd 100644 --- a/tests/utils/utils.go +++ b/tests/utils/utils.go @@ -515,14 +515,27 @@ func TraceTransaction(ctx context.Context, txHash common.Hash, subnetInfo Subnet return string(jsonStr) } -func DeployContract(ctx context.Context, byteCodeFileName string, deployerPK *ecdsa.PrivateKey, subnetInfo SubnetTestInfo, abi *abi.ABI, constructorArgs ...interface{}) { +func DeployContract( + ctx context.Context, + byteCodeFileName string, + deployerPK *ecdsa.PrivateKey, + subnetInfo SubnetTestInfo, + abi *abi.ABI, + constructorArgs ...interface{}, +) { // Deploy an example ERC20 contract to be used as the source token byteCode, err := deploymentUtils.ExtractByteCode(byteCodeFileName) Expect(err).Should(BeNil()) Expect(len(byteCode) > 0).Should(BeTrue()) transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetInfo.ChainIDInt) Expect(err).Should(BeNil()) - contractAddress, tx, _, err := bind.DeployContract(transactor, *abi, byteCode, subnetInfo.ChainWSClient, constructorArgs...) + contractAddress, tx, _, err := bind.DeployContract( + transactor, + *abi, + byteCode, + subnetInfo.ChainWSClient, + constructorArgs..., + ) Expect(err).Should(BeNil()) // Wait for transaction, then check code was deployed diff --git a/utils/contract-deployment/contractDeploymentTools.go b/utils/contract-deployment/contractDeploymentTools.go index bf7fbe26e..59064b242 100644 --- a/utils/contract-deployment/contractDeploymentTools.go +++ b/utils/contract-deployment/contractDeploymentTools.go @@ -49,5 +49,4 @@ func main() { default: log.Panic("Invalid command type. Supported options are \"constructKeylessTx\" and \"deriveContractAddress\".") } - } From 3fe7e0f3613a5ee265e02c7b94681d2af40e3a96 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Wed, 29 Nov 2023 11:10:33 -0500 Subject: [PATCH 153/183] Removed unused vars --- tests/utils/utils.go | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/tests/utils/utils.go b/tests/utils/utils.go index 63c82fffd..c4294c8d9 100644 --- a/tests/utils/utils.go +++ b/tests/utils/utils.go @@ -25,7 +25,6 @@ import ( "github.com/ava-labs/subnet-evm/core/types" "github.com/ava-labs/subnet-evm/eth/tracers" "github.com/ava-labs/subnet-evm/ethclient" - "github.com/ava-labs/subnet-evm/params" predicateutils "github.com/ava-labs/subnet-evm/predicate" "github.com/ava-labs/subnet-evm/rpc" "github.com/ava-labs/subnet-evm/x/warp" @@ -36,11 +35,9 @@ import ( ) var ( - NativeTransferGas uint64 = 21_000 - DefaultTeleporterTransactionGas uint64 = 300_000 - DefaultTeleporterTransactionGasFeeCap = big.NewInt(225 * params.GWei) - DefaultTeleporterTransactionGasTipCap = big.NewInt(params.GWei) - DefaultTeleporterTransactionValue = common.Big0 + NativeTransferGas uint64 = 21_000 + DefaultTeleporterTransactionGas uint64 = 300_000 + DefaultTeleporterTransactionValue = common.Big0 ) type SubnetTestInfo struct { @@ -438,10 +435,6 @@ func WaitForTransaction(ctx context.Context, txHash common.Hash, subnetInfo Subn } } -// -// Event getters -// - // Returns the first log in 'logs' that is successfully parsed by 'parser' func GetEventFromLogs[T any](logs []*types.Log, parser func(log types.Log) (T, error)) (T, error) { for _, log := range logs { @@ -453,10 +446,6 @@ func GetEventFromLogs[T any](logs []*types.Log, parser func(log types.Log) (T, e return *new(T), fmt.Errorf("failed to find %T event in receipt logs", *new(T)) } -// -// Unexported functions -// - // Signs a transaction using the provided key for the specified chainID func SignTransaction(tx *types.Transaction, key *ecdsa.PrivateKey, chainID *big.Int) *types.Transaction { txSigner := types.LatestSignerForChainID(chainID) From eda62d6522e5c91e962cc3deca789726e32c1954 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Wed, 29 Nov 2023 12:45:37 -0500 Subject: [PATCH 154/183] Update README --- .../NativeTokenBridge/README.md | 57 +++++++++++-------- 1 file changed, 34 insertions(+), 23 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/README.md b/contracts/src/CrossChainApplications/NativeTokenBridge/README.md index 2ff02a012..2578f9dd4 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/README.md +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/README.md @@ -1,34 +1,45 @@ -# Native-to-Native Token Bridge +# Native Token Bridge Smart contracts built on top of Teleporter to support using an ERC20 token or the native token of any EVM-based subnet as the native token for another subnet. ## Design -The native-to-native bridge is implemented using two primary contracts. -### `NativeTokenSource` - - Lives on the source chain. Pairs with exactly one `NativeTokenDestination` contract on the destination chain. - - Locks and unlocks native tokens on the Source chain corresponding to mints and burns on the destination chain. - - `transferToDestination`: transfers all tokens paid to this function call to `recipient` on the destination chain by locking them and instructing the destination chain to mint. Optionally takes the address of an ERC20 contract `feeContractAddress` as well as an amount `feeAmount` that will be used as the relayer-incentivization for the teleporter cross-chain call. Also allows for the caller to specify `allowedRelayerAddresses`. - - `receiveTeleporterMessage`: unlocks tokens on the source chain when instructed to by the `NativeTokenDestination` contract. +The Native Token Bridge is implemented using two primary contracts. + +A `TokenSource` contract lives on the `source chain`, which can be any chain on Avalanche. + +A `NativeTokenDestination` contract lives on the `destination chain`, which should be a newly created subnet. + +### `TokenSource` +Can either be a `NativeTokenSource` contract or an `ERC20TokenSource` contract. It lives on the source chain. Pairs with exactly one `NativeTokenDestination` contract on the destination chain. It locks and unlocks native tokens on the Source chain corresponding to mints and burns on the destination chain. +- `transferToDestination`: Transfers all tokens paid to this function call to `recipient` on the destination chain by locking them and instructing the destination chain to mint. Optionally takes the address of an ERC20 contract `feeContractAddress` as well as an amount `feeAmount` that will be used as the relayer-incentivization for the teleporter cross-chain call. Also allows for the caller to specify `allowedRelayerAddresses`. +- `receiveTeleporterMessage`: Can receive two types of messages: + - `Unlock`: Unlocks tokens on the source chain when instructed to by the `NativeTokenDestination` contract. + - `Burn`: Burns tokens on the source chain when instructed to by a call to `reportTotalBurnedTxFees` on the `NativeTokenDestination` contract. This function will burn tokens equal to the increase from the highest previously reported total from the destination chain. + ### `NativeTokenDestination` - - Lives on the destination chain. Pairs with exactly one `NativeTokenSource` contract on the source chain. - - Mints and burns native tokens on the Destination chain corresponding to locks and unlocks on the source chain. - - `transferToSource`: transfers all tokens paid to this function call to `recipient` on the source chain by burning the tokens and instructing the source chain to unlock. Optionally takes the address of an ERC20 contract `feeContractAddress` as well as an amount `feeAmount` that will be used as the relayer-incentivisation for the teleporter cross-chain call. Also allows for the caller to specify `allowedRelayerAddresses`. - - `receiveTeleporterMessage`: mints tokens on the destination chain when instructed to by the `NativeTokenDestination` contract. - - `isCollateralized`: returns true if `currentReserveImbalance == 0`, meaning that enough tokens have been sent from the source chain to offset the `initialReserveImbalance`. If true, all tokens sent to the destination chain will be minted, and burning/unlocking tokens will be enabled. - - `totalSupply`: Returns the best estimate of available native tokens on this chain. Equal to the `initialReserveImbalance` + `all tokens minted` - `all tokens in known burn address`. Known burn addresses include the burn address for this contract used when burning/unlocking, and the address for burned transaction fees. +A contract that lives on the destination chain. Pairs with exactly one `TokenSource` contract on the source chain. It mints and burns native tokens on the Destination chain corresponding to locks and unlocks on the source chain. +- `transferToSource`: Transfers all tokens paid to this function call to `recipient` on the source chain by burning the tokens and instructing the source chain to unlock. Optionally takes the address of an ERC20 contract `feeContractAddress` as well as an amount `feeAmount` that will be used as the relayer-incentivisation for the teleporter cross-chain call. Also allows for the caller to specify `allowedRelayerAddresses`. +- `receiveTeleporterMessage`: Mints tokens on the destination chain when instructed to by the `NativeTokenDestination` contract. +- `isCollateralized`: Returns true if `currentReserveImbalance == 0`, meaning that enough tokens have been sent from the source chain to offset the `initialReserveImbalance`. If true, all tokens sent to the destination chain will be minted, and burning/unlocking tokens will be enabled. +- `totalSupply`: Returns the best estimate of available native tokens on this chain. Equal to the `initialReserveImbalance` + `all tokens minted` - `all tokens in known burn address`. Known burn addresses include the burn address for this contract used when burning/unlocking, and the address for burned transaction fees. +- `reportTotalBurnedTxFees`: Sends a Teleporter message to the source chain containing the total number of tokens at `0x0100000000000000000000000000000000000000`. ### `Collateralizing the bridge` -On initialization, the bridge will be undercollateralized by exactly the number of tokens minted in the genesis block on the destination chain. These tokens could theoretically be sent through the bridge, with no corresponding tokens able to be unlocked on the source chain. In order to avoid this problem, the `NativeTokenDestination` contract is initialized with the value for `initialReserveImbalance`, which should correspond to the number of tokens allocated in the genesis block of the destination chain. If `initialReserveImbalance` is not properly set, behavior of this contract is undefined. The `NativeTokenDestination` contract will not mint tokens until it at least `initialReserveImbalance` tokens have been locked on the source chain. It is left to the contract deployer to ensure that the bridge is properly collateralized. Burning/unlocking is disabled until the bridge is properly collateralized. +On initialization, the bridge will be undercollateralized by exactly the number of tokens minted in the genesis block on the destination chain. These tokens could theoretically be sent through the bridge, with no corresponding tokens able to be unlocked on the source chain. In order to avoid this problem, the `NativeTokenDestination` contract is initialized with the value for `initialReserveImbalance`. + +`initialReserveImbalance` should correspond to the number of tokens allocated in the genesis block of the destination chain. If `initialReserveImbalance` is not properly set, behavior of this contract is undefined. The `NativeTokenDestination` contract will not mint tokens until it at least `initialReserveImbalance` tokens have been locked on the source chain. + +It is left to the contract deployer to ensure that the bridge is properly collateralized. Burning/unlocking is disabled until the bridge is properly collateralized. ### `Burning tokens spent as fees` - - As tokens are burned for transaction fees on the destination chain, contract owners may want to relay this information to the source chain in order to burn an equivalent number of locked tokens there because these tokens will never be bridged back. - - The address for burned transaction fees is `0x0100000000000000000000000000000000000000`. When transferring token to the source chain, the "burned" tokens are sent here so that `0x0100000000000000000000000000000000000000` will only include burned transaction fees (or tokens others have decided to burn outside of this contract) so that this number can be reported to the source chain to burn an equivalent numbers of locked tokens. - - `TODO` explain implementation. +As tokens are burned for transaction fees on the destination chain, contract owners may want to relay this information to the source chain in order to burn an equivalent number of locked tokens there because these tokens will never be bridged back. + +The address for burned transaction fees is `0x0100000000000000000000000000000000000000`. When transferring token to the source chain, the "burned" tokens are sent here so that `0x0100000000000000000000000000000000000000` will only include burned transaction fees (or tokens others have decided to burn outside of this contract) so that this number can be reported to the source chain to burn an equivalent numbers of locked tokens. ## `Setup` - - `TeleporterMessenger` must be deployed on both chains, and the address must be passed to the constructor of both contracts. - - `NativeTokenDestination` is meant to be deployed on a new subnet, and should be the only method for minting tokens on that subnet. The address of `NativeTokenDestination` must be included as the only entry for `adminAddresses` under `contractNativeMinterConfig` in the genesis config for the destination subnet. See `warp-genesis.json` for an example. - - Both `NativeTokenSource` and `NativeTokenDestination` need to be deployed to addresses known beforehand. Each address must be passed to the constructor of the other contract. To do this, you will need a known EOA, and preferably use the first transaction from the EOA (nonce 0) to deploy the contract on each chain. It is advised to allocate tokens to the EOA in the destination subnet genesis file so that it can easily deploy the contract. - - Both contracts need to be initialized with `teleporterMessengerAddress`, which is the only address they will accept function calls from. - - `NativeTokenDestination` needs to be intialized with `initialReserveImbalance`, which should equal the number of tokens allocated in the genesis file for the destination chain. If `initialReserveImbalance` is not properly set, behavior of these contracts in undefined. - - On the source chain, at least `initialReserveImbalance` tokens need to be transferred to `NativeTokenSource` using `transferToSource` in order to properly collateralize the bridge and allow regular functionality in both directions. The first `initialReserveImbalance` tokens will not be delivered to the recipient, but any excess will be delivered. Burning/unlocking is disabled until the bridge is fully collateralized. \ No newline at end of file +- `TeleporterMessenger` must be deployed on both chains, and the address must be passed to the constructor of both contracts. +- `NativeTokenDestination` is meant to be deployed on a new subnet, and should be the only method for minting tokens on that subnet. The address of `NativeTokenDestination` must be included as the only entry for `adminAddresses` under `contractNativeMinterConfig` in the genesis config for the destination subnet. See `warp-genesis.json` for an example. +- Both the chosen `TokenSource` contract and `NativeTokenDestination` need to be deployed to addresses known beforehand. Each address must be passed to the constructor of the other contract. To do this, you will need a known EOA, and preferably use the first transaction from the EOA (nonce 0) to deploy the contract on each chain. It is advised to allocate tokens to the EOA in the destination subnet genesis file so that it can easily deploy the contract. +- Both contracts need to be initialized with `teleporterMessengerAddress`, which is the only address they will accept function calls from. +- `NativeTokenDestination` needs to be intialized with `initialReserveImbalance`, which should equal the number of tokens allocated in the genesis file for the destination chain. If `initialReserveImbalance` is not properly set, behavior of these contracts in undefined. +- On the source chain, at least `initialReserveImbalance` tokens need to be transferred to the `TokenSource` contract using `transferToSource` in order to properly collateralize the bridge and allow regular functionality in both directions. The first `initialReserveImbalance` tokens will not be delivered to the recipient, but any excess will be delivered. Burning/unlocking is disabled until the bridge is fully collateralized. \ No newline at end of file From f96024d4a890c57f83826b42b441115525648148 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Wed, 29 Nov 2023 12:49:42 -0500 Subject: [PATCH 155/183] Update README --- .../src/CrossChainApplications/NativeTokenBridge/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/README.md b/contracts/src/CrossChainApplications/NativeTokenBridge/README.md index 2578f9dd4..e497ee526 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/README.md +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/README.md @@ -12,14 +12,14 @@ A `NativeTokenDestination` contract lives on the `destination chain`, which shou ### `TokenSource` Can either be a `NativeTokenSource` contract or an `ERC20TokenSource` contract. It lives on the source chain. Pairs with exactly one `NativeTokenDestination` contract on the destination chain. It locks and unlocks native tokens on the Source chain corresponding to mints and burns on the destination chain. - `transferToDestination`: Transfers all tokens paid to this function call to `recipient` on the destination chain by locking them and instructing the destination chain to mint. Optionally takes the address of an ERC20 contract `feeContractAddress` as well as an amount `feeAmount` that will be used as the relayer-incentivization for the teleporter cross-chain call. Also allows for the caller to specify `allowedRelayerAddresses`. -- `receiveTeleporterMessage`: Can receive two types of messages: +- `receiveTeleporterMessage`: Only accepts Teleporter messages from the `NativeTokenDestination` contract on the destination chain. Can receive two types of messages: - `Unlock`: Unlocks tokens on the source chain when instructed to by the `NativeTokenDestination` contract. - `Burn`: Burns tokens on the source chain when instructed to by a call to `reportTotalBurnedTxFees` on the `NativeTokenDestination` contract. This function will burn tokens equal to the increase from the highest previously reported total from the destination chain. ### `NativeTokenDestination` A contract that lives on the destination chain. Pairs with exactly one `TokenSource` contract on the source chain. It mints and burns native tokens on the Destination chain corresponding to locks and unlocks on the source chain. - `transferToSource`: Transfers all tokens paid to this function call to `recipient` on the source chain by burning the tokens and instructing the source chain to unlock. Optionally takes the address of an ERC20 contract `feeContractAddress` as well as an amount `feeAmount` that will be used as the relayer-incentivisation for the teleporter cross-chain call. Also allows for the caller to specify `allowedRelayerAddresses`. -- `receiveTeleporterMessage`: Mints tokens on the destination chain when instructed to by the `NativeTokenDestination` contract. +- `receiveTeleporterMessage`: Only accepts Teleporter messages from the `TokenSource` contract on the source chain. gMints tokens on the destination chain when instructed to by the `NativeTokenDestination` contract. - `isCollateralized`: Returns true if `currentReserveImbalance == 0`, meaning that enough tokens have been sent from the source chain to offset the `initialReserveImbalance`. If true, all tokens sent to the destination chain will be minted, and burning/unlocking tokens will be enabled. - `totalSupply`: Returns the best estimate of available native tokens on this chain. Equal to the `initialReserveImbalance` + `all tokens minted` - `all tokens in known burn address`. Known burn addresses include the burn address for this contract used when burning/unlocking, and the address for burned transaction fees. - `reportTotalBurnedTxFees`: Sends a Teleporter message to the source chain containing the total number of tokens at `0x0100000000000000000000000000000000000000`. From 91a265d805d24995217f3dee88f876f2d961c624 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Wed, 29 Nov 2023 14:16:50 -0500 Subject: [PATCH 156/183] abigen --- .../NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go | 2 +- .../NativeTokenDestination/NativeTokenDestination.go | 2 +- .../NativeTokenBridge/NativeTokenSource/NativeTokenSource.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go index 0ab0f6a53..7df5e1bb6 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go @@ -32,7 +32,7 @@ var ( // ERC20TokenSourceMetaData contains all meta data concerning the ERC20TokenSource contract. var ERC20TokenSourceMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"erc20ContractAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"transferAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBurnedTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"erc20ContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x6101006040523480156200001257600080fd5b50604051620016f3380380620016f383398101604081905262000035916200031b565b60016000556001600160a01b038416620000b15760405162461bcd60e51b815260206004820152603260248201527f4552433230546f6b656e536f757263653a207a65726f2054656c65706f727465604482015271724d657373656e676572206164647265737360701b60648201526084015b60405180910390fd5b6001600160a01b03841660e05282620001105760405162461bcd60e51b815260206004820152602b6024820152600080516020620016d383398151915260448201526a1bdb8818da185a5b88125160aa1b6064820152608401620000a8565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000163573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200018991906200036f565b8303620001ff5760405162461bcd60e51b815260206004820152603460248201527f4552433230546f6b656e536f757263653a2063616e6e6f74206272696467652060448201527f776974682073616d6520626c6f636b636861696e0000000000000000000000006064820152608401620000a8565b60808390526001600160a01b038216620002715760405162461bcd60e51b81526020600482015260336024820152600080516020620016d383398151915260448201527f6f6e20636f6e74726163742061646472657373000000000000000000000000006064820152608401620000a8565b6001600160a01b0380831660a0528116620002e85760405162461bcd60e51b815260206004820152603060248201527f4552433230546f6b656e536f757263653a20696e76616c69642045524332302060448201526f636f6e7472616374206164647265737360801b6064820152608401620000a8565b6001600160a01b031660c0525062000389915050565b80516001600160a01b03811681146200031657600080fd5b919050565b600080600080608085870312156200033257600080fd5b6200033d85620002fe565b9350602085015192506200035460408601620002fe565b91506200036460608601620002fe565b905092959194509250565b6000602082840312156200038257600080fd5b5051919050565b60805160a05160c05160e0516112be620004156000396000818160f50152818161029c015281816102d301526104ee015260008181610183015281816101e30152818161027b0152818161036d01528181610a590152610c3801526000818161013e015281816103330152610606015260008181609d0152818161030d015261058301526112be6000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063b6171f7311610066578063b6171f731461012f578063b8c9091a14610139578063c452165e14610160578063c868efaa1461016b578063e486df151461017e57600080fd5b806341d3014d1461009857806355db3e9e146100d257806387a2edba146100db5780639b3e5803146100f0575b600080fd5b6100bf7f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b6100bf60015481565b6100ee6100e9366004610e3d565b6101a5565b005b6101177f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100c9565b6100bf620186a081565b6101177f000000000000000000000000000000000000000000000000000000000000000081565b610117600160981b81565b6100ee610179366004610ed6565b6104db565b6101177f000000000000000000000000000000000000000000000000000000000000000081565b6101ad610786565b6001600160a01b0385166101dc5760405162461bcd60e51b81526004016101d390610f5f565b60405180910390fd5b60006102087f0000000000000000000000000000000000000000000000000000000000000000866107df565b90508381116102705760405162461bcd60e51b815260206004820152602e60248201527f4552433230546f6b656e536f757263653a20696e73756666696369656e74206160448201526d191a9d5cdd195908185b5bdd5b9d60921b60648201526084016101d3565b83156102c1576102c17f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000086610949565b60006102cd8583610fbd565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316815260200160405180604001604052807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031681526020018b8152508152602001620186a08152602001888880806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250604080516001600160a01b038e166020808301919091529181018890529101906060016040516020818303038152906040528152506040518263ffffffff1660e01b81526004016104339190611064565b6020604051808303816000875af1158015610452573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047691906110e2565b60408051848152602081018990529081018290529091506001600160a01b0389169033907f51f5c55ca5f8f5fde6736f19d1d035a8c67fe18c30d445cea44c4816c6a525a09060600160405180910390a35050506104d46001600055565b5050505050565b6104e3610786565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146105815760405162461bcd60e51b815260206004820152603b60248201527f4552433230546f6b656e536f757263653a20756e617574686f72697a6564205460448201527f656c65706f727465724d657373656e67657220636f6e7472616374000000000060648201526084016101d3565b7f000000000000000000000000000000000000000000000000000000000000000084146106045760405162461bcd60e51b815260206004820152602b60248201527f4552433230546f6b656e536f757263653a20696e76616c69642064657374696e60448201526a30ba34b7b71031b430b4b760a91b60648201526084016101d3565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316146106935760405162461bcd60e51b815260206004820152602560248201527f4552433230546f6b656e536f757263653a20756e617574686f72697a6564207360448201526432b73232b960d91b60648201526084016101d3565b6000806106a283850185611111565b909250905060008260018111156106bb576106bb6111d9565b036106ec57600080828060200190518101906106d791906111ef565b915091506106e58282610a2e565b5050610774565b6001826001811115610700576107006111d9565b0361072c5760008180602001905181019061071b91906110e2565b905061072681610ac5565b50610774565b60405162461bcd60e51b815260206004820181905260248201527f4552433230546f6b656e536f757263653a20696e76616c696420616374696f6e60448201526064016101d3565b50506107806001600055565b50505050565b6002600054036107d85760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101d3565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015610828573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084c91906110e2565b90506108636001600160a01b038516333086610af4565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa1580156108aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ce91906110e2565b90508181116109345760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016101d3565b61093e8282610fbd565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa15801561099a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109be91906110e2565b6109c8919061121d565b6040516001600160a01b03851660248201526044810182905290915061078090859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610b2c565b6001600160a01b038216610a545760405162461bcd60e51b81526004016101d390610f5f565b610a7f7f00000000000000000000000000000000000000000000000000000000000000008383610c03565b604080516001600160a01b0384168152602081018390527f55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407910160405180910390a15050565b600154811115610af157600060015482610adf9190610fbd565b9050610aea81610c33565b5060018190555b50565b6040516001600160a01b03808516602483015283166044820152606481018290526107809085906323b872dd60e01b906084016109f7565b6000610b81826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c989092919063ffffffff16565b805190915015610bfe5780806020019051810190610b9f9190611230565b610bfe5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016101d3565b505050565b6040516001600160a01b038316602482015260448101829052610bfe90849063a9059cbb60e01b906064016109f7565b610c627f0000000000000000000000000000000000000000000000000000000000000000600160981b83610c03565b6040518181527f2cd3fd70cd5a5d6d805e90d22741aa1a84590ace7cf01b244719558d266143829060200160405180910390a150565b6060610ca78484600085610caf565b949350505050565b606082471015610d105760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016101d3565b600080866001600160a01b03168587604051610d2c9190611259565b60006040518083038185875af1925050503d8060008114610d69576040519150601f19603f3d011682016040523d82523d6000602084013e610d6e565b606091505b5091509150610d7f87838387610d8a565b979650505050505050565b60608315610df9578251600003610df2576001600160a01b0385163b610df25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101d3565b5081610ca7565b610ca78383815115610e0e5781518083602001fd5b8060405162461bcd60e51b81526004016101d39190611275565b6001600160a01b0381168114610af157600080fd5b600080600080600060808688031215610e5557600080fd5b8535610e6081610e28565b94506020860135935060408601359250606086013567ffffffffffffffff80821115610e8b57600080fd5b818801915088601f830112610e9f57600080fd5b813581811115610eae57600080fd5b8960208260051b8501011115610ec357600080fd5b9699959850939650602001949392505050565b60008060008060608587031215610eec57600080fd5b843593506020850135610efe81610e28565b9250604085013567ffffffffffffffff80821115610f1b57600080fd5b818701915087601f830112610f2f57600080fd5b813581811115610f3e57600080fd5b886020828501011115610f5057600080fd5b95989497505060200194505050565b60208082526028908201527f4552433230546f6b656e536f757263653a207a65726f20726563697069656e74604082015267206164647265737360c01b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b8181038181111561094357610943610fa7565b600081518084526020808501945080840160005b838110156110095781516001600160a01b031687529582019590820190600101610fe4565b509495945050505050565b60005b8381101561102f578181015183820152602001611017565b50506000910152565b60008151808452611050816020860160208601611014565b601f01601f19169290920160200192915050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526110c5610100840182610fd0565b905060a0840151601f198483030160e085015261093e8282611038565b6000602082840312156110f457600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561112457600080fd5b82356002811061113357600080fd5b9150602083013567ffffffffffffffff8082111561115057600080fd5b818501915085601f83011261116457600080fd5b813581811115611176576111766110fb565b604051601f8201601f19908116603f0116810190838211818310171561119e5761119e6110fb565b816040528281528860208487010111156111b757600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b634e487b7160e01b600052602160045260246000fd5b6000806040838503121561120257600080fd5b825161120d81610e28565b6020939093015192949293505050565b8082018082111561094357610943610fa7565b60006020828403121561124257600080fd5b8151801515811461125257600080fd5b9392505050565b6000825161126b818460208701611014565b9190910192915050565b602081526000611252602083018461103856fea2646970667358221220d90cc4126b15e5abc660ddbae6b59c0246158b8acd424c01f28dad310862316d64736f6c634300081200334552433230546f6b656e536f757263653a207a65726f2064657374696e617469", + Bin: "0x6101006040523480156200001257600080fd5b50604051620016f3380380620016f383398101604081905262000035916200031b565b60016000556001600160a01b038416620000b15760405162461bcd60e51b815260206004820152603260248201527f4552433230546f6b656e536f757263653a207a65726f2054656c65706f727465604482015271724d657373656e676572206164647265737360701b60648201526084015b60405180910390fd5b6001600160a01b03841660e05282620001105760405162461bcd60e51b815260206004820152602b6024820152600080516020620016d383398151915260448201526a1bdb8818da185a5b88125160aa1b6064820152608401620000a8565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000163573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200018991906200036f565b8303620001ff5760405162461bcd60e51b815260206004820152603460248201527f4552433230546f6b656e536f757263653a2063616e6e6f74206272696467652060448201527f776974682073616d6520626c6f636b636861696e0000000000000000000000006064820152608401620000a8565b60808390526001600160a01b038216620002715760405162461bcd60e51b81526020600482015260336024820152600080516020620016d383398151915260448201527f6f6e20636f6e74726163742061646472657373000000000000000000000000006064820152608401620000a8565b6001600160a01b0380831660a0528116620002e85760405162461bcd60e51b815260206004820152603060248201527f4552433230546f6b656e536f757263653a20696e76616c69642045524332302060448201526f636f6e7472616374206164647265737360801b6064820152608401620000a8565b6001600160a01b031660c0525062000389915050565b80516001600160a01b03811681146200031657600080fd5b919050565b600080600080608085870312156200033257600080fd5b6200033d85620002fe565b9350602085015192506200035460408601620002fe565b91506200036460608601620002fe565b905092959194509250565b6000602082840312156200038257600080fd5b5051919050565b60805160a05160c05160e0516112be620004156000396000818160f50152818161029c015281816102d301526104ee015260008181610183015281816101e30152818161027b0152818161036d01528181610a590152610c3801526000818161013e015281816103330152610606015260008181609d0152818161030d015261058301526112be6000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063b6171f7311610066578063b6171f731461012f578063b8c9091a14610139578063c452165e14610160578063c868efaa1461016b578063e486df151461017e57600080fd5b806341d3014d1461009857806355db3e9e146100d257806387a2edba146100db5780639b3e5803146100f0575b600080fd5b6100bf7f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b6100bf60015481565b6100ee6100e9366004610e3d565b6101a5565b005b6101177f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100c9565b6100bf620186a081565b6101177f000000000000000000000000000000000000000000000000000000000000000081565b610117600160981b81565b6100ee610179366004610ed6565b6104db565b6101177f000000000000000000000000000000000000000000000000000000000000000081565b6101ad610786565b6001600160a01b0385166101dc5760405162461bcd60e51b81526004016101d390610f5f565b60405180910390fd5b60006102087f0000000000000000000000000000000000000000000000000000000000000000866107df565b90508381116102705760405162461bcd60e51b815260206004820152602e60248201527f4552433230546f6b656e536f757263653a20696e73756666696369656e74206160448201526d191a9d5cdd195908185b5bdd5b9d60921b60648201526084016101d3565b83156102c1576102c17f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000086610949565b60006102cd8583610fbd565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316815260200160405180604001604052807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031681526020018b8152508152602001620186a08152602001888880806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250604080516001600160a01b038e166020808301919091529181018890529101906060016040516020818303038152906040528152506040518263ffffffff1660e01b81526004016104339190611064565b6020604051808303816000875af1158015610452573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047691906110e2565b60408051848152602081018990529081018290529091506001600160a01b0389169033907f51f5c55ca5f8f5fde6736f19d1d035a8c67fe18c30d445cea44c4816c6a525a09060600160405180910390a35050506104d46001600055565b5050505050565b6104e3610786565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146105815760405162461bcd60e51b815260206004820152603b60248201527f4552433230546f6b656e536f757263653a20756e617574686f72697a6564205460448201527f656c65706f727465724d657373656e67657220636f6e7472616374000000000060648201526084016101d3565b7f000000000000000000000000000000000000000000000000000000000000000084146106045760405162461bcd60e51b815260206004820152602b60248201527f4552433230546f6b656e536f757263653a20696e76616c69642064657374696e60448201526a30ba34b7b71031b430b4b760a91b60648201526084016101d3565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316146106935760405162461bcd60e51b815260206004820152602560248201527f4552433230546f6b656e536f757263653a20756e617574686f72697a6564207360448201526432b73232b960d91b60648201526084016101d3565b6000806106a283850185611111565b909250905060008260018111156106bb576106bb6111d9565b036106ec57600080828060200190518101906106d791906111ef565b915091506106e58282610a2e565b5050610774565b6001826001811115610700576107006111d9565b0361072c5760008180602001905181019061071b91906110e2565b905061072681610ac5565b50610774565b60405162461bcd60e51b815260206004820181905260248201527f4552433230546f6b656e536f757263653a20696e76616c696420616374696f6e60448201526064016101d3565b50506107806001600055565b50505050565b6002600054036107d85760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101d3565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015610828573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084c91906110e2565b90506108636001600160a01b038516333086610af4565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa1580156108aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ce91906110e2565b90508181116109345760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016101d3565b61093e8282610fbd565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa15801561099a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109be91906110e2565b6109c8919061121d565b6040516001600160a01b03851660248201526044810182905290915061078090859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610b2c565b6001600160a01b038216610a545760405162461bcd60e51b81526004016101d390610f5f565b610a7f7f00000000000000000000000000000000000000000000000000000000000000008383610c03565b604080516001600160a01b0384168152602081018390527f55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407910160405180910390a15050565b600154811115610af157600060015482610adf9190610fbd565b9050610aea81610c33565b5060018190555b50565b6040516001600160a01b03808516602483015283166044820152606481018290526107809085906323b872dd60e01b906084016109f7565b6000610b81826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c989092919063ffffffff16565b805190915015610bfe5780806020019051810190610b9f9190611230565b610bfe5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016101d3565b505050565b6040516001600160a01b038316602482015260448101829052610bfe90849063a9059cbb60e01b906064016109f7565b610c627f0000000000000000000000000000000000000000000000000000000000000000600160981b83610c03565b6040518181527f2cd3fd70cd5a5d6d805e90d22741aa1a84590ace7cf01b244719558d266143829060200160405180910390a150565b6060610ca78484600085610caf565b949350505050565b606082471015610d105760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016101d3565b600080866001600160a01b03168587604051610d2c9190611259565b60006040518083038185875af1925050503d8060008114610d69576040519150601f19603f3d011682016040523d82523d6000602084013e610d6e565b606091505b5091509150610d7f87838387610d8a565b979650505050505050565b60608315610df9578251600003610df2576001600160a01b0385163b610df25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101d3565b5081610ca7565b610ca78383815115610e0e5781518083602001fd5b8060405162461bcd60e51b81526004016101d39190611275565b6001600160a01b0381168114610af157600080fd5b600080600080600060808688031215610e5557600080fd5b8535610e6081610e28565b94506020860135935060408601359250606086013567ffffffffffffffff80821115610e8b57600080fd5b818801915088601f830112610e9f57600080fd5b813581811115610eae57600080fd5b8960208260051b8501011115610ec357600080fd5b9699959850939650602001949392505050565b60008060008060608587031215610eec57600080fd5b843593506020850135610efe81610e28565b9250604085013567ffffffffffffffff80821115610f1b57600080fd5b818701915087601f830112610f2f57600080fd5b813581811115610f3e57600080fd5b886020828501011115610f5057600080fd5b95989497505060200194505050565b60208082526028908201527f4552433230546f6b656e536f757263653a207a65726f20726563697069656e74604082015267206164647265737360c01b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b8181038181111561094357610943610fa7565b600081518084526020808501945080840160005b838110156110095781516001600160a01b031687529582019590820190600101610fe4565b509495945050505050565b60005b8381101561102f578181015183820152602001611017565b50506000910152565b60008151808452611050816020860160208601611014565b601f01601f19169290920160200192915050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526110c5610100840182610fd0565b905060a0840151601f198483030160e085015261093e8282611038565b6000602082840312156110f457600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561112457600080fd5b82356002811061113357600080fd5b9150602083013567ffffffffffffffff8082111561115057600080fd5b818501915085601f83011261116457600080fd5b813581811115611176576111766110fb565b604051601f8201601f19908116603f0116810190838211818310171561119e5761119e6110fb565b816040528281528860208487010111156111b757600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b634e487b7160e01b600052602160045260246000fd5b6000806040838503121561120257600080fd5b825161120d81610e28565b6020939093015192949293505050565b8082018082111561094357610943610fa7565b60006020828403121561124257600080fd5b8151801515811461125257600080fd5b9392505050565b6000825161126b818460208701611014565b9190910192915050565b602081526000611252602083018461103856fea2646970667358221220f7e42fc360c2fbd286b857618d7456ef997666777dc8ca7c3ccc9a49b0b0088864736f6c634300081200334552433230546f6b656e536f757263653a207a65726f2064657374696e617469", } // ERC20TokenSourceABI is the input ABI used to generate the binding from. diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go index 1edec64e1..e24f4de41 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go @@ -38,7 +38,7 @@ type TeleporterFeeInfo struct { // NativeTokenDestinationMetaData contains all meta data concerning the NativeTokenDestination contract. var NativeTokenDestinationMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialReserveImbalance_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"burnAddressBalance\",\"type\":\"uint256\"}],\"name\":\"ReportTotalBurnedTxFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"BURN_FOR_TRANSFER_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REPORT_BURNED_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"reportTotalBurnedTxFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalMinted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", - Bin: "0x61012060405273020000000000000000000000000000000000000160805260006002553480156200002f57600080fd5b5060405162001b4c38038062001b4c8339810160408190526200005291620002d7565b60016000556001600160a01b038416620000d95760405162461bcd60e51b815260206004820152603860248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2054656c60448201527f65706f727465724d657373656e6765722061646472657373000000000000000060648201526084015b60405180910390fd5b6001600160a01b03841661010052826200013a5760405162461bcd60e51b815260206004820152602c602482015260008051602062001b2c83398151915260448201526b1c98d94818da185a5b88125160a21b6064820152608401620000d0565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200018d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001b3919062000320565b8303620002295760405162461bcd60e51b815260206004820152603a60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a2063616e6e6f74206260448201527f726964676520776974682073616d6520626c6f636b636861696e0000000000006064820152608401620000d0565b60a08390526001600160a01b0382166200029b5760405162461bcd60e51b8152602060048201526034602482015260008051602062001b2c83398151915260448201527f72636520636f6e747261637420616464726573730000000000000000000000006064820152608401620000d0565b6001600160a01b0390911660c05260e0819052600155506200033a9050565b80516001600160a01b0381168114620002d257600080fd5b919050565b60008060008060808587031215620002ee57600080fd5b620002f985620002ba565b9350602085015192506200031060408601620002ba565b6060959095015193969295505050565b6000602082840312156200033357600080fd5b5051919050565b60805160a05160c05160e05161010051611759620003d3600039600081816102440152818161040c015281816106a50152818161070201526109120152600081816102100152818161030401526103b90152600081816101b10152818161046c015281816107620152610a3501526000818161013c015281816104460152818161073c01526109b101526000610c6d01526117596000f3fe6080604052600436106100e75760003560e01c80638ac7dd201161008a578063ab28523011610059578063ab28523014610297578063c452165e146102ae578063c868efaa146102c6578063d30951261461029757600080fd5b80638ac7dd20146101fe5780639b3e580314610232578063a2309ff814610266578063a2a950171461027c57600080fd5b80633a94fe51116100c65780633a94fe511461015e57806349e3284e146101805780635d93f9af1461019f57806375846562146101eb57600080fd5b8062d872ae146100ec57806318160ddd1461011557806329b7b3fd1461012a575b600080fd5b3480156100f857600080fd5b5061010260015481565b6040519081526020015b60405180910390f35b34801561012157600080fd5b506101026102e6565b34801561013657600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561016a57600080fd5b5061017e6101793660046112d7565b6103f5565b005b34801561018c57600080fd5b506001546040519015815260200161010c565b3480156101ab57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010c565b61017e6101f9366004611343565b6105d0565b34801561020a57600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561023e57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b34801561027257600080fd5b5061010260025481565b34801561028857600080fd5b506101d36001600160981b0181565b3480156102a357600080fd5b50610102620186a081565b3480156102ba57600080fd5b506101d3600160981b81565b3480156102d257600080fd5b5061017e6102e13660046113a7565b6108ff565b6000806103006001600160981b0131600160981b31611446565b90507f00000000000000000000000000000000000000000000000000000000000000006002546103309190611446565b8111156103b65760405162461bcd60e51b815260206004820152604360248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20464154414c202d2060448201527f636f6e74726163742068617320746f6b656e7320756e6163636f756e746564206064820152623337b960e91b608482015260a4015b60405180910390fd5b807f00000000000000000000000000000000000000000000000000000000000000006002546103e59190611446565b6103ef9190611459565b91505090565b6000600160981b6001600160a01b031631905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906104aa919061146c565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505050908252506040805160208082018990528251808303820181528284019093529092019161051c91600191606001611522565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161054a919061159d565b6020604051808303816000875af1158015610569573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058d919061161b565b9050807f2550fa6041684d40e635e29e93dde9017d70c25b46aa88393317b5182ed6ae7c836040516105c191815260200190565b60405180910390a25050505050565b6105d8610d2c565b6001600160a01b0384166105fe5760405162461bcd60e51b81526004016103ad90611634565b6001541561066b5760405162461bcd60e51b815260206004820152603460248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20636f6e7472616374604482015273081d5b99195c98dbdb1b185d195c985b1a5e995960621b60648201526084016103ad565b60006020840135156106ca576106916106876020860186611682565b8560200135610d85565b90506106ca6106a36020860186611682565b7f000000000000000000000000000000000000000000000000000000000000000083610eef565b6040516001600160981b01903480156108fc02916000818181858888f193505050501580156106fd573d6000803e3d6000fd5b5060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906107a0919061146c565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250938552505060405160209384019361080e92508d913491016001600160a01b03929092168252602082015260400190565b60408051601f198184030181529082905261082c9291602001611522565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161085a919061159d565b6020604051808303816000875af1158015610879573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061089d919061161b565b905080866001600160a01b0316336001600160a01b03167f0322cbb1d3c23f6dbf1deddb3b4ef3ce0f93ae6eec7b44e4f395804104466d14346040516108e591815260200190565b60405180910390a450506108f96001600055565b50505050565b610907610d2c565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146109af5760405162461bcd60e51b815260206004820152604160248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201527f697a65642054656c65706f727465724d657373656e67657220636f6e747261636064820152601d60fa1b608482015260a4016103ad565b7f00000000000000000000000000000000000000000000000000000000000000008414610a335760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20696e76616c69642060448201526b39b7bab931b29031b430b4b760a11b60648201526084016103ad565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031614610ac85760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201526a34bd32b21039b2b73232b960a91b60648201526084016103ad565b600080610ad7838501856116a6565b90925090506001600160a01b038216610b025760405162461bcd60e51b81526004016103ad90611634565b80600003610b665760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2074726160448201526a6e736665722076616c756560a81b60648201526084016103ad565b600154819015610c4757600154821115610bdd5760015460408051918252600060208301526001600160a01b03881682820152517f66c12a5fefbc1f35dd64a1d9b069fc5bda187e6f68812c58a330b77b2a695ba99181900360600190a1600154610bd19083611459565b60006001559050610c47565b8160016000828254610bef9190611459565b90915550506001546040805184815260208101929092526001600160a01b03881682820152517f66c12a5fefbc1f35dd64a1d9b069fc5bda187e6f68812c58a330b77b2a695ba99181900360600190a1505050610d22565b6040516327ad555d60e11b81526001600160a01b038481166004830152602482018390527f00000000000000000000000000000000000000000000000000000000000000001690634f5aaaba90604401600060405180830381600087803b158015610cb157600080fd5b505af1158015610cc5573d6000803e3d6000fd5b505050508060026000828254610cdb9190611446565b90915550506040518181526001600160a01b038416907fd949ea0e9d5db53492d77f28fd5467fb2f6c4f5b88e3350e3c36729b76e99cf29060200160405180910390a25050505b6108f96001600055565b600260005403610d7e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016103ad565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015610dce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df2919061161b565b9050610e096001600160a01b038516333086610fd4565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610e50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e74919061161b565b9050818111610eda5760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016103ad565b610ee48282611459565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610f40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f64919061161b565b610f6e9190611446565b6040516001600160a01b0385166024820152604481018290529091506108f990859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261100c565b6040516001600160a01b03808516602483015283166044820152606481018290526108f99085906323b872dd60e01b90608401610f9d565b6000611061826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166110e39092919063ffffffff16565b8051909150156110de578080602001905181019061107f91906116d2565b6110de5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103ad565b505050565b60606110f284846000856110fa565b949350505050565b60608247101561115b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016103ad565b600080866001600160a01b0316858760405161117791906116f4565b60006040518083038185875af1925050503d80600081146111b4576040519150601f19603f3d011682016040523d82523d6000602084013e6111b9565b606091505b50915091506111ca878383876111d5565b979650505050505050565b6060831561124457825160000361123d576001600160a01b0385163b61123d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103ad565b50816110f2565b6110f283838151156112595781518083602001fd5b8060405162461bcd60e51b81526004016103ad9190611710565b60006040828403121561128557600080fd5b50919050565b60008083601f84011261129d57600080fd5b50813567ffffffffffffffff8111156112b557600080fd5b6020830191508360208260051b85010111156112d057600080fd5b9250929050565b6000806000606084860312156112ec57600080fd5b6112f68585611273565b9250604084013567ffffffffffffffff81111561131257600080fd5b61131e8682870161128b565b9497909650939450505050565b6001600160a01b038116811461134057600080fd5b50565b6000806000806080858703121561135957600080fd5b84356113648161132b565b93506113738660208701611273565b9250606085013567ffffffffffffffff81111561138f57600080fd5b61139b8782880161128b565b95989497509550505050565b600080600080606085870312156113bd57600080fd5b8435935060208501356113cf8161132b565b9250604085013567ffffffffffffffff808211156113ec57600080fd5b818701915087601f83011261140057600080fd5b81358181111561140f57600080fd5b88602082850101111561142157600080fd5b95989497505060200194505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610ee957610ee9611430565b81810381811115610ee957610ee9611430565b60006040828403121561147e57600080fd5b6040516040810181811067ffffffffffffffff821117156114af57634e487b7160e01b600052604160045260246000fd5b60405282356114bd8161132b565b81526020928301359281019290925250919050565b60005b838110156114ed5781810151838201526020016114d5565b50506000910152565b6000815180845261150e8160208601602086016114d2565b601f01601f19169290920160200192915050565b60006002841061154257634e487b7160e01b600052602160045260246000fd5b838252604060208301526110f260408301846114f6565b600081518084526020808501945080840160005b838110156115925781516001600160a01b03168752958201959082019060010161156d565b509495945050505050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526115fe610100840182611559565b905060a0840151601f198483030160e0850152610ee482826114f6565b60006020828403121561162d57600080fd5b5051919050565b6020808252602e908201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2072656360408201526d697069656e74206164647265737360901b606082015260800190565b60006020828403121561169457600080fd5b813561169f8161132b565b9392505050565b600080604083850312156116b957600080fd5b82356116c48161132b565b946020939093013593505050565b6000602082840312156116e457600080fd5b8151801515811461169f57600080fd5b600082516117068184602087016114d2565b9190910192915050565b60208152600061169f60208301846114f656fea26469706673582212202e12a8ebb7466abc217cf86709f71e9b451ca1cd29a79690f73c276914f44a5e64736f6c634300081200334e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20736f75", + Bin: "0x61012060405273020000000000000000000000000000000000000160805260006002553480156200002f57600080fd5b5060405162001b4c38038062001b4c8339810160408190526200005291620002d7565b60016000556001600160a01b038416620000d95760405162461bcd60e51b815260206004820152603860248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2054656c60448201527f65706f727465724d657373656e6765722061646472657373000000000000000060648201526084015b60405180910390fd5b6001600160a01b03841661010052826200013a5760405162461bcd60e51b815260206004820152602c602482015260008051602062001b2c83398151915260448201526b1c98d94818da185a5b88125160a21b6064820152608401620000d0565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200018d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001b3919062000320565b8303620002295760405162461bcd60e51b815260206004820152603a60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a2063616e6e6f74206260448201527f726964676520776974682073616d6520626c6f636b636861696e0000000000006064820152608401620000d0565b60a08390526001600160a01b0382166200029b5760405162461bcd60e51b8152602060048201526034602482015260008051602062001b2c83398151915260448201527f72636520636f6e747261637420616464726573730000000000000000000000006064820152608401620000d0565b6001600160a01b0390911660c05260e0819052600155506200033a9050565b80516001600160a01b0381168114620002d257600080fd5b919050565b60008060008060808587031215620002ee57600080fd5b620002f985620002ba565b9350602085015192506200031060408601620002ba565b6060959095015193969295505050565b6000602082840312156200033357600080fd5b5051919050565b60805160a05160c05160e05161010051611759620003d3600039600081816102440152818161040c015281816106a50152818161070201526109120152600081816102100152818161030401526103b90152600081816101b10152818161046c015281816107620152610a3501526000818161013c015281816104460152818161073c01526109b101526000610c6d01526117596000f3fe6080604052600436106100e75760003560e01c80638ac7dd201161008a578063ab28523011610059578063ab28523014610297578063c452165e146102ae578063c868efaa146102c6578063d30951261461029757600080fd5b80638ac7dd20146101fe5780639b3e580314610232578063a2309ff814610266578063a2a950171461027c57600080fd5b80633a94fe51116100c65780633a94fe511461015e57806349e3284e146101805780635d93f9af1461019f57806375846562146101eb57600080fd5b8062d872ae146100ec57806318160ddd1461011557806329b7b3fd1461012a575b600080fd5b3480156100f857600080fd5b5061010260015481565b6040519081526020015b60405180910390f35b34801561012157600080fd5b506101026102e6565b34801561013657600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561016a57600080fd5b5061017e6101793660046112d7565b6103f5565b005b34801561018c57600080fd5b506001546040519015815260200161010c565b3480156101ab57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010c565b61017e6101f9366004611343565b6105d0565b34801561020a57600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561023e57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b34801561027257600080fd5b5061010260025481565b34801561028857600080fd5b506101d36001600160981b0181565b3480156102a357600080fd5b50610102620186a081565b3480156102ba57600080fd5b506101d3600160981b81565b3480156102d257600080fd5b5061017e6102e13660046113a7565b6108ff565b6000806103006001600160981b0131600160981b31611446565b90507f00000000000000000000000000000000000000000000000000000000000000006002546103309190611446565b8111156103b65760405162461bcd60e51b815260206004820152604360248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20464154414c202d2060448201527f636f6e74726163742068617320746f6b656e7320756e6163636f756e746564206064820152623337b960e91b608482015260a4015b60405180910390fd5b807f00000000000000000000000000000000000000000000000000000000000000006002546103e59190611446565b6103ef9190611459565b91505090565b6000600160981b6001600160a01b031631905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906104aa919061146c565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505050908252506040805160208082018990528251808303820181528284019093529092019161051c91600191606001611522565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161054a919061159d565b6020604051808303816000875af1158015610569573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058d919061161b565b9050807f2550fa6041684d40e635e29e93dde9017d70c25b46aa88393317b5182ed6ae7c836040516105c191815260200190565b60405180910390a25050505050565b6105d8610d2c565b6001600160a01b0384166105fe5760405162461bcd60e51b81526004016103ad90611634565b6001541561066b5760405162461bcd60e51b815260206004820152603460248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20636f6e7472616374604482015273081d5b99195c98dbdb1b185d195c985b1a5e995960621b60648201526084016103ad565b60006020840135156106ca576106916106876020860186611682565b8560200135610d85565b90506106ca6106a36020860186611682565b7f000000000000000000000000000000000000000000000000000000000000000083610eef565b6040516001600160981b01903480156108fc02916000818181858888f193505050501580156106fd573d6000803e3d6000fd5b5060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906107a0919061146c565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250938552505060405160209384019361080e92508d913491016001600160a01b03929092168252602082015260400190565b60408051601f198184030181529082905261082c9291602001611522565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161085a919061159d565b6020604051808303816000875af1158015610879573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061089d919061161b565b905080866001600160a01b0316336001600160a01b03167f0322cbb1d3c23f6dbf1deddb3b4ef3ce0f93ae6eec7b44e4f395804104466d14346040516108e591815260200190565b60405180910390a450506108f96001600055565b50505050565b610907610d2c565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146109af5760405162461bcd60e51b815260206004820152604160248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201527f697a65642054656c65706f727465724d657373656e67657220636f6e747261636064820152601d60fa1b608482015260a4016103ad565b7f00000000000000000000000000000000000000000000000000000000000000008414610a335760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20696e76616c69642060448201526b39b7bab931b29031b430b4b760a11b60648201526084016103ad565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031614610ac85760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201526a34bd32b21039b2b73232b960a91b60648201526084016103ad565b600080610ad7838501856116a6565b90925090506001600160a01b038216610b025760405162461bcd60e51b81526004016103ad90611634565b80600003610b665760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2074726160448201526a6e736665722076616c756560a81b60648201526084016103ad565b600154819015610c4757600154821115610bdd5760015460408051918252600060208301526001600160a01b03881682820152517f66c12a5fefbc1f35dd64a1d9b069fc5bda187e6f68812c58a330b77b2a695ba99181900360600190a1600154610bd19083611459565b60006001559050610c47565b8160016000828254610bef9190611459565b90915550506001546040805184815260208101929092526001600160a01b03881682820152517f66c12a5fefbc1f35dd64a1d9b069fc5bda187e6f68812c58a330b77b2a695ba99181900360600190a1505050610d22565b6040516327ad555d60e11b81526001600160a01b038481166004830152602482018390527f00000000000000000000000000000000000000000000000000000000000000001690634f5aaaba90604401600060405180830381600087803b158015610cb157600080fd5b505af1158015610cc5573d6000803e3d6000fd5b505050508060026000828254610cdb9190611446565b90915550506040518181526001600160a01b038416907fd949ea0e9d5db53492d77f28fd5467fb2f6c4f5b88e3350e3c36729b76e99cf29060200160405180910390a25050505b6108f96001600055565b600260005403610d7e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016103ad565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015610dce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df2919061161b565b9050610e096001600160a01b038516333086610fd4565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610e50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e74919061161b565b9050818111610eda5760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016103ad565b610ee48282611459565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610f40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f64919061161b565b610f6e9190611446565b6040516001600160a01b0385166024820152604481018290529091506108f990859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261100c565b6040516001600160a01b03808516602483015283166044820152606481018290526108f99085906323b872dd60e01b90608401610f9d565b6000611061826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166110e39092919063ffffffff16565b8051909150156110de578080602001905181019061107f91906116d2565b6110de5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103ad565b505050565b60606110f284846000856110fa565b949350505050565b60608247101561115b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016103ad565b600080866001600160a01b0316858760405161117791906116f4565b60006040518083038185875af1925050503d80600081146111b4576040519150601f19603f3d011682016040523d82523d6000602084013e6111b9565b606091505b50915091506111ca878383876111d5565b979650505050505050565b6060831561124457825160000361123d576001600160a01b0385163b61123d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103ad565b50816110f2565b6110f283838151156112595781518083602001fd5b8060405162461bcd60e51b81526004016103ad9190611710565b60006040828403121561128557600080fd5b50919050565b60008083601f84011261129d57600080fd5b50813567ffffffffffffffff8111156112b557600080fd5b6020830191508360208260051b85010111156112d057600080fd5b9250929050565b6000806000606084860312156112ec57600080fd5b6112f68585611273565b9250604084013567ffffffffffffffff81111561131257600080fd5b61131e8682870161128b565b9497909650939450505050565b6001600160a01b038116811461134057600080fd5b50565b6000806000806080858703121561135957600080fd5b84356113648161132b565b93506113738660208701611273565b9250606085013567ffffffffffffffff81111561138f57600080fd5b61139b8782880161128b565b95989497509550505050565b600080600080606085870312156113bd57600080fd5b8435935060208501356113cf8161132b565b9250604085013567ffffffffffffffff808211156113ec57600080fd5b818701915087601f83011261140057600080fd5b81358181111561140f57600080fd5b88602082850101111561142157600080fd5b95989497505060200194505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610ee957610ee9611430565b81810381811115610ee957610ee9611430565b60006040828403121561147e57600080fd5b6040516040810181811067ffffffffffffffff821117156114af57634e487b7160e01b600052604160045260246000fd5b60405282356114bd8161132b565b81526020928301359281019290925250919050565b60005b838110156114ed5781810151838201526020016114d5565b50506000910152565b6000815180845261150e8160208601602086016114d2565b601f01601f19169290920160200192915050565b60006002841061154257634e487b7160e01b600052602160045260246000fd5b838252604060208301526110f260408301846114f6565b600081518084526020808501945080840160005b838110156115925781516001600160a01b03168752958201959082019060010161156d565b509495945050505050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526115fe610100840182611559565b905060a0840151601f198483030160e0850152610ee482826114f6565b60006020828403121561162d57600080fd5b5051919050565b6020808252602e908201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2072656360408201526d697069656e74206164647265737360901b606082015260800190565b60006020828403121561169457600080fd5b813561169f8161132b565b9392505050565b600080604083850312156116b957600080fd5b82356116c48161132b565b946020939093013593505050565b6000602082840312156116e457600080fd5b8151801515811461169f57600080fd5b600082516117068184602087016114d2565b9190910192915050565b60208152600061169f60208301846114f656fea2646970667358221220afb0887f1be0fc10dadd8cbb6ba44b02480439b2bc005d1c9fb4a66c4a0c97b164736f6c634300081200334e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20736f75", } // NativeTokenDestinationABI is the input ABI used to generate the binding from. diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go index 8437ffce9..e73f6dfc3 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go @@ -38,7 +38,7 @@ type TeleporterFeeInfo struct { // NativeTokenSourceMetaData contains all meta data concerning the NativeTokenSource contract. var NativeTokenSourceMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBurnedTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", - Bin: "0x60e06040523480156200001157600080fd5b5060405162001643380380620016438339810160408190526200003491620002ae565b60016000556001600160a01b038316620000bb5760405162461bcd60e51b815260206004820152603360248201527f4e6174697665546f6b656e536f757263653a207a65726f2054656c65706f727460448201527f65724d657373656e67657220616464726573730000000000000000000000000060648201526084015b60405180910390fd5b6001600160a01b03831660c052816200011b5760405162461bcd60e51b815260206004820152602c60248201526000805160206200162383398151915260448201526b1a5bdb8818da185a5b88125160a21b6064820152608401620000b2565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200016e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001949190620002ef565b82036200020a5760405162461bcd60e51b815260206004820152603560248201527f4e6174697665546f6b656e536f757263653a2063616e6e6f742062726964676560448201527f20776974682073616d6520626c6f636b636861696e00000000000000000000006064820152608401620000b2565b60808290526001600160a01b0381166200027c5760405162461bcd60e51b815260206004820152603460248201526000805160206200162383398151915260448201527f696f6e20636f6e747261637420616464726573730000000000000000000000006064820152608401620000b2565b6001600160a01b031660a05250620003099050565b80516001600160a01b0381168114620002a957600080fd5b919050565b600080600060608486031215620002c457600080fd5b620002cf8462000291565b925060208401519150620002e66040850162000291565b90509250925092565b6000602082840312156200030257600080fd5b5051919050565b60805160a05160c0516112bb620003686000396000818160ef0152818161027001528181610299015261048c015260008181610167015281816102f901526105a50152600081816092015281816102d3015261052101526112bb6000f3fe60806040526004361061007b5760003560e01c8063b6171f731161004e578063b6171f731461013e578063b8c9091a14610155578063c452165e14610189578063c868efaa146101a157600080fd5b806341d3014d1461008057806355db3e9e146100c75780639b3e5803146100dd578063ad0aee2514610129575b600080fd5b34801561008c57600080fd5b506100b47f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b3480156100d357600080fd5b506100b460015481565b3480156100e957600080fd5b506101117f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100be565b61013c610137366004610e01565b6101c1565b005b34801561014a57600080fd5b506100b4620186a081565b34801561016157600080fd5b506101117f000000000000000000000000000000000000000000000000000000000000000081565b34801561019557600080fd5b50610111600160981b81565b3480156101ad57600080fd5b5061013c6101bc366004610ea0565b610479565b6101c961072a565b6001600160a01b0384166102365760405162461bcd60e51b815260206004820152602960248201527f4e6174697665546f6b656e536f757263653a207a65726f20657263697069656e60448201526874206164647265737360b81b60648201526084015b60405180910390fd5b60006020840135156102955761025c6102526020860186610f1a565b8560200135610783565b905061029561026e6020860186610f1a565b7f0000000000000000000000000000000000000000000000000000000000000000836108ed565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906103379190610f85565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505050908252506040516020918201916103a6918c913491016001600160a01b03929092168252602082015260400190565b6040516020818303038152906040528152506040518263ffffffff1660e01b81526004016103d49190611071565b6020604051808303816000875af11580156103f3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041791906110ef565b905080866001600160a01b0316336001600160a01b03167f2b4e8f08417773e367064a6aea9ca2df303a60876676f70b6c3c5e66b314ca5a3460405161045f91815260200190565b60405180910390a450506104736001600055565b50505050565b61048161072a565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461051f5760405162461bcd60e51b815260206004820152603c60248201527f4e6174697665546f6b656e536f757263653a20756e617574686f72697a65642060448201527f74656c65706f727465724d657373656e67657220636f6e747261637400000000606482015260840161022d565b7f000000000000000000000000000000000000000000000000000000000000000084146105a35760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e536f757263653a20696e76616c696420646573746960448201526b3730ba34b7b71031b430b4b760a11b606482015260840161022d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316146106335760405162461bcd60e51b815260206004820152602660248201527f4e6174697665546f6b656e536f757263653a20756e617574686f72697a65642060448201526539b2b73232b960d11b606482015260840161022d565b60008061064283850185611108565b9092509050600082600181111561065b5761065b6111b4565b0361068c576000808280602001905181019061067791906111ca565b9150915061068582826109d2565b505061071e565b60018260018111156106a0576106a06111b4565b036106cc576000818060200190518101906106bb91906110ef565b90506106c681610ab6565b5061071e565b60405162461bcd60e51b815260206004820152602160248201527f4e6174697665546f6b656e536f757263653a20696e76616c696420616374696f6044820152603760f91b606482015260840161022d565b50506104736001600055565b60026000540361077c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161022d565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa1580156107cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f091906110ef565b90506108076001600160a01b038516333086610ae5565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa15801561084e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061087291906110ef565b90508181116108d85760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b606482015260840161022d565b6108e2828261120e565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa15801561093e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061096291906110ef565b61096c9190611221565b6040516001600160a01b03851660248201526044810182905290915061047390859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610b1d565b6001600160a01b038216610a395760405162461bcd60e51b815260206004820152602860248201527f4552433230546f6b656e536f757263653a207a65726f20726563697069656e74604482015267206164647265737360c01b606482015260840161022d565b6040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015610a6f573d6000803e3d6000fd5b50604080516001600160a01b0384168152602081018390527f55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407910160405180910390a15050565b600154811115610ae257600060015482610ad0919061120e565b9050610adb81610bf4565b5060018190555b50565b6040516001600160a01b03808516602483015283166044820152606481018290526104739085906323b872dd60e01b9060840161099b565b6000610b72826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c5c9092919063ffffffff16565b805190915015610bef5780806020019051810190610b909190611234565b610bef5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161022d565b505050565b604051600160981b9082156108fc029083906000818181858888f19350505050158015610c25573d6000803e3d6000fd5b506040518181527f2cd3fd70cd5a5d6d805e90d22741aa1a84590ace7cf01b244719558d266143829060200160405180910390a150565b6060610c6b8484600085610c73565b949350505050565b606082471015610cd45760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161022d565b600080866001600160a01b03168587604051610cf09190611256565b60006040518083038185875af1925050503d8060008114610d2d576040519150601f19603f3d011682016040523d82523d6000602084013e610d32565b606091505b5091509150610d4387838387610d4e565b979650505050505050565b60608315610dbd578251600003610db6576001600160a01b0385163b610db65760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161022d565b5081610c6b565b610c6b8383815115610dd25781518083602001fd5b8060405162461bcd60e51b815260040161022d9190611272565b6001600160a01b0381168114610ae257600080fd5b6000806000808486036080811215610e1857600080fd5b8535610e2381610dec565b94506040601f1982011215610e3757600080fd5b50602085019250606085013567ffffffffffffffff80821115610e5957600080fd5b818701915087601f830112610e6d57600080fd5b813581811115610e7c57600080fd5b8860208260051b8501011115610e9157600080fd5b95989497505060200194505050565b60008060008060608587031215610eb657600080fd5b843593506020850135610ec881610dec565b9250604085013567ffffffffffffffff80821115610ee557600080fd5b818701915087601f830112610ef957600080fd5b813581811115610f0857600080fd5b886020828501011115610e9157600080fd5b600060208284031215610f2c57600080fd5b8135610f3781610dec565b9392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610f7d57610f7d610f3e565b604052919050565b600060408284031215610f9757600080fd5b6040516040810181811067ffffffffffffffff82111715610fba57610fba610f3e565b6040528235610fc881610dec565b81526020928301359281019290925250919050565b600081518084526020808501945080840160005b838110156110165781516001600160a01b031687529582019590820190600101610ff1565b509495945050505050565b60005b8381101561103c578181015183820152602001611024565b50506000910152565b6000815180845261105d816020860160208601611021565b601f01601f19169290920160200192915050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526110d2610100840182610fdd565b905060a0840151601f198483030160e08501526108e28282611045565b60006020828403121561110157600080fd5b5051919050565b6000806040838503121561111b57600080fd5b82356002811061112a57600080fd5b915060208381013567ffffffffffffffff8082111561114857600080fd5b818601915086601f83011261115c57600080fd5b81358181111561116e5761116e610f3e565b611180601f8201601f19168501610f54565b9150808252878482850101111561119657600080fd5b80848401858401376000848284010152508093505050509250929050565b634e487b7160e01b600052602160045260246000fd5b600080604083850312156111dd57600080fd5b82516111e881610dec565b6020939093015192949293505050565b634e487b7160e01b600052601160045260246000fd5b818103818111156108e7576108e76111f8565b808201808211156108e7576108e76111f8565b60006020828403121561124657600080fd5b81518015158114610f3757600080fd5b60008251611268818460208701611021565b9190910192915050565b602081526000610f37602083018461104556fea2646970667358221220e8cbdf2ffcdd9a41fcf7f19146c49a2513c9847816ef7fceeb854242be953f7c64736f6c634300081200334e6174697665546f6b656e536f757263653a207a65726f2064657374696e6174", + Bin: "0x60e06040523480156200001157600080fd5b5060405162001643380380620016438339810160408190526200003491620002ae565b60016000556001600160a01b038316620000bb5760405162461bcd60e51b815260206004820152603360248201527f4e6174697665546f6b656e536f757263653a207a65726f2054656c65706f727460448201527f65724d657373656e67657220616464726573730000000000000000000000000060648201526084015b60405180910390fd5b6001600160a01b03831660c052816200011b5760405162461bcd60e51b815260206004820152602c60248201526000805160206200162383398151915260448201526b1a5bdb8818da185a5b88125160a21b6064820152608401620000b2565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200016e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001949190620002ef565b82036200020a5760405162461bcd60e51b815260206004820152603560248201527f4e6174697665546f6b656e536f757263653a2063616e6e6f742062726964676560448201527f20776974682073616d6520626c6f636b636861696e00000000000000000000006064820152608401620000b2565b60808290526001600160a01b0381166200027c5760405162461bcd60e51b815260206004820152603460248201526000805160206200162383398151915260448201527f696f6e20636f6e747261637420616464726573730000000000000000000000006064820152608401620000b2565b6001600160a01b031660a05250620003099050565b80516001600160a01b0381168114620002a957600080fd5b919050565b600080600060608486031215620002c457600080fd5b620002cf8462000291565b925060208401519150620002e66040850162000291565b90509250925092565b6000602082840312156200030257600080fd5b5051919050565b60805160a05160c0516112bb620003686000396000818160ef0152818161027001528181610299015261048c015260008181610167015281816102f901526105a50152600081816092015281816102d3015261052101526112bb6000f3fe60806040526004361061007b5760003560e01c8063b6171f731161004e578063b6171f731461013e578063b8c9091a14610155578063c452165e14610189578063c868efaa146101a157600080fd5b806341d3014d1461008057806355db3e9e146100c75780639b3e5803146100dd578063ad0aee2514610129575b600080fd5b34801561008c57600080fd5b506100b47f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b3480156100d357600080fd5b506100b460015481565b3480156100e957600080fd5b506101117f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100be565b61013c610137366004610e01565b6101c1565b005b34801561014a57600080fd5b506100b4620186a081565b34801561016157600080fd5b506101117f000000000000000000000000000000000000000000000000000000000000000081565b34801561019557600080fd5b50610111600160981b81565b3480156101ad57600080fd5b5061013c6101bc366004610ea0565b610479565b6101c961072a565b6001600160a01b0384166102365760405162461bcd60e51b815260206004820152602960248201527f4e6174697665546f6b656e536f757263653a207a65726f20657263697069656e60448201526874206164647265737360b81b60648201526084015b60405180910390fd5b60006020840135156102955761025c6102526020860186610f1a565b8560200135610783565b905061029561026e6020860186610f1a565b7f0000000000000000000000000000000000000000000000000000000000000000836108ed565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906103379190610f85565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505050908252506040516020918201916103a6918c913491016001600160a01b03929092168252602082015260400190565b6040516020818303038152906040528152506040518263ffffffff1660e01b81526004016103d49190611071565b6020604051808303816000875af11580156103f3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041791906110ef565b905080866001600160a01b0316336001600160a01b03167f2b4e8f08417773e367064a6aea9ca2df303a60876676f70b6c3c5e66b314ca5a3460405161045f91815260200190565b60405180910390a450506104736001600055565b50505050565b61048161072a565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461051f5760405162461bcd60e51b815260206004820152603c60248201527f4e6174697665546f6b656e536f757263653a20756e617574686f72697a65642060448201527f74656c65706f727465724d657373656e67657220636f6e747261637400000000606482015260840161022d565b7f000000000000000000000000000000000000000000000000000000000000000084146105a35760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e536f757263653a20696e76616c696420646573746960448201526b3730ba34b7b71031b430b4b760a11b606482015260840161022d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316146106335760405162461bcd60e51b815260206004820152602660248201527f4e6174697665546f6b656e536f757263653a20756e617574686f72697a65642060448201526539b2b73232b960d11b606482015260840161022d565b60008061064283850185611108565b9092509050600082600181111561065b5761065b6111b4565b0361068c576000808280602001905181019061067791906111ca565b9150915061068582826109d2565b505061071e565b60018260018111156106a0576106a06111b4565b036106cc576000818060200190518101906106bb91906110ef565b90506106c681610ab6565b5061071e565b60405162461bcd60e51b815260206004820152602160248201527f4e6174697665546f6b656e536f757263653a20696e76616c696420616374696f6044820152603760f91b606482015260840161022d565b50506104736001600055565b60026000540361077c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161022d565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa1580156107cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f091906110ef565b90506108076001600160a01b038516333086610ae5565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa15801561084e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061087291906110ef565b90508181116108d85760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b606482015260840161022d565b6108e2828261120e565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa15801561093e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061096291906110ef565b61096c9190611221565b6040516001600160a01b03851660248201526044810182905290915061047390859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610b1d565b6001600160a01b038216610a395760405162461bcd60e51b815260206004820152602860248201527f4552433230546f6b656e536f757263653a207a65726f20726563697069656e74604482015267206164647265737360c01b606482015260840161022d565b6040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015610a6f573d6000803e3d6000fd5b50604080516001600160a01b0384168152602081018390527f55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407910160405180910390a15050565b600154811115610ae257600060015482610ad0919061120e565b9050610adb81610bf4565b5060018190555b50565b6040516001600160a01b03808516602483015283166044820152606481018290526104739085906323b872dd60e01b9060840161099b565b6000610b72826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c5c9092919063ffffffff16565b805190915015610bef5780806020019051810190610b909190611234565b610bef5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161022d565b505050565b604051600160981b9082156108fc029083906000818181858888f19350505050158015610c25573d6000803e3d6000fd5b506040518181527f2cd3fd70cd5a5d6d805e90d22741aa1a84590ace7cf01b244719558d266143829060200160405180910390a150565b6060610c6b8484600085610c73565b949350505050565b606082471015610cd45760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161022d565b600080866001600160a01b03168587604051610cf09190611256565b60006040518083038185875af1925050503d8060008114610d2d576040519150601f19603f3d011682016040523d82523d6000602084013e610d32565b606091505b5091509150610d4387838387610d4e565b979650505050505050565b60608315610dbd578251600003610db6576001600160a01b0385163b610db65760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161022d565b5081610c6b565b610c6b8383815115610dd25781518083602001fd5b8060405162461bcd60e51b815260040161022d9190611272565b6001600160a01b0381168114610ae257600080fd5b6000806000808486036080811215610e1857600080fd5b8535610e2381610dec565b94506040601f1982011215610e3757600080fd5b50602085019250606085013567ffffffffffffffff80821115610e5957600080fd5b818701915087601f830112610e6d57600080fd5b813581811115610e7c57600080fd5b8860208260051b8501011115610e9157600080fd5b95989497505060200194505050565b60008060008060608587031215610eb657600080fd5b843593506020850135610ec881610dec565b9250604085013567ffffffffffffffff80821115610ee557600080fd5b818701915087601f830112610ef957600080fd5b813581811115610f0857600080fd5b886020828501011115610e9157600080fd5b600060208284031215610f2c57600080fd5b8135610f3781610dec565b9392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610f7d57610f7d610f3e565b604052919050565b600060408284031215610f9757600080fd5b6040516040810181811067ffffffffffffffff82111715610fba57610fba610f3e565b6040528235610fc881610dec565b81526020928301359281019290925250919050565b600081518084526020808501945080840160005b838110156110165781516001600160a01b031687529582019590820190600101610ff1565b509495945050505050565b60005b8381101561103c578181015183820152602001611024565b50506000910152565b6000815180845261105d816020860160208601611021565b601f01601f19169290920160200192915050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526110d2610100840182610fdd565b905060a0840151601f198483030160e08501526108e28282611045565b60006020828403121561110157600080fd5b5051919050565b6000806040838503121561111b57600080fd5b82356002811061112a57600080fd5b915060208381013567ffffffffffffffff8082111561114857600080fd5b818601915086601f83011261115c57600080fd5b81358181111561116e5761116e610f3e565b611180601f8201601f19168501610f54565b9150808252878482850101111561119657600080fd5b80848401858401376000848284010152508093505050509250929050565b634e487b7160e01b600052602160045260246000fd5b600080604083850312156111dd57600080fd5b82516111e881610dec565b6020939093015192949293505050565b634e487b7160e01b600052601160045260246000fd5b818103818111156108e7576108e76111f8565b808201808211156108e7576108e76111f8565b60006020828403121561124657600080fd5b81518015158114610f3757600080fd5b60008251611268818460208701611021565b9190910192915050565b602081526000610f37602083018461104556fea2646970667358221220781ecc15f0e165563ff8d3b6e079f5e1cbfff2f5b9cbcd5b58c9e0c497acf27764736f6c634300081200334e6174697665546f6b656e536f757263653a207a65726f2064657374696e6174", } // NativeTokenSourceABI is the input ABI used to generate the binding from. From cef97d7882813ec16197684684d725584de2252d Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Fri, 1 Dec 2023 09:25:33 -0500 Subject: [PATCH 157/183] Fix param name --- .../NativeTokenBridge/INativeTokenDestination.sol | 2 +- .../NativeTokenBridge/NativeTokenDestination.sol | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol index b58d4b246..09f5644f3 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol @@ -25,7 +25,7 @@ interface INativeTokenDestination { /** * @dev Emitted when tokens are not minted in order to collateralize the source contract. */ - event CollateralAdded(uint256 amount, uint256 remaining, address sender); + event CollateralAdded(uint256 amount, uint256 remaining, address recipient); /** * @dev Emitted when minting native tokens. diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index 655601cc6..c9e6ecfa8 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -131,7 +131,7 @@ contract NativeTokenDestination is emit CollateralAdded({ amount: currentReserveImbalance, remaining: 0, - sender: senderAddress + recipient: recipient }); adjustedAmount = amount - currentReserveImbalance; currentReserveImbalance = 0; @@ -140,7 +140,7 @@ contract NativeTokenDestination is emit CollateralAdded({ amount: amount, remaining: currentReserveImbalance, - sender: senderAddress + recipient: senderAddress }); return; } From 2355865a969673b0bc34f00278b64de2a4f6f01d Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Fri, 1 Dec 2023 09:29:05 -0500 Subject: [PATCH 158/183] Fix param name --- .../NativeTokenDestination/NativeTokenDestination.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go index e24f4de41..c5a0e7d78 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go @@ -37,8 +37,8 @@ type TeleporterFeeInfo struct { // NativeTokenDestinationMetaData contains all meta data concerning the NativeTokenDestination contract. var NativeTokenDestinationMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialReserveImbalance_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"burnAddressBalance\",\"type\":\"uint256\"}],\"name\":\"ReportTotalBurnedTxFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"BURN_FOR_TRANSFER_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REPORT_BURNED_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"reportTotalBurnedTxFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalMinted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", - Bin: "0x61012060405273020000000000000000000000000000000000000160805260006002553480156200002f57600080fd5b5060405162001b4c38038062001b4c8339810160408190526200005291620002d7565b60016000556001600160a01b038416620000d95760405162461bcd60e51b815260206004820152603860248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2054656c60448201527f65706f727465724d657373656e6765722061646472657373000000000000000060648201526084015b60405180910390fd5b6001600160a01b03841661010052826200013a5760405162461bcd60e51b815260206004820152602c602482015260008051602062001b2c83398151915260448201526b1c98d94818da185a5b88125160a21b6064820152608401620000d0565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200018d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001b3919062000320565b8303620002295760405162461bcd60e51b815260206004820152603a60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a2063616e6e6f74206260448201527f726964676520776974682073616d6520626c6f636b636861696e0000000000006064820152608401620000d0565b60a08390526001600160a01b0382166200029b5760405162461bcd60e51b8152602060048201526034602482015260008051602062001b2c83398151915260448201527f72636520636f6e747261637420616464726573730000000000000000000000006064820152608401620000d0565b6001600160a01b0390911660c05260e0819052600155506200033a9050565b80516001600160a01b0381168114620002d257600080fd5b919050565b60008060008060808587031215620002ee57600080fd5b620002f985620002ba565b9350602085015192506200031060408601620002ba565b6060959095015193969295505050565b6000602082840312156200033357600080fd5b5051919050565b60805160a05160c05160e05161010051611759620003d3600039600081816102440152818161040c015281816106a50152818161070201526109120152600081816102100152818161030401526103b90152600081816101b10152818161046c015281816107620152610a3501526000818161013c015281816104460152818161073c01526109b101526000610c6d01526117596000f3fe6080604052600436106100e75760003560e01c80638ac7dd201161008a578063ab28523011610059578063ab28523014610297578063c452165e146102ae578063c868efaa146102c6578063d30951261461029757600080fd5b80638ac7dd20146101fe5780639b3e580314610232578063a2309ff814610266578063a2a950171461027c57600080fd5b80633a94fe51116100c65780633a94fe511461015e57806349e3284e146101805780635d93f9af1461019f57806375846562146101eb57600080fd5b8062d872ae146100ec57806318160ddd1461011557806329b7b3fd1461012a575b600080fd5b3480156100f857600080fd5b5061010260015481565b6040519081526020015b60405180910390f35b34801561012157600080fd5b506101026102e6565b34801561013657600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561016a57600080fd5b5061017e6101793660046112d7565b6103f5565b005b34801561018c57600080fd5b506001546040519015815260200161010c565b3480156101ab57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010c565b61017e6101f9366004611343565b6105d0565b34801561020a57600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561023e57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b34801561027257600080fd5b5061010260025481565b34801561028857600080fd5b506101d36001600160981b0181565b3480156102a357600080fd5b50610102620186a081565b3480156102ba57600080fd5b506101d3600160981b81565b3480156102d257600080fd5b5061017e6102e13660046113a7565b6108ff565b6000806103006001600160981b0131600160981b31611446565b90507f00000000000000000000000000000000000000000000000000000000000000006002546103309190611446565b8111156103b65760405162461bcd60e51b815260206004820152604360248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20464154414c202d2060448201527f636f6e74726163742068617320746f6b656e7320756e6163636f756e746564206064820152623337b960e91b608482015260a4015b60405180910390fd5b807f00000000000000000000000000000000000000000000000000000000000000006002546103e59190611446565b6103ef9190611459565b91505090565b6000600160981b6001600160a01b031631905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906104aa919061146c565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505050908252506040805160208082018990528251808303820181528284019093529092019161051c91600191606001611522565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161054a919061159d565b6020604051808303816000875af1158015610569573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058d919061161b565b9050807f2550fa6041684d40e635e29e93dde9017d70c25b46aa88393317b5182ed6ae7c836040516105c191815260200190565b60405180910390a25050505050565b6105d8610d2c565b6001600160a01b0384166105fe5760405162461bcd60e51b81526004016103ad90611634565b6001541561066b5760405162461bcd60e51b815260206004820152603460248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20636f6e7472616374604482015273081d5b99195c98dbdb1b185d195c985b1a5e995960621b60648201526084016103ad565b60006020840135156106ca576106916106876020860186611682565b8560200135610d85565b90506106ca6106a36020860186611682565b7f000000000000000000000000000000000000000000000000000000000000000083610eef565b6040516001600160981b01903480156108fc02916000818181858888f193505050501580156106fd573d6000803e3d6000fd5b5060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906107a0919061146c565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250938552505060405160209384019361080e92508d913491016001600160a01b03929092168252602082015260400190565b60408051601f198184030181529082905261082c9291602001611522565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161085a919061159d565b6020604051808303816000875af1158015610879573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061089d919061161b565b905080866001600160a01b0316336001600160a01b03167f0322cbb1d3c23f6dbf1deddb3b4ef3ce0f93ae6eec7b44e4f395804104466d14346040516108e591815260200190565b60405180910390a450506108f96001600055565b50505050565b610907610d2c565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146109af5760405162461bcd60e51b815260206004820152604160248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201527f697a65642054656c65706f727465724d657373656e67657220636f6e747261636064820152601d60fa1b608482015260a4016103ad565b7f00000000000000000000000000000000000000000000000000000000000000008414610a335760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20696e76616c69642060448201526b39b7bab931b29031b430b4b760a11b60648201526084016103ad565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031614610ac85760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201526a34bd32b21039b2b73232b960a91b60648201526084016103ad565b600080610ad7838501856116a6565b90925090506001600160a01b038216610b025760405162461bcd60e51b81526004016103ad90611634565b80600003610b665760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2074726160448201526a6e736665722076616c756560a81b60648201526084016103ad565b600154819015610c4757600154821115610bdd5760015460408051918252600060208301526001600160a01b03881682820152517f66c12a5fefbc1f35dd64a1d9b069fc5bda187e6f68812c58a330b77b2a695ba99181900360600190a1600154610bd19083611459565b60006001559050610c47565b8160016000828254610bef9190611459565b90915550506001546040805184815260208101929092526001600160a01b03881682820152517f66c12a5fefbc1f35dd64a1d9b069fc5bda187e6f68812c58a330b77b2a695ba99181900360600190a1505050610d22565b6040516327ad555d60e11b81526001600160a01b038481166004830152602482018390527f00000000000000000000000000000000000000000000000000000000000000001690634f5aaaba90604401600060405180830381600087803b158015610cb157600080fd5b505af1158015610cc5573d6000803e3d6000fd5b505050508060026000828254610cdb9190611446565b90915550506040518181526001600160a01b038416907fd949ea0e9d5db53492d77f28fd5467fb2f6c4f5b88e3350e3c36729b76e99cf29060200160405180910390a25050505b6108f96001600055565b600260005403610d7e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016103ad565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015610dce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df2919061161b565b9050610e096001600160a01b038516333086610fd4565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610e50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e74919061161b565b9050818111610eda5760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016103ad565b610ee48282611459565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610f40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f64919061161b565b610f6e9190611446565b6040516001600160a01b0385166024820152604481018290529091506108f990859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261100c565b6040516001600160a01b03808516602483015283166044820152606481018290526108f99085906323b872dd60e01b90608401610f9d565b6000611061826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166110e39092919063ffffffff16565b8051909150156110de578080602001905181019061107f91906116d2565b6110de5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103ad565b505050565b60606110f284846000856110fa565b949350505050565b60608247101561115b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016103ad565b600080866001600160a01b0316858760405161117791906116f4565b60006040518083038185875af1925050503d80600081146111b4576040519150601f19603f3d011682016040523d82523d6000602084013e6111b9565b606091505b50915091506111ca878383876111d5565b979650505050505050565b6060831561124457825160000361123d576001600160a01b0385163b61123d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103ad565b50816110f2565b6110f283838151156112595781518083602001fd5b8060405162461bcd60e51b81526004016103ad9190611710565b60006040828403121561128557600080fd5b50919050565b60008083601f84011261129d57600080fd5b50813567ffffffffffffffff8111156112b557600080fd5b6020830191508360208260051b85010111156112d057600080fd5b9250929050565b6000806000606084860312156112ec57600080fd5b6112f68585611273565b9250604084013567ffffffffffffffff81111561131257600080fd5b61131e8682870161128b565b9497909650939450505050565b6001600160a01b038116811461134057600080fd5b50565b6000806000806080858703121561135957600080fd5b84356113648161132b565b93506113738660208701611273565b9250606085013567ffffffffffffffff81111561138f57600080fd5b61139b8782880161128b565b95989497509550505050565b600080600080606085870312156113bd57600080fd5b8435935060208501356113cf8161132b565b9250604085013567ffffffffffffffff808211156113ec57600080fd5b818701915087601f83011261140057600080fd5b81358181111561140f57600080fd5b88602082850101111561142157600080fd5b95989497505060200194505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610ee957610ee9611430565b81810381811115610ee957610ee9611430565b60006040828403121561147e57600080fd5b6040516040810181811067ffffffffffffffff821117156114af57634e487b7160e01b600052604160045260246000fd5b60405282356114bd8161132b565b81526020928301359281019290925250919050565b60005b838110156114ed5781810151838201526020016114d5565b50506000910152565b6000815180845261150e8160208601602086016114d2565b601f01601f19169290920160200192915050565b60006002841061154257634e487b7160e01b600052602160045260246000fd5b838252604060208301526110f260408301846114f6565b600081518084526020808501945080840160005b838110156115925781516001600160a01b03168752958201959082019060010161156d565b509495945050505050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526115fe610100840182611559565b905060a0840151601f198483030160e0850152610ee482826114f6565b60006020828403121561162d57600080fd5b5051919050565b6020808252602e908201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2072656360408201526d697069656e74206164647265737360901b606082015260800190565b60006020828403121561169457600080fd5b813561169f8161132b565b9392505050565b600080604083850312156116b957600080fd5b82356116c48161132b565b946020939093013593505050565b6000602082840312156116e457600080fd5b8151801515811461169f57600080fd5b600082516117068184602087016114d2565b9190910192915050565b60208152600061169f60208301846114f656fea2646970667358221220afb0887f1be0fc10dadd8cbb6ba44b02480439b2bc005d1c9fb4a66c4a0c97b164736f6c634300081200334e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20736f75", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialReserveImbalance_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"burnAddressBalance\",\"type\":\"uint256\"}],\"name\":\"ReportTotalBurnedTxFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"BURN_FOR_TRANSFER_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REPORT_BURNED_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"reportTotalBurnedTxFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalMinted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", + Bin: "0x61012060405273020000000000000000000000000000000000000160805260006002553480156200002f57600080fd5b5060405162001b4c38038062001b4c8339810160408190526200005291620002d7565b60016000556001600160a01b038416620000d95760405162461bcd60e51b815260206004820152603860248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2054656c60448201527f65706f727465724d657373656e6765722061646472657373000000000000000060648201526084015b60405180910390fd5b6001600160a01b03841661010052826200013a5760405162461bcd60e51b815260206004820152602c602482015260008051602062001b2c83398151915260448201526b1c98d94818da185a5b88125160a21b6064820152608401620000d0565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200018d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001b3919062000320565b8303620002295760405162461bcd60e51b815260206004820152603a60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a2063616e6e6f74206260448201527f726964676520776974682073616d6520626c6f636b636861696e0000000000006064820152608401620000d0565b60a08390526001600160a01b0382166200029b5760405162461bcd60e51b8152602060048201526034602482015260008051602062001b2c83398151915260448201527f72636520636f6e747261637420616464726573730000000000000000000000006064820152608401620000d0565b6001600160a01b0390911660c05260e0819052600155506200033a9050565b80516001600160a01b0381168114620002d257600080fd5b919050565b60008060008060808587031215620002ee57600080fd5b620002f985620002ba565b9350602085015192506200031060408601620002ba565b6060959095015193969295505050565b6000602082840312156200033357600080fd5b5051919050565b60805160a05160c05160e05161010051611759620003d3600039600081816102440152818161040c015281816106a50152818161070201526109120152600081816102100152818161030401526103b90152600081816101b10152818161046c015281816107620152610a3501526000818161013c015281816104460152818161073c01526109b101526000610c6d01526117596000f3fe6080604052600436106100e75760003560e01c80638ac7dd201161008a578063ab28523011610059578063ab28523014610297578063c452165e146102ae578063c868efaa146102c6578063d30951261461029757600080fd5b80638ac7dd20146101fe5780639b3e580314610232578063a2309ff814610266578063a2a950171461027c57600080fd5b80633a94fe51116100c65780633a94fe511461015e57806349e3284e146101805780635d93f9af1461019f57806375846562146101eb57600080fd5b8062d872ae146100ec57806318160ddd1461011557806329b7b3fd1461012a575b600080fd5b3480156100f857600080fd5b5061010260015481565b6040519081526020015b60405180910390f35b34801561012157600080fd5b506101026102e6565b34801561013657600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561016a57600080fd5b5061017e6101793660046112d7565b6103f5565b005b34801561018c57600080fd5b506001546040519015815260200161010c565b3480156101ab57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010c565b61017e6101f9366004611343565b6105d0565b34801561020a57600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561023e57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b34801561027257600080fd5b5061010260025481565b34801561028857600080fd5b506101d36001600160981b0181565b3480156102a357600080fd5b50610102620186a081565b3480156102ba57600080fd5b506101d3600160981b81565b3480156102d257600080fd5b5061017e6102e13660046113a7565b6108ff565b6000806103006001600160981b0131600160981b31611446565b90507f00000000000000000000000000000000000000000000000000000000000000006002546103309190611446565b8111156103b65760405162461bcd60e51b815260206004820152604360248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20464154414c202d2060448201527f636f6e74726163742068617320746f6b656e7320756e6163636f756e746564206064820152623337b960e91b608482015260a4015b60405180910390fd5b807f00000000000000000000000000000000000000000000000000000000000000006002546103e59190611446565b6103ef9190611459565b91505090565b6000600160981b6001600160a01b031631905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906104aa919061146c565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505050908252506040805160208082018990528251808303820181528284019093529092019161051c91600191606001611522565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161054a919061159d565b6020604051808303816000875af1158015610569573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058d919061161b565b9050807f2550fa6041684d40e635e29e93dde9017d70c25b46aa88393317b5182ed6ae7c836040516105c191815260200190565b60405180910390a25050505050565b6105d8610d2c565b6001600160a01b0384166105fe5760405162461bcd60e51b81526004016103ad90611634565b6001541561066b5760405162461bcd60e51b815260206004820152603460248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20636f6e7472616374604482015273081d5b99195c98dbdb1b185d195c985b1a5e995960621b60648201526084016103ad565b60006020840135156106ca576106916106876020860186611682565b8560200135610d85565b90506106ca6106a36020860186611682565b7f000000000000000000000000000000000000000000000000000000000000000083610eef565b6040516001600160981b01903480156108fc02916000818181858888f193505050501580156106fd573d6000803e3d6000fd5b5060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906107a0919061146c565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250938552505060405160209384019361080e92508d913491016001600160a01b03929092168252602082015260400190565b60408051601f198184030181529082905261082c9291602001611522565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161085a919061159d565b6020604051808303816000875af1158015610879573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061089d919061161b565b905080866001600160a01b0316336001600160a01b03167f0322cbb1d3c23f6dbf1deddb3b4ef3ce0f93ae6eec7b44e4f395804104466d14346040516108e591815260200190565b60405180910390a450506108f96001600055565b50505050565b610907610d2c565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146109af5760405162461bcd60e51b815260206004820152604160248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201527f697a65642054656c65706f727465724d657373656e67657220636f6e747261636064820152601d60fa1b608482015260a4016103ad565b7f00000000000000000000000000000000000000000000000000000000000000008414610a335760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20696e76616c69642060448201526b39b7bab931b29031b430b4b760a11b60648201526084016103ad565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031614610ac85760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201526a34bd32b21039b2b73232b960a91b60648201526084016103ad565b600080610ad7838501856116a6565b90925090506001600160a01b038216610b025760405162461bcd60e51b81526004016103ad90611634565b80600003610b665760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2074726160448201526a6e736665722076616c756560a81b60648201526084016103ad565b600154819015610c4757600154821115610bdd5760015460408051918252600060208301526001600160a01b03851682820152517f66c12a5fefbc1f35dd64a1d9b069fc5bda187e6f68812c58a330b77b2a695ba99181900360600190a1600154610bd19083611459565b60006001559050610c47565b8160016000828254610bef9190611459565b90915550506001546040805184815260208101929092526001600160a01b03881682820152517f66c12a5fefbc1f35dd64a1d9b069fc5bda187e6f68812c58a330b77b2a695ba99181900360600190a1505050610d22565b6040516327ad555d60e11b81526001600160a01b038481166004830152602482018390527f00000000000000000000000000000000000000000000000000000000000000001690634f5aaaba90604401600060405180830381600087803b158015610cb157600080fd5b505af1158015610cc5573d6000803e3d6000fd5b505050508060026000828254610cdb9190611446565b90915550506040518181526001600160a01b038416907fd949ea0e9d5db53492d77f28fd5467fb2f6c4f5b88e3350e3c36729b76e99cf29060200160405180910390a25050505b6108f96001600055565b600260005403610d7e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016103ad565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015610dce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df2919061161b565b9050610e096001600160a01b038516333086610fd4565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610e50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e74919061161b565b9050818111610eda5760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016103ad565b610ee48282611459565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610f40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f64919061161b565b610f6e9190611446565b6040516001600160a01b0385166024820152604481018290529091506108f990859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261100c565b6040516001600160a01b03808516602483015283166044820152606481018290526108f99085906323b872dd60e01b90608401610f9d565b6000611061826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166110e39092919063ffffffff16565b8051909150156110de578080602001905181019061107f91906116d2565b6110de5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103ad565b505050565b60606110f284846000856110fa565b949350505050565b60608247101561115b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016103ad565b600080866001600160a01b0316858760405161117791906116f4565b60006040518083038185875af1925050503d80600081146111b4576040519150601f19603f3d011682016040523d82523d6000602084013e6111b9565b606091505b50915091506111ca878383876111d5565b979650505050505050565b6060831561124457825160000361123d576001600160a01b0385163b61123d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103ad565b50816110f2565b6110f283838151156112595781518083602001fd5b8060405162461bcd60e51b81526004016103ad9190611710565b60006040828403121561128557600080fd5b50919050565b60008083601f84011261129d57600080fd5b50813567ffffffffffffffff8111156112b557600080fd5b6020830191508360208260051b85010111156112d057600080fd5b9250929050565b6000806000606084860312156112ec57600080fd5b6112f68585611273565b9250604084013567ffffffffffffffff81111561131257600080fd5b61131e8682870161128b565b9497909650939450505050565b6001600160a01b038116811461134057600080fd5b50565b6000806000806080858703121561135957600080fd5b84356113648161132b565b93506113738660208701611273565b9250606085013567ffffffffffffffff81111561138f57600080fd5b61139b8782880161128b565b95989497509550505050565b600080600080606085870312156113bd57600080fd5b8435935060208501356113cf8161132b565b9250604085013567ffffffffffffffff808211156113ec57600080fd5b818701915087601f83011261140057600080fd5b81358181111561140f57600080fd5b88602082850101111561142157600080fd5b95989497505060200194505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610ee957610ee9611430565b81810381811115610ee957610ee9611430565b60006040828403121561147e57600080fd5b6040516040810181811067ffffffffffffffff821117156114af57634e487b7160e01b600052604160045260246000fd5b60405282356114bd8161132b565b81526020928301359281019290925250919050565b60005b838110156114ed5781810151838201526020016114d5565b50506000910152565b6000815180845261150e8160208601602086016114d2565b601f01601f19169290920160200192915050565b60006002841061154257634e487b7160e01b600052602160045260246000fd5b838252604060208301526110f260408301846114f6565b600081518084526020808501945080840160005b838110156115925781516001600160a01b03168752958201959082019060010161156d565b509495945050505050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526115fe610100840182611559565b905060a0840151601f198483030160e0850152610ee482826114f6565b60006020828403121561162d57600080fd5b5051919050565b6020808252602e908201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2072656360408201526d697069656e74206164647265737360901b606082015260800190565b60006020828403121561169457600080fd5b813561169f8161132b565b9392505050565b600080604083850312156116b957600080fd5b82356116c48161132b565b946020939093013593505050565b6000602082840312156116e457600080fd5b8151801515811461169f57600080fd5b600082516117068184602087016114d2565b9190910192915050565b60208152600061169f60208301846114f656fea2646970667358221220e69d93758ea1af3507f63ec6e21a4b898ebab5fbc91abd0e57728e38a35561ec64736f6c634300081200334e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20736f75", } // NativeTokenDestinationABI is the input ABI used to generate the binding from. @@ -714,13 +714,13 @@ func (it *NativeTokenDestinationCollateralAddedIterator) Close() error { type NativeTokenDestinationCollateralAdded struct { Amount *big.Int Remaining *big.Int - Sender common.Address + Recipient common.Address Raw types.Log // Blockchain specific contextual infos } // FilterCollateralAdded is a free log retrieval operation binding the contract event 0x66c12a5fefbc1f35dd64a1d9b069fc5bda187e6f68812c58a330b77b2a695ba9. // -// Solidity: event CollateralAdded(uint256 amount, uint256 remaining, address sender) +// Solidity: event CollateralAdded(uint256 amount, uint256 remaining, address recipient) func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterCollateralAdded(opts *bind.FilterOpts) (*NativeTokenDestinationCollateralAddedIterator, error) { logs, sub, err := _NativeTokenDestination.contract.FilterLogs(opts, "CollateralAdded") @@ -732,7 +732,7 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterCollateralA // WatchCollateralAdded is a free log subscription operation binding the contract event 0x66c12a5fefbc1f35dd64a1d9b069fc5bda187e6f68812c58a330b77b2a695ba9. // -// Solidity: event CollateralAdded(uint256 amount, uint256 remaining, address sender) +// Solidity: event CollateralAdded(uint256 amount, uint256 remaining, address recipient) func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchCollateralAdded(opts *bind.WatchOpts, sink chan<- *NativeTokenDestinationCollateralAdded) (event.Subscription, error) { logs, sub, err := _NativeTokenDestination.contract.WatchLogs(opts, "CollateralAdded") @@ -769,7 +769,7 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchCollateralAd // ParseCollateralAdded is a log parse operation binding the contract event 0x66c12a5fefbc1f35dd64a1d9b069fc5bda187e6f68812c58a330b77b2a695ba9. // -// Solidity: event CollateralAdded(uint256 amount, uint256 remaining, address sender) +// Solidity: event CollateralAdded(uint256 amount, uint256 remaining, address recipient) func (_NativeTokenDestination *NativeTokenDestinationFilterer) ParseCollateralAdded(log types.Log) (*NativeTokenDestinationCollateralAdded, error) { event := new(NativeTokenDestinationCollateralAdded) if err := _NativeTokenDestination.contract.UnpackLog(event, "CollateralAdded", log); err != nil { From 4a6059a85f4e4c601d511a077ea29d6411a3c983 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Fri, 1 Dec 2023 10:53:45 -0500 Subject: [PATCH 159/183] Fix param name --- .../NativeTokenDestination/NativeTokenDestination.go | 2 +- .../NativeTokenBridge/NativeTokenDestination.sol | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go index c5a0e7d78..3fe67fe2b 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go @@ -38,7 +38,7 @@ type TeleporterFeeInfo struct { // NativeTokenDestinationMetaData contains all meta data concerning the NativeTokenDestination contract. var NativeTokenDestinationMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialReserveImbalance_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"burnAddressBalance\",\"type\":\"uint256\"}],\"name\":\"ReportTotalBurnedTxFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"BURN_FOR_TRANSFER_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REPORT_BURNED_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"reportTotalBurnedTxFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalMinted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", - Bin: "0x61012060405273020000000000000000000000000000000000000160805260006002553480156200002f57600080fd5b5060405162001b4c38038062001b4c8339810160408190526200005291620002d7565b60016000556001600160a01b038416620000d95760405162461bcd60e51b815260206004820152603860248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2054656c60448201527f65706f727465724d657373656e6765722061646472657373000000000000000060648201526084015b60405180910390fd5b6001600160a01b03841661010052826200013a5760405162461bcd60e51b815260206004820152602c602482015260008051602062001b2c83398151915260448201526b1c98d94818da185a5b88125160a21b6064820152608401620000d0565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200018d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001b3919062000320565b8303620002295760405162461bcd60e51b815260206004820152603a60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a2063616e6e6f74206260448201527f726964676520776974682073616d6520626c6f636b636861696e0000000000006064820152608401620000d0565b60a08390526001600160a01b0382166200029b5760405162461bcd60e51b8152602060048201526034602482015260008051602062001b2c83398151915260448201527f72636520636f6e747261637420616464726573730000000000000000000000006064820152608401620000d0565b6001600160a01b0390911660c05260e0819052600155506200033a9050565b80516001600160a01b0381168114620002d257600080fd5b919050565b60008060008060808587031215620002ee57600080fd5b620002f985620002ba565b9350602085015192506200031060408601620002ba565b6060959095015193969295505050565b6000602082840312156200033357600080fd5b5051919050565b60805160a05160c05160e05161010051611759620003d3600039600081816102440152818161040c015281816106a50152818161070201526109120152600081816102100152818161030401526103b90152600081816101b10152818161046c015281816107620152610a3501526000818161013c015281816104460152818161073c01526109b101526000610c6d01526117596000f3fe6080604052600436106100e75760003560e01c80638ac7dd201161008a578063ab28523011610059578063ab28523014610297578063c452165e146102ae578063c868efaa146102c6578063d30951261461029757600080fd5b80638ac7dd20146101fe5780639b3e580314610232578063a2309ff814610266578063a2a950171461027c57600080fd5b80633a94fe51116100c65780633a94fe511461015e57806349e3284e146101805780635d93f9af1461019f57806375846562146101eb57600080fd5b8062d872ae146100ec57806318160ddd1461011557806329b7b3fd1461012a575b600080fd5b3480156100f857600080fd5b5061010260015481565b6040519081526020015b60405180910390f35b34801561012157600080fd5b506101026102e6565b34801561013657600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561016a57600080fd5b5061017e6101793660046112d7565b6103f5565b005b34801561018c57600080fd5b506001546040519015815260200161010c565b3480156101ab57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010c565b61017e6101f9366004611343565b6105d0565b34801561020a57600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561023e57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b34801561027257600080fd5b5061010260025481565b34801561028857600080fd5b506101d36001600160981b0181565b3480156102a357600080fd5b50610102620186a081565b3480156102ba57600080fd5b506101d3600160981b81565b3480156102d257600080fd5b5061017e6102e13660046113a7565b6108ff565b6000806103006001600160981b0131600160981b31611446565b90507f00000000000000000000000000000000000000000000000000000000000000006002546103309190611446565b8111156103b65760405162461bcd60e51b815260206004820152604360248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20464154414c202d2060448201527f636f6e74726163742068617320746f6b656e7320756e6163636f756e746564206064820152623337b960e91b608482015260a4015b60405180910390fd5b807f00000000000000000000000000000000000000000000000000000000000000006002546103e59190611446565b6103ef9190611459565b91505090565b6000600160981b6001600160a01b031631905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906104aa919061146c565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505050908252506040805160208082018990528251808303820181528284019093529092019161051c91600191606001611522565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161054a919061159d565b6020604051808303816000875af1158015610569573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058d919061161b565b9050807f2550fa6041684d40e635e29e93dde9017d70c25b46aa88393317b5182ed6ae7c836040516105c191815260200190565b60405180910390a25050505050565b6105d8610d2c565b6001600160a01b0384166105fe5760405162461bcd60e51b81526004016103ad90611634565b6001541561066b5760405162461bcd60e51b815260206004820152603460248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20636f6e7472616374604482015273081d5b99195c98dbdb1b185d195c985b1a5e995960621b60648201526084016103ad565b60006020840135156106ca576106916106876020860186611682565b8560200135610d85565b90506106ca6106a36020860186611682565b7f000000000000000000000000000000000000000000000000000000000000000083610eef565b6040516001600160981b01903480156108fc02916000818181858888f193505050501580156106fd573d6000803e3d6000fd5b5060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906107a0919061146c565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250938552505060405160209384019361080e92508d913491016001600160a01b03929092168252602082015260400190565b60408051601f198184030181529082905261082c9291602001611522565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161085a919061159d565b6020604051808303816000875af1158015610879573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061089d919061161b565b905080866001600160a01b0316336001600160a01b03167f0322cbb1d3c23f6dbf1deddb3b4ef3ce0f93ae6eec7b44e4f395804104466d14346040516108e591815260200190565b60405180910390a450506108f96001600055565b50505050565b610907610d2c565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146109af5760405162461bcd60e51b815260206004820152604160248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201527f697a65642054656c65706f727465724d657373656e67657220636f6e747261636064820152601d60fa1b608482015260a4016103ad565b7f00000000000000000000000000000000000000000000000000000000000000008414610a335760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20696e76616c69642060448201526b39b7bab931b29031b430b4b760a11b60648201526084016103ad565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031614610ac85760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201526a34bd32b21039b2b73232b960a91b60648201526084016103ad565b600080610ad7838501856116a6565b90925090506001600160a01b038216610b025760405162461bcd60e51b81526004016103ad90611634565b80600003610b665760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2074726160448201526a6e736665722076616c756560a81b60648201526084016103ad565b600154819015610c4757600154821115610bdd5760015460408051918252600060208301526001600160a01b03851682820152517f66c12a5fefbc1f35dd64a1d9b069fc5bda187e6f68812c58a330b77b2a695ba99181900360600190a1600154610bd19083611459565b60006001559050610c47565b8160016000828254610bef9190611459565b90915550506001546040805184815260208101929092526001600160a01b03881682820152517f66c12a5fefbc1f35dd64a1d9b069fc5bda187e6f68812c58a330b77b2a695ba99181900360600190a1505050610d22565b6040516327ad555d60e11b81526001600160a01b038481166004830152602482018390527f00000000000000000000000000000000000000000000000000000000000000001690634f5aaaba90604401600060405180830381600087803b158015610cb157600080fd5b505af1158015610cc5573d6000803e3d6000fd5b505050508060026000828254610cdb9190611446565b90915550506040518181526001600160a01b038416907fd949ea0e9d5db53492d77f28fd5467fb2f6c4f5b88e3350e3c36729b76e99cf29060200160405180910390a25050505b6108f96001600055565b600260005403610d7e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016103ad565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015610dce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df2919061161b565b9050610e096001600160a01b038516333086610fd4565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610e50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e74919061161b565b9050818111610eda5760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016103ad565b610ee48282611459565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610f40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f64919061161b565b610f6e9190611446565b6040516001600160a01b0385166024820152604481018290529091506108f990859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261100c565b6040516001600160a01b03808516602483015283166044820152606481018290526108f99085906323b872dd60e01b90608401610f9d565b6000611061826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166110e39092919063ffffffff16565b8051909150156110de578080602001905181019061107f91906116d2565b6110de5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103ad565b505050565b60606110f284846000856110fa565b949350505050565b60608247101561115b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016103ad565b600080866001600160a01b0316858760405161117791906116f4565b60006040518083038185875af1925050503d80600081146111b4576040519150601f19603f3d011682016040523d82523d6000602084013e6111b9565b606091505b50915091506111ca878383876111d5565b979650505050505050565b6060831561124457825160000361123d576001600160a01b0385163b61123d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103ad565b50816110f2565b6110f283838151156112595781518083602001fd5b8060405162461bcd60e51b81526004016103ad9190611710565b60006040828403121561128557600080fd5b50919050565b60008083601f84011261129d57600080fd5b50813567ffffffffffffffff8111156112b557600080fd5b6020830191508360208260051b85010111156112d057600080fd5b9250929050565b6000806000606084860312156112ec57600080fd5b6112f68585611273565b9250604084013567ffffffffffffffff81111561131257600080fd5b61131e8682870161128b565b9497909650939450505050565b6001600160a01b038116811461134057600080fd5b50565b6000806000806080858703121561135957600080fd5b84356113648161132b565b93506113738660208701611273565b9250606085013567ffffffffffffffff81111561138f57600080fd5b61139b8782880161128b565b95989497509550505050565b600080600080606085870312156113bd57600080fd5b8435935060208501356113cf8161132b565b9250604085013567ffffffffffffffff808211156113ec57600080fd5b818701915087601f83011261140057600080fd5b81358181111561140f57600080fd5b88602082850101111561142157600080fd5b95989497505060200194505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610ee957610ee9611430565b81810381811115610ee957610ee9611430565b60006040828403121561147e57600080fd5b6040516040810181811067ffffffffffffffff821117156114af57634e487b7160e01b600052604160045260246000fd5b60405282356114bd8161132b565b81526020928301359281019290925250919050565b60005b838110156114ed5781810151838201526020016114d5565b50506000910152565b6000815180845261150e8160208601602086016114d2565b601f01601f19169290920160200192915050565b60006002841061154257634e487b7160e01b600052602160045260246000fd5b838252604060208301526110f260408301846114f6565b600081518084526020808501945080840160005b838110156115925781516001600160a01b03168752958201959082019060010161156d565b509495945050505050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526115fe610100840182611559565b905060a0840151601f198483030160e0850152610ee482826114f6565b60006020828403121561162d57600080fd5b5051919050565b6020808252602e908201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2072656360408201526d697069656e74206164647265737360901b606082015260800190565b60006020828403121561169457600080fd5b813561169f8161132b565b9392505050565b600080604083850312156116b957600080fd5b82356116c48161132b565b946020939093013593505050565b6000602082840312156116e457600080fd5b8151801515811461169f57600080fd5b600082516117068184602087016114d2565b9190910192915050565b60208152600061169f60208301846114f656fea2646970667358221220e69d93758ea1af3507f63ec6e21a4b898ebab5fbc91abd0e57728e38a35561ec64736f6c634300081200334e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20736f75", + Bin: "0x61012060405273020000000000000000000000000000000000000160805260006002553480156200002f57600080fd5b5060405162001b4c38038062001b4c8339810160408190526200005291620002d7565b60016000556001600160a01b038416620000d95760405162461bcd60e51b815260206004820152603860248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2054656c60448201527f65706f727465724d657373656e6765722061646472657373000000000000000060648201526084015b60405180910390fd5b6001600160a01b03841661010052826200013a5760405162461bcd60e51b815260206004820152602c602482015260008051602062001b2c83398151915260448201526b1c98d94818da185a5b88125160a21b6064820152608401620000d0565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200018d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001b3919062000320565b8303620002295760405162461bcd60e51b815260206004820152603a60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a2063616e6e6f74206260448201527f726964676520776974682073616d6520626c6f636b636861696e0000000000006064820152608401620000d0565b60a08390526001600160a01b0382166200029b5760405162461bcd60e51b8152602060048201526034602482015260008051602062001b2c83398151915260448201527f72636520636f6e747261637420616464726573730000000000000000000000006064820152608401620000d0565b6001600160a01b0390911660c05260e0819052600155506200033a9050565b80516001600160a01b0381168114620002d257600080fd5b919050565b60008060008060808587031215620002ee57600080fd5b620002f985620002ba565b9350602085015192506200031060408601620002ba565b6060959095015193969295505050565b6000602082840312156200033357600080fd5b5051919050565b60805160a05160c05160e05161010051611759620003d3600039600081816102440152818161040c015281816106a50152818161070201526109120152600081816102100152818161030401526103b90152600081816101b10152818161046c015281816107620152610a3501526000818161013c015281816104460152818161073c01526109b101526000610c6d01526117596000f3fe6080604052600436106100e75760003560e01c80638ac7dd201161008a578063ab28523011610059578063ab28523014610297578063c452165e146102ae578063c868efaa146102c6578063d30951261461029757600080fd5b80638ac7dd20146101fe5780639b3e580314610232578063a2309ff814610266578063a2a950171461027c57600080fd5b80633a94fe51116100c65780633a94fe511461015e57806349e3284e146101805780635d93f9af1461019f57806375846562146101eb57600080fd5b8062d872ae146100ec57806318160ddd1461011557806329b7b3fd1461012a575b600080fd5b3480156100f857600080fd5b5061010260015481565b6040519081526020015b60405180910390f35b34801561012157600080fd5b506101026102e6565b34801561013657600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561016a57600080fd5b5061017e6101793660046112d7565b6103f5565b005b34801561018c57600080fd5b506001546040519015815260200161010c565b3480156101ab57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010c565b61017e6101f9366004611343565b6105d0565b34801561020a57600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561023e57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b34801561027257600080fd5b5061010260025481565b34801561028857600080fd5b506101d36001600160981b0181565b3480156102a357600080fd5b50610102620186a081565b3480156102ba57600080fd5b506101d3600160981b81565b3480156102d257600080fd5b5061017e6102e13660046113a7565b6108ff565b6000806103006001600160981b0131600160981b31611446565b90507f00000000000000000000000000000000000000000000000000000000000000006002546103309190611446565b8111156103b65760405162461bcd60e51b815260206004820152604360248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20464154414c202d2060448201527f636f6e74726163742068617320746f6b656e7320756e6163636f756e746564206064820152623337b960e91b608482015260a4015b60405180910390fd5b807f00000000000000000000000000000000000000000000000000000000000000006002546103e59190611446565b6103ef9190611459565b91505090565b6000600160981b6001600160a01b031631905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906104aa919061146c565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505050908252506040805160208082018990528251808303820181528284019093529092019161051c91600191606001611522565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161054a919061159d565b6020604051808303816000875af1158015610569573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058d919061161b565b9050807f2550fa6041684d40e635e29e93dde9017d70c25b46aa88393317b5182ed6ae7c836040516105c191815260200190565b60405180910390a25050505050565b6105d8610d2c565b6001600160a01b0384166105fe5760405162461bcd60e51b81526004016103ad90611634565b6001541561066b5760405162461bcd60e51b815260206004820152603460248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20636f6e7472616374604482015273081d5b99195c98dbdb1b185d195c985b1a5e995960621b60648201526084016103ad565b60006020840135156106ca576106916106876020860186611682565b8560200135610d85565b90506106ca6106a36020860186611682565b7f000000000000000000000000000000000000000000000000000000000000000083610eef565b6040516001600160981b01903480156108fc02916000818181858888f193505050501580156106fd573d6000803e3d6000fd5b5060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906107a0919061146c565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250938552505060405160209384019361080e92508d913491016001600160a01b03929092168252602082015260400190565b60408051601f198184030181529082905261082c9291602001611522565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161085a919061159d565b6020604051808303816000875af1158015610879573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061089d919061161b565b905080866001600160a01b0316336001600160a01b03167f0322cbb1d3c23f6dbf1deddb3b4ef3ce0f93ae6eec7b44e4f395804104466d14346040516108e591815260200190565b60405180910390a450506108f96001600055565b50505050565b610907610d2c565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146109af5760405162461bcd60e51b815260206004820152604160248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201527f697a65642054656c65706f727465724d657373656e67657220636f6e747261636064820152601d60fa1b608482015260a4016103ad565b7f00000000000000000000000000000000000000000000000000000000000000008414610a335760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20696e76616c69642060448201526b39b7bab931b29031b430b4b760a11b60648201526084016103ad565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031614610ac85760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201526a34bd32b21039b2b73232b960a91b60648201526084016103ad565b600080610ad7838501856116a6565b90925090506001600160a01b038216610b025760405162461bcd60e51b81526004016103ad90611634565b80600003610b665760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2074726160448201526a6e736665722076616c756560a81b60648201526084016103ad565b600154819015610c4757600154821115610bdd5760015460408051918252600060208301526001600160a01b03851682820152517f66c12a5fefbc1f35dd64a1d9b069fc5bda187e6f68812c58a330b77b2a695ba99181900360600190a1600154610bd19083611459565b60006001559050610c47565b8160016000828254610bef9190611459565b90915550506001546040805184815260208101929092526001600160a01b03851682820152517f66c12a5fefbc1f35dd64a1d9b069fc5bda187e6f68812c58a330b77b2a695ba99181900360600190a1505050610d22565b6040516327ad555d60e11b81526001600160a01b038481166004830152602482018390527f00000000000000000000000000000000000000000000000000000000000000001690634f5aaaba90604401600060405180830381600087803b158015610cb157600080fd5b505af1158015610cc5573d6000803e3d6000fd5b505050508060026000828254610cdb9190611446565b90915550506040518181526001600160a01b038416907fd949ea0e9d5db53492d77f28fd5467fb2f6c4f5b88e3350e3c36729b76e99cf29060200160405180910390a25050505b6108f96001600055565b600260005403610d7e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016103ad565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015610dce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df2919061161b565b9050610e096001600160a01b038516333086610fd4565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610e50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e74919061161b565b9050818111610eda5760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016103ad565b610ee48282611459565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610f40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f64919061161b565b610f6e9190611446565b6040516001600160a01b0385166024820152604481018290529091506108f990859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261100c565b6040516001600160a01b03808516602483015283166044820152606481018290526108f99085906323b872dd60e01b90608401610f9d565b6000611061826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166110e39092919063ffffffff16565b8051909150156110de578080602001905181019061107f91906116d2565b6110de5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103ad565b505050565b60606110f284846000856110fa565b949350505050565b60608247101561115b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016103ad565b600080866001600160a01b0316858760405161117791906116f4565b60006040518083038185875af1925050503d80600081146111b4576040519150601f19603f3d011682016040523d82523d6000602084013e6111b9565b606091505b50915091506111ca878383876111d5565b979650505050505050565b6060831561124457825160000361123d576001600160a01b0385163b61123d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103ad565b50816110f2565b6110f283838151156112595781518083602001fd5b8060405162461bcd60e51b81526004016103ad9190611710565b60006040828403121561128557600080fd5b50919050565b60008083601f84011261129d57600080fd5b50813567ffffffffffffffff8111156112b557600080fd5b6020830191508360208260051b85010111156112d057600080fd5b9250929050565b6000806000606084860312156112ec57600080fd5b6112f68585611273565b9250604084013567ffffffffffffffff81111561131257600080fd5b61131e8682870161128b565b9497909650939450505050565b6001600160a01b038116811461134057600080fd5b50565b6000806000806080858703121561135957600080fd5b84356113648161132b565b93506113738660208701611273565b9250606085013567ffffffffffffffff81111561138f57600080fd5b61139b8782880161128b565b95989497509550505050565b600080600080606085870312156113bd57600080fd5b8435935060208501356113cf8161132b565b9250604085013567ffffffffffffffff808211156113ec57600080fd5b818701915087601f83011261140057600080fd5b81358181111561140f57600080fd5b88602082850101111561142157600080fd5b95989497505060200194505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610ee957610ee9611430565b81810381811115610ee957610ee9611430565b60006040828403121561147e57600080fd5b6040516040810181811067ffffffffffffffff821117156114af57634e487b7160e01b600052604160045260246000fd5b60405282356114bd8161132b565b81526020928301359281019290925250919050565b60005b838110156114ed5781810151838201526020016114d5565b50506000910152565b6000815180845261150e8160208601602086016114d2565b601f01601f19169290920160200192915050565b60006002841061154257634e487b7160e01b600052602160045260246000fd5b838252604060208301526110f260408301846114f6565b600081518084526020808501945080840160005b838110156115925781516001600160a01b03168752958201959082019060010161156d565b509495945050505050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526115fe610100840182611559565b905060a0840151601f198483030160e0850152610ee482826114f6565b60006020828403121561162d57600080fd5b5051919050565b6020808252602e908201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2072656360408201526d697069656e74206164647265737360901b606082015260800190565b60006020828403121561169457600080fd5b813561169f8161132b565b9392505050565b600080604083850312156116b957600080fd5b82356116c48161132b565b946020939093013593505050565b6000602082840312156116e457600080fd5b8151801515811461169f57600080fd5b600082516117068184602087016114d2565b9190910192915050565b60208152600061169f60208301846114f656fea26469706673582212202e89d0e42e719ffead05d17a1322510094cc80106135a8579d2553ab8cc9f65964736f6c634300081200334e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20736f75", } // NativeTokenDestinationABI is the input ABI used to generate the binding from. diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index c9e6ecfa8..6fc0c0bd1 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -140,7 +140,7 @@ contract NativeTokenDestination is emit CollateralAdded({ amount: amount, remaining: currentReserveImbalance, - recipient: senderAddress + recipient: recipient }); return; } From 95fba13f974c4a52b9885d3fae76a403a9f7852e Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Fri, 1 Dec 2023 11:34:14 -0500 Subject: [PATCH 160/183] Working test --- .../tests/NativeTokenDestinationTests.t.sol | 163 ++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol new file mode 100644 index 000000000..4f0e1fa08 --- /dev/null +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol @@ -0,0 +1,163 @@ +// (c) 2023, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +// SPDX-License-Identifier: Ecosystem + +pragma solidity 0.8.18; + +import {Test} from "forge-std/Test.sol"; +import {NativeTokenDestination, IERC20, ITokenSource, SafeERC20, SafeERC20TransferFrom, TeleporterMessageInput, TeleporterFeeInfo, IWarpMessenger, ITeleporterMessenger} from "../NativeTokenDestination.sol"; +import {INativeTokenDestination} from "../INativeTokenDestination.sol"; +import {ITeleporterReceiver} from "../../../Teleporter/ITeleporterReceiver.sol"; +import {UnitTestMockERC20} from "../../../Mocks/UnitTestMockERC20.sol"; +import {INativeMinter} from "@subnet-evm-contracts/interfaces/INativeMinter.sol"; + +contract NativeTokenDestinationTest is Test { + address public constant MOCK_TELEPORTER_MESSENGER_ADDRESS = + 0x644E5b7c5D4Bc8073732CEa72c66e0BB90dFC00f; + address public constant WARP_PRECOMPILE_ADDRESS = + address(0x0200000000000000000000000000000000000005); + address public constant NATIVE_MINTER_PRECOMPILE_ADDRESS = + address(0x0200000000000000000000000000000000000001); + bytes32 private constant _MOCK_BLOCKCHAIN_ID = bytes32(uint256(123456)); + bytes32 private constant _DEFAULT_OTHER_CHAIN_ID = + bytes32( + hex"abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcd" + ); + address private constant _DEFAULT_OTHER_BRIDGE_ADDRESS = + 0xd54e3E251b9b0EEd3ed70A858e927bbC2659587d; + uint256 private constant _DEFAULT_INITIAL_RESERVE_IMBALANCE = 1000000000; + address private constant _DEFAULT_RECIPIENT = + 0xa4CEE7d1aF6aDdDD33E3b1cC680AB84fdf1b6d1d; + + event TransferToSource( + address indexed sender, + address indexed recipient, + uint256 indexed teleporterMessageID, + uint256 amount + ); + event CollateralAdded(uint256 amount, uint256 remaining, address recipient); + event NativeTokensMinted(address indexed recipient, uint256 amount); + event ReportTotalBurnedTxFees( + uint256 indexed teleporterMessageID, + uint256 burnAddressBalance + ); + + NativeTokenDestination public nativeTokenDestination; + UnitTestMockERC20 public mockERC20; + + function setUp() public virtual { + vm.mockCall( + WARP_PRECOMPILE_ADDRESS, + abi.encodeWithSelector(IWarpMessenger.getBlockchainID.selector), + abi.encode(_MOCK_BLOCKCHAIN_ID) + ); + vm.mockCall( + NATIVE_MINTER_PRECOMPILE_ADDRESS, + abi.encodeWithSelector(INativeMinter.mintNativeCoin.selector), + "" + ); + vm.mockCall( + MOCK_TELEPORTER_MESSENGER_ADDRESS, + abi.encodeWithSelector(ITeleporterMessenger.sendCrossChainMessage.selector), + abi.encode(1) + ); + + vm.expectCall( + WARP_PRECOMPILE_ADDRESS, + abi.encodeWithSelector(IWarpMessenger.getBlockchainID.selector) + ); + + nativeTokenDestination = new NativeTokenDestination(MOCK_TELEPORTER_MESSENGER_ADDRESS, _DEFAULT_OTHER_CHAIN_ID, _DEFAULT_OTHER_BRIDGE_ADDRESS, _DEFAULT_INITIAL_RESERVE_IMBALANCE); + mockERC20 = new UnitTestMockERC20(); + + vm.mockCall( + address(mockERC20), + abi.encodeWithSelector(IERC20.allowance.selector), + abi.encode(1234) + ); + vm.mockCall( + address(mockERC20), + abi.encodeWithSelector(IERC20.transfer.selector), + abi.encode(true) + ); + vm.mockCall( + address(mockERC20), + abi.encodeWithSelector(IERC20.approve.selector), + abi.encode(true) + ); + } + + function collateralizeBridge() public { + uint256 amount = _DEFAULT_INITIAL_RESERVE_IMBALANCE; + + vm.expectEmit(true, true, true, true, address(nativeTokenDestination)); + emit CollateralAdded({ + amount: _DEFAULT_INITIAL_RESERVE_IMBALANCE, + remaining: 0, + recipient: _DEFAULT_RECIPIENT + }); + + vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); + bytes memory message = abi.encode(_DEFAULT_RECIPIENT, amount); + nativeTokenDestination.receiveTeleporterMessage( + _DEFAULT_OTHER_CHAIN_ID, + _DEFAULT_OTHER_BRIDGE_ADDRESS, + message + ); + vm.stopPrank(); + } + + function testTransferToSource() public { + collateralizeBridge(); + uint256 feeAmount = 12345; + uint256 amount = 1e18; + + vm.expectEmit(true, true, true, true, address(nativeTokenDestination)); + emit TransferToSource({ + sender: address(this), + recipient: _DEFAULT_RECIPIENT, + amount: amount, + teleporterMessageID: 1 + }); + + TeleporterMessageInput + memory expectedMessageInput = TeleporterMessageInput({ + destinationBlockchainID: _DEFAULT_OTHER_CHAIN_ID, + destinationAddress: _DEFAULT_OTHER_BRIDGE_ADDRESS, + feeInfo: TeleporterFeeInfo({ + feeTokenAddress: address(mockERC20), + amount: feeAmount + }), + requiredGasLimit: nativeTokenDestination.TRANSFER_NATIVE_TOKENS_REQUIRED_GAS(), + allowedRelayerAddresses: new address[](0), + message: abi.encode( + ITokenSource.SourceAction.Unlock, + abi.encode(_DEFAULT_RECIPIENT, amount) + ) + }); + + vm.expectCall( + MOCK_TELEPORTER_MESSENGER_ADDRESS, + abi.encodeCall( + ITeleporterMessenger.sendCrossChainMessage, + (expectedMessageInput) + ) + ); + + nativeTokenDestination.transferToSource{value: amount}( + _DEFAULT_RECIPIENT, + TeleporterFeeInfo({ + feeTokenAddress: address(mockERC20), + amount: feeAmount + }), + new address[](0) + ); + } + + function _formatNativeTokenDestinationErrorMessage( + string memory errorMessage + ) private pure returns (bytes memory) { + return bytes(string.concat("NativeTokenDestination: ", errorMessage)); + } +} From f8d720d7b214a11766c77d8bb650ba2af3daa494 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 4 Dec 2023 11:51:11 -0500 Subject: [PATCH 161/183] Most tests --- .../NativeTokenDestination.go | 2 +- .../NativeTokenDestination.sol | 7 +- .../tests/NativeTokenDestinationTests.t.sol | 155 ++++++++++++++++-- 3 files changed, 144 insertions(+), 20 deletions(-) diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go index 3fe67fe2b..c19b645c6 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go @@ -38,7 +38,7 @@ type TeleporterFeeInfo struct { // NativeTokenDestinationMetaData contains all meta data concerning the NativeTokenDestination contract. var NativeTokenDestinationMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialReserveImbalance_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"burnAddressBalance\",\"type\":\"uint256\"}],\"name\":\"ReportTotalBurnedTxFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"BURN_FOR_TRANSFER_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REPORT_BURNED_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"reportTotalBurnedTxFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalMinted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", - Bin: "0x61012060405273020000000000000000000000000000000000000160805260006002553480156200002f57600080fd5b5060405162001b4c38038062001b4c8339810160408190526200005291620002d7565b60016000556001600160a01b038416620000d95760405162461bcd60e51b815260206004820152603860248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2054656c60448201527f65706f727465724d657373656e6765722061646472657373000000000000000060648201526084015b60405180910390fd5b6001600160a01b03841661010052826200013a5760405162461bcd60e51b815260206004820152602c602482015260008051602062001b2c83398151915260448201526b1c98d94818da185a5b88125160a21b6064820152608401620000d0565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200018d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001b3919062000320565b8303620002295760405162461bcd60e51b815260206004820152603a60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a2063616e6e6f74206260448201527f726964676520776974682073616d6520626c6f636b636861696e0000000000006064820152608401620000d0565b60a08390526001600160a01b0382166200029b5760405162461bcd60e51b8152602060048201526034602482015260008051602062001b2c83398151915260448201527f72636520636f6e747261637420616464726573730000000000000000000000006064820152608401620000d0565b6001600160a01b0390911660c05260e0819052600155506200033a9050565b80516001600160a01b0381168114620002d257600080fd5b919050565b60008060008060808587031215620002ee57600080fd5b620002f985620002ba565b9350602085015192506200031060408601620002ba565b6060959095015193969295505050565b6000602082840312156200033357600080fd5b5051919050565b60805160a05160c05160e05161010051611759620003d3600039600081816102440152818161040c015281816106a50152818161070201526109120152600081816102100152818161030401526103b90152600081816101b10152818161046c015281816107620152610a3501526000818161013c015281816104460152818161073c01526109b101526000610c6d01526117596000f3fe6080604052600436106100e75760003560e01c80638ac7dd201161008a578063ab28523011610059578063ab28523014610297578063c452165e146102ae578063c868efaa146102c6578063d30951261461029757600080fd5b80638ac7dd20146101fe5780639b3e580314610232578063a2309ff814610266578063a2a950171461027c57600080fd5b80633a94fe51116100c65780633a94fe511461015e57806349e3284e146101805780635d93f9af1461019f57806375846562146101eb57600080fd5b8062d872ae146100ec57806318160ddd1461011557806329b7b3fd1461012a575b600080fd5b3480156100f857600080fd5b5061010260015481565b6040519081526020015b60405180910390f35b34801561012157600080fd5b506101026102e6565b34801561013657600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561016a57600080fd5b5061017e6101793660046112d7565b6103f5565b005b34801561018c57600080fd5b506001546040519015815260200161010c565b3480156101ab57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010c565b61017e6101f9366004611343565b6105d0565b34801561020a57600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561023e57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b34801561027257600080fd5b5061010260025481565b34801561028857600080fd5b506101d36001600160981b0181565b3480156102a357600080fd5b50610102620186a081565b3480156102ba57600080fd5b506101d3600160981b81565b3480156102d257600080fd5b5061017e6102e13660046113a7565b6108ff565b6000806103006001600160981b0131600160981b31611446565b90507f00000000000000000000000000000000000000000000000000000000000000006002546103309190611446565b8111156103b65760405162461bcd60e51b815260206004820152604360248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20464154414c202d2060448201527f636f6e74726163742068617320746f6b656e7320756e6163636f756e746564206064820152623337b960e91b608482015260a4015b60405180910390fd5b807f00000000000000000000000000000000000000000000000000000000000000006002546103e59190611446565b6103ef9190611459565b91505090565b6000600160981b6001600160a01b031631905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906104aa919061146c565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505050908252506040805160208082018990528251808303820181528284019093529092019161051c91600191606001611522565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161054a919061159d565b6020604051808303816000875af1158015610569573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058d919061161b565b9050807f2550fa6041684d40e635e29e93dde9017d70c25b46aa88393317b5182ed6ae7c836040516105c191815260200190565b60405180910390a25050505050565b6105d8610d2c565b6001600160a01b0384166105fe5760405162461bcd60e51b81526004016103ad90611634565b6001541561066b5760405162461bcd60e51b815260206004820152603460248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20636f6e7472616374604482015273081d5b99195c98dbdb1b185d195c985b1a5e995960621b60648201526084016103ad565b60006020840135156106ca576106916106876020860186611682565b8560200135610d85565b90506106ca6106a36020860186611682565b7f000000000000000000000000000000000000000000000000000000000000000083610eef565b6040516001600160981b01903480156108fc02916000818181858888f193505050501580156106fd573d6000803e3d6000fd5b5060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906107a0919061146c565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250938552505060405160209384019361080e92508d913491016001600160a01b03929092168252602082015260400190565b60408051601f198184030181529082905261082c9291602001611522565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161085a919061159d565b6020604051808303816000875af1158015610879573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061089d919061161b565b905080866001600160a01b0316336001600160a01b03167f0322cbb1d3c23f6dbf1deddb3b4ef3ce0f93ae6eec7b44e4f395804104466d14346040516108e591815260200190565b60405180910390a450506108f96001600055565b50505050565b610907610d2c565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146109af5760405162461bcd60e51b815260206004820152604160248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201527f697a65642054656c65706f727465724d657373656e67657220636f6e747261636064820152601d60fa1b608482015260a4016103ad565b7f00000000000000000000000000000000000000000000000000000000000000008414610a335760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20696e76616c69642060448201526b39b7bab931b29031b430b4b760a11b60648201526084016103ad565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031614610ac85760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201526a34bd32b21039b2b73232b960a91b60648201526084016103ad565b600080610ad7838501856116a6565b90925090506001600160a01b038216610b025760405162461bcd60e51b81526004016103ad90611634565b80600003610b665760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2074726160448201526a6e736665722076616c756560a81b60648201526084016103ad565b600154819015610c4757600154821115610bdd5760015460408051918252600060208301526001600160a01b03851682820152517f66c12a5fefbc1f35dd64a1d9b069fc5bda187e6f68812c58a330b77b2a695ba99181900360600190a1600154610bd19083611459565b60006001559050610c47565b8160016000828254610bef9190611459565b90915550506001546040805184815260208101929092526001600160a01b03851682820152517f66c12a5fefbc1f35dd64a1d9b069fc5bda187e6f68812c58a330b77b2a695ba99181900360600190a1505050610d22565b6040516327ad555d60e11b81526001600160a01b038481166004830152602482018390527f00000000000000000000000000000000000000000000000000000000000000001690634f5aaaba90604401600060405180830381600087803b158015610cb157600080fd5b505af1158015610cc5573d6000803e3d6000fd5b505050508060026000828254610cdb9190611446565b90915550506040518181526001600160a01b038416907fd949ea0e9d5db53492d77f28fd5467fb2f6c4f5b88e3350e3c36729b76e99cf29060200160405180910390a25050505b6108f96001600055565b600260005403610d7e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016103ad565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015610dce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df2919061161b565b9050610e096001600160a01b038516333086610fd4565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610e50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e74919061161b565b9050818111610eda5760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016103ad565b610ee48282611459565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610f40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f64919061161b565b610f6e9190611446565b6040516001600160a01b0385166024820152604481018290529091506108f990859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261100c565b6040516001600160a01b03808516602483015283166044820152606481018290526108f99085906323b872dd60e01b90608401610f9d565b6000611061826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166110e39092919063ffffffff16565b8051909150156110de578080602001905181019061107f91906116d2565b6110de5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103ad565b505050565b60606110f284846000856110fa565b949350505050565b60608247101561115b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016103ad565b600080866001600160a01b0316858760405161117791906116f4565b60006040518083038185875af1925050503d80600081146111b4576040519150601f19603f3d011682016040523d82523d6000602084013e6111b9565b606091505b50915091506111ca878383876111d5565b979650505050505050565b6060831561124457825160000361123d576001600160a01b0385163b61123d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103ad565b50816110f2565b6110f283838151156112595781518083602001fd5b8060405162461bcd60e51b81526004016103ad9190611710565b60006040828403121561128557600080fd5b50919050565b60008083601f84011261129d57600080fd5b50813567ffffffffffffffff8111156112b557600080fd5b6020830191508360208260051b85010111156112d057600080fd5b9250929050565b6000806000606084860312156112ec57600080fd5b6112f68585611273565b9250604084013567ffffffffffffffff81111561131257600080fd5b61131e8682870161128b565b9497909650939450505050565b6001600160a01b038116811461134057600080fd5b50565b6000806000806080858703121561135957600080fd5b84356113648161132b565b93506113738660208701611273565b9250606085013567ffffffffffffffff81111561138f57600080fd5b61139b8782880161128b565b95989497509550505050565b600080600080606085870312156113bd57600080fd5b8435935060208501356113cf8161132b565b9250604085013567ffffffffffffffff808211156113ec57600080fd5b818701915087601f83011261140057600080fd5b81358181111561140f57600080fd5b88602082850101111561142157600080fd5b95989497505060200194505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610ee957610ee9611430565b81810381811115610ee957610ee9611430565b60006040828403121561147e57600080fd5b6040516040810181811067ffffffffffffffff821117156114af57634e487b7160e01b600052604160045260246000fd5b60405282356114bd8161132b565b81526020928301359281019290925250919050565b60005b838110156114ed5781810151838201526020016114d5565b50506000910152565b6000815180845261150e8160208601602086016114d2565b601f01601f19169290920160200192915050565b60006002841061154257634e487b7160e01b600052602160045260246000fd5b838252604060208301526110f260408301846114f6565b600081518084526020808501945080840160005b838110156115925781516001600160a01b03168752958201959082019060010161156d565b509495945050505050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526115fe610100840182611559565b905060a0840151601f198483030160e0850152610ee482826114f6565b60006020828403121561162d57600080fd5b5051919050565b6020808252602e908201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2072656360408201526d697069656e74206164647265737360901b606082015260800190565b60006020828403121561169457600080fd5b813561169f8161132b565b9392505050565b600080604083850312156116b957600080fd5b82356116c48161132b565b946020939093013593505050565b6000602082840312156116e457600080fd5b8151801515811461169f57600080fd5b600082516117068184602087016114d2565b9190910192915050565b60208152600061169f60208301846114f656fea26469706673582212202e89d0e42e719ffead05d17a1322510094cc80106135a8579d2553ab8cc9f65964736f6c634300081200334e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20736f75", + Bin: "0x61012060405273020000000000000000000000000000000000000160805260006002553480156200002f57600080fd5b5060405162001bca38038062001bca833981016040819052620000529162000355565b60016000556001600160a01b038416620000d95760405162461bcd60e51b815260206004820152603860248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2054656c60448201527f65706f727465724d657373656e6765722061646472657373000000000000000060648201526084015b60405180910390fd5b6001600160a01b03841661010052826200013f5760405162461bcd60e51b8152602060048201526031602482015260008051602062001baa8339815191526044820152701c98d948189b1bd8dad8da185a5b881251607a1b6064820152608401620000d0565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000192573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001b891906200039e565b83036200022e5760405162461bcd60e51b815260206004820152603a60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a2063616e6e6f74206260448201527f726964676520776974682073616d6520626c6f636b636861696e0000000000006064820152608401620000d0565b60a08390526001600160a01b038216620002a05760405162461bcd60e51b8152602060048201526034602482015260008051602062001baa83398151915260448201527f72636520636f6e747261637420616464726573730000000000000000000000006064820152608401620000d0565b6001600160a01b03821660c0526000819003620003265760405162461bcd60e51b815260206004820152603660248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20696e6960448201527f7469616c207265736572766520696d62616c616e6365000000000000000000006064820152608401620000d0565b60e081905260015550620003b8915050565b80516001600160a01b03811681146200035057600080fd5b919050565b600080600080608085870312156200036c57600080fd5b620003778562000338565b9350602085015192506200038e6040860162000338565b6060959095015193969295505050565b600060208284031215620003b157600080fd5b5051919050565b60805160a05160c05160e0516101005161175962000451600039600081816102440152818161040c015281816106a50152818161070201526109120152600081816102100152818161030401526103b90152600081816101b10152818161046c015281816107620152610a3501526000818161013c015281816104460152818161073c01526109b101526000610c6d01526117596000f3fe6080604052600436106100e75760003560e01c80638ac7dd201161008a578063ab28523011610059578063ab28523014610297578063c452165e146102ae578063c868efaa146102c6578063d30951261461029757600080fd5b80638ac7dd20146101fe5780639b3e580314610232578063a2309ff814610266578063a2a950171461027c57600080fd5b80633a94fe51116100c65780633a94fe511461015e57806349e3284e146101805780635d93f9af1461019f57806375846562146101eb57600080fd5b8062d872ae146100ec57806318160ddd1461011557806329b7b3fd1461012a575b600080fd5b3480156100f857600080fd5b5061010260015481565b6040519081526020015b60405180910390f35b34801561012157600080fd5b506101026102e6565b34801561013657600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561016a57600080fd5b5061017e6101793660046112d7565b6103f5565b005b34801561018c57600080fd5b506001546040519015815260200161010c565b3480156101ab57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010c565b61017e6101f9366004611343565b6105d0565b34801561020a57600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561023e57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b34801561027257600080fd5b5061010260025481565b34801561028857600080fd5b506101d36001600160981b0181565b3480156102a357600080fd5b50610102620186a081565b3480156102ba57600080fd5b506101d3600160981b81565b3480156102d257600080fd5b5061017e6102e13660046113a7565b6108ff565b6000806103006001600160981b0131600160981b31611446565b90507f00000000000000000000000000000000000000000000000000000000000000006002546103309190611446565b8111156103b65760405162461bcd60e51b815260206004820152604360248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20464154414c202d2060448201527f636f6e74726163742068617320746f6b656e7320756e6163636f756e746564206064820152623337b960e91b608482015260a4015b60405180910390fd5b807f00000000000000000000000000000000000000000000000000000000000000006002546103e59190611446565b6103ef9190611459565b91505090565b6000600160981b6001600160a01b031631905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906104aa919061146c565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505050908252506040805160208082018990528251808303820181528284019093529092019161051c91600191606001611522565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161054a919061159d565b6020604051808303816000875af1158015610569573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058d919061161b565b9050807f2550fa6041684d40e635e29e93dde9017d70c25b46aa88393317b5182ed6ae7c836040516105c191815260200190565b60405180910390a25050505050565b6105d8610d2c565b6001600160a01b0384166105fe5760405162461bcd60e51b81526004016103ad90611634565b6001541561066b5760405162461bcd60e51b815260206004820152603460248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20636f6e7472616374604482015273081d5b99195c98dbdb1b185d195c985b1a5e995960621b60648201526084016103ad565b60006020840135156106ca576106916106876020860186611682565b8560200135610d85565b90506106ca6106a36020860186611682565b7f000000000000000000000000000000000000000000000000000000000000000083610eef565b6040516001600160981b01903480156108fc02916000818181858888f193505050501580156106fd573d6000803e3d6000fd5b5060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906107a0919061146c565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250938552505060405160209384019361080e92508d913491016001600160a01b03929092168252602082015260400190565b60408051601f198184030181529082905261082c9291602001611522565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161085a919061159d565b6020604051808303816000875af1158015610879573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061089d919061161b565b905080866001600160a01b0316336001600160a01b03167f0322cbb1d3c23f6dbf1deddb3b4ef3ce0f93ae6eec7b44e4f395804104466d14346040516108e591815260200190565b60405180910390a450506108f96001600055565b50505050565b610907610d2c565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146109af5760405162461bcd60e51b815260206004820152604160248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201527f697a65642054656c65706f727465724d657373656e67657220636f6e747261636064820152601d60fa1b608482015260a4016103ad565b7f00000000000000000000000000000000000000000000000000000000000000008414610a335760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20696e76616c69642060448201526b39b7bab931b29031b430b4b760a11b60648201526084016103ad565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031614610ac85760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201526a34bd32b21039b2b73232b960a91b60648201526084016103ad565b600080610ad7838501856116a6565b90925090506001600160a01b038216610b025760405162461bcd60e51b81526004016103ad90611634565b80600003610b665760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2074726160448201526a6e736665722076616c756560a81b60648201526084016103ad565b600154819015610c4757600154821115610bdd5760015460408051918252600060208301526001600160a01b03851682820152517f66c12a5fefbc1f35dd64a1d9b069fc5bda187e6f68812c58a330b77b2a695ba99181900360600190a1600154610bd19083611459565b60006001559050610c47565b8160016000828254610bef9190611459565b90915550506001546040805184815260208101929092526001600160a01b03851682820152517f66c12a5fefbc1f35dd64a1d9b069fc5bda187e6f68812c58a330b77b2a695ba99181900360600190a1505050610d22565b6040516327ad555d60e11b81526001600160a01b038481166004830152602482018390527f00000000000000000000000000000000000000000000000000000000000000001690634f5aaaba90604401600060405180830381600087803b158015610cb157600080fd5b505af1158015610cc5573d6000803e3d6000fd5b505050508060026000828254610cdb9190611446565b90915550506040518181526001600160a01b038416907fd949ea0e9d5db53492d77f28fd5467fb2f6c4f5b88e3350e3c36729b76e99cf29060200160405180910390a25050505b6108f96001600055565b600260005403610d7e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016103ad565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015610dce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df2919061161b565b9050610e096001600160a01b038516333086610fd4565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610e50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e74919061161b565b9050818111610eda5760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016103ad565b610ee48282611459565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610f40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f64919061161b565b610f6e9190611446565b6040516001600160a01b0385166024820152604481018290529091506108f990859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261100c565b6040516001600160a01b03808516602483015283166044820152606481018290526108f99085906323b872dd60e01b90608401610f9d565b6000611061826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166110e39092919063ffffffff16565b8051909150156110de578080602001905181019061107f91906116d2565b6110de5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103ad565b505050565b60606110f284846000856110fa565b949350505050565b60608247101561115b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016103ad565b600080866001600160a01b0316858760405161117791906116f4565b60006040518083038185875af1925050503d80600081146111b4576040519150601f19603f3d011682016040523d82523d6000602084013e6111b9565b606091505b50915091506111ca878383876111d5565b979650505050505050565b6060831561124457825160000361123d576001600160a01b0385163b61123d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103ad565b50816110f2565b6110f283838151156112595781518083602001fd5b8060405162461bcd60e51b81526004016103ad9190611710565b60006040828403121561128557600080fd5b50919050565b60008083601f84011261129d57600080fd5b50813567ffffffffffffffff8111156112b557600080fd5b6020830191508360208260051b85010111156112d057600080fd5b9250929050565b6000806000606084860312156112ec57600080fd5b6112f68585611273565b9250604084013567ffffffffffffffff81111561131257600080fd5b61131e8682870161128b565b9497909650939450505050565b6001600160a01b038116811461134057600080fd5b50565b6000806000806080858703121561135957600080fd5b84356113648161132b565b93506113738660208701611273565b9250606085013567ffffffffffffffff81111561138f57600080fd5b61139b8782880161128b565b95989497509550505050565b600080600080606085870312156113bd57600080fd5b8435935060208501356113cf8161132b565b9250604085013567ffffffffffffffff808211156113ec57600080fd5b818701915087601f83011261140057600080fd5b81358181111561140f57600080fd5b88602082850101111561142157600080fd5b95989497505060200194505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610ee957610ee9611430565b81810381811115610ee957610ee9611430565b60006040828403121561147e57600080fd5b6040516040810181811067ffffffffffffffff821117156114af57634e487b7160e01b600052604160045260246000fd5b60405282356114bd8161132b565b81526020928301359281019290925250919050565b60005b838110156114ed5781810151838201526020016114d5565b50506000910152565b6000815180845261150e8160208601602086016114d2565b601f01601f19169290920160200192915050565b60006002841061154257634e487b7160e01b600052602160045260246000fd5b838252604060208301526110f260408301846114f6565b600081518084526020808501945080840160005b838110156115925781516001600160a01b03168752958201959082019060010161156d565b509495945050505050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526115fe610100840182611559565b905060a0840151601f198483030160e0850152610ee482826114f6565b60006020828403121561162d57600080fd5b5051919050565b6020808252602e908201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2072656360408201526d697069656e74206164647265737360901b606082015260800190565b60006020828403121561169457600080fd5b813561169f8161132b565b9392505050565b600080604083850312156116b957600080fd5b82356116c48161132b565b946020939093013593505050565b6000602082840312156116e457600080fd5b8151801515811461169f57600080fd5b600082516117068184602087016114d2565b9190910192915050565b60208152600061169f60208301846114f656fea2646970667358221220e654409b56d0fb144cca2efd98206e7c459f86b520030bac24030b613f116a8764736f6c634300081200334e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20736f75", } // NativeTokenDestinationABI is the input ABI used to generate the binding from. diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index 6fc0c0bd1..66fc822cc 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -64,7 +64,7 @@ contract NativeTokenDestination is require( sourceBlockchainID_ != bytes32(0), - "NativeTokenDestination: zero source chain ID" + "NativeTokenDestination: zero source blockchain ID" ); require( sourceBlockchainID_ != @@ -80,6 +80,11 @@ contract NativeTokenDestination is ); nativeTokenSourceAddress = nativeTokenSourceAddress_; + require( + initialReserveImbalance_ != 0, + "NativeTokenDestination: zero initial reserve imbalance" + ); + initialReserveImbalance = initialReserveImbalance_; currentReserveImbalance = initialReserveImbalance_; } diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol index 4f0e1fa08..5d89e7674 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol @@ -29,6 +29,7 @@ contract NativeTokenDestinationTest is Test { uint256 private constant _DEFAULT_INITIAL_RESERVE_IMBALANCE = 1000000000; address private constant _DEFAULT_RECIPIENT = 0xa4CEE7d1aF6aDdDD33E3b1cC680AB84fdf1b6d1d; + uint256 private constant _DEFAULT_TRANSFER_AMOUNT = 1e18; event TransferToSource( address indexed sender, @@ -59,7 +60,9 @@ contract NativeTokenDestinationTest is Test { ); vm.mockCall( MOCK_TELEPORTER_MESSENGER_ADDRESS, - abi.encodeWithSelector(ITeleporterMessenger.sendCrossChainMessage.selector), + abi.encodeWithSelector( + ITeleporterMessenger.sendCrossChainMessage.selector + ), abi.encode(1) ); @@ -68,7 +71,12 @@ contract NativeTokenDestinationTest is Test { abi.encodeWithSelector(IWarpMessenger.getBlockchainID.selector) ); - nativeTokenDestination = new NativeTokenDestination(MOCK_TELEPORTER_MESSENGER_ADDRESS, _DEFAULT_OTHER_CHAIN_ID, _DEFAULT_OTHER_BRIDGE_ADDRESS, _DEFAULT_INITIAL_RESERVE_IMBALANCE); + nativeTokenDestination = new NativeTokenDestination( + MOCK_TELEPORTER_MESSENGER_ADDRESS, + _DEFAULT_OTHER_CHAIN_ID, + _DEFAULT_OTHER_BRIDGE_ADDRESS, + _DEFAULT_INITIAL_RESERVE_IMBALANCE + ); mockERC20 = new UnitTestMockERC20(); vm.mockCall( @@ -76,11 +84,6 @@ contract NativeTokenDestinationTest is Test { abi.encodeWithSelector(IERC20.allowance.selector), abi.encode(1234) ); - vm.mockCall( - address(mockERC20), - abi.encodeWithSelector(IERC20.transfer.selector), - abi.encode(true) - ); vm.mockCall( address(mockERC20), abi.encodeWithSelector(IERC20.approve.selector), @@ -90,7 +93,7 @@ contract NativeTokenDestinationTest is Test { function collateralizeBridge() public { uint256 amount = _DEFAULT_INITIAL_RESERVE_IMBALANCE; - + vm.expectEmit(true, true, true, true, address(nativeTokenDestination)); emit CollateralAdded({ amount: _DEFAULT_INITIAL_RESERVE_IMBALANCE, @@ -98,12 +101,18 @@ contract NativeTokenDestinationTest is Test { recipient: _DEFAULT_RECIPIENT }); + // We shouldn't mint anything here. + vm.expectCall( + NATIVE_MINTER_PRECOMPILE_ADDRESS, + abi.encodeWithSelector(INativeMinter.mintNativeCoin.selector), + 0 + ); + vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); - bytes memory message = abi.encode(_DEFAULT_RECIPIENT, amount); nativeTokenDestination.receiveTeleporterMessage( _DEFAULT_OTHER_CHAIN_ID, _DEFAULT_OTHER_BRIDGE_ADDRESS, - message + abi.encode(_DEFAULT_RECIPIENT, amount) ); vm.stopPrank(); } @@ -111,13 +120,12 @@ contract NativeTokenDestinationTest is Test { function testTransferToSource() public { collateralizeBridge(); uint256 feeAmount = 12345; - uint256 amount = 1e18; vm.expectEmit(true, true, true, true, address(nativeTokenDestination)); emit TransferToSource({ sender: address(this), recipient: _DEFAULT_RECIPIENT, - amount: amount, + amount: _DEFAULT_TRANSFER_AMOUNT, teleporterMessageID: 1 }); @@ -129,11 +137,12 @@ contract NativeTokenDestinationTest is Test { feeTokenAddress: address(mockERC20), amount: feeAmount }), - requiredGasLimit: nativeTokenDestination.TRANSFER_NATIVE_TOKENS_REQUIRED_GAS(), + requiredGasLimit: nativeTokenDestination + .TRANSFER_NATIVE_TOKENS_REQUIRED_GAS(), allowedRelayerAddresses: new address[](0), message: abi.encode( ITokenSource.SourceAction.Unlock, - abi.encode(_DEFAULT_RECIPIENT, amount) + abi.encode(_DEFAULT_RECIPIENT, _DEFAULT_TRANSFER_AMOUNT) ) }); @@ -144,17 +153,127 @@ contract NativeTokenDestinationTest is Test { (expectedMessageInput) ) ); - - nativeTokenDestination.transferToSource{value: amount}( - _DEFAULT_RECIPIENT, + + nativeTokenDestination.transferToSource{value: _DEFAULT_TRANSFER_AMOUNT}( + _DEFAULT_RECIPIENT, TeleporterFeeInfo({ feeTokenAddress: address(mockERC20), amount: feeAmount - }), + }), new address[](0) ); } + function testZeroTeleporterAddress() public { + vm.expectRevert(_formatNativeTokenDestinationErrorMessage("zero TeleporterMessenger address")); + + new NativeTokenDestination( + address(0x0), + _DEFAULT_OTHER_CHAIN_ID, + _DEFAULT_OTHER_BRIDGE_ADDRESS, + _DEFAULT_INITIAL_RESERVE_IMBALANCE + ); + } + + function testZeroSourceChainID() public { + vm.expectRevert(_formatNativeTokenDestinationErrorMessage("zero source blockchain ID")); + + new NativeTokenDestination( + MOCK_TELEPORTER_MESSENGER_ADDRESS, + bytes32(0), + _DEFAULT_OTHER_BRIDGE_ADDRESS, + _DEFAULT_INITIAL_RESERVE_IMBALANCE + ); + } + + function testSameBlockchainID() public { + vm.expectRevert(_formatNativeTokenDestinationErrorMessage("cannot bridge with same blockchain")); + + new NativeTokenDestination( + MOCK_TELEPORTER_MESSENGER_ADDRESS, + _MOCK_BLOCKCHAIN_ID, + _DEFAULT_OTHER_BRIDGE_ADDRESS, + _DEFAULT_INITIAL_RESERVE_IMBALANCE + ); + } + + function testZeroSourceContractAddress() public { + vm.expectRevert(_formatNativeTokenDestinationErrorMessage("zero source contract address")); + + new NativeTokenDestination( + MOCK_TELEPORTER_MESSENGER_ADDRESS, + _DEFAULT_OTHER_CHAIN_ID, + address(0x0), + _DEFAULT_INITIAL_RESERVE_IMBALANCE + ); + } + + function testZeroInitialReserveImbalance() public { + vm.expectRevert(_formatNativeTokenDestinationErrorMessage("zero initial reserve imbalance")); + + new NativeTokenDestination( + MOCK_TELEPORTER_MESSENGER_ADDRESS, + _DEFAULT_OTHER_CHAIN_ID, + _DEFAULT_OTHER_BRIDGE_ADDRESS, + 0 + ); + } + + function testInvalidTeleporterAddress() public { + vm.expectRevert(_formatNativeTokenDestinationErrorMessage("unauthorized TeleporterMessenger contract")); + + vm.prank(address(0x123)); + nativeTokenDestination.receiveTeleporterMessage( + _DEFAULT_OTHER_CHAIN_ID, + _DEFAULT_OTHER_BRIDGE_ADDRESS, + abi.encode(_DEFAULT_RECIPIENT, _DEFAULT_TRANSFER_AMOUNT) + ); + } + + function testInvalidSourceBlockchain() public { + vm.expectRevert(_formatNativeTokenDestinationErrorMessage("invalid source chain")); + + vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); + nativeTokenDestination.receiveTeleporterMessage( + _MOCK_BLOCKCHAIN_ID, + _DEFAULT_OTHER_BRIDGE_ADDRESS, + abi.encode(_DEFAULT_RECIPIENT, _DEFAULT_TRANSFER_AMOUNT) + ); + } + + function testInvalidSenderContract() public { + vm.expectRevert(_formatNativeTokenDestinationErrorMessage("unauthorized sender")); + + vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); + nativeTokenDestination.receiveTeleporterMessage( + _DEFAULT_OTHER_CHAIN_ID, + address(0x123), + abi.encode(_DEFAULT_RECIPIENT, _DEFAULT_TRANSFER_AMOUNT) + ); + } + + function testInvalidRecipientAddress() public { + vm.expectRevert(_formatNativeTokenDestinationErrorMessage("zero recipient address")); + + vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); + nativeTokenDestination.receiveTeleporterMessage( + _DEFAULT_OTHER_CHAIN_ID, + _DEFAULT_OTHER_BRIDGE_ADDRESS, + abi.encode(address(0x0), _DEFAULT_TRANSFER_AMOUNT) + ); + } + + function testInvalidTransferAmount() public { + vm.expectRevert(_formatNativeTokenDestinationErrorMessage("zero transfer value")); + + vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); + nativeTokenDestination.receiveTeleporterMessage( + _DEFAULT_OTHER_CHAIN_ID, + _DEFAULT_OTHER_BRIDGE_ADDRESS, + abi.encode(_DEFAULT_RECIPIENT, 0) + ); + } + function _formatNativeTokenDestinationErrorMessage( string memory errorMessage ) private pure returns (bytes memory) { From 8a793db751f506fac06f97ae38d925d185cff066 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 4 Dec 2023 12:11:03 -0500 Subject: [PATCH 162/183] Most tests --- .../tests/NativeTokenDestinationTests.t.sol | 144 ++++++++++++++++-- 1 file changed, 130 insertions(+), 14 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol index 5d89e7674..a3369fc27 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol @@ -30,6 +30,7 @@ contract NativeTokenDestinationTest is Test { address private constant _DEFAULT_RECIPIENT = 0xa4CEE7d1aF6aDdDD33E3b1cC680AB84fdf1b6d1d; uint256 private constant _DEFAULT_TRANSFER_AMOUNT = 1e18; + uint256 private constant _DEFAULT_FEE_AMOUNT = 123456; event TransferToSource( address indexed sender, @@ -119,7 +120,6 @@ contract NativeTokenDestinationTest is Test { function testTransferToSource() public { collateralizeBridge(); - uint256 feeAmount = 12345; vm.expectEmit(true, true, true, true, address(nativeTokenDestination)); emit TransferToSource({ @@ -135,7 +135,7 @@ contract NativeTokenDestinationTest is Test { destinationAddress: _DEFAULT_OTHER_BRIDGE_ADDRESS, feeInfo: TeleporterFeeInfo({ feeTokenAddress: address(mockERC20), - amount: feeAmount + amount: _DEFAULT_FEE_AMOUNT }), requiredGasLimit: nativeTokenDestination .TRANSFER_NATIVE_TOKENS_REQUIRED_GAS(), @@ -154,18 +154,69 @@ contract NativeTokenDestinationTest is Test { ) ); - nativeTokenDestination.transferToSource{value: _DEFAULT_TRANSFER_AMOUNT}( + nativeTokenDestination.transferToSource{ + value: _DEFAULT_TRANSFER_AMOUNT + }( _DEFAULT_RECIPIENT, TeleporterFeeInfo({ feeTokenAddress: address(mockERC20), - amount: feeAmount + amount: _DEFAULT_FEE_AMOUNT + }), + new address[](0) + ); + } + + function testReportBurnedTxFees() public { + uint256 burnedFees = nativeTokenDestination + .BURNED_TX_FEES_ADDRESS() + .balance; + + vm.expectEmit(true, true, true, true, address(nativeTokenDestination)); + emit ReportTotalBurnedTxFees({ + burnAddressBalance: burnedFees, + teleporterMessageID: 1 + }); + + TeleporterMessageInput + memory expectedMessageInput = TeleporterMessageInput({ + destinationBlockchainID: _DEFAULT_OTHER_CHAIN_ID, + destinationAddress: _DEFAULT_OTHER_BRIDGE_ADDRESS, + feeInfo: TeleporterFeeInfo({ + feeTokenAddress: address(mockERC20), + amount: _DEFAULT_FEE_AMOUNT + }), + requiredGasLimit: nativeTokenDestination + .REPORT_BURNED_TOKENS_REQUIRED_GAS(), + allowedRelayerAddresses: new address[](0), + message: abi.encode( + ITokenSource.SourceAction.Burn, + abi.encode(burnedFees) + ) + }); + + vm.expectCall( + MOCK_TELEPORTER_MESSENGER_ADDRESS, + abi.encodeCall( + ITeleporterMessenger.sendCrossChainMessage, + (expectedMessageInput) + ) + ); + + nativeTokenDestination.reportTotalBurnedTxFees( + TeleporterFeeInfo({ + feeTokenAddress: address(mockERC20), + amount: _DEFAULT_FEE_AMOUNT }), new address[](0) ); } function testZeroTeleporterAddress() public { - vm.expectRevert(_formatNativeTokenDestinationErrorMessage("zero TeleporterMessenger address")); + vm.expectRevert( + _formatNativeTokenDestinationErrorMessage( + "zero TeleporterMessenger address" + ) + ); new NativeTokenDestination( address(0x0), @@ -176,7 +227,11 @@ contract NativeTokenDestinationTest is Test { } function testZeroSourceChainID() public { - vm.expectRevert(_formatNativeTokenDestinationErrorMessage("zero source blockchain ID")); + vm.expectRevert( + _formatNativeTokenDestinationErrorMessage( + "zero source blockchain ID" + ) + ); new NativeTokenDestination( MOCK_TELEPORTER_MESSENGER_ADDRESS, @@ -187,7 +242,11 @@ contract NativeTokenDestinationTest is Test { } function testSameBlockchainID() public { - vm.expectRevert(_formatNativeTokenDestinationErrorMessage("cannot bridge with same blockchain")); + vm.expectRevert( + _formatNativeTokenDestinationErrorMessage( + "cannot bridge with same blockchain" + ) + ); new NativeTokenDestination( MOCK_TELEPORTER_MESSENGER_ADDRESS, @@ -198,7 +257,11 @@ contract NativeTokenDestinationTest is Test { } function testZeroSourceContractAddress() public { - vm.expectRevert(_formatNativeTokenDestinationErrorMessage("zero source contract address")); + vm.expectRevert( + _formatNativeTokenDestinationErrorMessage( + "zero source contract address" + ) + ); new NativeTokenDestination( MOCK_TELEPORTER_MESSENGER_ADDRESS, @@ -209,7 +272,11 @@ contract NativeTokenDestinationTest is Test { } function testZeroInitialReserveImbalance() public { - vm.expectRevert(_formatNativeTokenDestinationErrorMessage("zero initial reserve imbalance")); + vm.expectRevert( + _formatNativeTokenDestinationErrorMessage( + "zero initial reserve imbalance" + ) + ); new NativeTokenDestination( MOCK_TELEPORTER_MESSENGER_ADDRESS, @@ -220,7 +287,11 @@ contract NativeTokenDestinationTest is Test { } function testInvalidTeleporterAddress() public { - vm.expectRevert(_formatNativeTokenDestinationErrorMessage("unauthorized TeleporterMessenger contract")); + vm.expectRevert( + _formatNativeTokenDestinationErrorMessage( + "unauthorized TeleporterMessenger contract" + ) + ); vm.prank(address(0x123)); nativeTokenDestination.receiveTeleporterMessage( @@ -231,7 +302,9 @@ contract NativeTokenDestinationTest is Test { } function testInvalidSourceBlockchain() public { - vm.expectRevert(_formatNativeTokenDestinationErrorMessage("invalid source chain")); + vm.expectRevert( + _formatNativeTokenDestinationErrorMessage("invalid source chain") + ); vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); nativeTokenDestination.receiveTeleporterMessage( @@ -242,7 +315,9 @@ contract NativeTokenDestinationTest is Test { } function testInvalidSenderContract() public { - vm.expectRevert(_formatNativeTokenDestinationErrorMessage("unauthorized sender")); + vm.expectRevert( + _formatNativeTokenDestinationErrorMessage("unauthorized sender") + ); vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); nativeTokenDestination.receiveTeleporterMessage( @@ -253,7 +328,9 @@ contract NativeTokenDestinationTest is Test { } function testInvalidRecipientAddress() public { - vm.expectRevert(_formatNativeTokenDestinationErrorMessage("zero recipient address")); + vm.expectRevert( + _formatNativeTokenDestinationErrorMessage("zero recipient address") + ); vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); nativeTokenDestination.receiveTeleporterMessage( @@ -264,7 +341,9 @@ contract NativeTokenDestinationTest is Test { } function testInvalidTransferAmount() public { - vm.expectRevert(_formatNativeTokenDestinationErrorMessage("zero transfer value")); + vm.expectRevert( + _formatNativeTokenDestinationErrorMessage("zero transfer value") + ); vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); nativeTokenDestination.receiveTeleporterMessage( @@ -274,6 +353,43 @@ contract NativeTokenDestinationTest is Test { ); } + function testZeroRecipient() public { + collateralizeBridge(); + vm.expectRevert( + _formatNativeTokenDestinationErrorMessage("zero recipient address") + ); + + nativeTokenDestination.transferToSource{ + value: _DEFAULT_TRANSFER_AMOUNT + }( + address(0x0), + TeleporterFeeInfo({ + feeTokenAddress: address(mockERC20), + amount: _DEFAULT_FEE_AMOUNT + }), + new address[](0) + ); + } + + function testUncollateralizedBridge() public { + vm.expectRevert( + _formatNativeTokenDestinationErrorMessage( + "contract undercollateralized" + ) + ); + + nativeTokenDestination.transferToSource{ + value: _DEFAULT_TRANSFER_AMOUNT + }( + _DEFAULT_RECIPIENT, + TeleporterFeeInfo({ + feeTokenAddress: address(mockERC20), + amount: _DEFAULT_FEE_AMOUNT + }), + new address[](0) + ); + } + function _formatNativeTokenDestinationErrorMessage( string memory errorMessage ) private pure returns (bytes memory) { From f6066054503230baacedae8822df2b3ccce0f43e Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 4 Dec 2023 12:37:24 -0500 Subject: [PATCH 163/183] Linter --- .../NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol index a3369fc27..8247da468 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol @@ -6,9 +6,7 @@ pragma solidity 0.8.18; import {Test} from "forge-std/Test.sol"; -import {NativeTokenDestination, IERC20, ITokenSource, SafeERC20, SafeERC20TransferFrom, TeleporterMessageInput, TeleporterFeeInfo, IWarpMessenger, ITeleporterMessenger} from "../NativeTokenDestination.sol"; -import {INativeTokenDestination} from "../INativeTokenDestination.sol"; -import {ITeleporterReceiver} from "../../../Teleporter/ITeleporterReceiver.sol"; +import {NativeTokenDestination, IERC20, ITokenSource, TeleporterMessageInput, TeleporterFeeInfo, IWarpMessenger, ITeleporterMessenger} from "../NativeTokenDestination.sol"; import {UnitTestMockERC20} from "../../../Mocks/UnitTestMockERC20.sol"; import {INativeMinter} from "@subnet-evm-contracts/interfaces/INativeMinter.sol"; From 8b3e203932f17125120ce9d20bf0e62f0934eaef Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 4 Dec 2023 12:38:28 -0500 Subject: [PATCH 164/183] Linter --- .../tests/NativeTokenDestinationTests.t.sol | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol index 8247da468..f5e341636 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol @@ -30,6 +30,9 @@ contract NativeTokenDestinationTest is Test { uint256 private constant _DEFAULT_TRANSFER_AMOUNT = 1e18; uint256 private constant _DEFAULT_FEE_AMOUNT = 123456; + NativeTokenDestination public nativeTokenDestination; + UnitTestMockERC20 public mockERC20; + event TransferToSource( address indexed sender, address indexed recipient, @@ -43,9 +46,6 @@ contract NativeTokenDestinationTest is Test { uint256 burnAddressBalance ); - NativeTokenDestination public nativeTokenDestination; - UnitTestMockERC20 public mockERC20; - function setUp() public virtual { vm.mockCall( WARP_PRECOMPILE_ADDRESS, From 354b53a248ae86ac90a092cebaaa11ad9b630338 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 5 Dec 2023 08:59:34 -0500 Subject: [PATCH 165/183] NativeTokenSource units tests --- .../NativeTokenSource/NativeTokenSource.go | 2 +- .../NativeTokenBridge/NativeTokenSource.sol | 8 +- .../tests/NativeTokenSourceTests.t.sol | 360 ++++++++++++++++++ 3 files changed, 365 insertions(+), 5 deletions(-) create mode 100644 contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenSourceTests.t.sol diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go index e73f6dfc3..fe72ba845 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go @@ -38,7 +38,7 @@ type TeleporterFeeInfo struct { // NativeTokenSourceMetaData contains all meta data concerning the NativeTokenSource contract. var NativeTokenSourceMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBurnedTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", - Bin: "0x60e06040523480156200001157600080fd5b5060405162001643380380620016438339810160408190526200003491620002ae565b60016000556001600160a01b038316620000bb5760405162461bcd60e51b815260206004820152603360248201527f4e6174697665546f6b656e536f757263653a207a65726f2054656c65706f727460448201527f65724d657373656e67657220616464726573730000000000000000000000000060648201526084015b60405180910390fd5b6001600160a01b03831660c052816200011b5760405162461bcd60e51b815260206004820152602c60248201526000805160206200162383398151915260448201526b1a5bdb8818da185a5b88125160a21b6064820152608401620000b2565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200016e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001949190620002ef565b82036200020a5760405162461bcd60e51b815260206004820152603560248201527f4e6174697665546f6b656e536f757263653a2063616e6e6f742062726964676560448201527f20776974682073616d6520626c6f636b636861696e00000000000000000000006064820152608401620000b2565b60808290526001600160a01b0381166200027c5760405162461bcd60e51b815260206004820152603460248201526000805160206200162383398151915260448201527f696f6e20636f6e747261637420616464726573730000000000000000000000006064820152608401620000b2565b6001600160a01b031660a05250620003099050565b80516001600160a01b0381168114620002a957600080fd5b919050565b600080600060608486031215620002c457600080fd5b620002cf8462000291565b925060208401519150620002e66040850162000291565b90509250925092565b6000602082840312156200030257600080fd5b5051919050565b60805160a05160c0516112bb620003686000396000818160ef0152818161027001528181610299015261048c015260008181610167015281816102f901526105a50152600081816092015281816102d3015261052101526112bb6000f3fe60806040526004361061007b5760003560e01c8063b6171f731161004e578063b6171f731461013e578063b8c9091a14610155578063c452165e14610189578063c868efaa146101a157600080fd5b806341d3014d1461008057806355db3e9e146100c75780639b3e5803146100dd578063ad0aee2514610129575b600080fd5b34801561008c57600080fd5b506100b47f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b3480156100d357600080fd5b506100b460015481565b3480156100e957600080fd5b506101117f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100be565b61013c610137366004610e01565b6101c1565b005b34801561014a57600080fd5b506100b4620186a081565b34801561016157600080fd5b506101117f000000000000000000000000000000000000000000000000000000000000000081565b34801561019557600080fd5b50610111600160981b81565b3480156101ad57600080fd5b5061013c6101bc366004610ea0565b610479565b6101c961072a565b6001600160a01b0384166102365760405162461bcd60e51b815260206004820152602960248201527f4e6174697665546f6b656e536f757263653a207a65726f20657263697069656e60448201526874206164647265737360b81b60648201526084015b60405180910390fd5b60006020840135156102955761025c6102526020860186610f1a565b8560200135610783565b905061029561026e6020860186610f1a565b7f0000000000000000000000000000000000000000000000000000000000000000836108ed565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906103379190610f85565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505050908252506040516020918201916103a6918c913491016001600160a01b03929092168252602082015260400190565b6040516020818303038152906040528152506040518263ffffffff1660e01b81526004016103d49190611071565b6020604051808303816000875af11580156103f3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041791906110ef565b905080866001600160a01b0316336001600160a01b03167f2b4e8f08417773e367064a6aea9ca2df303a60876676f70b6c3c5e66b314ca5a3460405161045f91815260200190565b60405180910390a450506104736001600055565b50505050565b61048161072a565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461051f5760405162461bcd60e51b815260206004820152603c60248201527f4e6174697665546f6b656e536f757263653a20756e617574686f72697a65642060448201527f74656c65706f727465724d657373656e67657220636f6e747261637400000000606482015260840161022d565b7f000000000000000000000000000000000000000000000000000000000000000084146105a35760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e536f757263653a20696e76616c696420646573746960448201526b3730ba34b7b71031b430b4b760a11b606482015260840161022d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316146106335760405162461bcd60e51b815260206004820152602660248201527f4e6174697665546f6b656e536f757263653a20756e617574686f72697a65642060448201526539b2b73232b960d11b606482015260840161022d565b60008061064283850185611108565b9092509050600082600181111561065b5761065b6111b4565b0361068c576000808280602001905181019061067791906111ca565b9150915061068582826109d2565b505061071e565b60018260018111156106a0576106a06111b4565b036106cc576000818060200190518101906106bb91906110ef565b90506106c681610ab6565b5061071e565b60405162461bcd60e51b815260206004820152602160248201527f4e6174697665546f6b656e536f757263653a20696e76616c696420616374696f6044820152603760f91b606482015260840161022d565b50506104736001600055565b60026000540361077c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161022d565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa1580156107cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f091906110ef565b90506108076001600160a01b038516333086610ae5565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa15801561084e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061087291906110ef565b90508181116108d85760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b606482015260840161022d565b6108e2828261120e565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa15801561093e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061096291906110ef565b61096c9190611221565b6040516001600160a01b03851660248201526044810182905290915061047390859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610b1d565b6001600160a01b038216610a395760405162461bcd60e51b815260206004820152602860248201527f4552433230546f6b656e536f757263653a207a65726f20726563697069656e74604482015267206164647265737360c01b606482015260840161022d565b6040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015610a6f573d6000803e3d6000fd5b50604080516001600160a01b0384168152602081018390527f55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407910160405180910390a15050565b600154811115610ae257600060015482610ad0919061120e565b9050610adb81610bf4565b5060018190555b50565b6040516001600160a01b03808516602483015283166044820152606481018290526104739085906323b872dd60e01b9060840161099b565b6000610b72826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c5c9092919063ffffffff16565b805190915015610bef5780806020019051810190610b909190611234565b610bef5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161022d565b505050565b604051600160981b9082156108fc029083906000818181858888f19350505050158015610c25573d6000803e3d6000fd5b506040518181527f2cd3fd70cd5a5d6d805e90d22741aa1a84590ace7cf01b244719558d266143829060200160405180910390a150565b6060610c6b8484600085610c73565b949350505050565b606082471015610cd45760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161022d565b600080866001600160a01b03168587604051610cf09190611256565b60006040518083038185875af1925050503d8060008114610d2d576040519150601f19603f3d011682016040523d82523d6000602084013e610d32565b606091505b5091509150610d4387838387610d4e565b979650505050505050565b60608315610dbd578251600003610db6576001600160a01b0385163b610db65760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161022d565b5081610c6b565b610c6b8383815115610dd25781518083602001fd5b8060405162461bcd60e51b815260040161022d9190611272565b6001600160a01b0381168114610ae257600080fd5b6000806000808486036080811215610e1857600080fd5b8535610e2381610dec565b94506040601f1982011215610e3757600080fd5b50602085019250606085013567ffffffffffffffff80821115610e5957600080fd5b818701915087601f830112610e6d57600080fd5b813581811115610e7c57600080fd5b8860208260051b8501011115610e9157600080fd5b95989497505060200194505050565b60008060008060608587031215610eb657600080fd5b843593506020850135610ec881610dec565b9250604085013567ffffffffffffffff80821115610ee557600080fd5b818701915087601f830112610ef957600080fd5b813581811115610f0857600080fd5b886020828501011115610e9157600080fd5b600060208284031215610f2c57600080fd5b8135610f3781610dec565b9392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610f7d57610f7d610f3e565b604052919050565b600060408284031215610f9757600080fd5b6040516040810181811067ffffffffffffffff82111715610fba57610fba610f3e565b6040528235610fc881610dec565b81526020928301359281019290925250919050565b600081518084526020808501945080840160005b838110156110165781516001600160a01b031687529582019590820190600101610ff1565b509495945050505050565b60005b8381101561103c578181015183820152602001611024565b50506000910152565b6000815180845261105d816020860160208601611021565b601f01601f19169290920160200192915050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526110d2610100840182610fdd565b905060a0840151601f198483030160e08501526108e28282611045565b60006020828403121561110157600080fd5b5051919050565b6000806040838503121561111b57600080fd5b82356002811061112a57600080fd5b915060208381013567ffffffffffffffff8082111561114857600080fd5b818601915086601f83011261115c57600080fd5b81358181111561116e5761116e610f3e565b611180601f8201601f19168501610f54565b9150808252878482850101111561119657600080fd5b80848401858401376000848284010152508093505050509250929050565b634e487b7160e01b600052602160045260246000fd5b600080604083850312156111dd57600080fd5b82516111e881610dec565b6020939093015192949293505050565b634e487b7160e01b600052601160045260246000fd5b818103818111156108e7576108e76111f8565b808201808211156108e7576108e76111f8565b60006020828403121561124657600080fd5b81518015158114610f3757600080fd5b60008251611268818460208701611021565b9190910192915050565b602081526000610f37602083018461104556fea2646970667358221220781ecc15f0e165563ff8d3b6e079f5e1cbfff2f5b9cbcd5b58c9e0c497acf27764736f6c634300081200334e6174697665546f6b656e536f757263653a207a65726f2064657374696e6174", + Bin: "0x60e06040523480156200001157600080fd5b5060405162001612380380620016128339810160408190526200003491620002b3565b60016000556001600160a01b038316620000bb5760405162461bcd60e51b815260206004820152603360248201527f4e6174697665546f6b656e536f757263653a207a65726f2054656c65706f727460448201527f65724d657373656e67657220616464726573730000000000000000000000000060648201526084015b60405180910390fd5b6001600160a01b03831660c05281620001205760405162461bcd60e51b81526020600482015260316024820152600080516020620015f28339815191526044820152701a5bdb88189b1bd8dad8da185a5b881251607a1b6064820152608401620000b2565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000173573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001999190620002f4565b82036200020f5760405162461bcd60e51b815260206004820152603560248201527f4e6174697665546f6b656e536f757263653a2063616e6e6f742062726964676560448201527f20776974682073616d6520626c6f636b636861696e00000000000000000000006064820152608401620000b2565b60808290526001600160a01b038116620002815760405162461bcd60e51b81526020600482015260346024820152600080516020620015f283398151915260448201527f696f6e20636f6e747261637420616464726573730000000000000000000000006064820152608401620000b2565b6001600160a01b031660a052506200030e9050565b80516001600160a01b0381168114620002ae57600080fd5b919050565b600080600060608486031215620002c957600080fd5b620002d48462000296565b925060208401519150620002eb6040850162000296565b90509250925092565b6000602082840312156200030757600080fd5b5051919050565b60805160a05160c0516112856200036d6000396000818160ef015281816102320152818161025b015261044e015260008181610167015281816102bb015261056701526000818160920152818161029501526104e301526112856000f3fe60806040526004361061007b5760003560e01c8063b6171f731161004e578063b6171f731461013e578063b8c9091a14610155578063c452165e14610189578063c868efaa146101a157600080fd5b806341d3014d1461008057806355db3e9e146100c75780639b3e5803146100dd578063ad0aee2514610129575b600080fd5b34801561008c57600080fd5b506100b47f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b3480156100d357600080fd5b506100b460015481565b3480156100e957600080fd5b506101117f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100be565b61013c610137366004610d82565b6101c1565b005b34801561014a57600080fd5b506100b4620186a081565b34801561016157600080fd5b506101117f000000000000000000000000000000000000000000000000000000000000000081565b34801561019557600080fd5b50610111600160981b81565b3480156101ad57600080fd5b5061013c6101bc366004610e21565b61043b565b6101c96106ec565b6001600160a01b0384166101f85760405162461bcd60e51b81526004016101ef90610e9b565b60405180910390fd5b60006020840135156102575761021e6102146020860186610ee4565b8560200135610745565b90506102576102306020860186610ee4565b7f0000000000000000000000000000000000000000000000000000000000000000836108af565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906102f99190610f4f565b8152602001620186a08152602001878780806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250604051602091820191610368918c913491016001600160a01b03929092168252602082015260400190565b6040516020818303038152906040528152506040518263ffffffff1660e01b8152600401610396919061103b565b6020604051808303816000875af11580156103b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d991906110b9565b905080866001600160a01b0316336001600160a01b03167f2b4e8f08417773e367064a6aea9ca2df303a60876676f70b6c3c5e66b314ca5a3460405161042191815260200190565b60405180910390a450506104356001600055565b50505050565b6104436106ec565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146104e15760405162461bcd60e51b815260206004820152603c60248201527f4e6174697665546f6b656e536f757263653a20756e617574686f72697a65642060448201527f54656c65706f727465724d657373656e67657220636f6e74726163740000000060648201526084016101ef565b7f000000000000000000000000000000000000000000000000000000000000000084146105655760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e536f757263653a20696e76616c696420646573746960448201526b3730ba34b7b71031b430b4b760a11b60648201526084016101ef565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316146105f55760405162461bcd60e51b815260206004820152602660248201527f4e6174697665546f6b656e536f757263653a20756e617574686f72697a65642060448201526539b2b73232b960d11b60648201526084016101ef565b600080610604838501856110d2565b9092509050600082600181111561061d5761061d61117e565b0361064e57600080828060200190518101906106399190611194565b915091506106478282610994565b50506106e0565b60018260018111156106625761066261117e565b0361068e5760008180602001905181019061067d91906110b9565b905061068881610a37565b506106e0565b60405162461bcd60e51b815260206004820152602160248201527f4e6174697665546f6b656e536f757263653a20696e76616c696420616374696f6044820152603760f91b60648201526084016101ef565b50506104356001600055565b60026000540361073e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101ef565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa15801561078e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b291906110b9565b90506107c96001600160a01b038516333086610a66565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610810573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061083491906110b9565b905081811161089a5760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016101ef565b6108a482826111d8565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610900573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092491906110b9565b61092e91906111eb565b6040516001600160a01b03851660248201526044810182905290915061043590859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610a9e565b6001600160a01b0382166109ba5760405162461bcd60e51b81526004016101ef90610e9b565b6040516001600160a01b0383169082156108fc029083906000818181858888f193505050501580156109f0573d6000803e3d6000fd5b50604080516001600160a01b0384168152602081018390527f55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407910160405180910390a15050565b600154811115610a6357600060015482610a5191906111d8565b9050610a5c81610b75565b5060018190555b50565b6040516001600160a01b03808516602483015283166044820152606481018290526104359085906323b872dd60e01b9060840161095d565b6000610af3826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610bdd9092919063ffffffff16565b805190915015610b705780806020019051810190610b1191906111fe565b610b705760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016101ef565b505050565b604051600160981b9082156108fc029083906000818181858888f19350505050158015610ba6573d6000803e3d6000fd5b506040518181527f2cd3fd70cd5a5d6d805e90d22741aa1a84590ace7cf01b244719558d266143829060200160405180910390a150565b6060610bec8484600085610bf4565b949350505050565b606082471015610c555760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016101ef565b600080866001600160a01b03168587604051610c719190611220565b60006040518083038185875af1925050503d8060008114610cae576040519150601f19603f3d011682016040523d82523d6000602084013e610cb3565b606091505b5091509150610cc487838387610ccf565b979650505050505050565b60608315610d3e578251600003610d37576001600160a01b0385163b610d375760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101ef565b5081610bec565b610bec8383815115610d535781518083602001fd5b8060405162461bcd60e51b81526004016101ef919061123c565b6001600160a01b0381168114610a6357600080fd5b6000806000808486036080811215610d9957600080fd5b8535610da481610d6d565b94506040601f1982011215610db857600080fd5b50602085019250606085013567ffffffffffffffff80821115610dda57600080fd5b818701915087601f830112610dee57600080fd5b813581811115610dfd57600080fd5b8860208260051b8501011115610e1257600080fd5b95989497505060200194505050565b60008060008060608587031215610e3757600080fd5b843593506020850135610e4981610d6d565b9250604085013567ffffffffffffffff80821115610e6657600080fd5b818701915087601f830112610e7a57600080fd5b813581811115610e8957600080fd5b886020828501011115610e1257600080fd5b60208082526029908201527f4e6174697665546f6b656e536f757263653a207a65726f20726563697069656e60408201526874206164647265737360b81b606082015260800190565b600060208284031215610ef657600080fd5b8135610f0181610d6d565b9392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610f4757610f47610f08565b604052919050565b600060408284031215610f6157600080fd5b6040516040810181811067ffffffffffffffff82111715610f8457610f84610f08565b6040528235610f9281610d6d565b81526020928301359281019290925250919050565b600081518084526020808501945080840160005b83811015610fe05781516001600160a01b031687529582019590820190600101610fbb565b509495945050505050565b60005b83811015611006578181015183820152602001610fee565b50506000910152565b60008151808452611027816020860160208601610feb565b601f01601f19169290920160200192915050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c084015261109c610100840182610fa7565b905060a0840151601f198483030160e08501526108a4828261100f565b6000602082840312156110cb57600080fd5b5051919050565b600080604083850312156110e557600080fd5b8235600281106110f457600080fd5b915060208381013567ffffffffffffffff8082111561111257600080fd5b818601915086601f83011261112657600080fd5b81358181111561113857611138610f08565b61114a601f8201601f19168501610f1e565b9150808252878482850101111561116057600080fd5b80848401858401376000848284010152508093505050509250929050565b634e487b7160e01b600052602160045260246000fd5b600080604083850312156111a757600080fd5b82516111b281610d6d565b6020939093015192949293505050565b634e487b7160e01b600052601160045260246000fd5b818103818111156108a9576108a96111c2565b808201808211156108a9576108a96111c2565b60006020828403121561121057600080fd5b81518015158114610f0157600080fd5b60008251611232818460208701610feb565b9190910192915050565b602081526000610f01602083018461100f56fea2646970667358221220866227f7b920a305fc572c88de560b59d138acceaf90ba9ef1e8e4ea549a7d5764736f6c634300081200334e6174697665546f6b656e536f757263653a207a65726f2064657374696e6174", } // NativeTokenSourceABI is the input ABI used to generate the binding from. diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index 7f100a623..824655573 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -50,7 +50,7 @@ contract NativeTokenSource is require( destinationBlockchainID_ != bytes32(0), - "NativeTokenSource: zero destination chain ID" + "NativeTokenSource: zero destination blockchain ID" ); require( destinationBlockchainID_ != @@ -80,7 +80,7 @@ contract NativeTokenSource is // Only allow the Teleporter messenger to deliver messages. require( msg.sender == address(teleporterMessenger), - "NativeTokenSource: unauthorized teleporterMessenger contract" + "NativeTokenSource: unauthorized TeleporterMessenger contract" ); // Only allow messages from the destination chain. @@ -127,7 +127,7 @@ contract NativeTokenSource is // The recipient cannot be the zero address. require( recipient != address(0), - "NativeTokenSource: zero ercipient address" + "NativeTokenSource: zero recipient address" ); // Lock tokens in this bridge instance. Supports "fee/burn on transfer" ERC20 token @@ -171,7 +171,7 @@ contract NativeTokenSource is function _unlockTokens(address recipient, uint256 amount) private { require( recipient != address(0), - "ERC20TokenSource: zero recipient address" + "NativeTokenSource: zero recipient address" ); // Transfer to recipient diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenSourceTests.t.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenSourceTests.t.sol new file mode 100644 index 000000000..864bb99ad --- /dev/null +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenSourceTests.t.sol @@ -0,0 +1,360 @@ +// (c) 2023, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +// SPDX-License-Identifier: Ecosystem + +pragma solidity 0.8.18; + +import {Test} from "forge-std/Test.sol"; +import {NativeTokenSource, IERC20, ITokenSource, TeleporterMessageInput, TeleporterFeeInfo, IWarpMessenger, ITeleporterMessenger} from "../NativeTokenSource.sol"; +import {UnitTestMockERC20} from "../../../Mocks/UnitTestMockERC20.sol"; + +contract NativeTokenSourceTest is Test { + address public constant MOCK_TELEPORTER_MESSENGER_ADDRESS = + 0x644E5b7c5D4Bc8073732CEa72c66e0BB90dFC00f; + address public constant WARP_PRECOMPILE_ADDRESS = + address(0x0200000000000000000000000000000000000005); + address public constant NATIVE_MINTER_PRECOMPILE_ADDRESS = + address(0x0200000000000000000000000000000000000001); + bytes32 private constant _MOCK_BLOCKCHAIN_ID = bytes32(uint256(123456)); + bytes32 private constant _DEFAULT_OTHER_CHAIN_ID = + bytes32( + hex"abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcd" + ); + address private constant _DEFAULT_OTHER_BRIDGE_ADDRESS = + 0xd54e3E251b9b0EEd3ed70A858e927bbC2659587d; + uint256 private constant _DEFAULT_INITIAL_RESERVE_IMBALANCE = 1000000000; + address private constant _DEFAULT_RECIPIENT = + 0xa4CEE7d1aF6aDdDD33E3b1cC680AB84fdf1b6d1d; + uint256 private constant _DEFAULT_TRANSFER_AMOUNT = 1e18; + uint256 private constant _DEFAULT_FEE_AMOUNT = 123456; + + NativeTokenSource public nativeTokenSource; + UnitTestMockERC20 public mockERC20; + + event TransferToDestination( + address indexed sender, + address indexed recipient, + uint256 indexed teleporterMessageID, + uint256 amount + ); + event UnlockTokens(address recipient, uint256 amount); + event BurnTokens(uint256 amount); + + function setUp() public virtual { + vm.mockCall( + WARP_PRECOMPILE_ADDRESS, + abi.encodeWithSelector(IWarpMessenger.getBlockchainID.selector), + abi.encode(_MOCK_BLOCKCHAIN_ID) + ); + vm.mockCall( + MOCK_TELEPORTER_MESSENGER_ADDRESS, + abi.encodeWithSelector( + ITeleporterMessenger.sendCrossChainMessage.selector + ), + abi.encode(1) + ); + + vm.expectCall( + WARP_PRECOMPILE_ADDRESS, + abi.encodeWithSelector(IWarpMessenger.getBlockchainID.selector) + ); + + nativeTokenSource = new NativeTokenSource( + MOCK_TELEPORTER_MESSENGER_ADDRESS, + _DEFAULT_OTHER_CHAIN_ID, + _DEFAULT_OTHER_BRIDGE_ADDRESS + ); + mockERC20 = new UnitTestMockERC20(); + + vm.mockCall( + address(mockERC20), + abi.encodeWithSelector(IERC20.allowance.selector), + abi.encode(1234) + ); + vm.mockCall( + address(mockERC20), + abi.encodeWithSelector(IERC20.approve.selector), + abi.encode(true) + ); + } + + function testTransferToDestination() public { + vm.expectEmit(true, true, true, true, address(nativeTokenSource)); + emit TransferToDestination({ + sender: address(this), + recipient: _DEFAULT_RECIPIENT, + amount: _DEFAULT_TRANSFER_AMOUNT, + teleporterMessageID: 1 + }); + + TeleporterMessageInput + memory expectedMessageInput = TeleporterMessageInput({ + destinationBlockchainID: _DEFAULT_OTHER_CHAIN_ID, + destinationAddress: _DEFAULT_OTHER_BRIDGE_ADDRESS, + feeInfo: TeleporterFeeInfo({ + feeTokenAddress: address(mockERC20), + amount: _DEFAULT_FEE_AMOUNT + }), + requiredGasLimit: nativeTokenSource + .MINT_NATIVE_TOKENS_REQUIRED_GAS(), + allowedRelayerAddresses: new address[](0), + message: abi.encode(_DEFAULT_RECIPIENT, _DEFAULT_TRANSFER_AMOUNT) + }); + + vm.expectCall( + MOCK_TELEPORTER_MESSENGER_ADDRESS, + abi.encodeCall( + ITeleporterMessenger.sendCrossChainMessage, + (expectedMessageInput) + ) + ); + + nativeTokenSource.transferToDestination{ + value: _DEFAULT_TRANSFER_AMOUNT + }( + _DEFAULT_RECIPIENT, + TeleporterFeeInfo({ + feeTokenAddress: address(mockERC20), + amount: _DEFAULT_FEE_AMOUNT + }), + new address[](0) + ); + } + + function testUnlock() public { + // Give the contract some tokens to burn. + nativeTokenSource.transferToDestination{ + value: _DEFAULT_TRANSFER_AMOUNT * 2 + }( + _DEFAULT_RECIPIENT, + TeleporterFeeInfo({ + feeTokenAddress: address(mockERC20), + amount: _DEFAULT_FEE_AMOUNT + }), + new address[](0) + ); + + vm.expectEmit(true, true, true, true, address(nativeTokenSource)); + emit UnlockTokens(_DEFAULT_RECIPIENT, _DEFAULT_TRANSFER_AMOUNT); + + vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); + nativeTokenSource.receiveTeleporterMessage( + _DEFAULT_OTHER_CHAIN_ID, + _DEFAULT_OTHER_BRIDGE_ADDRESS, + abi.encode( + ITokenSource.SourceAction.Unlock, + abi.encode(_DEFAULT_RECIPIENT, _DEFAULT_TRANSFER_AMOUNT) + ) + ); + + assertEq(_DEFAULT_TRANSFER_AMOUNT, _DEFAULT_RECIPIENT.balance); + } + + function testBurnedTxFees() public { + // Give the contract some tokens to burn. + nativeTokenSource.transferToDestination{ + value: _DEFAULT_TRANSFER_AMOUNT + }( + _DEFAULT_RECIPIENT, + TeleporterFeeInfo({ + feeTokenAddress: address(mockERC20), + amount: _DEFAULT_FEE_AMOUNT + }), + new address[](0) + ); + + uint256 burnedTxFees = 100; + uint256 additionalTxFees = 50; + assertEq(0, nativeTokenSource.destinationBurnedTotal()); + + vm.expectEmit(true, true, true, true, address(nativeTokenSource)); + emit BurnTokens(burnedTxFees); + + vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); + nativeTokenSource.receiveTeleporterMessage( + _DEFAULT_OTHER_CHAIN_ID, + _DEFAULT_OTHER_BRIDGE_ADDRESS, + abi.encode( + ITokenSource.SourceAction.Burn, + abi.encode(burnedTxFees) + ) + ); + + assertEq(burnedTxFees, nativeTokenSource.destinationBurnedTotal()); + assertEq(burnedTxFees, nativeTokenSource.BURNED_TX_FEES_ADDRESS().balance); + + vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); + nativeTokenSource.receiveTeleporterMessage( + _DEFAULT_OTHER_CHAIN_ID, + _DEFAULT_OTHER_BRIDGE_ADDRESS, + abi.encode( + ITokenSource.SourceAction.Burn, + abi.encode(burnedTxFees - 1) + ) + ); + + assertEq(burnedTxFees, nativeTokenSource.destinationBurnedTotal()); + assertEq(burnedTxFees, nativeTokenSource.BURNED_TX_FEES_ADDRESS().balance); + + emit BurnTokens(additionalTxFees); + + vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); + nativeTokenSource.receiveTeleporterMessage( + _DEFAULT_OTHER_CHAIN_ID, + _DEFAULT_OTHER_BRIDGE_ADDRESS, + abi.encode( + ITokenSource.SourceAction.Burn, + abi.encode(burnedTxFees + additionalTxFees) + ) + ); + + assertEq(burnedTxFees + additionalTxFees, nativeTokenSource.destinationBurnedTotal()); + assertEq(burnedTxFees + additionalTxFees, nativeTokenSource.BURNED_TX_FEES_ADDRESS().balance); + } + + function testZeroTeleporterAddress() public { + vm.expectRevert( + _formatNativeTokenSourceErrorMessage( + "zero TeleporterMessenger address" + ) + ); + + new NativeTokenSource( + address(0x0), + _DEFAULT_OTHER_CHAIN_ID, + _DEFAULT_OTHER_BRIDGE_ADDRESS + ); + } + + function testZeroDestinationChainID() public { + vm.expectRevert( + _formatNativeTokenSourceErrorMessage( + "zero destination blockchain ID" + ) + ); + + new NativeTokenSource( + MOCK_TELEPORTER_MESSENGER_ADDRESS, + bytes32(0), + _DEFAULT_OTHER_BRIDGE_ADDRESS + ); + } + + function testSameBlockchainID() public { + vm.expectRevert( + _formatNativeTokenSourceErrorMessage( + "cannot bridge with same blockchain" + ) + ); + + new NativeTokenSource( + MOCK_TELEPORTER_MESSENGER_ADDRESS, + _MOCK_BLOCKCHAIN_ID, + _DEFAULT_OTHER_BRIDGE_ADDRESS + ); + } + + function testZeroDestinationContractAddress() public { + vm.expectRevert( + _formatNativeTokenSourceErrorMessage( + "zero destination contract address" + ) + ); + + new NativeTokenSource( + MOCK_TELEPORTER_MESSENGER_ADDRESS, + _DEFAULT_OTHER_CHAIN_ID, + address(0x0) + ); + } + + function testInvalidTeleporterAddress() public { + vm.expectRevert( + _formatNativeTokenSourceErrorMessage( + "unauthorized TeleporterMessenger contract" + ) + ); + + vm.prank(address(0x123)); + nativeTokenSource.receiveTeleporterMessage( + _DEFAULT_OTHER_CHAIN_ID, + _DEFAULT_OTHER_BRIDGE_ADDRESS, + abi.encode( + ITokenSource.SourceAction.Unlock, + abi.encode(_DEFAULT_RECIPIENT, _DEFAULT_TRANSFER_AMOUNT) + ) + ); + } + + function testInvalidDestinationBlockchain() public { + vm.expectRevert( + _formatNativeTokenSourceErrorMessage("invalid destination chain") + ); + + vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); + nativeTokenSource.receiveTeleporterMessage( + _MOCK_BLOCKCHAIN_ID, + _DEFAULT_OTHER_BRIDGE_ADDRESS, + abi.encode( + ITokenSource.SourceAction.Unlock, + abi.encode(_DEFAULT_RECIPIENT, _DEFAULT_TRANSFER_AMOUNT) + ) + ); + } + + function testInvalidSenderContract() public { + vm.expectRevert( + _formatNativeTokenSourceErrorMessage("unauthorized sender") + ); + + vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); + nativeTokenSource.receiveTeleporterMessage( + _DEFAULT_OTHER_CHAIN_ID, + address(0x123), + abi.encode( + ITokenSource.SourceAction.Unlock, + abi.encode(_DEFAULT_RECIPIENT, _DEFAULT_TRANSFER_AMOUNT) + ) + ); + } + + function testInvalidRecipientAddress() public { + vm.expectRevert( + _formatNativeTokenSourceErrorMessage("zero recipient address") + ); + + vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); + nativeTokenSource.receiveTeleporterMessage( + _DEFAULT_OTHER_CHAIN_ID, + _DEFAULT_OTHER_BRIDGE_ADDRESS, + abi.encode( + ITokenSource.SourceAction.Unlock, + abi.encode(address(0x0), _DEFAULT_TRANSFER_AMOUNT) + ) + ); + } + + function testZeroRecipient() public { + vm.expectRevert( + _formatNativeTokenSourceErrorMessage("zero recipient address") + ); + + nativeTokenSource.transferToDestination{ + value: _DEFAULT_TRANSFER_AMOUNT + }( + address(0x0), + TeleporterFeeInfo({ + feeTokenAddress: address(mockERC20), + amount: _DEFAULT_FEE_AMOUNT + }), + new address[](0) + ); + } + + function _formatNativeTokenSourceErrorMessage( + string memory errorMessage + ) private pure returns (bytes memory) { + return bytes(string.concat("NativeTokenSource: ", errorMessage)); + } +} From 0a3e4ffecc4cfd95f31d1ea77f14916c4eb61929 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 5 Dec 2023 09:22:12 -0500 Subject: [PATCH 166/183] ERC20TokenSource units tests --- .../ERC20TokenSource/ERC20TokenSource.go | 35 +- .../NativeTokenDestination.go | 2 +- .../NativeTokenSource/NativeTokenSource.go | 2 +- .../NativeTokenBridge/ERC20TokenSource.sol | 7 +- .../NativeTokenBridge/IERC20TokenSource.sol | 11 - .../NativeTokenBridge/INativeTokenSource.sol | 10 - .../NativeTokenBridge/ITokenSource.sol | 10 + .../tests/ERC20TokenSourceTests.t.sol | 362 ++++++++++++++++++ .../tests/NativeTokenSourceTests.t.sol | 2 - contracts/src/Mocks/UnitTestMockERC20.sol | 12 + 10 files changed, 410 insertions(+), 43 deletions(-) create mode 100644 contracts/src/CrossChainApplications/NativeTokenBridge/tests/ERC20TokenSourceTests.t.sol diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go index 7df5e1bb6..5d30c65e6 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go @@ -31,8 +31,8 @@ var ( // ERC20TokenSourceMetaData contains all meta data concerning the ERC20TokenSource contract. var ERC20TokenSourceMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"erc20ContractAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"transferAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBurnedTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"erc20ContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x6101006040523480156200001257600080fd5b50604051620016f3380380620016f383398101604081905262000035916200031b565b60016000556001600160a01b038416620000b15760405162461bcd60e51b815260206004820152603260248201527f4552433230546f6b656e536f757263653a207a65726f2054656c65706f727465604482015271724d657373656e676572206164647265737360701b60648201526084015b60405180910390fd5b6001600160a01b03841660e05282620001105760405162461bcd60e51b815260206004820152602b6024820152600080516020620016d383398151915260448201526a1bdb8818da185a5b88125160aa1b6064820152608401620000a8565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000163573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200018991906200036f565b8303620001ff5760405162461bcd60e51b815260206004820152603460248201527f4552433230546f6b656e536f757263653a2063616e6e6f74206272696467652060448201527f776974682073616d6520626c6f636b636861696e0000000000000000000000006064820152608401620000a8565b60808390526001600160a01b038216620002715760405162461bcd60e51b81526020600482015260336024820152600080516020620016d383398151915260448201527f6f6e20636f6e74726163742061646472657373000000000000000000000000006064820152608401620000a8565b6001600160a01b0380831660a0528116620002e85760405162461bcd60e51b815260206004820152603060248201527f4552433230546f6b656e536f757263653a20696e76616c69642045524332302060448201526f636f6e7472616374206164647265737360801b6064820152608401620000a8565b6001600160a01b031660c0525062000389915050565b80516001600160a01b03811681146200031657600080fd5b919050565b600080600080608085870312156200033257600080fd5b6200033d85620002fe565b9350602085015192506200035460408601620002fe565b91506200036460608601620002fe565b905092959194509250565b6000602082840312156200038257600080fd5b5051919050565b60805160a05160c05160e0516112be620004156000396000818160f50152818161029c015281816102d301526104ee015260008181610183015281816101e30152818161027b0152818161036d01528181610a590152610c3801526000818161013e015281816103330152610606015260008181609d0152818161030d015261058301526112be6000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063b6171f7311610066578063b6171f731461012f578063b8c9091a14610139578063c452165e14610160578063c868efaa1461016b578063e486df151461017e57600080fd5b806341d3014d1461009857806355db3e9e146100d257806387a2edba146100db5780639b3e5803146100f0575b600080fd5b6100bf7f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b6100bf60015481565b6100ee6100e9366004610e3d565b6101a5565b005b6101177f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100c9565b6100bf620186a081565b6101177f000000000000000000000000000000000000000000000000000000000000000081565b610117600160981b81565b6100ee610179366004610ed6565b6104db565b6101177f000000000000000000000000000000000000000000000000000000000000000081565b6101ad610786565b6001600160a01b0385166101dc5760405162461bcd60e51b81526004016101d390610f5f565b60405180910390fd5b60006102087f0000000000000000000000000000000000000000000000000000000000000000866107df565b90508381116102705760405162461bcd60e51b815260206004820152602e60248201527f4552433230546f6b656e536f757263653a20696e73756666696369656e74206160448201526d191a9d5cdd195908185b5bdd5b9d60921b60648201526084016101d3565b83156102c1576102c17f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000086610949565b60006102cd8583610fbd565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316815260200160405180604001604052807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031681526020018b8152508152602001620186a08152602001888880806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250604080516001600160a01b038e166020808301919091529181018890529101906060016040516020818303038152906040528152506040518263ffffffff1660e01b81526004016104339190611064565b6020604051808303816000875af1158015610452573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047691906110e2565b60408051848152602081018990529081018290529091506001600160a01b0389169033907f51f5c55ca5f8f5fde6736f19d1d035a8c67fe18c30d445cea44c4816c6a525a09060600160405180910390a35050506104d46001600055565b5050505050565b6104e3610786565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146105815760405162461bcd60e51b815260206004820152603b60248201527f4552433230546f6b656e536f757263653a20756e617574686f72697a6564205460448201527f656c65706f727465724d657373656e67657220636f6e7472616374000000000060648201526084016101d3565b7f000000000000000000000000000000000000000000000000000000000000000084146106045760405162461bcd60e51b815260206004820152602b60248201527f4552433230546f6b656e536f757263653a20696e76616c69642064657374696e60448201526a30ba34b7b71031b430b4b760a91b60648201526084016101d3565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316146106935760405162461bcd60e51b815260206004820152602560248201527f4552433230546f6b656e536f757263653a20756e617574686f72697a6564207360448201526432b73232b960d91b60648201526084016101d3565b6000806106a283850185611111565b909250905060008260018111156106bb576106bb6111d9565b036106ec57600080828060200190518101906106d791906111ef565b915091506106e58282610a2e565b5050610774565b6001826001811115610700576107006111d9565b0361072c5760008180602001905181019061071b91906110e2565b905061072681610ac5565b50610774565b60405162461bcd60e51b815260206004820181905260248201527f4552433230546f6b656e536f757263653a20696e76616c696420616374696f6e60448201526064016101d3565b50506107806001600055565b50505050565b6002600054036107d85760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101d3565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015610828573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084c91906110e2565b90506108636001600160a01b038516333086610af4565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa1580156108aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ce91906110e2565b90508181116109345760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016101d3565b61093e8282610fbd565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa15801561099a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109be91906110e2565b6109c8919061121d565b6040516001600160a01b03851660248201526044810182905290915061078090859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610b2c565b6001600160a01b038216610a545760405162461bcd60e51b81526004016101d390610f5f565b610a7f7f00000000000000000000000000000000000000000000000000000000000000008383610c03565b604080516001600160a01b0384168152602081018390527f55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407910160405180910390a15050565b600154811115610af157600060015482610adf9190610fbd565b9050610aea81610c33565b5060018190555b50565b6040516001600160a01b03808516602483015283166044820152606481018290526107809085906323b872dd60e01b906084016109f7565b6000610b81826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c989092919063ffffffff16565b805190915015610bfe5780806020019051810190610b9f9190611230565b610bfe5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016101d3565b505050565b6040516001600160a01b038316602482015260448101829052610bfe90849063a9059cbb60e01b906064016109f7565b610c627f0000000000000000000000000000000000000000000000000000000000000000600160981b83610c03565b6040518181527f2cd3fd70cd5a5d6d805e90d22741aa1a84590ace7cf01b244719558d266143829060200160405180910390a150565b6060610ca78484600085610caf565b949350505050565b606082471015610d105760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016101d3565b600080866001600160a01b03168587604051610d2c9190611259565b60006040518083038185875af1925050503d8060008114610d69576040519150601f19603f3d011682016040523d82523d6000602084013e610d6e565b606091505b5091509150610d7f87838387610d8a565b979650505050505050565b60608315610df9578251600003610df2576001600160a01b0385163b610df25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101d3565b5081610ca7565b610ca78383815115610e0e5781518083602001fd5b8060405162461bcd60e51b81526004016101d39190611275565b6001600160a01b0381168114610af157600080fd5b600080600080600060808688031215610e5557600080fd5b8535610e6081610e28565b94506020860135935060408601359250606086013567ffffffffffffffff80821115610e8b57600080fd5b818801915088601f830112610e9f57600080fd5b813581811115610eae57600080fd5b8960208260051b8501011115610ec357600080fd5b9699959850939650602001949392505050565b60008060008060608587031215610eec57600080fd5b843593506020850135610efe81610e28565b9250604085013567ffffffffffffffff80821115610f1b57600080fd5b818701915087601f830112610f2f57600080fd5b813581811115610f3e57600080fd5b886020828501011115610f5057600080fd5b95989497505060200194505050565b60208082526028908201527f4552433230546f6b656e536f757263653a207a65726f20726563697069656e74604082015267206164647265737360c01b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b8181038181111561094357610943610fa7565b600081518084526020808501945080840160005b838110156110095781516001600160a01b031687529582019590820190600101610fe4565b509495945050505050565b60005b8381101561102f578181015183820152602001611017565b50506000910152565b60008151808452611050816020860160208601611014565b601f01601f19169290920160200192915050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526110c5610100840182610fd0565b905060a0840151601f198483030160e085015261093e8282611038565b6000602082840312156110f457600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561112457600080fd5b82356002811061113357600080fd5b9150602083013567ffffffffffffffff8082111561115057600080fd5b818501915085601f83011261116457600080fd5b813581811115611176576111766110fb565b604051601f8201601f19908116603f0116810190838211818310171561119e5761119e6110fb565b816040528281528860208487010111156111b757600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b634e487b7160e01b600052602160045260246000fd5b6000806040838503121561120257600080fd5b825161120d81610e28565b6020939093015192949293505050565b8082018082111561094357610943610fa7565b60006020828403121561124257600080fd5b8151801515811461125257600080fd5b9392505050565b6000825161126b818460208701611014565b9190910192915050565b602081526000611252602083018461103856fea2646970667358221220f7e42fc360c2fbd286b857618d7456ef997666777dc8ca7c3ccc9a49b0b0088864736f6c634300081200334552433230546f6b656e536f757263653a207a65726f2064657374696e617469", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"erc20ContractAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBurnedTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"erc20ContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + Bin: "0x6101006040523480156200001257600080fd5b50604051620016f4380380620016f483398101604081905262000035916200031d565b60016000556001600160a01b038416620000b15760405162461bcd60e51b815260206004820152603260248201527f4552433230546f6b656e536f757263653a207a65726f2054656c65706f727465604482015271724d657373656e676572206164647265737360701b60648201526084015b60405180910390fd5b6001600160a01b03841660e05282620001155760405162461bcd60e51b81526020600482015260306024820152600080516020620016d483398151915260448201526f1bdb88189b1bd8dad8da185a5b88125160821b6064820152608401620000a8565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000168573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200018e919062000371565b8303620002045760405162461bcd60e51b815260206004820152603460248201527f4552433230546f6b656e536f757263653a2063616e6e6f74206272696467652060448201527f776974682073616d6520626c6f636b636861696e0000000000000000000000006064820152608401620000a8565b60808390526001600160a01b038216620002765760405162461bcd60e51b81526020600482015260336024820152600080516020620016d483398151915260448201527f6f6e20636f6e74726163742061646472657373000000000000000000000000006064820152608401620000a8565b6001600160a01b0380831660a0528116620002ea5760405162461bcd60e51b815260206004820152602d60248201527f4552433230546f6b656e536f757263653a207a65726f20455243323020636f6e60448201526c7472616374206164647265737360981b6064820152608401620000a8565b6001600160a01b031660c052506200038b915050565b80516001600160a01b03811681146200031857600080fd5b919050565b600080600080608085870312156200033457600080fd5b6200033f8562000300565b935060208501519250620003566040860162000300565b9150620003666060860162000300565b905092959194509250565b6000602082840312156200038457600080fd5b5051919050565b60805160a05160c05160e0516112bd620004176000396000818160f50152818161029c015281816102d301526104ed015260008181610183015281816101e30152818161027b0152818161036d01528181610a580152610c3701526000818161013e015281816103330152610605015260008181609d0152818161030d015261058201526112bd6000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063b6171f7311610066578063b6171f731461012f578063b8c9091a14610139578063c452165e14610160578063c868efaa1461016b578063e486df151461017e57600080fd5b806341d3014d1461009857806355db3e9e146100d257806387a2edba146100db5780639b3e5803146100f0575b600080fd5b6100bf7f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b6100bf60015481565b6100ee6100e9366004610e3c565b6101a5565b005b6101177f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100c9565b6100bf620186a081565b6101177f000000000000000000000000000000000000000000000000000000000000000081565b610117600160981b81565b6100ee610179366004610ed5565b6104da565b6101177f000000000000000000000000000000000000000000000000000000000000000081565b6101ad610785565b6001600160a01b0385166101dc5760405162461bcd60e51b81526004016101d390610f5e565b60405180910390fd5b60006102087f0000000000000000000000000000000000000000000000000000000000000000866107de565b90508381116102705760405162461bcd60e51b815260206004820152602e60248201527f4552433230546f6b656e536f757263653a20696e73756666696369656e74206160448201526d191a9d5cdd195908185b5bdd5b9d60921b60648201526084016101d3565b83156102c1576102c17f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000086610948565b60006102cd8583610fbc565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316815260200160405180604001604052807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031681526020018b8152508152602001620186a08152602001888880806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250604080516001600160a01b038e166020808301919091529181018890529101906060016040516020818303038152906040528152506040518263ffffffff1660e01b81526004016104339190611063565b6020604051808303816000875af1158015610452573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047691906110e1565b905080886001600160a01b0316336001600160a01b03167f2b4e8f08417773e367064a6aea9ca2df303a60876676f70b6c3c5e66b314ca5a856040516104be91815260200190565b60405180910390a45050506104d36001600055565b5050505050565b6104e2610785565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146105805760405162461bcd60e51b815260206004820152603b60248201527f4552433230546f6b656e536f757263653a20756e617574686f72697a6564205460448201527f656c65706f727465724d657373656e67657220636f6e7472616374000000000060648201526084016101d3565b7f000000000000000000000000000000000000000000000000000000000000000084146106035760405162461bcd60e51b815260206004820152602b60248201527f4552433230546f6b656e536f757263653a20696e76616c69642064657374696e60448201526a30ba34b7b71031b430b4b760a91b60648201526084016101d3565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316146106925760405162461bcd60e51b815260206004820152602560248201527f4552433230546f6b656e536f757263653a20756e617574686f72697a6564207360448201526432b73232b960d91b60648201526084016101d3565b6000806106a183850185611110565b909250905060008260018111156106ba576106ba6111d8565b036106eb57600080828060200190518101906106d691906111ee565b915091506106e48282610a2d565b5050610773565b60018260018111156106ff576106ff6111d8565b0361072b5760008180602001905181019061071a91906110e1565b905061072581610ac4565b50610773565b60405162461bcd60e51b815260206004820181905260248201527f4552433230546f6b656e536f757263653a20696e76616c696420616374696f6e60448201526064016101d3565b505061077f6001600055565b50505050565b6002600054036107d75760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101d3565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015610827573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084b91906110e1565b90506108626001600160a01b038516333086610af3565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa1580156108a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108cd91906110e1565b90508181116109335760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016101d3565b61093d8282610fbc565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610999573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109bd91906110e1565b6109c7919061121c565b6040516001600160a01b03851660248201526044810182905290915061077f90859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610b2b565b6001600160a01b038216610a535760405162461bcd60e51b81526004016101d390610f5e565b610a7e7f00000000000000000000000000000000000000000000000000000000000000008383610c02565b604080516001600160a01b0384168152602081018390527f55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407910160405180910390a15050565b600154811115610af057600060015482610ade9190610fbc565b9050610ae981610c32565b5060018190555b50565b6040516001600160a01b038085166024830152831660448201526064810182905261077f9085906323b872dd60e01b906084016109f6565b6000610b80826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c979092919063ffffffff16565b805190915015610bfd5780806020019051810190610b9e919061122f565b610bfd5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016101d3565b505050565b6040516001600160a01b038316602482015260448101829052610bfd90849063a9059cbb60e01b906064016109f6565b610c617f0000000000000000000000000000000000000000000000000000000000000000600160981b83610c02565b6040518181527f2cd3fd70cd5a5d6d805e90d22741aa1a84590ace7cf01b244719558d266143829060200160405180910390a150565b6060610ca68484600085610cae565b949350505050565b606082471015610d0f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016101d3565b600080866001600160a01b03168587604051610d2b9190611258565b60006040518083038185875af1925050503d8060008114610d68576040519150601f19603f3d011682016040523d82523d6000602084013e610d6d565b606091505b5091509150610d7e87838387610d89565b979650505050505050565b60608315610df8578251600003610df1576001600160a01b0385163b610df15760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101d3565b5081610ca6565b610ca68383815115610e0d5781518083602001fd5b8060405162461bcd60e51b81526004016101d39190611274565b6001600160a01b0381168114610af057600080fd5b600080600080600060808688031215610e5457600080fd5b8535610e5f81610e27565b94506020860135935060408601359250606086013567ffffffffffffffff80821115610e8a57600080fd5b818801915088601f830112610e9e57600080fd5b813581811115610ead57600080fd5b8960208260051b8501011115610ec257600080fd5b9699959850939650602001949392505050565b60008060008060608587031215610eeb57600080fd5b843593506020850135610efd81610e27565b9250604085013567ffffffffffffffff80821115610f1a57600080fd5b818701915087601f830112610f2e57600080fd5b813581811115610f3d57600080fd5b886020828501011115610f4f57600080fd5b95989497505060200194505050565b60208082526028908201527f4552433230546f6b656e536f757263653a207a65726f20726563697069656e74604082015267206164647265737360c01b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b8181038181111561094257610942610fa6565b600081518084526020808501945080840160005b838110156110085781516001600160a01b031687529582019590820190600101610fe3565b509495945050505050565b60005b8381101561102e578181015183820152602001611016565b50506000910152565b6000815180845261104f816020860160208601611013565b601f01601f19169290920160200192915050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526110c4610100840182610fcf565b905060a0840151601f198483030160e085015261093d8282611037565b6000602082840312156110f357600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561112357600080fd5b82356002811061113257600080fd5b9150602083013567ffffffffffffffff8082111561114f57600080fd5b818501915085601f83011261116357600080fd5b813581811115611175576111756110fa565b604051601f8201601f19908116603f0116810190838211818310171561119d5761119d6110fa565b816040528281528860208487010111156111b657600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b634e487b7160e01b600052602160045260246000fd5b6000806040838503121561120157600080fd5b825161120c81610e27565b6020939093015192949293505050565b8082018082111561094257610942610fa6565b60006020828403121561124157600080fd5b8151801515811461125157600080fd5b9392505050565b6000825161126a818460208701611013565b9190910192915050565b602081526000611251602083018461103756fea264697066735822122087d9c28ea505fb476fe20f41685a6fcfc36f9d8ec4c6f6614d2b4f197d0d850364736f6c634300081200334552433230546f6b656e536f757263653a207a65726f2064657374696e617469", } // ERC20TokenSourceABI is the input ABI used to generate the binding from. @@ -666,16 +666,15 @@ func (it *ERC20TokenSourceTransferToDestinationIterator) Close() error { type ERC20TokenSourceTransferToDestination struct { Sender common.Address Recipient common.Address - TransferAmount *big.Int - FeeAmount *big.Int TeleporterMessageID *big.Int + Amount *big.Int Raw types.Log // Blockchain specific contextual infos } -// FilterTransferToDestination is a free log retrieval operation binding the contract event 0x51f5c55ca5f8f5fde6736f19d1d035a8c67fe18c30d445cea44c4816c6a525a0. +// FilterTransferToDestination is a free log retrieval operation binding the contract event 0x2b4e8f08417773e367064a6aea9ca2df303a60876676f70b6c3c5e66b314ca5a. // -// Solidity: event TransferToDestination(address indexed sender, address indexed recipient, uint256 transferAmount, uint256 feeAmount, uint256 teleporterMessageID) -func (_ERC20TokenSource *ERC20TokenSourceFilterer) FilterTransferToDestination(opts *bind.FilterOpts, sender []common.Address, recipient []common.Address) (*ERC20TokenSourceTransferToDestinationIterator, error) { +// Solidity: event TransferToDestination(address indexed sender, address indexed recipient, uint256 indexed teleporterMessageID, uint256 amount) +func (_ERC20TokenSource *ERC20TokenSourceFilterer) FilterTransferToDestination(opts *bind.FilterOpts, sender []common.Address, recipient []common.Address, teleporterMessageID []*big.Int) (*ERC20TokenSourceTransferToDestinationIterator, error) { var senderRule []interface{} for _, senderItem := range sender { @@ -685,18 +684,22 @@ func (_ERC20TokenSource *ERC20TokenSourceFilterer) FilterTransferToDestination(o for _, recipientItem := range recipient { recipientRule = append(recipientRule, recipientItem) } + var teleporterMessageIDRule []interface{} + for _, teleporterMessageIDItem := range teleporterMessageID { + teleporterMessageIDRule = append(teleporterMessageIDRule, teleporterMessageIDItem) + } - logs, sub, err := _ERC20TokenSource.contract.FilterLogs(opts, "TransferToDestination", senderRule, recipientRule) + logs, sub, err := _ERC20TokenSource.contract.FilterLogs(opts, "TransferToDestination", senderRule, recipientRule, teleporterMessageIDRule) if err != nil { return nil, err } return &ERC20TokenSourceTransferToDestinationIterator{contract: _ERC20TokenSource.contract, event: "TransferToDestination", logs: logs, sub: sub}, nil } -// WatchTransferToDestination is a free log subscription operation binding the contract event 0x51f5c55ca5f8f5fde6736f19d1d035a8c67fe18c30d445cea44c4816c6a525a0. +// WatchTransferToDestination is a free log subscription operation binding the contract event 0x2b4e8f08417773e367064a6aea9ca2df303a60876676f70b6c3c5e66b314ca5a. // -// Solidity: event TransferToDestination(address indexed sender, address indexed recipient, uint256 transferAmount, uint256 feeAmount, uint256 teleporterMessageID) -func (_ERC20TokenSource *ERC20TokenSourceFilterer) WatchTransferToDestination(opts *bind.WatchOpts, sink chan<- *ERC20TokenSourceTransferToDestination, sender []common.Address, recipient []common.Address) (event.Subscription, error) { +// Solidity: event TransferToDestination(address indexed sender, address indexed recipient, uint256 indexed teleporterMessageID, uint256 amount) +func (_ERC20TokenSource *ERC20TokenSourceFilterer) WatchTransferToDestination(opts *bind.WatchOpts, sink chan<- *ERC20TokenSourceTransferToDestination, sender []common.Address, recipient []common.Address, teleporterMessageID []*big.Int) (event.Subscription, error) { var senderRule []interface{} for _, senderItem := range sender { @@ -706,8 +709,12 @@ func (_ERC20TokenSource *ERC20TokenSourceFilterer) WatchTransferToDestination(op for _, recipientItem := range recipient { recipientRule = append(recipientRule, recipientItem) } + var teleporterMessageIDRule []interface{} + for _, teleporterMessageIDItem := range teleporterMessageID { + teleporterMessageIDRule = append(teleporterMessageIDRule, teleporterMessageIDItem) + } - logs, sub, err := _ERC20TokenSource.contract.WatchLogs(opts, "TransferToDestination", senderRule, recipientRule) + logs, sub, err := _ERC20TokenSource.contract.WatchLogs(opts, "TransferToDestination", senderRule, recipientRule, teleporterMessageIDRule) if err != nil { return nil, err } @@ -739,9 +746,9 @@ func (_ERC20TokenSource *ERC20TokenSourceFilterer) WatchTransferToDestination(op }), nil } -// ParseTransferToDestination is a log parse operation binding the contract event 0x51f5c55ca5f8f5fde6736f19d1d035a8c67fe18c30d445cea44c4816c6a525a0. +// ParseTransferToDestination is a log parse operation binding the contract event 0x2b4e8f08417773e367064a6aea9ca2df303a60876676f70b6c3c5e66b314ca5a. // -// Solidity: event TransferToDestination(address indexed sender, address indexed recipient, uint256 transferAmount, uint256 feeAmount, uint256 teleporterMessageID) +// Solidity: event TransferToDestination(address indexed sender, address indexed recipient, uint256 indexed teleporterMessageID, uint256 amount) func (_ERC20TokenSource *ERC20TokenSourceFilterer) ParseTransferToDestination(log types.Log) (*ERC20TokenSourceTransferToDestination, error) { event := new(ERC20TokenSourceTransferToDestination) if err := _ERC20TokenSource.contract.UnpackLog(event, "TransferToDestination", log); err != nil { diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go index c19b645c6..140438987 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go @@ -38,7 +38,7 @@ type TeleporterFeeInfo struct { // NativeTokenDestinationMetaData contains all meta data concerning the NativeTokenDestination contract. var NativeTokenDestinationMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialReserveImbalance_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"burnAddressBalance\",\"type\":\"uint256\"}],\"name\":\"ReportTotalBurnedTxFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"BURN_FOR_TRANSFER_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REPORT_BURNED_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"reportTotalBurnedTxFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalMinted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", - Bin: "0x61012060405273020000000000000000000000000000000000000160805260006002553480156200002f57600080fd5b5060405162001bca38038062001bca833981016040819052620000529162000355565b60016000556001600160a01b038416620000d95760405162461bcd60e51b815260206004820152603860248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2054656c60448201527f65706f727465724d657373656e6765722061646472657373000000000000000060648201526084015b60405180910390fd5b6001600160a01b03841661010052826200013f5760405162461bcd60e51b8152602060048201526031602482015260008051602062001baa8339815191526044820152701c98d948189b1bd8dad8da185a5b881251607a1b6064820152608401620000d0565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000192573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001b891906200039e565b83036200022e5760405162461bcd60e51b815260206004820152603a60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a2063616e6e6f74206260448201527f726964676520776974682073616d6520626c6f636b636861696e0000000000006064820152608401620000d0565b60a08390526001600160a01b038216620002a05760405162461bcd60e51b8152602060048201526034602482015260008051602062001baa83398151915260448201527f72636520636f6e747261637420616464726573730000000000000000000000006064820152608401620000d0565b6001600160a01b03821660c0526000819003620003265760405162461bcd60e51b815260206004820152603660248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20696e6960448201527f7469616c207265736572766520696d62616c616e6365000000000000000000006064820152608401620000d0565b60e081905260015550620003b8915050565b80516001600160a01b03811681146200035057600080fd5b919050565b600080600080608085870312156200036c57600080fd5b620003778562000338565b9350602085015192506200038e6040860162000338565b6060959095015193969295505050565b600060208284031215620003b157600080fd5b5051919050565b60805160a05160c05160e0516101005161175962000451600039600081816102440152818161040c015281816106a50152818161070201526109120152600081816102100152818161030401526103b90152600081816101b10152818161046c015281816107620152610a3501526000818161013c015281816104460152818161073c01526109b101526000610c6d01526117596000f3fe6080604052600436106100e75760003560e01c80638ac7dd201161008a578063ab28523011610059578063ab28523014610297578063c452165e146102ae578063c868efaa146102c6578063d30951261461029757600080fd5b80638ac7dd20146101fe5780639b3e580314610232578063a2309ff814610266578063a2a950171461027c57600080fd5b80633a94fe51116100c65780633a94fe511461015e57806349e3284e146101805780635d93f9af1461019f57806375846562146101eb57600080fd5b8062d872ae146100ec57806318160ddd1461011557806329b7b3fd1461012a575b600080fd5b3480156100f857600080fd5b5061010260015481565b6040519081526020015b60405180910390f35b34801561012157600080fd5b506101026102e6565b34801561013657600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561016a57600080fd5b5061017e6101793660046112d7565b6103f5565b005b34801561018c57600080fd5b506001546040519015815260200161010c565b3480156101ab57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010c565b61017e6101f9366004611343565b6105d0565b34801561020a57600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561023e57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b34801561027257600080fd5b5061010260025481565b34801561028857600080fd5b506101d36001600160981b0181565b3480156102a357600080fd5b50610102620186a081565b3480156102ba57600080fd5b506101d3600160981b81565b3480156102d257600080fd5b5061017e6102e13660046113a7565b6108ff565b6000806103006001600160981b0131600160981b31611446565b90507f00000000000000000000000000000000000000000000000000000000000000006002546103309190611446565b8111156103b65760405162461bcd60e51b815260206004820152604360248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20464154414c202d2060448201527f636f6e74726163742068617320746f6b656e7320756e6163636f756e746564206064820152623337b960e91b608482015260a4015b60405180910390fd5b807f00000000000000000000000000000000000000000000000000000000000000006002546103e59190611446565b6103ef9190611459565b91505090565b6000600160981b6001600160a01b031631905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906104aa919061146c565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505050908252506040805160208082018990528251808303820181528284019093529092019161051c91600191606001611522565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161054a919061159d565b6020604051808303816000875af1158015610569573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058d919061161b565b9050807f2550fa6041684d40e635e29e93dde9017d70c25b46aa88393317b5182ed6ae7c836040516105c191815260200190565b60405180910390a25050505050565b6105d8610d2c565b6001600160a01b0384166105fe5760405162461bcd60e51b81526004016103ad90611634565b6001541561066b5760405162461bcd60e51b815260206004820152603460248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20636f6e7472616374604482015273081d5b99195c98dbdb1b185d195c985b1a5e995960621b60648201526084016103ad565b60006020840135156106ca576106916106876020860186611682565b8560200135610d85565b90506106ca6106a36020860186611682565b7f000000000000000000000000000000000000000000000000000000000000000083610eef565b6040516001600160981b01903480156108fc02916000818181858888f193505050501580156106fd573d6000803e3d6000fd5b5060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906107a0919061146c565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250938552505060405160209384019361080e92508d913491016001600160a01b03929092168252602082015260400190565b60408051601f198184030181529082905261082c9291602001611522565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161085a919061159d565b6020604051808303816000875af1158015610879573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061089d919061161b565b905080866001600160a01b0316336001600160a01b03167f0322cbb1d3c23f6dbf1deddb3b4ef3ce0f93ae6eec7b44e4f395804104466d14346040516108e591815260200190565b60405180910390a450506108f96001600055565b50505050565b610907610d2c565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146109af5760405162461bcd60e51b815260206004820152604160248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201527f697a65642054656c65706f727465724d657373656e67657220636f6e747261636064820152601d60fa1b608482015260a4016103ad565b7f00000000000000000000000000000000000000000000000000000000000000008414610a335760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20696e76616c69642060448201526b39b7bab931b29031b430b4b760a11b60648201526084016103ad565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031614610ac85760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201526a34bd32b21039b2b73232b960a91b60648201526084016103ad565b600080610ad7838501856116a6565b90925090506001600160a01b038216610b025760405162461bcd60e51b81526004016103ad90611634565b80600003610b665760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2074726160448201526a6e736665722076616c756560a81b60648201526084016103ad565b600154819015610c4757600154821115610bdd5760015460408051918252600060208301526001600160a01b03851682820152517f66c12a5fefbc1f35dd64a1d9b069fc5bda187e6f68812c58a330b77b2a695ba99181900360600190a1600154610bd19083611459565b60006001559050610c47565b8160016000828254610bef9190611459565b90915550506001546040805184815260208101929092526001600160a01b03851682820152517f66c12a5fefbc1f35dd64a1d9b069fc5bda187e6f68812c58a330b77b2a695ba99181900360600190a1505050610d22565b6040516327ad555d60e11b81526001600160a01b038481166004830152602482018390527f00000000000000000000000000000000000000000000000000000000000000001690634f5aaaba90604401600060405180830381600087803b158015610cb157600080fd5b505af1158015610cc5573d6000803e3d6000fd5b505050508060026000828254610cdb9190611446565b90915550506040518181526001600160a01b038416907fd949ea0e9d5db53492d77f28fd5467fb2f6c4f5b88e3350e3c36729b76e99cf29060200160405180910390a25050505b6108f96001600055565b600260005403610d7e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016103ad565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015610dce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df2919061161b565b9050610e096001600160a01b038516333086610fd4565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610e50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e74919061161b565b9050818111610eda5760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016103ad565b610ee48282611459565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610f40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f64919061161b565b610f6e9190611446565b6040516001600160a01b0385166024820152604481018290529091506108f990859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261100c565b6040516001600160a01b03808516602483015283166044820152606481018290526108f99085906323b872dd60e01b90608401610f9d565b6000611061826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166110e39092919063ffffffff16565b8051909150156110de578080602001905181019061107f91906116d2565b6110de5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103ad565b505050565b60606110f284846000856110fa565b949350505050565b60608247101561115b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016103ad565b600080866001600160a01b0316858760405161117791906116f4565b60006040518083038185875af1925050503d80600081146111b4576040519150601f19603f3d011682016040523d82523d6000602084013e6111b9565b606091505b50915091506111ca878383876111d5565b979650505050505050565b6060831561124457825160000361123d576001600160a01b0385163b61123d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103ad565b50816110f2565b6110f283838151156112595781518083602001fd5b8060405162461bcd60e51b81526004016103ad9190611710565b60006040828403121561128557600080fd5b50919050565b60008083601f84011261129d57600080fd5b50813567ffffffffffffffff8111156112b557600080fd5b6020830191508360208260051b85010111156112d057600080fd5b9250929050565b6000806000606084860312156112ec57600080fd5b6112f68585611273565b9250604084013567ffffffffffffffff81111561131257600080fd5b61131e8682870161128b565b9497909650939450505050565b6001600160a01b038116811461134057600080fd5b50565b6000806000806080858703121561135957600080fd5b84356113648161132b565b93506113738660208701611273565b9250606085013567ffffffffffffffff81111561138f57600080fd5b61139b8782880161128b565b95989497509550505050565b600080600080606085870312156113bd57600080fd5b8435935060208501356113cf8161132b565b9250604085013567ffffffffffffffff808211156113ec57600080fd5b818701915087601f83011261140057600080fd5b81358181111561140f57600080fd5b88602082850101111561142157600080fd5b95989497505060200194505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610ee957610ee9611430565b81810381811115610ee957610ee9611430565b60006040828403121561147e57600080fd5b6040516040810181811067ffffffffffffffff821117156114af57634e487b7160e01b600052604160045260246000fd5b60405282356114bd8161132b565b81526020928301359281019290925250919050565b60005b838110156114ed5781810151838201526020016114d5565b50506000910152565b6000815180845261150e8160208601602086016114d2565b601f01601f19169290920160200192915050565b60006002841061154257634e487b7160e01b600052602160045260246000fd5b838252604060208301526110f260408301846114f6565b600081518084526020808501945080840160005b838110156115925781516001600160a01b03168752958201959082019060010161156d565b509495945050505050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526115fe610100840182611559565b905060a0840151601f198483030160e0850152610ee482826114f6565b60006020828403121561162d57600080fd5b5051919050565b6020808252602e908201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2072656360408201526d697069656e74206164647265737360901b606082015260800190565b60006020828403121561169457600080fd5b813561169f8161132b565b9392505050565b600080604083850312156116b957600080fd5b82356116c48161132b565b946020939093013593505050565b6000602082840312156116e457600080fd5b8151801515811461169f57600080fd5b600082516117068184602087016114d2565b9190910192915050565b60208152600061169f60208301846114f656fea2646970667358221220e654409b56d0fb144cca2efd98206e7c459f86b520030bac24030b613f116a8764736f6c634300081200334e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20736f75", + Bin: "0x61012060405273020000000000000000000000000000000000000160805260006002553480156200002f57600080fd5b5060405162001bca38038062001bca833981016040819052620000529162000355565b60016000556001600160a01b038416620000d95760405162461bcd60e51b815260206004820152603860248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2054656c60448201527f65706f727465724d657373656e6765722061646472657373000000000000000060648201526084015b60405180910390fd5b6001600160a01b03841661010052826200013f5760405162461bcd60e51b8152602060048201526031602482015260008051602062001baa8339815191526044820152701c98d948189b1bd8dad8da185a5b881251607a1b6064820152608401620000d0565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000192573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001b891906200039e565b83036200022e5760405162461bcd60e51b815260206004820152603a60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a2063616e6e6f74206260448201527f726964676520776974682073616d6520626c6f636b636861696e0000000000006064820152608401620000d0565b60a08390526001600160a01b038216620002a05760405162461bcd60e51b8152602060048201526034602482015260008051602062001baa83398151915260448201527f72636520636f6e747261637420616464726573730000000000000000000000006064820152608401620000d0565b6001600160a01b03821660c0526000819003620003265760405162461bcd60e51b815260206004820152603660248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20696e6960448201527f7469616c207265736572766520696d62616c616e6365000000000000000000006064820152608401620000d0565b60e081905260015550620003b8915050565b80516001600160a01b03811681146200035057600080fd5b919050565b600080600080608085870312156200036c57600080fd5b620003778562000338565b9350602085015192506200038e6040860162000338565b6060959095015193969295505050565b600060208284031215620003b157600080fd5b5051919050565b60805160a05160c05160e0516101005161175962000451600039600081816102440152818161040c015281816106a50152818161070201526109120152600081816102100152818161030401526103b90152600081816101b10152818161046c015281816107620152610a3501526000818161013c015281816104460152818161073c01526109b101526000610c6d01526117596000f3fe6080604052600436106100e75760003560e01c80638ac7dd201161008a578063ab28523011610059578063ab28523014610297578063c452165e146102ae578063c868efaa146102c6578063d30951261461029757600080fd5b80638ac7dd20146101fe5780639b3e580314610232578063a2309ff814610266578063a2a950171461027c57600080fd5b80633a94fe51116100c65780633a94fe511461015e57806349e3284e146101805780635d93f9af1461019f57806375846562146101eb57600080fd5b8062d872ae146100ec57806318160ddd1461011557806329b7b3fd1461012a575b600080fd5b3480156100f857600080fd5b5061010260015481565b6040519081526020015b60405180910390f35b34801561012157600080fd5b506101026102e6565b34801561013657600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561016a57600080fd5b5061017e6101793660046112d7565b6103f5565b005b34801561018c57600080fd5b506001546040519015815260200161010c565b3480156101ab57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010c565b61017e6101f9366004611343565b6105d0565b34801561020a57600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561023e57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b34801561027257600080fd5b5061010260025481565b34801561028857600080fd5b506101d36001600160981b0181565b3480156102a357600080fd5b50610102620186a081565b3480156102ba57600080fd5b506101d3600160981b81565b3480156102d257600080fd5b5061017e6102e13660046113a7565b6108ff565b6000806103006001600160981b0131600160981b31611446565b90507f00000000000000000000000000000000000000000000000000000000000000006002546103309190611446565b8111156103b65760405162461bcd60e51b815260206004820152604360248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20464154414c202d2060448201527f636f6e74726163742068617320746f6b656e7320756e6163636f756e746564206064820152623337b960e91b608482015260a4015b60405180910390fd5b807f00000000000000000000000000000000000000000000000000000000000000006002546103e59190611446565b6103ef9190611459565b91505090565b6000600160981b6001600160a01b031631905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906104aa919061146c565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505050908252506040805160208082018990528251808303820181528284019093529092019161051c91600191606001611522565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161054a919061159d565b6020604051808303816000875af1158015610569573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058d919061161b565b9050807f2550fa6041684d40e635e29e93dde9017d70c25b46aa88393317b5182ed6ae7c836040516105c191815260200190565b60405180910390a25050505050565b6105d8610d2c565b6001600160a01b0384166105fe5760405162461bcd60e51b81526004016103ad90611634565b6001541561066b5760405162461bcd60e51b815260206004820152603460248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20636f6e7472616374604482015273081d5b99195c98dbdb1b185d195c985b1a5e995960621b60648201526084016103ad565b60006020840135156106ca576106916106876020860186611682565b8560200135610d85565b90506106ca6106a36020860186611682565b7f000000000000000000000000000000000000000000000000000000000000000083610eef565b6040516001600160981b01903480156108fc02916000818181858888f193505050501580156106fd573d6000803e3d6000fd5b5060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906107a0919061146c565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250938552505060405160209384019361080e92508d913491016001600160a01b03929092168252602082015260400190565b60408051601f198184030181529082905261082c9291602001611522565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161085a919061159d565b6020604051808303816000875af1158015610879573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061089d919061161b565b905080866001600160a01b0316336001600160a01b03167f0322cbb1d3c23f6dbf1deddb3b4ef3ce0f93ae6eec7b44e4f395804104466d14346040516108e591815260200190565b60405180910390a450506108f96001600055565b50505050565b610907610d2c565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146109af5760405162461bcd60e51b815260206004820152604160248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201527f697a65642054656c65706f727465724d657373656e67657220636f6e747261636064820152601d60fa1b608482015260a4016103ad565b7f00000000000000000000000000000000000000000000000000000000000000008414610a335760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20696e76616c69642060448201526b39b7bab931b29031b430b4b760a11b60648201526084016103ad565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031614610ac85760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201526a34bd32b21039b2b73232b960a91b60648201526084016103ad565b600080610ad7838501856116a6565b90925090506001600160a01b038216610b025760405162461bcd60e51b81526004016103ad90611634565b80600003610b665760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2074726160448201526a6e736665722076616c756560a81b60648201526084016103ad565b600154819015610c4757600154821115610bdd5760015460408051918252600060208301526001600160a01b03851682820152517f66c12a5fefbc1f35dd64a1d9b069fc5bda187e6f68812c58a330b77b2a695ba99181900360600190a1600154610bd19083611459565b60006001559050610c47565b8160016000828254610bef9190611459565b90915550506001546040805184815260208101929092526001600160a01b03851682820152517f66c12a5fefbc1f35dd64a1d9b069fc5bda187e6f68812c58a330b77b2a695ba99181900360600190a1505050610d22565b6040516327ad555d60e11b81526001600160a01b038481166004830152602482018390527f00000000000000000000000000000000000000000000000000000000000000001690634f5aaaba90604401600060405180830381600087803b158015610cb157600080fd5b505af1158015610cc5573d6000803e3d6000fd5b505050508060026000828254610cdb9190611446565b90915550506040518181526001600160a01b038416907fd949ea0e9d5db53492d77f28fd5467fb2f6c4f5b88e3350e3c36729b76e99cf29060200160405180910390a25050505b6108f96001600055565b600260005403610d7e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016103ad565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015610dce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df2919061161b565b9050610e096001600160a01b038516333086610fd4565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610e50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e74919061161b565b9050818111610eda5760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016103ad565b610ee48282611459565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610f40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f64919061161b565b610f6e9190611446565b6040516001600160a01b0385166024820152604481018290529091506108f990859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261100c565b6040516001600160a01b03808516602483015283166044820152606481018290526108f99085906323b872dd60e01b90608401610f9d565b6000611061826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166110e39092919063ffffffff16565b8051909150156110de578080602001905181019061107f91906116d2565b6110de5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103ad565b505050565b60606110f284846000856110fa565b949350505050565b60608247101561115b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016103ad565b600080866001600160a01b0316858760405161117791906116f4565b60006040518083038185875af1925050503d80600081146111b4576040519150601f19603f3d011682016040523d82523d6000602084013e6111b9565b606091505b50915091506111ca878383876111d5565b979650505050505050565b6060831561124457825160000361123d576001600160a01b0385163b61123d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103ad565b50816110f2565b6110f283838151156112595781518083602001fd5b8060405162461bcd60e51b81526004016103ad9190611710565b60006040828403121561128557600080fd5b50919050565b60008083601f84011261129d57600080fd5b50813567ffffffffffffffff8111156112b557600080fd5b6020830191508360208260051b85010111156112d057600080fd5b9250929050565b6000806000606084860312156112ec57600080fd5b6112f68585611273565b9250604084013567ffffffffffffffff81111561131257600080fd5b61131e8682870161128b565b9497909650939450505050565b6001600160a01b038116811461134057600080fd5b50565b6000806000806080858703121561135957600080fd5b84356113648161132b565b93506113738660208701611273565b9250606085013567ffffffffffffffff81111561138f57600080fd5b61139b8782880161128b565b95989497509550505050565b600080600080606085870312156113bd57600080fd5b8435935060208501356113cf8161132b565b9250604085013567ffffffffffffffff808211156113ec57600080fd5b818701915087601f83011261140057600080fd5b81358181111561140f57600080fd5b88602082850101111561142157600080fd5b95989497505060200194505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610ee957610ee9611430565b81810381811115610ee957610ee9611430565b60006040828403121561147e57600080fd5b6040516040810181811067ffffffffffffffff821117156114af57634e487b7160e01b600052604160045260246000fd5b60405282356114bd8161132b565b81526020928301359281019290925250919050565b60005b838110156114ed5781810151838201526020016114d5565b50506000910152565b6000815180845261150e8160208601602086016114d2565b601f01601f19169290920160200192915050565b60006002841061154257634e487b7160e01b600052602160045260246000fd5b838252604060208301526110f260408301846114f6565b600081518084526020808501945080840160005b838110156115925781516001600160a01b03168752958201959082019060010161156d565b509495945050505050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526115fe610100840182611559565b905060a0840151601f198483030160e0850152610ee482826114f6565b60006020828403121561162d57600080fd5b5051919050565b6020808252602e908201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2072656360408201526d697069656e74206164647265737360901b606082015260800190565b60006020828403121561169457600080fd5b813561169f8161132b565b9392505050565b600080604083850312156116b957600080fd5b82356116c48161132b565b946020939093013593505050565b6000602082840312156116e457600080fd5b8151801515811461169f57600080fd5b600082516117068184602087016114d2565b9190910192915050565b60208152600061169f60208301846114f656fea264697066735822122006d380a20d4384f925a266331fccd80279fd131b12a129c4c2d19a1b63a003f564736f6c634300081200334e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20736f75", } // NativeTokenDestinationABI is the input ABI used to generate the binding from. diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go index fe72ba845..4d2ab455f 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go @@ -38,7 +38,7 @@ type TeleporterFeeInfo struct { // NativeTokenSourceMetaData contains all meta data concerning the NativeTokenSource contract. var NativeTokenSourceMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBurnedTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", - Bin: "0x60e06040523480156200001157600080fd5b5060405162001612380380620016128339810160408190526200003491620002b3565b60016000556001600160a01b038316620000bb5760405162461bcd60e51b815260206004820152603360248201527f4e6174697665546f6b656e536f757263653a207a65726f2054656c65706f727460448201527f65724d657373656e67657220616464726573730000000000000000000000000060648201526084015b60405180910390fd5b6001600160a01b03831660c05281620001205760405162461bcd60e51b81526020600482015260316024820152600080516020620015f28339815191526044820152701a5bdb88189b1bd8dad8da185a5b881251607a1b6064820152608401620000b2565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000173573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001999190620002f4565b82036200020f5760405162461bcd60e51b815260206004820152603560248201527f4e6174697665546f6b656e536f757263653a2063616e6e6f742062726964676560448201527f20776974682073616d6520626c6f636b636861696e00000000000000000000006064820152608401620000b2565b60808290526001600160a01b038116620002815760405162461bcd60e51b81526020600482015260346024820152600080516020620015f283398151915260448201527f696f6e20636f6e747261637420616464726573730000000000000000000000006064820152608401620000b2565b6001600160a01b031660a052506200030e9050565b80516001600160a01b0381168114620002ae57600080fd5b919050565b600080600060608486031215620002c957600080fd5b620002d48462000296565b925060208401519150620002eb6040850162000296565b90509250925092565b6000602082840312156200030757600080fd5b5051919050565b60805160a05160c0516112856200036d6000396000818160ef015281816102320152818161025b015261044e015260008181610167015281816102bb015261056701526000818160920152818161029501526104e301526112856000f3fe60806040526004361061007b5760003560e01c8063b6171f731161004e578063b6171f731461013e578063b8c9091a14610155578063c452165e14610189578063c868efaa146101a157600080fd5b806341d3014d1461008057806355db3e9e146100c75780639b3e5803146100dd578063ad0aee2514610129575b600080fd5b34801561008c57600080fd5b506100b47f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b3480156100d357600080fd5b506100b460015481565b3480156100e957600080fd5b506101117f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100be565b61013c610137366004610d82565b6101c1565b005b34801561014a57600080fd5b506100b4620186a081565b34801561016157600080fd5b506101117f000000000000000000000000000000000000000000000000000000000000000081565b34801561019557600080fd5b50610111600160981b81565b3480156101ad57600080fd5b5061013c6101bc366004610e21565b61043b565b6101c96106ec565b6001600160a01b0384166101f85760405162461bcd60e51b81526004016101ef90610e9b565b60405180910390fd5b60006020840135156102575761021e6102146020860186610ee4565b8560200135610745565b90506102576102306020860186610ee4565b7f0000000000000000000000000000000000000000000000000000000000000000836108af565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906102f99190610f4f565b8152602001620186a08152602001878780806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250604051602091820191610368918c913491016001600160a01b03929092168252602082015260400190565b6040516020818303038152906040528152506040518263ffffffff1660e01b8152600401610396919061103b565b6020604051808303816000875af11580156103b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d991906110b9565b905080866001600160a01b0316336001600160a01b03167f2b4e8f08417773e367064a6aea9ca2df303a60876676f70b6c3c5e66b314ca5a3460405161042191815260200190565b60405180910390a450506104356001600055565b50505050565b6104436106ec565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146104e15760405162461bcd60e51b815260206004820152603c60248201527f4e6174697665546f6b656e536f757263653a20756e617574686f72697a65642060448201527f54656c65706f727465724d657373656e67657220636f6e74726163740000000060648201526084016101ef565b7f000000000000000000000000000000000000000000000000000000000000000084146105655760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e536f757263653a20696e76616c696420646573746960448201526b3730ba34b7b71031b430b4b760a11b60648201526084016101ef565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316146105f55760405162461bcd60e51b815260206004820152602660248201527f4e6174697665546f6b656e536f757263653a20756e617574686f72697a65642060448201526539b2b73232b960d11b60648201526084016101ef565b600080610604838501856110d2565b9092509050600082600181111561061d5761061d61117e565b0361064e57600080828060200190518101906106399190611194565b915091506106478282610994565b50506106e0565b60018260018111156106625761066261117e565b0361068e5760008180602001905181019061067d91906110b9565b905061068881610a37565b506106e0565b60405162461bcd60e51b815260206004820152602160248201527f4e6174697665546f6b656e536f757263653a20696e76616c696420616374696f6044820152603760f91b60648201526084016101ef565b50506104356001600055565b60026000540361073e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101ef565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa15801561078e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b291906110b9565b90506107c96001600160a01b038516333086610a66565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610810573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061083491906110b9565b905081811161089a5760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016101ef565b6108a482826111d8565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610900573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092491906110b9565b61092e91906111eb565b6040516001600160a01b03851660248201526044810182905290915061043590859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610a9e565b6001600160a01b0382166109ba5760405162461bcd60e51b81526004016101ef90610e9b565b6040516001600160a01b0383169082156108fc029083906000818181858888f193505050501580156109f0573d6000803e3d6000fd5b50604080516001600160a01b0384168152602081018390527f55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407910160405180910390a15050565b600154811115610a6357600060015482610a5191906111d8565b9050610a5c81610b75565b5060018190555b50565b6040516001600160a01b03808516602483015283166044820152606481018290526104359085906323b872dd60e01b9060840161095d565b6000610af3826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610bdd9092919063ffffffff16565b805190915015610b705780806020019051810190610b1191906111fe565b610b705760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016101ef565b505050565b604051600160981b9082156108fc029083906000818181858888f19350505050158015610ba6573d6000803e3d6000fd5b506040518181527f2cd3fd70cd5a5d6d805e90d22741aa1a84590ace7cf01b244719558d266143829060200160405180910390a150565b6060610bec8484600085610bf4565b949350505050565b606082471015610c555760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016101ef565b600080866001600160a01b03168587604051610c719190611220565b60006040518083038185875af1925050503d8060008114610cae576040519150601f19603f3d011682016040523d82523d6000602084013e610cb3565b606091505b5091509150610cc487838387610ccf565b979650505050505050565b60608315610d3e578251600003610d37576001600160a01b0385163b610d375760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101ef565b5081610bec565b610bec8383815115610d535781518083602001fd5b8060405162461bcd60e51b81526004016101ef919061123c565b6001600160a01b0381168114610a6357600080fd5b6000806000808486036080811215610d9957600080fd5b8535610da481610d6d565b94506040601f1982011215610db857600080fd5b50602085019250606085013567ffffffffffffffff80821115610dda57600080fd5b818701915087601f830112610dee57600080fd5b813581811115610dfd57600080fd5b8860208260051b8501011115610e1257600080fd5b95989497505060200194505050565b60008060008060608587031215610e3757600080fd5b843593506020850135610e4981610d6d565b9250604085013567ffffffffffffffff80821115610e6657600080fd5b818701915087601f830112610e7a57600080fd5b813581811115610e8957600080fd5b886020828501011115610e1257600080fd5b60208082526029908201527f4e6174697665546f6b656e536f757263653a207a65726f20726563697069656e60408201526874206164647265737360b81b606082015260800190565b600060208284031215610ef657600080fd5b8135610f0181610d6d565b9392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610f4757610f47610f08565b604052919050565b600060408284031215610f6157600080fd5b6040516040810181811067ffffffffffffffff82111715610f8457610f84610f08565b6040528235610f9281610d6d565b81526020928301359281019290925250919050565b600081518084526020808501945080840160005b83811015610fe05781516001600160a01b031687529582019590820190600101610fbb565b509495945050505050565b60005b83811015611006578181015183820152602001610fee565b50506000910152565b60008151808452611027816020860160208601610feb565b601f01601f19169290920160200192915050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c084015261109c610100840182610fa7565b905060a0840151601f198483030160e08501526108a4828261100f565b6000602082840312156110cb57600080fd5b5051919050565b600080604083850312156110e557600080fd5b8235600281106110f457600080fd5b915060208381013567ffffffffffffffff8082111561111257600080fd5b818601915086601f83011261112657600080fd5b81358181111561113857611138610f08565b61114a601f8201601f19168501610f1e565b9150808252878482850101111561116057600080fd5b80848401858401376000848284010152508093505050509250929050565b634e487b7160e01b600052602160045260246000fd5b600080604083850312156111a757600080fd5b82516111b281610d6d565b6020939093015192949293505050565b634e487b7160e01b600052601160045260246000fd5b818103818111156108a9576108a96111c2565b808201808211156108a9576108a96111c2565b60006020828403121561121057600080fd5b81518015158114610f0157600080fd5b60008251611232818460208701610feb565b9190910192915050565b602081526000610f01602083018461100f56fea2646970667358221220866227f7b920a305fc572c88de560b59d138acceaf90ba9ef1e8e4ea549a7d5764736f6c634300081200334e6174697665546f6b656e536f757263653a207a65726f2064657374696e6174", + Bin: "0x60e06040523480156200001157600080fd5b5060405162001612380380620016128339810160408190526200003491620002b3565b60016000556001600160a01b038316620000bb5760405162461bcd60e51b815260206004820152603360248201527f4e6174697665546f6b656e536f757263653a207a65726f2054656c65706f727460448201527f65724d657373656e67657220616464726573730000000000000000000000000060648201526084015b60405180910390fd5b6001600160a01b03831660c05281620001205760405162461bcd60e51b81526020600482015260316024820152600080516020620015f28339815191526044820152701a5bdb88189b1bd8dad8da185a5b881251607a1b6064820152608401620000b2565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000173573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001999190620002f4565b82036200020f5760405162461bcd60e51b815260206004820152603560248201527f4e6174697665546f6b656e536f757263653a2063616e6e6f742062726964676560448201527f20776974682073616d6520626c6f636b636861696e00000000000000000000006064820152608401620000b2565b60808290526001600160a01b038116620002815760405162461bcd60e51b81526020600482015260346024820152600080516020620015f283398151915260448201527f696f6e20636f6e747261637420616464726573730000000000000000000000006064820152608401620000b2565b6001600160a01b031660a052506200030e9050565b80516001600160a01b0381168114620002ae57600080fd5b919050565b600080600060608486031215620002c957600080fd5b620002d48462000296565b925060208401519150620002eb6040850162000296565b90509250925092565b6000602082840312156200030757600080fd5b5051919050565b60805160a05160c0516112856200036d6000396000818160ef015281816102320152818161025b015261044e015260008181610167015281816102bb015261056701526000818160920152818161029501526104e301526112856000f3fe60806040526004361061007b5760003560e01c8063b6171f731161004e578063b6171f731461013e578063b8c9091a14610155578063c452165e14610189578063c868efaa146101a157600080fd5b806341d3014d1461008057806355db3e9e146100c75780639b3e5803146100dd578063ad0aee2514610129575b600080fd5b34801561008c57600080fd5b506100b47f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b3480156100d357600080fd5b506100b460015481565b3480156100e957600080fd5b506101117f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100be565b61013c610137366004610d82565b6101c1565b005b34801561014a57600080fd5b506100b4620186a081565b34801561016157600080fd5b506101117f000000000000000000000000000000000000000000000000000000000000000081565b34801561019557600080fd5b50610111600160981b81565b3480156101ad57600080fd5b5061013c6101bc366004610e21565b61043b565b6101c96106ec565b6001600160a01b0384166101f85760405162461bcd60e51b81526004016101ef90610e9b565b60405180910390fd5b60006020840135156102575761021e6102146020860186610ee4565b8560200135610745565b90506102576102306020860186610ee4565b7f0000000000000000000000000000000000000000000000000000000000000000836108af565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906102f99190610f4f565b8152602001620186a08152602001878780806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250604051602091820191610368918c913491016001600160a01b03929092168252602082015260400190565b6040516020818303038152906040528152506040518263ffffffff1660e01b8152600401610396919061103b565b6020604051808303816000875af11580156103b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d991906110b9565b905080866001600160a01b0316336001600160a01b03167f2b4e8f08417773e367064a6aea9ca2df303a60876676f70b6c3c5e66b314ca5a3460405161042191815260200190565b60405180910390a450506104356001600055565b50505050565b6104436106ec565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146104e15760405162461bcd60e51b815260206004820152603c60248201527f4e6174697665546f6b656e536f757263653a20756e617574686f72697a65642060448201527f54656c65706f727465724d657373656e67657220636f6e74726163740000000060648201526084016101ef565b7f000000000000000000000000000000000000000000000000000000000000000084146105655760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e536f757263653a20696e76616c696420646573746960448201526b3730ba34b7b71031b430b4b760a11b60648201526084016101ef565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316146105f55760405162461bcd60e51b815260206004820152602660248201527f4e6174697665546f6b656e536f757263653a20756e617574686f72697a65642060448201526539b2b73232b960d11b60648201526084016101ef565b600080610604838501856110d2565b9092509050600082600181111561061d5761061d61117e565b0361064e57600080828060200190518101906106399190611194565b915091506106478282610994565b50506106e0565b60018260018111156106625761066261117e565b0361068e5760008180602001905181019061067d91906110b9565b905061068881610a37565b506106e0565b60405162461bcd60e51b815260206004820152602160248201527f4e6174697665546f6b656e536f757263653a20696e76616c696420616374696f6044820152603760f91b60648201526084016101ef565b50506104356001600055565b60026000540361073e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101ef565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa15801561078e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b291906110b9565b90506107c96001600160a01b038516333086610a66565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610810573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061083491906110b9565b905081811161089a5760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016101ef565b6108a482826111d8565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610900573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092491906110b9565b61092e91906111eb565b6040516001600160a01b03851660248201526044810182905290915061043590859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610a9e565b6001600160a01b0382166109ba5760405162461bcd60e51b81526004016101ef90610e9b565b6040516001600160a01b0383169082156108fc029083906000818181858888f193505050501580156109f0573d6000803e3d6000fd5b50604080516001600160a01b0384168152602081018390527f55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407910160405180910390a15050565b600154811115610a6357600060015482610a5191906111d8565b9050610a5c81610b75565b5060018190555b50565b6040516001600160a01b03808516602483015283166044820152606481018290526104359085906323b872dd60e01b9060840161095d565b6000610af3826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610bdd9092919063ffffffff16565b805190915015610b705780806020019051810190610b1191906111fe565b610b705760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016101ef565b505050565b604051600160981b9082156108fc029083906000818181858888f19350505050158015610ba6573d6000803e3d6000fd5b506040518181527f2cd3fd70cd5a5d6d805e90d22741aa1a84590ace7cf01b244719558d266143829060200160405180910390a150565b6060610bec8484600085610bf4565b949350505050565b606082471015610c555760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016101ef565b600080866001600160a01b03168587604051610c719190611220565b60006040518083038185875af1925050503d8060008114610cae576040519150601f19603f3d011682016040523d82523d6000602084013e610cb3565b606091505b5091509150610cc487838387610ccf565b979650505050505050565b60608315610d3e578251600003610d37576001600160a01b0385163b610d375760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101ef565b5081610bec565b610bec8383815115610d535781518083602001fd5b8060405162461bcd60e51b81526004016101ef919061123c565b6001600160a01b0381168114610a6357600080fd5b6000806000808486036080811215610d9957600080fd5b8535610da481610d6d565b94506040601f1982011215610db857600080fd5b50602085019250606085013567ffffffffffffffff80821115610dda57600080fd5b818701915087601f830112610dee57600080fd5b813581811115610dfd57600080fd5b8860208260051b8501011115610e1257600080fd5b95989497505060200194505050565b60008060008060608587031215610e3757600080fd5b843593506020850135610e4981610d6d565b9250604085013567ffffffffffffffff80821115610e6657600080fd5b818701915087601f830112610e7a57600080fd5b813581811115610e8957600080fd5b886020828501011115610e1257600080fd5b60208082526029908201527f4e6174697665546f6b656e536f757263653a207a65726f20726563697069656e60408201526874206164647265737360b81b606082015260800190565b600060208284031215610ef657600080fd5b8135610f0181610d6d565b9392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610f4757610f47610f08565b604052919050565b600060408284031215610f6157600080fd5b6040516040810181811067ffffffffffffffff82111715610f8457610f84610f08565b6040528235610f9281610d6d565b81526020928301359281019290925250919050565b600081518084526020808501945080840160005b83811015610fe05781516001600160a01b031687529582019590820190600101610fbb565b509495945050505050565b60005b83811015611006578181015183820152602001610fee565b50506000910152565b60008151808452611027816020860160208601610feb565b601f01601f19169290920160200192915050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c084015261109c610100840182610fa7565b905060a0840151601f198483030160e08501526108a4828261100f565b6000602082840312156110cb57600080fd5b5051919050565b600080604083850312156110e557600080fd5b8235600281106110f457600080fd5b915060208381013567ffffffffffffffff8082111561111257600080fd5b818601915086601f83011261112657600080fd5b81358181111561113857611138610f08565b61114a601f8201601f19168501610f1e565b9150808252878482850101111561116057600080fd5b80848401858401376000848284010152508093505050509250929050565b634e487b7160e01b600052602160045260246000fd5b600080604083850312156111a757600080fd5b82516111b281610d6d565b6020939093015192949293505050565b634e487b7160e01b600052601160045260246000fd5b818103818111156108a9576108a96111c2565b808201808211156108a9576108a96111c2565b60006020828403121561121057600080fd5b81518015158114610f0157600080fd5b60008251611232818460208701610feb565b9190910192915050565b602081526000610f01602083018461100f56fea2646970667358221220ecdd6f6bea4e2ec3a0249408f7475a37da7d73bdf5eb50a39965597e7db3106164736f6c634300081200334e6174697665546f6b656e536f757263653a207a65726f2064657374696e6174", } // NativeTokenSourceABI is the input ABI used to generate the binding from. diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol index 2c76c2aff..2c7632223 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol @@ -51,7 +51,7 @@ contract ERC20TokenSource is require( destinationBlockchainID_ != bytes32(0), - "ERC20TokenSource: zero destination chain ID" + "ERC20TokenSource: zero destination blockchain ID" ); require( destinationBlockchainID_ != @@ -69,7 +69,7 @@ contract ERC20TokenSource is require( erc20ContractAddress_ != address(0), - "ERC20TokenSource: invalid ERC20 contract address" + "ERC20TokenSource: zero ERC20 contract address" ); erc20ContractAddress = erc20ContractAddress_; } @@ -180,8 +180,7 @@ contract ERC20TokenSource is emit TransferToDestination({ sender: msg.sender, recipient: recipient, - transferAmount: transferAmount, - feeAmount: feeAmount, + amount: transferAmount, teleporterMessageID: messageID }); } diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol index 74355eecb..1567c4793 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/IERC20TokenSource.sol @@ -10,17 +10,6 @@ pragma solidity 0.8.18; * Teleporter message to a {INativeTokenDestination} contract to mint native tokens on the destination chain. */ interface IERC20TokenSource { - /** - * @dev Emitted when ERC20 tokens are locked in this source contract to be transferred to the destination chain. - */ - event TransferToDestination( - address indexed sender, - address indexed recipient, - uint256 transferAmount, - uint256 feeAmount, - uint256 teleporterMessageID - ); - /** * @dev Locks ERC20 tokens on the source contract chain, and sends a message to mint the * corresponding native tokens on the destination chain. diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol index 2836c8dc2..c425f7ec9 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenSource.sol @@ -12,16 +12,6 @@ import {TeleporterFeeInfo} from "../../Teleporter/ITeleporterMessenger.sol"; * Teleporter message to a {INativeTokenDestination} contract to mint native tokens on the destination chain. */ interface INativeTokenSource { - /** - * @dev Emitted when native tokens are locked in the source contract to be transferred to the destination chain. - */ - event TransferToDestination( - address indexed sender, - address indexed recipient, - uint256 indexed teleporterMessageID, - uint256 amount - ); - /** * @dev Locks native tokens on the source contract chain, and sends a message to the destination * contract to mint corresponding tokens. diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/ITokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/ITokenSource.sol index b572add16..9ba712f12 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/ITokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/ITokenSource.sol @@ -17,6 +17,16 @@ interface ITokenSource { Unlock, Burn } + + /** + * @dev Emitted when native tokens are locked in the source contract to be transferred to the destination chain. + */ + event TransferToDestination( + address indexed sender, + address indexed recipient, + uint256 indexed teleporterMessageID, + uint256 amount + ); /** * @dev Emitted when tokens are unlocked on this chain. diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/tests/ERC20TokenSourceTests.t.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/tests/ERC20TokenSourceTests.t.sol new file mode 100644 index 000000000..3afd106d2 --- /dev/null +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/tests/ERC20TokenSourceTests.t.sol @@ -0,0 +1,362 @@ +// (c) 2023, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +// SPDX-License-Identifier: Ecosystem + +pragma solidity 0.8.18; + +import {Test} from "forge-std/Test.sol"; +import {ERC20TokenSource, IERC20, ITokenSource, TeleporterMessageInput, TeleporterFeeInfo, IWarpMessenger, ITeleporterMessenger} from "../ERC20TokenSource.sol"; +import {UnitTestMockERC20} from "../../../Mocks/UnitTestMockERC20.sol"; + +contract ERC20TokenSourceTest is Test { + address public constant MOCK_TELEPORTER_MESSENGER_ADDRESS = + 0x644E5b7c5D4Bc8073732CEa72c66e0BB90dFC00f; + address public constant WARP_PRECOMPILE_ADDRESS = + address(0x0200000000000000000000000000000000000005); + bytes32 private constant _MOCK_BLOCKCHAIN_ID = bytes32(uint256(123456)); + bytes32 private constant _DEFAULT_OTHER_CHAIN_ID = + bytes32( + hex"abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcd" + ); + address private constant _DEFAULT_OTHER_BRIDGE_ADDRESS = + 0xd54e3E251b9b0EEd3ed70A858e927bbC2659587d; + uint256 private constant _DEFAULT_INITIAL_RESERVE_IMBALANCE = 1000000000; + address private constant _DEFAULT_RECIPIENT = + 0xa4CEE7d1aF6aDdDD33E3b1cC680AB84fdf1b6d1d; + uint256 private constant _DEFAULT_TRANSFER_AMOUNT = 1e18; + uint256 private constant _DEFAULT_FEE_AMOUNT = 123456; + + ERC20TokenSource public erc20TokenSource; + UnitTestMockERC20 public mockERC20; + + event TransferToDestination( + address indexed sender, + address indexed recipient, + uint256 indexed teleporterMessageID, + uint256 amount + ); + event UnlockTokens(address recipient, uint256 amount); + event BurnTokens(uint256 amount); + + function setUp() public virtual { + vm.mockCall( + WARP_PRECOMPILE_ADDRESS, + abi.encodeWithSelector(IWarpMessenger.getBlockchainID.selector), + abi.encode(_MOCK_BLOCKCHAIN_ID) + ); + vm.mockCall( + MOCK_TELEPORTER_MESSENGER_ADDRESS, + abi.encodeWithSelector( + ITeleporterMessenger.sendCrossChainMessage.selector + ), + abi.encode(1) + ); + + vm.expectCall( + WARP_PRECOMPILE_ADDRESS, + abi.encodeWithSelector(IWarpMessenger.getBlockchainID.selector) + ); + + mockERC20 = new UnitTestMockERC20(); + erc20TokenSource = new ERC20TokenSource( + MOCK_TELEPORTER_MESSENGER_ADDRESS, + _DEFAULT_OTHER_CHAIN_ID, + _DEFAULT_OTHER_BRIDGE_ADDRESS, + address(mockERC20) + ); + + vm.mockCall( + address(mockERC20), + abi.encodeWithSelector(IERC20.allowance.selector), + abi.encode(1234) + ); + vm.mockCall( + address(mockERC20), + abi.encodeWithSelector(IERC20.approve.selector), + abi.encode(true) + ); + } + + function testTransferToDestination() public { + vm.expectEmit(true, true, true, true, address(erc20TokenSource)); + emit TransferToDestination({ + sender: address(this), + recipient: _DEFAULT_RECIPIENT, + amount: _DEFAULT_TRANSFER_AMOUNT, + teleporterMessageID: 1 + }); + + TeleporterMessageInput + memory expectedMessageInput = TeleporterMessageInput({ + destinationBlockchainID: _DEFAULT_OTHER_CHAIN_ID, + destinationAddress: _DEFAULT_OTHER_BRIDGE_ADDRESS, + feeInfo: TeleporterFeeInfo({ + feeTokenAddress: address(mockERC20), + amount: _DEFAULT_FEE_AMOUNT + }), + requiredGasLimit: erc20TokenSource + .MINT_NATIVE_TOKENS_REQUIRED_GAS(), + allowedRelayerAddresses: new address[](0), + message: abi.encode(_DEFAULT_RECIPIENT, _DEFAULT_TRANSFER_AMOUNT) + }); + + vm.expectCall( + MOCK_TELEPORTER_MESSENGER_ADDRESS, + abi.encodeCall( + ITeleporterMessenger.sendCrossChainMessage, + (expectedMessageInput) + ) + ); + + erc20TokenSource.transferToDestination( + _DEFAULT_RECIPIENT, + _DEFAULT_TRANSFER_AMOUNT + _DEFAULT_FEE_AMOUNT, + _DEFAULT_FEE_AMOUNT, + new address[](0) + ); + } + + function testUnlock() public { + // Give the contract some tokens to burn. + erc20TokenSource.transferToDestination( + _DEFAULT_RECIPIENT, + _DEFAULT_TRANSFER_AMOUNT * 2 + _DEFAULT_FEE_AMOUNT , + _DEFAULT_FEE_AMOUNT, + new address[](0) + ); + + vm.expectEmit(true, true, true, true, address(erc20TokenSource)); + emit UnlockTokens(_DEFAULT_RECIPIENT, _DEFAULT_TRANSFER_AMOUNT); + + vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); + erc20TokenSource.receiveTeleporterMessage( + _DEFAULT_OTHER_CHAIN_ID, + _DEFAULT_OTHER_BRIDGE_ADDRESS, + abi.encode( + ITokenSource.SourceAction.Unlock, + abi.encode(_DEFAULT_RECIPIENT, _DEFAULT_TRANSFER_AMOUNT) + ) + ); + + assertEq(_DEFAULT_TRANSFER_AMOUNT, mockERC20.balanceOf(_DEFAULT_RECIPIENT)); + } + + function testBurnedTxFees() public { + // Give the contract some tokens to burn. + erc20TokenSource.transferToDestination( + _DEFAULT_RECIPIENT, + _DEFAULT_TRANSFER_AMOUNT + _DEFAULT_FEE_AMOUNT, + _DEFAULT_FEE_AMOUNT, + new address[](0) + ); + + uint256 burnedTxFees = 100; + uint256 additionalTxFees = 50; + assertEq(0, erc20TokenSource.destinationBurnedTotal()); + + vm.expectEmit(true, true, true, true, address(erc20TokenSource)); + emit BurnTokens(burnedTxFees); + + vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); + erc20TokenSource.receiveTeleporterMessage( + _DEFAULT_OTHER_CHAIN_ID, + _DEFAULT_OTHER_BRIDGE_ADDRESS, + abi.encode( + ITokenSource.SourceAction.Burn, + abi.encode(burnedTxFees) + ) + ); + + assertEq(burnedTxFees, erc20TokenSource.destinationBurnedTotal()); + assertEq(burnedTxFees, mockERC20.balanceOf(erc20TokenSource.BURNED_TX_FEES_ADDRESS())); + + vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); + erc20TokenSource.receiveTeleporterMessage( + _DEFAULT_OTHER_CHAIN_ID, + _DEFAULT_OTHER_BRIDGE_ADDRESS, + abi.encode( + ITokenSource.SourceAction.Burn, + abi.encode(burnedTxFees - 1) + ) + ); + + assertEq(burnedTxFees, erc20TokenSource.destinationBurnedTotal()); + assertEq(burnedTxFees, mockERC20.balanceOf(erc20TokenSource.BURNED_TX_FEES_ADDRESS())); + + emit BurnTokens(additionalTxFees); + + vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); + erc20TokenSource.receiveTeleporterMessage( + _DEFAULT_OTHER_CHAIN_ID, + _DEFAULT_OTHER_BRIDGE_ADDRESS, + abi.encode( + ITokenSource.SourceAction.Burn, + abi.encode(burnedTxFees + additionalTxFees) + ) + ); + + assertEq(burnedTxFees + additionalTxFees, erc20TokenSource.destinationBurnedTotal()); + assertEq(burnedTxFees + additionalTxFees, mockERC20.balanceOf(erc20TokenSource.BURNED_TX_FEES_ADDRESS())); + } + + function testZeroTeleporterAddress() public { + vm.expectRevert( + _formatERC20TokenSourceErrorMessage( + "zero TeleporterMessenger address" + ) + ); + + new ERC20TokenSource( + address(0x0), + _DEFAULT_OTHER_CHAIN_ID, + _DEFAULT_OTHER_BRIDGE_ADDRESS, + address(mockERC20) + ); + } + + function testZeroDestinationChainID() public { + vm.expectRevert( + _formatERC20TokenSourceErrorMessage( + "zero destination blockchain ID" + ) + ); + + new ERC20TokenSource( + MOCK_TELEPORTER_MESSENGER_ADDRESS, + bytes32(0), + _DEFAULT_OTHER_BRIDGE_ADDRESS, + address(mockERC20) + ); + } + + function testSameBlockchainID() public { + vm.expectRevert( + _formatERC20TokenSourceErrorMessage( + "cannot bridge with same blockchain" + ) + ); + + new ERC20TokenSource( + MOCK_TELEPORTER_MESSENGER_ADDRESS, + _MOCK_BLOCKCHAIN_ID, + _DEFAULT_OTHER_BRIDGE_ADDRESS, + address(mockERC20) + ); + } + + function testZeroDestinationContractAddress() public { + vm.expectRevert( + _formatERC20TokenSourceErrorMessage( + "zero destination contract address" + ) + ); + + new ERC20TokenSource( + MOCK_TELEPORTER_MESSENGER_ADDRESS, + _DEFAULT_OTHER_CHAIN_ID, + address(0x0), + address(mockERC20) + ); + } + + function testZeroERC20ContractAddress() public { + vm.expectRevert( + _formatERC20TokenSourceErrorMessage( + "zero ERC20 contract address" + ) + ); + + new ERC20TokenSource( + MOCK_TELEPORTER_MESSENGER_ADDRESS, + _DEFAULT_OTHER_CHAIN_ID, + _DEFAULT_OTHER_BRIDGE_ADDRESS, + address(0x0) + ); + } + + function testInvalidTeleporterAddress() public { + vm.expectRevert( + _formatERC20TokenSourceErrorMessage( + "unauthorized TeleporterMessenger contract" + ) + ); + + vm.prank(address(0x123)); + erc20TokenSource.receiveTeleporterMessage( + _DEFAULT_OTHER_CHAIN_ID, + _DEFAULT_OTHER_BRIDGE_ADDRESS, + abi.encode( + ITokenSource.SourceAction.Unlock, + abi.encode(_DEFAULT_RECIPIENT, _DEFAULT_TRANSFER_AMOUNT) + ) + ); + } + + function testInvalidDestinationBlockchain() public { + vm.expectRevert( + _formatERC20TokenSourceErrorMessage("invalid destination chain") + ); + + vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); + erc20TokenSource.receiveTeleporterMessage( + _MOCK_BLOCKCHAIN_ID, + _DEFAULT_OTHER_BRIDGE_ADDRESS, + abi.encode( + ITokenSource.SourceAction.Unlock, + abi.encode(_DEFAULT_RECIPIENT, _DEFAULT_TRANSFER_AMOUNT) + ) + ); + } + + function testInvalidSenderContract() public { + vm.expectRevert( + _formatERC20TokenSourceErrorMessage("unauthorized sender") + ); + + vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); + erc20TokenSource.receiveTeleporterMessage( + _DEFAULT_OTHER_CHAIN_ID, + address(0x123), + abi.encode( + ITokenSource.SourceAction.Unlock, + abi.encode(_DEFAULT_RECIPIENT, _DEFAULT_TRANSFER_AMOUNT) + ) + ); + } + + function testInvalidRecipientAddress() public { + vm.expectRevert( + _formatERC20TokenSourceErrorMessage("zero recipient address") + ); + + vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); + erc20TokenSource.receiveTeleporterMessage( + _DEFAULT_OTHER_CHAIN_ID, + _DEFAULT_OTHER_BRIDGE_ADDRESS, + abi.encode( + ITokenSource.SourceAction.Unlock, + abi.encode(address(0x0), _DEFAULT_TRANSFER_AMOUNT) + ) + ); + } + + function testZeroRecipient() public { + vm.expectRevert( + _formatERC20TokenSourceErrorMessage("zero recipient address") + ); + + erc20TokenSource.transferToDestination( + address(0x0), + _DEFAULT_TRANSFER_AMOUNT + _DEFAULT_FEE_AMOUNT, + _DEFAULT_FEE_AMOUNT, + new address[](0) + ); + } + + function _formatERC20TokenSourceErrorMessage( + string memory errorMessage + ) private pure returns (bytes memory) { + return bytes(string.concat("ERC20TokenSource: ", errorMessage)); + } +} diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenSourceTests.t.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenSourceTests.t.sol index 864bb99ad..2bbee09d9 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenSourceTests.t.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenSourceTests.t.sol @@ -14,8 +14,6 @@ contract NativeTokenSourceTest is Test { 0x644E5b7c5D4Bc8073732CEa72c66e0BB90dFC00f; address public constant WARP_PRECOMPILE_ADDRESS = address(0x0200000000000000000000000000000000000005); - address public constant NATIVE_MINTER_PRECOMPILE_ADDRESS = - address(0x0200000000000000000000000000000000000001); bytes32 private constant _MOCK_BLOCKCHAIN_ID = bytes32(uint256(123456)); bytes32 private constant _DEFAULT_OTHER_CHAIN_ID = bytes32( diff --git a/contracts/src/Mocks/UnitTestMockERC20.sol b/contracts/src/Mocks/UnitTestMockERC20.sol index e01ae4277..a1229d025 100644 --- a/contracts/src/Mocks/UnitTestMockERC20.sol +++ b/contracts/src/Mocks/UnitTestMockERC20.sol @@ -30,6 +30,18 @@ contract UnitTestMockERC20 { return true; } + // The mock allows anyone to call transferFrom to increment the balance of the + // receipt address. Neither the call or sender need to have sufficient balances to send, + // we just increment the balance the of the recipient. + function transfer( + address to, + uint256 amount + ) public returns (bool) { + uint256 feeAmount = feeOnTransferSenders[msg.sender]; + mockBalances[to] += (amount - feeAmount); + return true; + } + function balanceOf(address account) public view returns (uint256) { return mockBalances[account]; } From 250ef1a81db7d7f881df5dfe78388a168377e45d Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 5 Dec 2023 09:29:50 -0500 Subject: [PATCH 167/183] Review fixes --- .../ERC20TokenSource/ERC20TokenSource.go | 2 +- .../NativeTokenSource/NativeTokenSource.go | 2 +- .../NativeTokenBridge/ERC20TokenSource.sol | 6 +++--- .../NativeTokenBridge/NativeTokenSource.sol | 10 +++++++--- .../tests/NativeTokenSourceTests.t.sol | 16 ++++++++++++++++ 5 files changed, 28 insertions(+), 8 deletions(-) diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go index 5d30c65e6..36621d6f6 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go @@ -32,7 +32,7 @@ var ( // ERC20TokenSourceMetaData contains all meta data concerning the ERC20TokenSource contract. var ERC20TokenSourceMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"erc20ContractAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBurnedTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"erc20ContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x6101006040523480156200001257600080fd5b50604051620016f4380380620016f483398101604081905262000035916200031d565b60016000556001600160a01b038416620000b15760405162461bcd60e51b815260206004820152603260248201527f4552433230546f6b656e536f757263653a207a65726f2054656c65706f727465604482015271724d657373656e676572206164647265737360701b60648201526084015b60405180910390fd5b6001600160a01b03841660e05282620001155760405162461bcd60e51b81526020600482015260306024820152600080516020620016d483398151915260448201526f1bdb88189b1bd8dad8da185a5b88125160821b6064820152608401620000a8565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000168573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200018e919062000371565b8303620002045760405162461bcd60e51b815260206004820152603460248201527f4552433230546f6b656e536f757263653a2063616e6e6f74206272696467652060448201527f776974682073616d6520626c6f636b636861696e0000000000000000000000006064820152608401620000a8565b60808390526001600160a01b038216620002765760405162461bcd60e51b81526020600482015260336024820152600080516020620016d483398151915260448201527f6f6e20636f6e74726163742061646472657373000000000000000000000000006064820152608401620000a8565b6001600160a01b0380831660a0528116620002ea5760405162461bcd60e51b815260206004820152602d60248201527f4552433230546f6b656e536f757263653a207a65726f20455243323020636f6e60448201526c7472616374206164647265737360981b6064820152608401620000a8565b6001600160a01b031660c052506200038b915050565b80516001600160a01b03811681146200031857600080fd5b919050565b600080600080608085870312156200033457600080fd5b6200033f8562000300565b935060208501519250620003566040860162000300565b9150620003666060860162000300565b905092959194509250565b6000602082840312156200038457600080fd5b5051919050565b60805160a05160c05160e0516112bd620004176000396000818160f50152818161029c015281816102d301526104ed015260008181610183015281816101e30152818161027b0152818161036d01528181610a580152610c3701526000818161013e015281816103330152610605015260008181609d0152818161030d015261058201526112bd6000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063b6171f7311610066578063b6171f731461012f578063b8c9091a14610139578063c452165e14610160578063c868efaa1461016b578063e486df151461017e57600080fd5b806341d3014d1461009857806355db3e9e146100d257806387a2edba146100db5780639b3e5803146100f0575b600080fd5b6100bf7f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b6100bf60015481565b6100ee6100e9366004610e3c565b6101a5565b005b6101177f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100c9565b6100bf620186a081565b6101177f000000000000000000000000000000000000000000000000000000000000000081565b610117600160981b81565b6100ee610179366004610ed5565b6104da565b6101177f000000000000000000000000000000000000000000000000000000000000000081565b6101ad610785565b6001600160a01b0385166101dc5760405162461bcd60e51b81526004016101d390610f5e565b60405180910390fd5b60006102087f0000000000000000000000000000000000000000000000000000000000000000866107de565b90508381116102705760405162461bcd60e51b815260206004820152602e60248201527f4552433230546f6b656e536f757263653a20696e73756666696369656e74206160448201526d191a9d5cdd195908185b5bdd5b9d60921b60648201526084016101d3565b83156102c1576102c17f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000086610948565b60006102cd8583610fbc565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316815260200160405180604001604052807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031681526020018b8152508152602001620186a08152602001888880806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250604080516001600160a01b038e166020808301919091529181018890529101906060016040516020818303038152906040528152506040518263ffffffff1660e01b81526004016104339190611063565b6020604051808303816000875af1158015610452573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047691906110e1565b905080886001600160a01b0316336001600160a01b03167f2b4e8f08417773e367064a6aea9ca2df303a60876676f70b6c3c5e66b314ca5a856040516104be91815260200190565b60405180910390a45050506104d36001600055565b5050505050565b6104e2610785565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146105805760405162461bcd60e51b815260206004820152603b60248201527f4552433230546f6b656e536f757263653a20756e617574686f72697a6564205460448201527f656c65706f727465724d657373656e67657220636f6e7472616374000000000060648201526084016101d3565b7f000000000000000000000000000000000000000000000000000000000000000084146106035760405162461bcd60e51b815260206004820152602b60248201527f4552433230546f6b656e536f757263653a20696e76616c69642064657374696e60448201526a30ba34b7b71031b430b4b760a91b60648201526084016101d3565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316146106925760405162461bcd60e51b815260206004820152602560248201527f4552433230546f6b656e536f757263653a20756e617574686f72697a6564207360448201526432b73232b960d91b60648201526084016101d3565b6000806106a183850185611110565b909250905060008260018111156106ba576106ba6111d8565b036106eb57600080828060200190518101906106d691906111ee565b915091506106e48282610a2d565b5050610773565b60018260018111156106ff576106ff6111d8565b0361072b5760008180602001905181019061071a91906110e1565b905061072581610ac4565b50610773565b60405162461bcd60e51b815260206004820181905260248201527f4552433230546f6b656e536f757263653a20696e76616c696420616374696f6e60448201526064016101d3565b505061077f6001600055565b50505050565b6002600054036107d75760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101d3565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015610827573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084b91906110e1565b90506108626001600160a01b038516333086610af3565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa1580156108a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108cd91906110e1565b90508181116109335760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016101d3565b61093d8282610fbc565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610999573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109bd91906110e1565b6109c7919061121c565b6040516001600160a01b03851660248201526044810182905290915061077f90859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610b2b565b6001600160a01b038216610a535760405162461bcd60e51b81526004016101d390610f5e565b610a7e7f00000000000000000000000000000000000000000000000000000000000000008383610c02565b604080516001600160a01b0384168152602081018390527f55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407910160405180910390a15050565b600154811115610af057600060015482610ade9190610fbc565b9050610ae981610c32565b5060018190555b50565b6040516001600160a01b038085166024830152831660448201526064810182905261077f9085906323b872dd60e01b906084016109f6565b6000610b80826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c979092919063ffffffff16565b805190915015610bfd5780806020019051810190610b9e919061122f565b610bfd5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016101d3565b505050565b6040516001600160a01b038316602482015260448101829052610bfd90849063a9059cbb60e01b906064016109f6565b610c617f0000000000000000000000000000000000000000000000000000000000000000600160981b83610c02565b6040518181527f2cd3fd70cd5a5d6d805e90d22741aa1a84590ace7cf01b244719558d266143829060200160405180910390a150565b6060610ca68484600085610cae565b949350505050565b606082471015610d0f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016101d3565b600080866001600160a01b03168587604051610d2b9190611258565b60006040518083038185875af1925050503d8060008114610d68576040519150601f19603f3d011682016040523d82523d6000602084013e610d6d565b606091505b5091509150610d7e87838387610d89565b979650505050505050565b60608315610df8578251600003610df1576001600160a01b0385163b610df15760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101d3565b5081610ca6565b610ca68383815115610e0d5781518083602001fd5b8060405162461bcd60e51b81526004016101d39190611274565b6001600160a01b0381168114610af057600080fd5b600080600080600060808688031215610e5457600080fd5b8535610e5f81610e27565b94506020860135935060408601359250606086013567ffffffffffffffff80821115610e8a57600080fd5b818801915088601f830112610e9e57600080fd5b813581811115610ead57600080fd5b8960208260051b8501011115610ec257600080fd5b9699959850939650602001949392505050565b60008060008060608587031215610eeb57600080fd5b843593506020850135610efd81610e27565b9250604085013567ffffffffffffffff80821115610f1a57600080fd5b818701915087601f830112610f2e57600080fd5b813581811115610f3d57600080fd5b886020828501011115610f4f57600080fd5b95989497505060200194505050565b60208082526028908201527f4552433230546f6b656e536f757263653a207a65726f20726563697069656e74604082015267206164647265737360c01b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b8181038181111561094257610942610fa6565b600081518084526020808501945080840160005b838110156110085781516001600160a01b031687529582019590820190600101610fe3565b509495945050505050565b60005b8381101561102e578181015183820152602001611016565b50506000910152565b6000815180845261104f816020860160208601611013565b601f01601f19169290920160200192915050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526110c4610100840182610fcf565b905060a0840151601f198483030160e085015261093d8282611037565b6000602082840312156110f357600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561112357600080fd5b82356002811061113257600080fd5b9150602083013567ffffffffffffffff8082111561114f57600080fd5b818501915085601f83011261116357600080fd5b813581811115611175576111756110fa565b604051601f8201601f19908116603f0116810190838211818310171561119d5761119d6110fa565b816040528281528860208487010111156111b657600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b634e487b7160e01b600052602160045260246000fd5b6000806040838503121561120157600080fd5b825161120c81610e27565b6020939093015192949293505050565b8082018082111561094257610942610fa6565b60006020828403121561124157600080fd5b8151801515811461125157600080fd5b9392505050565b6000825161126a818460208701611013565b9190910192915050565b602081526000611251602083018461103756fea264697066735822122087d9c28ea505fb476fe20f41685a6fcfc36f9d8ec4c6f6614d2b4f197d0d850364736f6c634300081200334552433230546f6b656e536f757263653a207a65726f2064657374696e617469", + Bin: "0x6101006040523480156200001257600080fd5b50604051620016f4380380620016f483398101604081905262000035916200031d565b60016000556001600160a01b038416620000b15760405162461bcd60e51b815260206004820152603260248201527f4552433230546f6b656e536f757263653a207a65726f2054656c65706f727465604482015271724d657373656e676572206164647265737360701b60648201526084015b60405180910390fd5b6001600160a01b03841660e05282620001155760405162461bcd60e51b81526020600482015260306024820152600080516020620016d483398151915260448201526f1bdb88189b1bd8dad8da185a5b88125160821b6064820152608401620000a8565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000168573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200018e919062000371565b8303620002045760405162461bcd60e51b815260206004820152603460248201527f4552433230546f6b656e536f757263653a2063616e6e6f74206272696467652060448201527f776974682073616d6520626c6f636b636861696e0000000000000000000000006064820152608401620000a8565b60808390526001600160a01b038216620002765760405162461bcd60e51b81526020600482015260336024820152600080516020620016d483398151915260448201527f6f6e20636f6e74726163742061646472657373000000000000000000000000006064820152608401620000a8565b6001600160a01b0380831660a0528116620002ea5760405162461bcd60e51b815260206004820152602d60248201527f4552433230546f6b656e536f757263653a207a65726f20455243323020636f6e60448201526c7472616374206164647265737360981b6064820152608401620000a8565b6001600160a01b031660c052506200038b915050565b80516001600160a01b03811681146200031857600080fd5b919050565b600080600080608085870312156200033457600080fd5b6200033f8562000300565b935060208501519250620003566040860162000300565b9150620003666060860162000300565b905092959194509250565b6000602082840312156200038457600080fd5b5051919050565b60805160a05160c05160e0516112bd620004176000396000818160f50152818161029c015281816102d301526104ed015260008181610183015281816101e30152818161027b0152818161036d01528181610a580152610c3701526000818161013e015281816103330152610605015260008181609d0152818161030d015261058201526112bd6000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063b6171f7311610066578063b6171f731461012f578063b8c9091a14610139578063c452165e14610160578063c868efaa1461016b578063e486df151461017e57600080fd5b806341d3014d1461009857806355db3e9e146100d257806387a2edba146100db5780639b3e5803146100f0575b600080fd5b6100bf7f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b6100bf60015481565b6100ee6100e9366004610e3c565b6101a5565b005b6101177f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100c9565b6100bf620186a081565b6101177f000000000000000000000000000000000000000000000000000000000000000081565b610117600160981b81565b6100ee610179366004610ed5565b6104da565b6101177f000000000000000000000000000000000000000000000000000000000000000081565b6101ad610785565b6001600160a01b0385166101dc5760405162461bcd60e51b81526004016101d390610f5e565b60405180910390fd5b60006102087f0000000000000000000000000000000000000000000000000000000000000000866107de565b90508381116102705760405162461bcd60e51b815260206004820152602e60248201527f4552433230546f6b656e536f757263653a20696e73756666696369656e74206160448201526d191a9d5cdd195908185b5bdd5b9d60921b60648201526084016101d3565b83156102c1576102c17f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000086610948565b60006102cd8583610fbc565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316815260200160405180604001604052807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031681526020018b8152508152602001620186a08152602001888880806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250604080516001600160a01b038e166020808301919091529181018890529101906060016040516020818303038152906040528152506040518263ffffffff1660e01b81526004016104339190611063565b6020604051808303816000875af1158015610452573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047691906110e1565b905080886001600160a01b0316336001600160a01b03167f2b4e8f08417773e367064a6aea9ca2df303a60876676f70b6c3c5e66b314ca5a856040516104be91815260200190565b60405180910390a45050506104d36001600055565b5050505050565b6104e2610785565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146105805760405162461bcd60e51b815260206004820152603b60248201527f4552433230546f6b656e536f757263653a20756e617574686f72697a6564205460448201527f656c65706f727465724d657373656e67657220636f6e7472616374000000000060648201526084016101d3565b7f000000000000000000000000000000000000000000000000000000000000000084146106035760405162461bcd60e51b815260206004820152602b60248201527f4552433230546f6b656e536f757263653a20696e76616c69642064657374696e60448201526a30ba34b7b71031b430b4b760a91b60648201526084016101d3565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316146106925760405162461bcd60e51b815260206004820152602560248201527f4552433230546f6b656e536f757263653a20756e617574686f72697a6564207360448201526432b73232b960d91b60648201526084016101d3565b6000806106a183850185611110565b909250905060008260018111156106ba576106ba6111d8565b036106eb57600080828060200190518101906106d691906111ee565b915091506106e48282610a2d565b5050610773565b60018260018111156106ff576106ff6111d8565b0361072b5760008180602001905181019061071a91906110e1565b905061072581610ac4565b50610773565b60405162461bcd60e51b815260206004820181905260248201527f4552433230546f6b656e536f757263653a20696e76616c696420616374696f6e60448201526064016101d3565b505061077f6001600055565b50505050565b6002600054036107d75760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101d3565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015610827573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084b91906110e1565b90506108626001600160a01b038516333086610af3565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa1580156108a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108cd91906110e1565b90508181116109335760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016101d3565b61093d8282610fbc565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610999573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109bd91906110e1565b6109c7919061121c565b6040516001600160a01b03851660248201526044810182905290915061077f90859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610b2b565b6001600160a01b038216610a535760405162461bcd60e51b81526004016101d390610f5e565b610a7e7f00000000000000000000000000000000000000000000000000000000000000008383610c02565b604080516001600160a01b0384168152602081018390527f55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407910160405180910390a15050565b600154811115610af057600060015482610ade9190610fbc565b9050610ae981610c32565b5060018190555b50565b6040516001600160a01b038085166024830152831660448201526064810182905261077f9085906323b872dd60e01b906084016109f6565b6000610b80826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c979092919063ffffffff16565b805190915015610bfd5780806020019051810190610b9e919061122f565b610bfd5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016101d3565b505050565b6040516001600160a01b038316602482015260448101829052610bfd90849063a9059cbb60e01b906064016109f6565b610c617f0000000000000000000000000000000000000000000000000000000000000000600160981b83610c02565b6040518181527f2cd3fd70cd5a5d6d805e90d22741aa1a84590ace7cf01b244719558d266143829060200160405180910390a150565b6060610ca68484600085610cae565b949350505050565b606082471015610d0f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016101d3565b600080866001600160a01b03168587604051610d2b9190611258565b60006040518083038185875af1925050503d8060008114610d68576040519150601f19603f3d011682016040523d82523d6000602084013e610d6d565b606091505b5091509150610d7e87838387610d89565b979650505050505050565b60608315610df8578251600003610df1576001600160a01b0385163b610df15760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101d3565b5081610ca6565b610ca68383815115610e0d5781518083602001fd5b8060405162461bcd60e51b81526004016101d39190611274565b6001600160a01b0381168114610af057600080fd5b600080600080600060808688031215610e5457600080fd5b8535610e5f81610e27565b94506020860135935060408601359250606086013567ffffffffffffffff80821115610e8a57600080fd5b818801915088601f830112610e9e57600080fd5b813581811115610ead57600080fd5b8960208260051b8501011115610ec257600080fd5b9699959850939650602001949392505050565b60008060008060608587031215610eeb57600080fd5b843593506020850135610efd81610e27565b9250604085013567ffffffffffffffff80821115610f1a57600080fd5b818701915087601f830112610f2e57600080fd5b813581811115610f3d57600080fd5b886020828501011115610f4f57600080fd5b95989497505060200194505050565b60208082526028908201527f4552433230546f6b656e536f757263653a207a65726f20726563697069656e74604082015267206164647265737360c01b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b8181038181111561094257610942610fa6565b600081518084526020808501945080840160005b838110156110085781516001600160a01b031687529582019590820190600101610fe3565b509495945050505050565b60005b8381101561102e578181015183820152602001611016565b50506000910152565b6000815180845261104f816020860160208601611013565b601f01601f19169290920160200192915050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526110c4610100840182610fcf565b905060a0840151601f198483030160e085015261093d8282611037565b6000602082840312156110f357600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561112357600080fd5b82356002811061113257600080fd5b9150602083013567ffffffffffffffff8082111561114f57600080fd5b818501915085601f83011261116357600080fd5b813581811115611175576111756110fa565b604051601f8201601f19908116603f0116810190838211818310171561119d5761119d6110fa565b816040528281528860208487010111156111b657600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b634e487b7160e01b600052602160045260246000fd5b6000806040838503121561120157600080fd5b825161120c81610e27565b6020939093015192949293505050565b8082018082111561094257610942610fa6565b60006020828403121561124157600080fd5b8151801515811461125157600080fd5b9392505050565b6000825161126a818460208701611013565b9190910192915050565b602081526000611251602083018461103756fea2646970667358221220dc055f68f3fcf4519cd866bb624c81c08c97e4d0960fa9f1fbac251e0c0bdac564736f6c634300081200334552433230546f6b656e536f757263653a207a65726f2064657374696e617469", } // ERC20TokenSourceABI is the input ABI used to generate the binding from. diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go index 4d2ab455f..92906f1dc 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go @@ -38,7 +38,7 @@ type TeleporterFeeInfo struct { // NativeTokenSourceMetaData contains all meta data concerning the NativeTokenSource contract. var NativeTokenSourceMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBurnedTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", - Bin: "0x60e06040523480156200001157600080fd5b5060405162001612380380620016128339810160408190526200003491620002b3565b60016000556001600160a01b038316620000bb5760405162461bcd60e51b815260206004820152603360248201527f4e6174697665546f6b656e536f757263653a207a65726f2054656c65706f727460448201527f65724d657373656e67657220616464726573730000000000000000000000000060648201526084015b60405180910390fd5b6001600160a01b03831660c05281620001205760405162461bcd60e51b81526020600482015260316024820152600080516020620015f28339815191526044820152701a5bdb88189b1bd8dad8da185a5b881251607a1b6064820152608401620000b2565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000173573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001999190620002f4565b82036200020f5760405162461bcd60e51b815260206004820152603560248201527f4e6174697665546f6b656e536f757263653a2063616e6e6f742062726964676560448201527f20776974682073616d6520626c6f636b636861696e00000000000000000000006064820152608401620000b2565b60808290526001600160a01b038116620002815760405162461bcd60e51b81526020600482015260346024820152600080516020620015f283398151915260448201527f696f6e20636f6e747261637420616464726573730000000000000000000000006064820152608401620000b2565b6001600160a01b031660a052506200030e9050565b80516001600160a01b0381168114620002ae57600080fd5b919050565b600080600060608486031215620002c957600080fd5b620002d48462000296565b925060208401519150620002eb6040850162000296565b90509250925092565b6000602082840312156200030757600080fd5b5051919050565b60805160a05160c0516112856200036d6000396000818160ef015281816102320152818161025b015261044e015260008181610167015281816102bb015261056701526000818160920152818161029501526104e301526112856000f3fe60806040526004361061007b5760003560e01c8063b6171f731161004e578063b6171f731461013e578063b8c9091a14610155578063c452165e14610189578063c868efaa146101a157600080fd5b806341d3014d1461008057806355db3e9e146100c75780639b3e5803146100dd578063ad0aee2514610129575b600080fd5b34801561008c57600080fd5b506100b47f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b3480156100d357600080fd5b506100b460015481565b3480156100e957600080fd5b506101117f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100be565b61013c610137366004610d82565b6101c1565b005b34801561014a57600080fd5b506100b4620186a081565b34801561016157600080fd5b506101117f000000000000000000000000000000000000000000000000000000000000000081565b34801561019557600080fd5b50610111600160981b81565b3480156101ad57600080fd5b5061013c6101bc366004610e21565b61043b565b6101c96106ec565b6001600160a01b0384166101f85760405162461bcd60e51b81526004016101ef90610e9b565b60405180910390fd5b60006020840135156102575761021e6102146020860186610ee4565b8560200135610745565b90506102576102306020860186610ee4565b7f0000000000000000000000000000000000000000000000000000000000000000836108af565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906102f99190610f4f565b8152602001620186a08152602001878780806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250604051602091820191610368918c913491016001600160a01b03929092168252602082015260400190565b6040516020818303038152906040528152506040518263ffffffff1660e01b8152600401610396919061103b565b6020604051808303816000875af11580156103b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d991906110b9565b905080866001600160a01b0316336001600160a01b03167f2b4e8f08417773e367064a6aea9ca2df303a60876676f70b6c3c5e66b314ca5a3460405161042191815260200190565b60405180910390a450506104356001600055565b50505050565b6104436106ec565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146104e15760405162461bcd60e51b815260206004820152603c60248201527f4e6174697665546f6b656e536f757263653a20756e617574686f72697a65642060448201527f54656c65706f727465724d657373656e67657220636f6e74726163740000000060648201526084016101ef565b7f000000000000000000000000000000000000000000000000000000000000000084146105655760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e536f757263653a20696e76616c696420646573746960448201526b3730ba34b7b71031b430b4b760a11b60648201526084016101ef565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316146105f55760405162461bcd60e51b815260206004820152602660248201527f4e6174697665546f6b656e536f757263653a20756e617574686f72697a65642060448201526539b2b73232b960d11b60648201526084016101ef565b600080610604838501856110d2565b9092509050600082600181111561061d5761061d61117e565b0361064e57600080828060200190518101906106399190611194565b915091506106478282610994565b50506106e0565b60018260018111156106625761066261117e565b0361068e5760008180602001905181019061067d91906110b9565b905061068881610a37565b506106e0565b60405162461bcd60e51b815260206004820152602160248201527f4e6174697665546f6b656e536f757263653a20696e76616c696420616374696f6044820152603760f91b60648201526084016101ef565b50506104356001600055565b60026000540361073e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101ef565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa15801561078e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b291906110b9565b90506107c96001600160a01b038516333086610a66565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610810573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061083491906110b9565b905081811161089a5760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016101ef565b6108a482826111d8565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610900573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092491906110b9565b61092e91906111eb565b6040516001600160a01b03851660248201526044810182905290915061043590859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610a9e565b6001600160a01b0382166109ba5760405162461bcd60e51b81526004016101ef90610e9b565b6040516001600160a01b0383169082156108fc029083906000818181858888f193505050501580156109f0573d6000803e3d6000fd5b50604080516001600160a01b0384168152602081018390527f55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407910160405180910390a15050565b600154811115610a6357600060015482610a5191906111d8565b9050610a5c81610b75565b5060018190555b50565b6040516001600160a01b03808516602483015283166044820152606481018290526104359085906323b872dd60e01b9060840161095d565b6000610af3826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610bdd9092919063ffffffff16565b805190915015610b705780806020019051810190610b1191906111fe565b610b705760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016101ef565b505050565b604051600160981b9082156108fc029083906000818181858888f19350505050158015610ba6573d6000803e3d6000fd5b506040518181527f2cd3fd70cd5a5d6d805e90d22741aa1a84590ace7cf01b244719558d266143829060200160405180910390a150565b6060610bec8484600085610bf4565b949350505050565b606082471015610c555760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016101ef565b600080866001600160a01b03168587604051610c719190611220565b60006040518083038185875af1925050503d8060008114610cae576040519150601f19603f3d011682016040523d82523d6000602084013e610cb3565b606091505b5091509150610cc487838387610ccf565b979650505050505050565b60608315610d3e578251600003610d37576001600160a01b0385163b610d375760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101ef565b5081610bec565b610bec8383815115610d535781518083602001fd5b8060405162461bcd60e51b81526004016101ef919061123c565b6001600160a01b0381168114610a6357600080fd5b6000806000808486036080811215610d9957600080fd5b8535610da481610d6d565b94506040601f1982011215610db857600080fd5b50602085019250606085013567ffffffffffffffff80821115610dda57600080fd5b818701915087601f830112610dee57600080fd5b813581811115610dfd57600080fd5b8860208260051b8501011115610e1257600080fd5b95989497505060200194505050565b60008060008060608587031215610e3757600080fd5b843593506020850135610e4981610d6d565b9250604085013567ffffffffffffffff80821115610e6657600080fd5b818701915087601f830112610e7a57600080fd5b813581811115610e8957600080fd5b886020828501011115610e1257600080fd5b60208082526029908201527f4e6174697665546f6b656e536f757263653a207a65726f20726563697069656e60408201526874206164647265737360b81b606082015260800190565b600060208284031215610ef657600080fd5b8135610f0181610d6d565b9392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610f4757610f47610f08565b604052919050565b600060408284031215610f6157600080fd5b6040516040810181811067ffffffffffffffff82111715610f8457610f84610f08565b6040528235610f9281610d6d565b81526020928301359281019290925250919050565b600081518084526020808501945080840160005b83811015610fe05781516001600160a01b031687529582019590820190600101610fbb565b509495945050505050565b60005b83811015611006578181015183820152602001610fee565b50506000910152565b60008151808452611027816020860160208601610feb565b601f01601f19169290920160200192915050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c084015261109c610100840182610fa7565b905060a0840151601f198483030160e08501526108a4828261100f565b6000602082840312156110cb57600080fd5b5051919050565b600080604083850312156110e557600080fd5b8235600281106110f457600080fd5b915060208381013567ffffffffffffffff8082111561111257600080fd5b818601915086601f83011261112657600080fd5b81358181111561113857611138610f08565b61114a601f8201601f19168501610f1e565b9150808252878482850101111561116057600080fd5b80848401858401376000848284010152508093505050509250929050565b634e487b7160e01b600052602160045260246000fd5b600080604083850312156111a757600080fd5b82516111b281610d6d565b6020939093015192949293505050565b634e487b7160e01b600052601160045260246000fd5b818103818111156108a9576108a96111c2565b808201808211156108a9576108a96111c2565b60006020828403121561121057600080fd5b81518015158114610f0157600080fd5b60008251611232818460208701610feb565b9190910192915050565b602081526000610f01602083018461100f56fea2646970667358221220ecdd6f6bea4e2ec3a0249408f7475a37da7d73bdf5eb50a39965597e7db3106164736f6c634300081200334e6174697665546f6b656e536f757263653a207a65726f2064657374696e6174", + Bin: "0x60e06040523480156200001157600080fd5b5060405162001675380380620016758339810160408190526200003491620002b3565b60016000556001600160a01b038316620000bb5760405162461bcd60e51b815260206004820152603360248201527f4e6174697665546f6b656e536f757263653a207a65726f2054656c65706f727460448201527f65724d657373656e67657220616464726573730000000000000000000000000060648201526084015b60405180910390fd5b6001600160a01b03831660c05281620001205760405162461bcd60e51b81526020600482015260316024820152600080516020620016558339815191526044820152701a5bdb88189b1bd8dad8da185a5b881251607a1b6064820152608401620000b2565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000173573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001999190620002f4565b82036200020f5760405162461bcd60e51b815260206004820152603560248201527f4e6174697665546f6b656e536f757263653a2063616e6e6f742062726964676560448201527f20776974682073616d6520626c6f636b636861696e00000000000000000000006064820152608401620000b2565b60808290526001600160a01b038116620002815760405162461bcd60e51b815260206004820152603460248201526000805160206200165583398151915260448201527f696f6e20636f6e747261637420616464726573730000000000000000000000006064820152608401620000b2565b6001600160a01b031660a052506200030e9050565b80516001600160a01b0381168114620002ae57600080fd5b919050565b600080600060608486031215620002c957600080fd5b620002d48462000296565b925060208401519150620002eb6040850162000296565b90509250925092565b6000602082840312156200030757600080fd5b5051919050565b60805160a05160c0516112e86200036d6000396000818160ef015281816102320152818161025b015261044e015260008181610167015281816102bb015261056701526000818160920152818161029501526104e301526112e86000f3fe60806040526004361061007b5760003560e01c8063b6171f731161004e578063b6171f731461013e578063b8c9091a14610155578063c452165e14610189578063c868efaa146101a157600080fd5b806341d3014d1461008057806355db3e9e146100c75780639b3e5803146100dd578063ad0aee2514610129575b600080fd5b34801561008c57600080fd5b506100b47f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b3480156100d357600080fd5b506100b460015481565b3480156100e957600080fd5b506101117f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100be565b61013c610137366004610de5565b6101c1565b005b34801561014a57600080fd5b506100b4620186a081565b34801561016157600080fd5b506101117f000000000000000000000000000000000000000000000000000000000000000081565b34801561019557600080fd5b50610111600160981b81565b3480156101ad57600080fd5b5061013c6101bc366004610e84565b61043b565b6101c96106ec565b6001600160a01b0384166101f85760405162461bcd60e51b81526004016101ef90610efe565b60405180910390fd5b60006020840135156102575761021e6102146020860186610f47565b8560200135610745565b90506102576102306020860186610f47565b7f0000000000000000000000000000000000000000000000000000000000000000836108af565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906102f99190610fb2565b8152602001620186a08152602001878780806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250604051602091820191610368918c913491016001600160a01b03929092168252602082015260400190565b6040516020818303038152906040528152506040518263ffffffff1660e01b8152600401610396919061109e565b6020604051808303816000875af11580156103b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d9919061111c565b905080866001600160a01b0316336001600160a01b03167f2b4e8f08417773e367064a6aea9ca2df303a60876676f70b6c3c5e66b314ca5a3460405161042191815260200190565b60405180910390a450506104356001600055565b50505050565b6104436106ec565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146104e15760405162461bcd60e51b815260206004820152603c60248201527f4e6174697665546f6b656e536f757263653a20756e617574686f72697a65642060448201527f54656c65706f727465724d657373656e67657220636f6e74726163740000000060648201526084016101ef565b7f000000000000000000000000000000000000000000000000000000000000000084146105655760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e536f757263653a20696e76616c696420646573746960448201526b3730ba34b7b71031b430b4b760a11b60648201526084016101ef565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316146105f55760405162461bcd60e51b815260206004820152602660248201527f4e6174697665546f6b656e536f757263653a20756e617574686f72697a65642060448201526539b2b73232b960d11b60648201526084016101ef565b60008061060483850185611135565b9092509050600082600181111561061d5761061d6111e1565b0361064e576000808280602001905181019061063991906111f7565b915091506106478282610994565b50506106e0565b6001826001811115610662576106626111e1565b0361068e5760008180602001905181019061067d919061111c565b905061068881610a9a565b506106e0565b60405162461bcd60e51b815260206004820152602160248201527f4e6174697665546f6b656e536f757263653a20696e76616c696420616374696f6044820152603760f91b60648201526084016101ef565b50506104356001600055565b60026000540361073e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101ef565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa15801561078e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b2919061111c565b90506107c96001600160a01b038516333086610ac9565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610810573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610834919061111c565b905081811161089a5760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016101ef565b6108a4828261123b565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610900573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610924919061111c565b61092e919061124e565b6040516001600160a01b03851660248201526044810182905290915061043590859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610b01565b6001600160a01b0382166109ba5760405162461bcd60e51b81526004016101ef90610efe565b80471015610a1d5760405162461bcd60e51b815260206004820152602a60248201527f4e6174697665546f6b656e536f757263653a20696e73756666696369656e742060448201526918dbdb1b185d195c985b60b21b60648201526084016101ef565b6040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015610a53573d6000803e3d6000fd5b50604080516001600160a01b0384168152602081018390527f55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407910160405180910390a15050565b600154811115610ac657600060015482610ab4919061123b565b9050610abf81610bd8565b5060018190555b50565b6040516001600160a01b03808516602483015283166044820152606481018290526104359085906323b872dd60e01b9060840161095d565b6000610b56826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c409092919063ffffffff16565b805190915015610bd35780806020019051810190610b749190611261565b610bd35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016101ef565b505050565b604051600160981b9082156108fc029083906000818181858888f19350505050158015610c09573d6000803e3d6000fd5b506040518181527f2cd3fd70cd5a5d6d805e90d22741aa1a84590ace7cf01b244719558d266143829060200160405180910390a150565b6060610c4f8484600085610c57565b949350505050565b606082471015610cb85760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016101ef565b600080866001600160a01b03168587604051610cd49190611283565b60006040518083038185875af1925050503d8060008114610d11576040519150601f19603f3d011682016040523d82523d6000602084013e610d16565b606091505b5091509150610d2787838387610d32565b979650505050505050565b60608315610da1578251600003610d9a576001600160a01b0385163b610d9a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101ef565b5081610c4f565b610c4f8383815115610db65781518083602001fd5b8060405162461bcd60e51b81526004016101ef919061129f565b6001600160a01b0381168114610ac657600080fd5b6000806000808486036080811215610dfc57600080fd5b8535610e0781610dd0565b94506040601f1982011215610e1b57600080fd5b50602085019250606085013567ffffffffffffffff80821115610e3d57600080fd5b818701915087601f830112610e5157600080fd5b813581811115610e6057600080fd5b8860208260051b8501011115610e7557600080fd5b95989497505060200194505050565b60008060008060608587031215610e9a57600080fd5b843593506020850135610eac81610dd0565b9250604085013567ffffffffffffffff80821115610ec957600080fd5b818701915087601f830112610edd57600080fd5b813581811115610eec57600080fd5b886020828501011115610e7557600080fd5b60208082526029908201527f4e6174697665546f6b656e536f757263653a207a65726f20726563697069656e60408201526874206164647265737360b81b606082015260800190565b600060208284031215610f5957600080fd5b8135610f6481610dd0565b9392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610faa57610faa610f6b565b604052919050565b600060408284031215610fc457600080fd5b6040516040810181811067ffffffffffffffff82111715610fe757610fe7610f6b565b6040528235610ff581610dd0565b81526020928301359281019290925250919050565b600081518084526020808501945080840160005b838110156110435781516001600160a01b03168752958201959082019060010161101e565b509495945050505050565b60005b83811015611069578181015183820152602001611051565b50506000910152565b6000815180845261108a81602086016020860161104e565b601f01601f19169290920160200192915050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526110ff61010084018261100a565b905060a0840151601f198483030160e08501526108a48282611072565b60006020828403121561112e57600080fd5b5051919050565b6000806040838503121561114857600080fd5b82356002811061115757600080fd5b915060208381013567ffffffffffffffff8082111561117557600080fd5b818601915086601f83011261118957600080fd5b81358181111561119b5761119b610f6b565b6111ad601f8201601f19168501610f81565b915080825287848285010111156111c357600080fd5b80848401858401376000848284010152508093505050509250929050565b634e487b7160e01b600052602160045260246000fd5b6000806040838503121561120a57600080fd5b825161121581610dd0565b6020939093015192949293505050565b634e487b7160e01b600052601160045260246000fd5b818103818111156108a9576108a9611225565b808201808211156108a9576108a9611225565b60006020828403121561127357600080fd5b81518015158114610f6457600080fd5b6000825161129581846020870161104e565b9190910192915050565b602081526000610f64602083018461107256fea26469706673582212202de39d30a1e98266c786b6775ff737a5f0c1b3469b5b69292101ed33301eab8a64736f6c634300081200334e6174697665546f6b656e536f757263653a207a65726f2064657374696e6174", } // NativeTokenSourceABI is the input ABI used to generate the binding from. diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol index 2c7632223..b38af09bd 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol @@ -117,7 +117,7 @@ contract ERC20TokenSource is _unlockTokens(recipient, amount); } else if (action == SourceAction.Burn) { uint256 newBurnTotal = abi.decode(actionData, (uint256)); - _updateDestinationBurnedTotal(newBurnTotal); + _handleBurnTokens(newBurnTotal); } else { revert("ERC20TokenSource: invalid action"); } @@ -201,7 +201,7 @@ contract ERC20TokenSource is } /** - * @dev Sends tokens to BURN_FOR_TRANSFER_ADDRESS. + * @dev Sends tokens to BURNED_TX_FEES_ADDRESS. */ function _burnTokens(uint256 amount) private { SafeERC20.safeTransfer( @@ -215,7 +215,7 @@ contract ERC20TokenSource is /** * @dev Update destinationBurnedTotal sent from destination chain */ - function _updateDestinationBurnedTotal(uint256 newBurnTotal) private { + function _handleBurnTokens(uint256 newBurnTotal) private { if (newBurnTotal > destinationBurnedTotal) { uint256 difference = newBurnTotal - destinationBurnedTotal; _burnTokens(difference); diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index 824655573..057028e75 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -110,7 +110,7 @@ contract NativeTokenSource is _unlockTokens(recipient, amount); } else if (action == SourceAction.Burn) { uint256 newBurnTotal = abi.decode(actionData, (uint256)); - _updateDestinationBurnedTotal(newBurnTotal); + _handleBurnTokens(newBurnTotal); } else { revert("NativeTokenSource: invalid action"); } @@ -173,6 +173,10 @@ contract NativeTokenSource is recipient != address(0), "NativeTokenSource: zero recipient address" ); + require( + address(this).balance >= amount, + "NativeTokenSource: insufficient collateral" + ); // Transfer to recipient payable(recipient).transfer(amount); @@ -181,7 +185,7 @@ contract NativeTokenSource is } /** - * @dev Sends tokens to BURN_FOR_TRANSFER_ADDRESS. + * @dev Sends tokens to BURNED_TX_FEES_ADDRESS. */ function _burnTokens(uint256 amount) private { payable(BURNED_TX_FEES_ADDRESS).transfer(amount); @@ -194,7 +198,7 @@ contract NativeTokenSource is * The burned total on the destination will only ever increase, but new totals may be relayed to this * chain out of order. */ - function _updateDestinationBurnedTotal(uint256 newBurnTotal) private { + function _handleBurnTokens(uint256 newBurnTotal) private { if (newBurnTotal > destinationBurnedTotal) { uint256 difference = newBurnTotal - destinationBurnedTotal; _burnTokens(difference); diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenSourceTests.t.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenSourceTests.t.sol index 2bbee09d9..0091ca6f0 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenSourceTests.t.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenSourceTests.t.sol @@ -350,6 +350,22 @@ contract NativeTokenSourceTest is Test { ); } + function testInsufficientCollateral() public { + vm.expectRevert( + _formatNativeTokenSourceErrorMessage("insufficient collateral") + ); + + vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); + nativeTokenSource.receiveTeleporterMessage( + _DEFAULT_OTHER_CHAIN_ID, + _DEFAULT_OTHER_BRIDGE_ADDRESS, + abi.encode( + ITokenSource.SourceAction.Unlock, + abi.encode(_DEFAULT_RECIPIENT, _DEFAULT_TRANSFER_AMOUNT) + ) + ); + } + function _formatNativeTokenSourceErrorMessage( string memory errorMessage ) private pure returns (bytes memory) { From 9daf35ac953502ecb40e346f7ec06cd018648b85 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 5 Dec 2023 09:33:47 -0500 Subject: [PATCH 168/183] Fix --- tests/erc20_to_native_token_bridge.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/erc20_to_native_token_bridge.go b/tests/erc20_to_native_token_bridge.go index 0d5242027..f12ef1dba 100644 --- a/tests/erc20_to_native_token_bridge.go +++ b/tests/erc20_to_native_token_bridge.go @@ -187,7 +187,7 @@ func ERC20ToNativeTokenBridge(network network.Network) { erc20TokenSource.ParseTransferToDestination, ) Expect(err).Should(BeNil()) - utils.ExpectBigEqual(transferEvent.TransferAmount, valueToSend) + utils.ExpectBigEqual(transferEvent.Amount, valueToSend) receipt := network.RelayMessage(ctx, sourceChainReceipt, subnetA, subnetB, true) From 162a701fd8b292b3638aa6a8a5176e53e519525b Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 5 Dec 2023 09:52:28 -0500 Subject: [PATCH 169/183] Update contracts/src/Mocks/UnitTestMockERC20.sol Co-authored-by: Michael Kaplan <55204436+michaelkaplan13@users.noreply.github.com> Signed-off-by: Geoff Stuart --- contracts/src/Mocks/UnitTestMockERC20.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/src/Mocks/UnitTestMockERC20.sol b/contracts/src/Mocks/UnitTestMockERC20.sol index a1229d025..9217604a6 100644 --- a/contracts/src/Mocks/UnitTestMockERC20.sol +++ b/contracts/src/Mocks/UnitTestMockERC20.sol @@ -31,7 +31,7 @@ contract UnitTestMockERC20 { } // The mock allows anyone to call transferFrom to increment the balance of the - // receipt address. Neither the call or sender need to have sufficient balances to send, + // receipt address. Neither the caller or sender need to have sufficient balances to send, // we just increment the balance the of the recipient. function transfer( address to, From 84098a2892b3b9934b5bcb12582dec78f9777401 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 5 Dec 2023 10:02:23 -0500 Subject: [PATCH 170/183] Review fixes --- tests/utils/utils.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/tests/utils/utils.go b/tests/utils/utils.go index c4294c8d9..302cab3a2 100644 --- a/tests/utils/utils.go +++ b/tests/utils/utils.go @@ -282,13 +282,13 @@ func CreateSendCrossChainMessageTransaction( ctx context.Context, source SubnetTestInfo, input teleportermessenger.TeleporterMessageInput, - relayerKey *ecdsa.PrivateKey, + senderKey *ecdsa.PrivateKey, teleporterContractAddress common.Address, ) *types.Transaction { data, err := teleportermessenger.PackSendCrossChainMessage(input) Expect(err).Should(BeNil()) - gasFeeCap, gasTipCap, nonce := CalculateTxParams(ctx, source, PrivateKeyToAddress(relayerKey)) + gasFeeCap, gasTipCap, nonce := CalculateTxParams(ctx, source, PrivateKeyToAddress(senderKey)) // Send a transaction to the Teleporter contract tx := types.NewTx(&types.DynamicFeeTx{ @@ -302,7 +302,7 @@ func CreateSendCrossChainMessageTransaction( Data: data, }) - return SignTransaction(tx, relayerKey, source.ChainIDInt) + return SignTransaction(tx, senderKey, source.ChainIDInt) } func CreateRetryMessageExecutionTransaction( @@ -310,11 +310,9 @@ func CreateRetryMessageExecutionTransaction( subnetInfo SubnetTestInfo, originChainID ids.ID, message teleportermessenger.TeleporterMessage, - fundedKey *ecdsa.PrivateKey, + senderKey *ecdsa.PrivateKey, teleporterContractAddress common.Address, ) *types.Transaction { - fundedAddress := crypto.PubkeyToAddress(fundedKey.PublicKey) - data, err := teleportermessenger.PackRetryMessageExecution(originChainID, message) Expect(err).Should(BeNil()) @@ -322,7 +320,7 @@ func CreateRetryMessageExecutionTransaction( gasLimit, err := gasUtils.CalculateReceiveMessageGasLimit(10, message.RequiredGasLimit) Expect(err).Should(BeNil()) - gasFeeCap, gasTipCap, nonce := CalculateTxParams(ctx, subnetInfo, fundedAddress) + gasFeeCap, gasTipCap, nonce := CalculateTxParams(ctx, subnetInfo, PrivateKeyToAddress(senderKey)) // Sign a transaction to the Teleporter contract tx := types.NewTx(&types.DynamicFeeTx{ @@ -336,7 +334,7 @@ func CreateRetryMessageExecutionTransaction( Data: data, }) - return SignTransaction(tx, fundedKey, subnetInfo.ChainIDInt) + return SignTransaction(tx, senderKey, subnetInfo.ChainIDInt) } // Constructs a transaction to call receiveCrossChainMessage @@ -419,7 +417,7 @@ func WaitForTransactionSuccess(ctx context.Context, txHash common.Hash, subnetIn } func WaitForTransaction(ctx context.Context, txHash common.Hash, subnetInfo SubnetTestInfo) *types.Receipt { - cctx, cancel := context.WithTimeout(ctx, 20*time.Second) + cctx, cancel := context.WithTimeout(ctx, 10*time.Second) defer cancel() // Loop until we find the transaction or time out From 93dab587e8115eb95699e4dbe5113e5e550dfcee Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 5 Dec 2023 10:18:30 -0500 Subject: [PATCH 171/183] Add collateral test --- .../tests/NativeTokenDestinationTests.t.sol | 45 +++++++++++++++++-- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol index f5e341636..c61bf6491 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol @@ -91,8 +91,6 @@ contract NativeTokenDestinationTest is Test { } function collateralizeBridge() public { - uint256 amount = _DEFAULT_INITIAL_RESERVE_IMBALANCE; - vm.expectEmit(true, true, true, true, address(nativeTokenDestination)); emit CollateralAdded({ amount: _DEFAULT_INITIAL_RESERVE_IMBALANCE, @@ -111,7 +109,7 @@ contract NativeTokenDestinationTest is Test { nativeTokenDestination.receiveTeleporterMessage( _DEFAULT_OTHER_CHAIN_ID, _DEFAULT_OTHER_BRIDGE_ADDRESS, - abi.encode(_DEFAULT_RECIPIENT, amount) + abi.encode(_DEFAULT_RECIPIENT, _DEFAULT_INITIAL_RESERVE_IMBALANCE) ); vm.stopPrank(); } @@ -164,6 +162,47 @@ contract NativeTokenDestinationTest is Test { ); } + function testCollateralizeBridge() public { + uint256 firstTransfer = _DEFAULT_INITIAL_RESERVE_IMBALANCE / 4; + + vm.expectEmit(true, true, true, true, address(nativeTokenDestination)); + emit CollateralAdded({ + amount: firstTransfer, + remaining: _DEFAULT_INITIAL_RESERVE_IMBALANCE - firstTransfer, + recipient: _DEFAULT_RECIPIENT + }); + + vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); + nativeTokenDestination.receiveTeleporterMessage( + _DEFAULT_OTHER_CHAIN_ID, + _DEFAULT_OTHER_BRIDGE_ADDRESS, + abi.encode(_DEFAULT_RECIPIENT, firstTransfer) + ); + + assertEq(0, _DEFAULT_RECIPIENT.balance); + + vm.expectEmit(true, true, true, true, address(nativeTokenDestination)); + emit CollateralAdded({ + amount: _DEFAULT_INITIAL_RESERVE_IMBALANCE - firstTransfer, + remaining: 0, + recipient: _DEFAULT_RECIPIENT + }); + emit NativeTokensMinted(_DEFAULT_RECIPIENT, firstTransfer); + + vm.expectCall( + NATIVE_MINTER_PRECOMPILE_ADDRESS, + abi.encodeWithSelector(INativeMinter.mintNativeCoin.selector), + 1 + ); + + vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); + nativeTokenDestination.receiveTeleporterMessage( + _DEFAULT_OTHER_CHAIN_ID, + _DEFAULT_OTHER_BRIDGE_ADDRESS, + abi.encode(_DEFAULT_RECIPIENT, _DEFAULT_INITIAL_RESERVE_IMBALANCE) + ); + } + function testReportBurnedTxFees() public { uint256 burnedFees = nativeTokenDestination .BURNED_TX_FEES_ADDRESS() From 21ed29a8f9fd2e761db38bab74b7ba86132ad6fa Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 5 Dec 2023 10:21:24 -0500 Subject: [PATCH 172/183] Add collateral test --- .../tests/NativeTokenDestinationTests.t.sol | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol index c61bf6491..4c5236ee8 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol @@ -165,6 +165,8 @@ contract NativeTokenDestinationTest is Test { function testCollateralizeBridge() public { uint256 firstTransfer = _DEFAULT_INITIAL_RESERVE_IMBALANCE / 4; + assertEq(_DEFAULT_INITIAL_RESERVE_IMBALANCE, nativeTokenDestination.totalSupply()); + vm.expectEmit(true, true, true, true, address(nativeTokenDestination)); emit CollateralAdded({ amount: firstTransfer, @@ -179,7 +181,8 @@ contract NativeTokenDestinationTest is Test { abi.encode(_DEFAULT_RECIPIENT, firstTransfer) ); - assertEq(0, _DEFAULT_RECIPIENT.balance); + assertEq(_DEFAULT_INITIAL_RESERVE_IMBALANCE - firstTransfer, nativeTokenDestination.currentReserveImbalance()); + assertEq(_DEFAULT_INITIAL_RESERVE_IMBALANCE, nativeTokenDestination.totalSupply()); vm.expectEmit(true, true, true, true, address(nativeTokenDestination)); emit CollateralAdded({ @@ -201,6 +204,9 @@ contract NativeTokenDestinationTest is Test { _DEFAULT_OTHER_BRIDGE_ADDRESS, abi.encode(_DEFAULT_RECIPIENT, _DEFAULT_INITIAL_RESERVE_IMBALANCE) ); + + assertEq(0, nativeTokenDestination.currentReserveImbalance()); + assertEq(_DEFAULT_INITIAL_RESERVE_IMBALANCE + firstTransfer, nativeTokenDestination.totalSupply()); } function testReportBurnedTxFees() public { From 414cb5d17e69423268338a89fc1cdaceecb48f87 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 5 Dec 2023 10:28:55 -0500 Subject: [PATCH 173/183] Remove recipient from collateralAdded event --- .../NativeTokenDestination.go | 17 ++++++++--------- .../INativeTokenDestination.sol | 2 +- .../NativeTokenDestination.sol | 6 ++---- .../tests/NativeTokenDestinationTests.t.sol | 11 ++++------- 4 files changed, 15 insertions(+), 21 deletions(-) diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go index 140438987..c5133c2ce 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go @@ -37,8 +37,8 @@ type TeleporterFeeInfo struct { // NativeTokenDestinationMetaData contains all meta data concerning the NativeTokenDestination contract. var NativeTokenDestinationMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialReserveImbalance_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"burnAddressBalance\",\"type\":\"uint256\"}],\"name\":\"ReportTotalBurnedTxFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"BURN_FOR_TRANSFER_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REPORT_BURNED_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"reportTotalBurnedTxFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalMinted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", - Bin: "0x61012060405273020000000000000000000000000000000000000160805260006002553480156200002f57600080fd5b5060405162001bca38038062001bca833981016040819052620000529162000355565b60016000556001600160a01b038416620000d95760405162461bcd60e51b815260206004820152603860248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2054656c60448201527f65706f727465724d657373656e6765722061646472657373000000000000000060648201526084015b60405180910390fd5b6001600160a01b03841661010052826200013f5760405162461bcd60e51b8152602060048201526031602482015260008051602062001baa8339815191526044820152701c98d948189b1bd8dad8da185a5b881251607a1b6064820152608401620000d0565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000192573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001b891906200039e565b83036200022e5760405162461bcd60e51b815260206004820152603a60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a2063616e6e6f74206260448201527f726964676520776974682073616d6520626c6f636b636861696e0000000000006064820152608401620000d0565b60a08390526001600160a01b038216620002a05760405162461bcd60e51b8152602060048201526034602482015260008051602062001baa83398151915260448201527f72636520636f6e747261637420616464726573730000000000000000000000006064820152608401620000d0565b6001600160a01b03821660c0526000819003620003265760405162461bcd60e51b815260206004820152603660248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20696e6960448201527f7469616c207265736572766520696d62616c616e6365000000000000000000006064820152608401620000d0565b60e081905260015550620003b8915050565b80516001600160a01b03811681146200035057600080fd5b919050565b600080600080608085870312156200036c57600080fd5b620003778562000338565b9350602085015192506200038e6040860162000338565b6060959095015193969295505050565b600060208284031215620003b157600080fd5b5051919050565b60805160a05160c05160e0516101005161175962000451600039600081816102440152818161040c015281816106a50152818161070201526109120152600081816102100152818161030401526103b90152600081816101b10152818161046c015281816107620152610a3501526000818161013c015281816104460152818161073c01526109b101526000610c6d01526117596000f3fe6080604052600436106100e75760003560e01c80638ac7dd201161008a578063ab28523011610059578063ab28523014610297578063c452165e146102ae578063c868efaa146102c6578063d30951261461029757600080fd5b80638ac7dd20146101fe5780639b3e580314610232578063a2309ff814610266578063a2a950171461027c57600080fd5b80633a94fe51116100c65780633a94fe511461015e57806349e3284e146101805780635d93f9af1461019f57806375846562146101eb57600080fd5b8062d872ae146100ec57806318160ddd1461011557806329b7b3fd1461012a575b600080fd5b3480156100f857600080fd5b5061010260015481565b6040519081526020015b60405180910390f35b34801561012157600080fd5b506101026102e6565b34801561013657600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561016a57600080fd5b5061017e6101793660046112d7565b6103f5565b005b34801561018c57600080fd5b506001546040519015815260200161010c565b3480156101ab57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010c565b61017e6101f9366004611343565b6105d0565b34801561020a57600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561023e57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b34801561027257600080fd5b5061010260025481565b34801561028857600080fd5b506101d36001600160981b0181565b3480156102a357600080fd5b50610102620186a081565b3480156102ba57600080fd5b506101d3600160981b81565b3480156102d257600080fd5b5061017e6102e13660046113a7565b6108ff565b6000806103006001600160981b0131600160981b31611446565b90507f00000000000000000000000000000000000000000000000000000000000000006002546103309190611446565b8111156103b65760405162461bcd60e51b815260206004820152604360248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20464154414c202d2060448201527f636f6e74726163742068617320746f6b656e7320756e6163636f756e746564206064820152623337b960e91b608482015260a4015b60405180910390fd5b807f00000000000000000000000000000000000000000000000000000000000000006002546103e59190611446565b6103ef9190611459565b91505090565b6000600160981b6001600160a01b031631905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906104aa919061146c565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505050908252506040805160208082018990528251808303820181528284019093529092019161051c91600191606001611522565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161054a919061159d565b6020604051808303816000875af1158015610569573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058d919061161b565b9050807f2550fa6041684d40e635e29e93dde9017d70c25b46aa88393317b5182ed6ae7c836040516105c191815260200190565b60405180910390a25050505050565b6105d8610d2c565b6001600160a01b0384166105fe5760405162461bcd60e51b81526004016103ad90611634565b6001541561066b5760405162461bcd60e51b815260206004820152603460248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20636f6e7472616374604482015273081d5b99195c98dbdb1b185d195c985b1a5e995960621b60648201526084016103ad565b60006020840135156106ca576106916106876020860186611682565b8560200135610d85565b90506106ca6106a36020860186611682565b7f000000000000000000000000000000000000000000000000000000000000000083610eef565b6040516001600160981b01903480156108fc02916000818181858888f193505050501580156106fd573d6000803e3d6000fd5b5060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906107a0919061146c565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250938552505060405160209384019361080e92508d913491016001600160a01b03929092168252602082015260400190565b60408051601f198184030181529082905261082c9291602001611522565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161085a919061159d565b6020604051808303816000875af1158015610879573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061089d919061161b565b905080866001600160a01b0316336001600160a01b03167f0322cbb1d3c23f6dbf1deddb3b4ef3ce0f93ae6eec7b44e4f395804104466d14346040516108e591815260200190565b60405180910390a450506108f96001600055565b50505050565b610907610d2c565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146109af5760405162461bcd60e51b815260206004820152604160248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201527f697a65642054656c65706f727465724d657373656e67657220636f6e747261636064820152601d60fa1b608482015260a4016103ad565b7f00000000000000000000000000000000000000000000000000000000000000008414610a335760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20696e76616c69642060448201526b39b7bab931b29031b430b4b760a11b60648201526084016103ad565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031614610ac85760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201526a34bd32b21039b2b73232b960a91b60648201526084016103ad565b600080610ad7838501856116a6565b90925090506001600160a01b038216610b025760405162461bcd60e51b81526004016103ad90611634565b80600003610b665760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2074726160448201526a6e736665722076616c756560a81b60648201526084016103ad565b600154819015610c4757600154821115610bdd5760015460408051918252600060208301526001600160a01b03851682820152517f66c12a5fefbc1f35dd64a1d9b069fc5bda187e6f68812c58a330b77b2a695ba99181900360600190a1600154610bd19083611459565b60006001559050610c47565b8160016000828254610bef9190611459565b90915550506001546040805184815260208101929092526001600160a01b03851682820152517f66c12a5fefbc1f35dd64a1d9b069fc5bda187e6f68812c58a330b77b2a695ba99181900360600190a1505050610d22565b6040516327ad555d60e11b81526001600160a01b038481166004830152602482018390527f00000000000000000000000000000000000000000000000000000000000000001690634f5aaaba90604401600060405180830381600087803b158015610cb157600080fd5b505af1158015610cc5573d6000803e3d6000fd5b505050508060026000828254610cdb9190611446565b90915550506040518181526001600160a01b038416907fd949ea0e9d5db53492d77f28fd5467fb2f6c4f5b88e3350e3c36729b76e99cf29060200160405180910390a25050505b6108f96001600055565b600260005403610d7e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016103ad565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015610dce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df2919061161b565b9050610e096001600160a01b038516333086610fd4565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610e50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e74919061161b565b9050818111610eda5760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016103ad565b610ee48282611459565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610f40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f64919061161b565b610f6e9190611446565b6040516001600160a01b0385166024820152604481018290529091506108f990859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261100c565b6040516001600160a01b03808516602483015283166044820152606481018290526108f99085906323b872dd60e01b90608401610f9d565b6000611061826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166110e39092919063ffffffff16565b8051909150156110de578080602001905181019061107f91906116d2565b6110de5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103ad565b505050565b60606110f284846000856110fa565b949350505050565b60608247101561115b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016103ad565b600080866001600160a01b0316858760405161117791906116f4565b60006040518083038185875af1925050503d80600081146111b4576040519150601f19603f3d011682016040523d82523d6000602084013e6111b9565b606091505b50915091506111ca878383876111d5565b979650505050505050565b6060831561124457825160000361123d576001600160a01b0385163b61123d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103ad565b50816110f2565b6110f283838151156112595781518083602001fd5b8060405162461bcd60e51b81526004016103ad9190611710565b60006040828403121561128557600080fd5b50919050565b60008083601f84011261129d57600080fd5b50813567ffffffffffffffff8111156112b557600080fd5b6020830191508360208260051b85010111156112d057600080fd5b9250929050565b6000806000606084860312156112ec57600080fd5b6112f68585611273565b9250604084013567ffffffffffffffff81111561131257600080fd5b61131e8682870161128b565b9497909650939450505050565b6001600160a01b038116811461134057600080fd5b50565b6000806000806080858703121561135957600080fd5b84356113648161132b565b93506113738660208701611273565b9250606085013567ffffffffffffffff81111561138f57600080fd5b61139b8782880161128b565b95989497509550505050565b600080600080606085870312156113bd57600080fd5b8435935060208501356113cf8161132b565b9250604085013567ffffffffffffffff808211156113ec57600080fd5b818701915087601f83011261140057600080fd5b81358181111561140f57600080fd5b88602082850101111561142157600080fd5b95989497505060200194505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610ee957610ee9611430565b81810381811115610ee957610ee9611430565b60006040828403121561147e57600080fd5b6040516040810181811067ffffffffffffffff821117156114af57634e487b7160e01b600052604160045260246000fd5b60405282356114bd8161132b565b81526020928301359281019290925250919050565b60005b838110156114ed5781810151838201526020016114d5565b50506000910152565b6000815180845261150e8160208601602086016114d2565b601f01601f19169290920160200192915050565b60006002841061154257634e487b7160e01b600052602160045260246000fd5b838252604060208301526110f260408301846114f6565b600081518084526020808501945080840160005b838110156115925781516001600160a01b03168752958201959082019060010161156d565b509495945050505050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526115fe610100840182611559565b905060a0840151601f198483030160e0850152610ee482826114f6565b60006020828403121561162d57600080fd5b5051919050565b6020808252602e908201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2072656360408201526d697069656e74206164647265737360901b606082015260800190565b60006020828403121561169457600080fd5b813561169f8161132b565b9392505050565b600080604083850312156116b957600080fd5b82356116c48161132b565b946020939093013593505050565b6000602082840312156116e457600080fd5b8151801515811461169f57600080fd5b600082516117068184602087016114d2565b9190910192915050565b60208152600061169f60208301846114f656fea264697066735822122006d380a20d4384f925a266331fccd80279fd131b12a129c4c2d19a1b63a003f564736f6c634300081200334e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20736f75", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialReserveImbalance_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"burnAddressBalance\",\"type\":\"uint256\"}],\"name\":\"ReportTotalBurnedTxFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"BURN_FOR_TRANSFER_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REPORT_BURNED_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"reportTotalBurnedTxFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalMinted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", + Bin: "0x61012060405273020000000000000000000000000000000000000160805260006002553480156200002f57600080fd5b5060405162001bae38038062001bae833981016040819052620000529162000355565b60016000556001600160a01b038416620000d95760405162461bcd60e51b815260206004820152603860248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2054656c60448201527f65706f727465724d657373656e6765722061646472657373000000000000000060648201526084015b60405180910390fd5b6001600160a01b03841661010052826200013f5760405162461bcd60e51b8152602060048201526031602482015260008051602062001b8e8339815191526044820152701c98d948189b1bd8dad8da185a5b881251607a1b6064820152608401620000d0565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000192573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001b891906200039e565b83036200022e5760405162461bcd60e51b815260206004820152603a60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a2063616e6e6f74206260448201527f726964676520776974682073616d6520626c6f636b636861696e0000000000006064820152608401620000d0565b60a08390526001600160a01b038216620002a05760405162461bcd60e51b8152602060048201526034602482015260008051602062001b8e83398151915260448201527f72636520636f6e747261637420616464726573730000000000000000000000006064820152608401620000d0565b6001600160a01b03821660c0526000819003620003265760405162461bcd60e51b815260206004820152603660248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20696e6960448201527f7469616c207265736572766520696d62616c616e6365000000000000000000006064820152608401620000d0565b60e081905260015550620003b8915050565b80516001600160a01b03811681146200035057600080fd5b919050565b600080600080608085870312156200036c57600080fd5b620003778562000338565b9350602085015192506200038e6040860162000338565b6060959095015193969295505050565b600060208284031215620003b157600080fd5b5051919050565b60805160a05160c05160e0516101005161173d62000451600039600081816102440152818161040c015281816106a50152818161070201526109120152600081816102100152818161030401526103b90152600081816101b10152818161046c015281816107620152610a3501526000818161013c015281816104460152818161073c01526109b101526000610c51015261173d6000f3fe6080604052600436106100e75760003560e01c80638ac7dd201161008a578063ab28523011610059578063ab28523014610297578063c452165e146102ae578063c868efaa146102c6578063d30951261461029757600080fd5b80638ac7dd20146101fe5780639b3e580314610232578063a2309ff814610266578063a2a950171461027c57600080fd5b80633a94fe51116100c65780633a94fe511461015e57806349e3284e146101805780635d93f9af1461019f57806375846562146101eb57600080fd5b8062d872ae146100ec57806318160ddd1461011557806329b7b3fd1461012a575b600080fd5b3480156100f857600080fd5b5061010260015481565b6040519081526020015b60405180910390f35b34801561012157600080fd5b506101026102e6565b34801561013657600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561016a57600080fd5b5061017e6101793660046112bb565b6103f5565b005b34801561018c57600080fd5b506001546040519015815260200161010c565b3480156101ab57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010c565b61017e6101f9366004611327565b6105d0565b34801561020a57600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561023e57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b34801561027257600080fd5b5061010260025481565b34801561028857600080fd5b506101d36001600160981b0181565b3480156102a357600080fd5b50610102620186a081565b3480156102ba57600080fd5b506101d3600160981b81565b3480156102d257600080fd5b5061017e6102e136600461138b565b6108ff565b6000806103006001600160981b0131600160981b3161142a565b90507f0000000000000000000000000000000000000000000000000000000000000000600254610330919061142a565b8111156103b65760405162461bcd60e51b815260206004820152604360248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20464154414c202d2060448201527f636f6e74726163742068617320746f6b656e7320756e6163636f756e746564206064820152623337b960e91b608482015260a4015b60405180910390fd5b807f00000000000000000000000000000000000000000000000000000000000000006002546103e5919061142a565b6103ef919061143d565b91505090565b6000600160981b6001600160a01b031631905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906104aa9190611450565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505050908252506040805160208082018990528251808303820181528284019093529092019161051c91600191606001611506565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161054a9190611581565b6020604051808303816000875af1158015610569573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058d91906115ff565b9050807f2550fa6041684d40e635e29e93dde9017d70c25b46aa88393317b5182ed6ae7c836040516105c191815260200190565b60405180910390a25050505050565b6105d8610d10565b6001600160a01b0384166105fe5760405162461bcd60e51b81526004016103ad90611618565b6001541561066b5760405162461bcd60e51b815260206004820152603460248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20636f6e7472616374604482015273081d5b99195c98dbdb1b185d195c985b1a5e995960621b60648201526084016103ad565b60006020840135156106ca576106916106876020860186611666565b8560200135610d69565b90506106ca6106a36020860186611666565b7f000000000000000000000000000000000000000000000000000000000000000083610ed3565b6040516001600160981b01903480156108fc02916000818181858888f193505050501580156106fd573d6000803e3d6000fd5b5060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906107a09190611450565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250938552505060405160209384019361080e92508d913491016001600160a01b03929092168252602082015260400190565b60408051601f198184030181529082905261082c9291602001611506565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161085a9190611581565b6020604051808303816000875af1158015610879573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061089d91906115ff565b905080866001600160a01b0316336001600160a01b03167f0322cbb1d3c23f6dbf1deddb3b4ef3ce0f93ae6eec7b44e4f395804104466d14346040516108e591815260200190565b60405180910390a450506108f96001600055565b50505050565b610907610d10565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146109af5760405162461bcd60e51b815260206004820152604160248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201527f697a65642054656c65706f727465724d657373656e67657220636f6e747261636064820152601d60fa1b608482015260a4016103ad565b7f00000000000000000000000000000000000000000000000000000000000000008414610a335760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20696e76616c69642060448201526b39b7bab931b29031b430b4b760a11b60648201526084016103ad565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031614610ac85760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201526a34bd32b21039b2b73232b960a91b60648201526084016103ad565b600080610ad78385018561168a565b90925090506001600160a01b038216610b025760405162461bcd60e51b81526004016103ad90611618565b80600003610b665760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2074726160448201526a6e736665722076616c756560a81b60648201526084016103ad565b600154819015610c2b57600154821115610bcf5760015460408051918252600060208301527f244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449910160405180910390a1600154610bc3908361143d565b60006001559050610c2b565b8160016000828254610be1919061143d565b90915550506001546040805184815260208101929092527f244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449910160405180910390a1505050610d06565b6040516327ad555d60e11b81526001600160a01b038481166004830152602482018390527f00000000000000000000000000000000000000000000000000000000000000001690634f5aaaba90604401600060405180830381600087803b158015610c9557600080fd5b505af1158015610ca9573d6000803e3d6000fd5b505050508060026000828254610cbf919061142a565b90915550506040518181526001600160a01b038416907fd949ea0e9d5db53492d77f28fd5467fb2f6c4f5b88e3350e3c36729b76e99cf29060200160405180910390a25050505b6108f96001600055565b600260005403610d625760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016103ad565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015610db2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dd691906115ff565b9050610ded6001600160a01b038516333086610fb8565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610e34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e5891906115ff565b9050818111610ebe5760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016103ad565b610ec8828261143d565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610f24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f4891906115ff565b610f52919061142a565b6040516001600160a01b0385166024820152604481018290529091506108f990859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610ff0565b6040516001600160a01b03808516602483015283166044820152606481018290526108f99085906323b872dd60e01b90608401610f81565b6000611045826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166110c79092919063ffffffff16565b8051909150156110c2578080602001905181019061106391906116b6565b6110c25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103ad565b505050565b60606110d684846000856110de565b949350505050565b60608247101561113f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016103ad565b600080866001600160a01b0316858760405161115b91906116d8565b60006040518083038185875af1925050503d8060008114611198576040519150601f19603f3d011682016040523d82523d6000602084013e61119d565b606091505b50915091506111ae878383876111b9565b979650505050505050565b60608315611228578251600003611221576001600160a01b0385163b6112215760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103ad565b50816110d6565b6110d6838381511561123d5781518083602001fd5b8060405162461bcd60e51b81526004016103ad91906116f4565b60006040828403121561126957600080fd5b50919050565b60008083601f84011261128157600080fd5b50813567ffffffffffffffff81111561129957600080fd5b6020830191508360208260051b85010111156112b457600080fd5b9250929050565b6000806000606084860312156112d057600080fd5b6112da8585611257565b9250604084013567ffffffffffffffff8111156112f657600080fd5b6113028682870161126f565b9497909650939450505050565b6001600160a01b038116811461132457600080fd5b50565b6000806000806080858703121561133d57600080fd5b84356113488161130f565b93506113578660208701611257565b9250606085013567ffffffffffffffff81111561137357600080fd5b61137f8782880161126f565b95989497509550505050565b600080600080606085870312156113a157600080fd5b8435935060208501356113b38161130f565b9250604085013567ffffffffffffffff808211156113d057600080fd5b818701915087601f8301126113e457600080fd5b8135818111156113f357600080fd5b88602082850101111561140557600080fd5b95989497505060200194505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610ecd57610ecd611414565b81810381811115610ecd57610ecd611414565b60006040828403121561146257600080fd5b6040516040810181811067ffffffffffffffff8211171561149357634e487b7160e01b600052604160045260246000fd5b60405282356114a18161130f565b81526020928301359281019290925250919050565b60005b838110156114d15781810151838201526020016114b9565b50506000910152565b600081518084526114f28160208601602086016114b6565b601f01601f19169290920160200192915050565b60006002841061152657634e487b7160e01b600052602160045260246000fd5b838252604060208301526110d660408301846114da565b600081518084526020808501945080840160005b838110156115765781516001600160a01b031687529582019590820190600101611551565b509495945050505050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526115e261010084018261153d565b905060a0840151601f198483030160e0850152610ec882826114da565b60006020828403121561161157600080fd5b5051919050565b6020808252602e908201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2072656360408201526d697069656e74206164647265737360901b606082015260800190565b60006020828403121561167857600080fd5b81356116838161130f565b9392505050565b6000806040838503121561169d57600080fd5b82356116a88161130f565b946020939093013593505050565b6000602082840312156116c857600080fd5b8151801515811461168357600080fd5b600082516116ea8184602087016114b6565b9190910192915050565b60208152600061168360208301846114da56fea26469706673582212203e788042f3e702711fff43e16b2fe5b4ba57bcaa7ce99474ec58f977be39e37b64736f6c634300081200334e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20736f75", } // NativeTokenDestinationABI is the input ABI used to generate the binding from. @@ -714,13 +714,12 @@ func (it *NativeTokenDestinationCollateralAddedIterator) Close() error { type NativeTokenDestinationCollateralAdded struct { Amount *big.Int Remaining *big.Int - Recipient common.Address Raw types.Log // Blockchain specific contextual infos } -// FilterCollateralAdded is a free log retrieval operation binding the contract event 0x66c12a5fefbc1f35dd64a1d9b069fc5bda187e6f68812c58a330b77b2a695ba9. +// FilterCollateralAdded is a free log retrieval operation binding the contract event 0x244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449. // -// Solidity: event CollateralAdded(uint256 amount, uint256 remaining, address recipient) +// Solidity: event CollateralAdded(uint256 amount, uint256 remaining) func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterCollateralAdded(opts *bind.FilterOpts) (*NativeTokenDestinationCollateralAddedIterator, error) { logs, sub, err := _NativeTokenDestination.contract.FilterLogs(opts, "CollateralAdded") @@ -730,9 +729,9 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) FilterCollateralA return &NativeTokenDestinationCollateralAddedIterator{contract: _NativeTokenDestination.contract, event: "CollateralAdded", logs: logs, sub: sub}, nil } -// WatchCollateralAdded is a free log subscription operation binding the contract event 0x66c12a5fefbc1f35dd64a1d9b069fc5bda187e6f68812c58a330b77b2a695ba9. +// WatchCollateralAdded is a free log subscription operation binding the contract event 0x244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449. // -// Solidity: event CollateralAdded(uint256 amount, uint256 remaining, address recipient) +// Solidity: event CollateralAdded(uint256 amount, uint256 remaining) func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchCollateralAdded(opts *bind.WatchOpts, sink chan<- *NativeTokenDestinationCollateralAdded) (event.Subscription, error) { logs, sub, err := _NativeTokenDestination.contract.WatchLogs(opts, "CollateralAdded") @@ -767,9 +766,9 @@ func (_NativeTokenDestination *NativeTokenDestinationFilterer) WatchCollateralAd }), nil } -// ParseCollateralAdded is a log parse operation binding the contract event 0x66c12a5fefbc1f35dd64a1d9b069fc5bda187e6f68812c58a330b77b2a695ba9. +// ParseCollateralAdded is a log parse operation binding the contract event 0x244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449. // -// Solidity: event CollateralAdded(uint256 amount, uint256 remaining, address recipient) +// Solidity: event CollateralAdded(uint256 amount, uint256 remaining) func (_NativeTokenDestination *NativeTokenDestinationFilterer) ParseCollateralAdded(log types.Log) (*NativeTokenDestinationCollateralAdded, error) { event := new(NativeTokenDestinationCollateralAdded) if err := _NativeTokenDestination.contract.UnpackLog(event, "CollateralAdded", log); err != nil { diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol index 09f5644f3..b34d74105 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol @@ -25,7 +25,7 @@ interface INativeTokenDestination { /** * @dev Emitted when tokens are not minted in order to collateralize the source contract. */ - event CollateralAdded(uint256 amount, uint256 remaining, address recipient); + event CollateralAdded(uint256 amount, uint256 remaining); /** * @dev Emitted when minting native tokens. diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index 66fc822cc..f961451ad 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -135,8 +135,7 @@ contract NativeTokenDestination is if (amount > currentReserveImbalance) { emit CollateralAdded({ amount: currentReserveImbalance, - remaining: 0, - recipient: recipient + remaining: 0 }); adjustedAmount = amount - currentReserveImbalance; currentReserveImbalance = 0; @@ -144,8 +143,7 @@ contract NativeTokenDestination is currentReserveImbalance -= amount; emit CollateralAdded({ amount: amount, - remaining: currentReserveImbalance, - recipient: recipient + remaining: currentReserveImbalance }); return; } diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol index 4c5236ee8..32e65b470 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol @@ -39,7 +39,7 @@ contract NativeTokenDestinationTest is Test { uint256 indexed teleporterMessageID, uint256 amount ); - event CollateralAdded(uint256 amount, uint256 remaining, address recipient); + event CollateralAdded(uint256 amount, uint256 remaining); event NativeTokensMinted(address indexed recipient, uint256 amount); event ReportTotalBurnedTxFees( uint256 indexed teleporterMessageID, @@ -94,8 +94,7 @@ contract NativeTokenDestinationTest is Test { vm.expectEmit(true, true, true, true, address(nativeTokenDestination)); emit CollateralAdded({ amount: _DEFAULT_INITIAL_RESERVE_IMBALANCE, - remaining: 0, - recipient: _DEFAULT_RECIPIENT + remaining: 0 }); // We shouldn't mint anything here. @@ -170,8 +169,7 @@ contract NativeTokenDestinationTest is Test { vm.expectEmit(true, true, true, true, address(nativeTokenDestination)); emit CollateralAdded({ amount: firstTransfer, - remaining: _DEFAULT_INITIAL_RESERVE_IMBALANCE - firstTransfer, - recipient: _DEFAULT_RECIPIENT + remaining: _DEFAULT_INITIAL_RESERVE_IMBALANCE - firstTransfer }); vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); @@ -187,8 +185,7 @@ contract NativeTokenDestinationTest is Test { vm.expectEmit(true, true, true, true, address(nativeTokenDestination)); emit CollateralAdded({ amount: _DEFAULT_INITIAL_RESERVE_IMBALANCE - firstTransfer, - remaining: 0, - recipient: _DEFAULT_RECIPIENT + remaining: 0 }); emit NativeTokensMinted(_DEFAULT_RECIPIENT, firstTransfer); From a341da3ace6e0cee65d025dd19b08a055299b12c Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 5 Dec 2023 12:33:31 -0500 Subject: [PATCH 174/183] Add comment --- tests/erc20_to_native_token_bridge.go | 3 ++- tests/native_token_bridge.go | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/erc20_to_native_token_bridge.go b/tests/erc20_to_native_token_bridge.go index f12ef1dba..d891dcd99 100644 --- a/tests/erc20_to_native_token_bridge.go +++ b/tests/erc20_to_native_token_bridge.go @@ -21,7 +21,8 @@ import ( func ERC20ToNativeTokenBridge(network network.Network) { const ( - // Each test file needs a unique deployer that must be funded with tokens to deploy + // This test needs a unique deployer key, whose nonce 0 is used to deploy the bridge contract on each chain. + // The address of the resulting contract has been added to the genesis file as an admin for the Native Minter precompile. deployerKeyStr = "ca7269c1fe2a5b86884a119aa516b8d5b641670b83aac0ebf9f2d71affcc12e4" ExampleERC20ByteCodeFile = "./contracts/out/ExampleERC20.sol/ExampleERC20.json" ERC20TokenSourceByteCodeFile = "./contracts/out/ERC20TokenSource.sol/ERC20TokenSource.json" diff --git a/tests/native_token_bridge.go b/tests/native_token_bridge.go index 8e3bbdd04..9563daf64 100644 --- a/tests/native_token_bridge.go +++ b/tests/native_token_bridge.go @@ -20,8 +20,8 @@ import ( func NativeTokenBridge(network network.Network) { const ( - - // Each test file needs a unique deployer that must be funded with tokens to deploy + // This test needs a unique deployer key, whose nonce 0 is used to deploy the bridge contract on each chain. + // The address of the resulting contract has been added to the genesis file as an admin for the Native Minter precompile. deployerKeyStr = "aad7440febfc8f9d73a58c3cb1f1754779a566978f9ebffcd4f4698e9b043985" NativeTokenSourceByteCodeFile = "./contracts/out/NativeTokenSource.sol/NativeTokenSource.json" NativeTokenDestinationByteCodeFile = "./contracts/out/NativeTokenDestination.sol/NativeTokenDestination.json" From 787f0ef2fc9528b6c44ea1a3c758099e8e490b02 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 5 Dec 2023 12:44:17 -0500 Subject: [PATCH 175/183] Linter --- tests/erc20_to_native_token_bridge.go | 5 +++-- tests/native_token_bridge.go | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/erc20_to_native_token_bridge.go b/tests/erc20_to_native_token_bridge.go index d891dcd99..242d3d4c1 100644 --- a/tests/erc20_to_native_token_bridge.go +++ b/tests/erc20_to_native_token_bridge.go @@ -21,8 +21,9 @@ import ( func ERC20ToNativeTokenBridge(network network.Network) { const ( - // This test needs a unique deployer key, whose nonce 0 is used to deploy the bridge contract on each chain. - // The address of the resulting contract has been added to the genesis file as an admin for the Native Minter precompile. + // This test needs a unique deployer key, whose nonce 0 is used to deploy the bridge contract + // on each chain. The address of the resulting contract has been added to the genesis file as + // an admin for the Native Minter precompile. deployerKeyStr = "ca7269c1fe2a5b86884a119aa516b8d5b641670b83aac0ebf9f2d71affcc12e4" ExampleERC20ByteCodeFile = "./contracts/out/ExampleERC20.sol/ExampleERC20.json" ERC20TokenSourceByteCodeFile = "./contracts/out/ERC20TokenSource.sol/ERC20TokenSource.json" diff --git a/tests/native_token_bridge.go b/tests/native_token_bridge.go index 9563daf64..034185802 100644 --- a/tests/native_token_bridge.go +++ b/tests/native_token_bridge.go @@ -20,8 +20,9 @@ import ( func NativeTokenBridge(network network.Network) { const ( - // This test needs a unique deployer key, whose nonce 0 is used to deploy the bridge contract on each chain. - // The address of the resulting contract has been added to the genesis file as an admin for the Native Minter precompile. + // This test needs a unique deployer key, whose nonce 0 is used to deploy the bridge contract + // on each chain. The address of the resulting contract has been added to the genesis file as + // an admin for the Native Minter precompile. deployerKeyStr = "aad7440febfc8f9d73a58c3cb1f1754779a566978f9ebffcd4f4698e9b043985" NativeTokenSourceByteCodeFile = "./contracts/out/NativeTokenSource.sol/NativeTokenSource.json" NativeTokenDestinationByteCodeFile = "./contracts/out/NativeTokenDestination.sol/NativeTokenDestination.json" From 9d56c4ff765d2742ac8a229f5f93146b2bd2bea0 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Wed, 6 Dec 2023 11:34:15 -0500 Subject: [PATCH 176/183] Linter --- tests/utils/utils.go | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/tests/utils/utils.go b/tests/utils/utils.go index 41e4cb4b8..ed7eb624f 100644 --- a/tests/utils/utils.go +++ b/tests/utils/utils.go @@ -406,14 +406,11 @@ func CreateNativeTransferTransaction( return SignTransaction(tx, fromKey, subnetInfo.EVMChainID) } -func SendAndWaitForTransaction(ctx context.Context, tx *types.Transaction, subnetInfo interfaces.SubnetTestInfo) *types.Receipt { - err := subnetInfo.WSClient.SendTransaction(ctx, tx) - Expect(err).Should(BeNil()) - - return WaitForTransaction(ctx, tx.Hash(), subnetInfo) -} - -func WaitForTransactionSuccess(ctx context.Context, txHash common.Hash, subnetInfo interfaces.SubnetTestInfo) *types.Receipt { +func WaitForTransactionSuccess( + ctx context.Context, + txHash common.Hash, + subnetInfo interfaces.SubnetTestInfo, +) *types.Receipt { receipt := WaitForTransaction(ctx, txHash, subnetInfo) Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) return receipt @@ -547,8 +544,7 @@ func BigIntSub(v1 *big.Int, v2 *big.Int) *big.Int { func BigIntMul(v1 *big.Int, v2 *big.Int) *big.Int { return big.NewInt(0).Mul(v1, v2) - -} +} func ERC20Approve( ctx context.Context, From c0aaa50b28451dabdeca3b013f45a43215a2cd41 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Thu, 7 Dec 2023 10:00:29 -0500 Subject: [PATCH 177/183] Review fixes --- .../ERC20TokenSource/ERC20TokenSource.go | 2 +- .../NativeTokenDestination.go | 2 +- .../NativeTokenSource/NativeTokenSource.go | 2 +- .../NativeTokenBridge/ERC20TokenSource.sol | 5 ++-- .../INativeTokenDestination.sol | 8 +++++++ .../NativeTokenDestination.sol | 11 +++++---- .../NativeTokenBridge/NativeTokenSource.sol | 5 ++-- tests/flows/erc20_to_native_token_bridge.go | 22 +++++++++-------- tests/flows/native_token_bridge.go | 24 +++++++++++-------- 9 files changed, 47 insertions(+), 34 deletions(-) diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go index 36621d6f6..bc06d7c95 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go @@ -32,7 +32,7 @@ var ( // ERC20TokenSourceMetaData contains all meta data concerning the ERC20TokenSource contract. var ERC20TokenSourceMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"erc20ContractAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBurnedTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"erc20ContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x6101006040523480156200001257600080fd5b50604051620016f4380380620016f483398101604081905262000035916200031d565b60016000556001600160a01b038416620000b15760405162461bcd60e51b815260206004820152603260248201527f4552433230546f6b656e536f757263653a207a65726f2054656c65706f727465604482015271724d657373656e676572206164647265737360701b60648201526084015b60405180910390fd5b6001600160a01b03841660e05282620001155760405162461bcd60e51b81526020600482015260306024820152600080516020620016d483398151915260448201526f1bdb88189b1bd8dad8da185a5b88125160821b6064820152608401620000a8565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000168573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200018e919062000371565b8303620002045760405162461bcd60e51b815260206004820152603460248201527f4552433230546f6b656e536f757263653a2063616e6e6f74206272696467652060448201527f776974682073616d6520626c6f636b636861696e0000000000000000000000006064820152608401620000a8565b60808390526001600160a01b038216620002765760405162461bcd60e51b81526020600482015260336024820152600080516020620016d483398151915260448201527f6f6e20636f6e74726163742061646472657373000000000000000000000000006064820152608401620000a8565b6001600160a01b0380831660a0528116620002ea5760405162461bcd60e51b815260206004820152602d60248201527f4552433230546f6b656e536f757263653a207a65726f20455243323020636f6e60448201526c7472616374206164647265737360981b6064820152608401620000a8565b6001600160a01b031660c052506200038b915050565b80516001600160a01b03811681146200031857600080fd5b919050565b600080600080608085870312156200033457600080fd5b6200033f8562000300565b935060208501519250620003566040860162000300565b9150620003666060860162000300565b905092959194509250565b6000602082840312156200038457600080fd5b5051919050565b60805160a05160c05160e0516112bd620004176000396000818160f50152818161029c015281816102d301526104ed015260008181610183015281816101e30152818161027b0152818161036d01528181610a580152610c3701526000818161013e015281816103330152610605015260008181609d0152818161030d015261058201526112bd6000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063b6171f7311610066578063b6171f731461012f578063b8c9091a14610139578063c452165e14610160578063c868efaa1461016b578063e486df151461017e57600080fd5b806341d3014d1461009857806355db3e9e146100d257806387a2edba146100db5780639b3e5803146100f0575b600080fd5b6100bf7f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b6100bf60015481565b6100ee6100e9366004610e3c565b6101a5565b005b6101177f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100c9565b6100bf620186a081565b6101177f000000000000000000000000000000000000000000000000000000000000000081565b610117600160981b81565b6100ee610179366004610ed5565b6104da565b6101177f000000000000000000000000000000000000000000000000000000000000000081565b6101ad610785565b6001600160a01b0385166101dc5760405162461bcd60e51b81526004016101d390610f5e565b60405180910390fd5b60006102087f0000000000000000000000000000000000000000000000000000000000000000866107de565b90508381116102705760405162461bcd60e51b815260206004820152602e60248201527f4552433230546f6b656e536f757263653a20696e73756666696369656e74206160448201526d191a9d5cdd195908185b5bdd5b9d60921b60648201526084016101d3565b83156102c1576102c17f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000086610948565b60006102cd8583610fbc565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316815260200160405180604001604052807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031681526020018b8152508152602001620186a08152602001888880806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250604080516001600160a01b038e166020808301919091529181018890529101906060016040516020818303038152906040528152506040518263ffffffff1660e01b81526004016104339190611063565b6020604051808303816000875af1158015610452573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047691906110e1565b905080886001600160a01b0316336001600160a01b03167f2b4e8f08417773e367064a6aea9ca2df303a60876676f70b6c3c5e66b314ca5a856040516104be91815260200190565b60405180910390a45050506104d36001600055565b5050505050565b6104e2610785565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146105805760405162461bcd60e51b815260206004820152603b60248201527f4552433230546f6b656e536f757263653a20756e617574686f72697a6564205460448201527f656c65706f727465724d657373656e67657220636f6e7472616374000000000060648201526084016101d3565b7f000000000000000000000000000000000000000000000000000000000000000084146106035760405162461bcd60e51b815260206004820152602b60248201527f4552433230546f6b656e536f757263653a20696e76616c69642064657374696e60448201526a30ba34b7b71031b430b4b760a91b60648201526084016101d3565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316146106925760405162461bcd60e51b815260206004820152602560248201527f4552433230546f6b656e536f757263653a20756e617574686f72697a6564207360448201526432b73232b960d91b60648201526084016101d3565b6000806106a183850185611110565b909250905060008260018111156106ba576106ba6111d8565b036106eb57600080828060200190518101906106d691906111ee565b915091506106e48282610a2d565b5050610773565b60018260018111156106ff576106ff6111d8565b0361072b5760008180602001905181019061071a91906110e1565b905061072581610ac4565b50610773565b60405162461bcd60e51b815260206004820181905260248201527f4552433230546f6b656e536f757263653a20696e76616c696420616374696f6e60448201526064016101d3565b505061077f6001600055565b50505050565b6002600054036107d75760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101d3565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015610827573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084b91906110e1565b90506108626001600160a01b038516333086610af3565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa1580156108a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108cd91906110e1565b90508181116109335760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016101d3565b61093d8282610fbc565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610999573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109bd91906110e1565b6109c7919061121c565b6040516001600160a01b03851660248201526044810182905290915061077f90859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610b2b565b6001600160a01b038216610a535760405162461bcd60e51b81526004016101d390610f5e565b610a7e7f00000000000000000000000000000000000000000000000000000000000000008383610c02565b604080516001600160a01b0384168152602081018390527f55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407910160405180910390a15050565b600154811115610af057600060015482610ade9190610fbc565b9050610ae981610c32565b5060018190555b50565b6040516001600160a01b038085166024830152831660448201526064810182905261077f9085906323b872dd60e01b906084016109f6565b6000610b80826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c979092919063ffffffff16565b805190915015610bfd5780806020019051810190610b9e919061122f565b610bfd5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016101d3565b505050565b6040516001600160a01b038316602482015260448101829052610bfd90849063a9059cbb60e01b906064016109f6565b610c617f0000000000000000000000000000000000000000000000000000000000000000600160981b83610c02565b6040518181527f2cd3fd70cd5a5d6d805e90d22741aa1a84590ace7cf01b244719558d266143829060200160405180910390a150565b6060610ca68484600085610cae565b949350505050565b606082471015610d0f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016101d3565b600080866001600160a01b03168587604051610d2b9190611258565b60006040518083038185875af1925050503d8060008114610d68576040519150601f19603f3d011682016040523d82523d6000602084013e610d6d565b606091505b5091509150610d7e87838387610d89565b979650505050505050565b60608315610df8578251600003610df1576001600160a01b0385163b610df15760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101d3565b5081610ca6565b610ca68383815115610e0d5781518083602001fd5b8060405162461bcd60e51b81526004016101d39190611274565b6001600160a01b0381168114610af057600080fd5b600080600080600060808688031215610e5457600080fd5b8535610e5f81610e27565b94506020860135935060408601359250606086013567ffffffffffffffff80821115610e8a57600080fd5b818801915088601f830112610e9e57600080fd5b813581811115610ead57600080fd5b8960208260051b8501011115610ec257600080fd5b9699959850939650602001949392505050565b60008060008060608587031215610eeb57600080fd5b843593506020850135610efd81610e27565b9250604085013567ffffffffffffffff80821115610f1a57600080fd5b818701915087601f830112610f2e57600080fd5b813581811115610f3d57600080fd5b886020828501011115610f4f57600080fd5b95989497505060200194505050565b60208082526028908201527f4552433230546f6b656e536f757263653a207a65726f20726563697069656e74604082015267206164647265737360c01b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b8181038181111561094257610942610fa6565b600081518084526020808501945080840160005b838110156110085781516001600160a01b031687529582019590820190600101610fe3565b509495945050505050565b60005b8381101561102e578181015183820152602001611016565b50506000910152565b6000815180845261104f816020860160208601611013565b601f01601f19169290920160200192915050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526110c4610100840182610fcf565b905060a0840151601f198483030160e085015261093d8282611037565b6000602082840312156110f357600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561112357600080fd5b82356002811061113257600080fd5b9150602083013567ffffffffffffffff8082111561114f57600080fd5b818501915085601f83011261116357600080fd5b813581811115611175576111756110fa565b604051601f8201601f19908116603f0116810190838211818310171561119d5761119d6110fa565b816040528281528860208487010111156111b657600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b634e487b7160e01b600052602160045260246000fd5b6000806040838503121561120157600080fd5b825161120c81610e27565b6020939093015192949293505050565b8082018082111561094257610942610fa6565b60006020828403121561124157600080fd5b8151801515811461125157600080fd5b9392505050565b6000825161126a818460208701611013565b9190910192915050565b602081526000611251602083018461103756fea2646970667358221220dc055f68f3fcf4519cd866bb624c81c08c97e4d0960fa9f1fbac251e0c0bdac564736f6c634300081200334552433230546f6b656e536f757263653a207a65726f2064657374696e617469", + Bin: "0x6101006040523480156200001257600080fd5b50604051620016f1380380620016f183398101604081905262000035916200031d565b60016000556001600160a01b038416620000b15760405162461bcd60e51b815260206004820152603260248201527f4552433230546f6b656e536f757263653a207a65726f2054656c65706f727465604482015271724d657373656e676572206164647265737360701b60648201526084015b60405180910390fd5b6001600160a01b03841660e05282620001155760405162461bcd60e51b81526020600482015260306024820152600080516020620016d183398151915260448201526f1bdb88189b1bd8dad8da185a5b88125160821b6064820152608401620000a8565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000168573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200018e919062000371565b8303620002045760405162461bcd60e51b815260206004820152603460248201527f4552433230546f6b656e536f757263653a2063616e6e6f74206272696467652060448201527f776974682073616d6520626c6f636b636861696e0000000000000000000000006064820152608401620000a8565b60808390526001600160a01b038216620002765760405162461bcd60e51b81526020600482015260336024820152600080516020620016d183398151915260448201527f6f6e20636f6e74726163742061646472657373000000000000000000000000006064820152608401620000a8565b6001600160a01b0380831660a0528116620002ea5760405162461bcd60e51b815260206004820152602d60248201527f4552433230546f6b656e536f757263653a207a65726f20455243323020636f6e60448201526c7472616374206164647265737360981b6064820152608401620000a8565b6001600160a01b031660c052506200038b915050565b80516001600160a01b03811681146200031857600080fd5b919050565b600080600080608085870312156200033457600080fd5b6200033f8562000300565b935060208501519250620003566040860162000300565b9150620003666060860162000300565b905092959194509250565b6000602082840312156200038457600080fd5b5051919050565b60805160a05160c05160e0516112ba620004176000396000818160f50152818161029c015281816102d301526104ed015260008181610183015281816101e30152818161027b0152818161036d01528181610a9a0152610c6a01526000818161013e015281816103330152610605015260008181609d0152818161030d015261058201526112ba6000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063b6171f7311610066578063b6171f731461012f578063b8c9091a14610139578063c452165e14610160578063c868efaa1461016b578063e486df151461017e57600080fd5b806341d3014d1461009857806355db3e9e146100d257806387a2edba146100db5780639b3e5803146100f0575b600080fd5b6100bf7f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b6100bf60015481565b6100ee6100e9366004610e39565b6101a5565b005b6101177f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100c9565b6100bf620186a081565b6101177f000000000000000000000000000000000000000000000000000000000000000081565b610117600160981b81565b6100ee610179366004610ed2565b6104da565b6101177f000000000000000000000000000000000000000000000000000000000000000081565b6101ad610785565b6001600160a01b0385166101dc5760405162461bcd60e51b81526004016101d390610f5b565b60405180910390fd5b60006102087f0000000000000000000000000000000000000000000000000000000000000000866107de565b90508381116102705760405162461bcd60e51b815260206004820152602e60248201527f4552433230546f6b656e536f757263653a20696e73756666696369656e74206160448201526d191a9d5cdd195908185b5bdd5b9d60921b60648201526084016101d3565b83156102c1576102c17f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000086610948565b60006102cd8583610fb9565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316815260200160405180604001604052807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031681526020018b8152508152602001620186a08152602001888880806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250604080516001600160a01b038e166020808301919091529181018890529101906060016040516020818303038152906040528152506040518263ffffffff1660e01b81526004016104339190611060565b6020604051808303816000875af1158015610452573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047691906110de565b905080886001600160a01b0316336001600160a01b03167f2b4e8f08417773e367064a6aea9ca2df303a60876676f70b6c3c5e66b314ca5a856040516104be91815260200190565b60405180910390a45050506104d36001600055565b5050505050565b6104e2610785565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146105805760405162461bcd60e51b815260206004820152603b60248201527f4552433230546f6b656e536f757263653a20756e617574686f72697a6564205460448201527f656c65706f727465724d657373656e67657220636f6e7472616374000000000060648201526084016101d3565b7f000000000000000000000000000000000000000000000000000000000000000084146106035760405162461bcd60e51b815260206004820152602b60248201527f4552433230546f6b656e536f757263653a20696e76616c69642064657374696e60448201526a30ba34b7b71031b430b4b760a91b60648201526084016101d3565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316146106925760405162461bcd60e51b815260206004820152602560248201527f4552433230546f6b656e536f757263653a20756e617574686f72697a6564207360448201526432b73232b960d91b60648201526084016101d3565b6000806106a18385018561110d565b909250905060008260018111156106ba576106ba6111d5565b036106eb57600080828060200190518101906106d691906111eb565b915091506106e48282610a2d565b5050610773565b60018260018111156106ff576106ff6111d5565b0361072b5760008180602001905181019061071a91906110de565b905061072581610ac4565b50610773565b60405162461bcd60e51b815260206004820181905260248201527f4552433230546f6b656e536f757263653a20696e76616c696420616374696f6e60448201526064016101d3565b505061077f6001600055565b50505050565b6002600054036107d75760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101d3565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015610827573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084b91906110de565b90506108626001600160a01b038516333086610af3565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa1580156108a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108cd91906110de565b90508181116109335760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016101d3565b61093d8282610fb9565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610999573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109bd91906110de565b6109c79190611219565b6040516001600160a01b03851660248201526044810182905290915061077f90859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610b2b565b6001600160a01b038216610a535760405162461bcd60e51b81526004016101d390610f5b565b604080516001600160a01b0384168152602081018390527f55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407910160405180910390a1610ac07f00000000000000000000000000000000000000000000000000000000000000008383610c02565b5050565b600154811115610af057600060015482610ade9190610fb9565b9050610ae981610c32565b5060018190555b50565b6040516001600160a01b038085166024830152831660448201526064810182905261077f9085906323b872dd60e01b906084016109f6565b6000610b80826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c949092919063ffffffff16565b805190915015610bfd5780806020019051810190610b9e919061122c565b610bfd5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016101d3565b505050565b6040516001600160a01b038316602482015260448101829052610bfd90849063a9059cbb60e01b906064016109f6565b6040518181527f2cd3fd70cd5a5d6d805e90d22741aa1a84590ace7cf01b244719558d266143829060200160405180910390a1610af07f0000000000000000000000000000000000000000000000000000000000000000600160981b83610c02565b6060610ca38484600085610cab565b949350505050565b606082471015610d0c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016101d3565b600080866001600160a01b03168587604051610d289190611255565b60006040518083038185875af1925050503d8060008114610d65576040519150601f19603f3d011682016040523d82523d6000602084013e610d6a565b606091505b5091509150610d7b87838387610d86565b979650505050505050565b60608315610df5578251600003610dee576001600160a01b0385163b610dee5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101d3565b5081610ca3565b610ca38383815115610e0a5781518083602001fd5b8060405162461bcd60e51b81526004016101d39190611271565b6001600160a01b0381168114610af057600080fd5b600080600080600060808688031215610e5157600080fd5b8535610e5c81610e24565b94506020860135935060408601359250606086013567ffffffffffffffff80821115610e8757600080fd5b818801915088601f830112610e9b57600080fd5b813581811115610eaa57600080fd5b8960208260051b8501011115610ebf57600080fd5b9699959850939650602001949392505050565b60008060008060608587031215610ee857600080fd5b843593506020850135610efa81610e24565b9250604085013567ffffffffffffffff80821115610f1757600080fd5b818701915087601f830112610f2b57600080fd5b813581811115610f3a57600080fd5b886020828501011115610f4c57600080fd5b95989497505060200194505050565b60208082526028908201527f4552433230546f6b656e536f757263653a207a65726f20726563697069656e74604082015267206164647265737360c01b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b8181038181111561094257610942610fa3565b600081518084526020808501945080840160005b838110156110055781516001600160a01b031687529582019590820190600101610fe0565b509495945050505050565b60005b8381101561102b578181015183820152602001611013565b50506000910152565b6000815180845261104c816020860160208601611010565b601f01601f19169290920160200192915050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526110c1610100840182610fcc565b905060a0840151601f198483030160e085015261093d8282611034565b6000602082840312156110f057600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561112057600080fd5b82356002811061112f57600080fd5b9150602083013567ffffffffffffffff8082111561114c57600080fd5b818501915085601f83011261116057600080fd5b813581811115611172576111726110f7565b604051601f8201601f19908116603f0116810190838211818310171561119a5761119a6110f7565b816040528281528860208487010111156111b357600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b634e487b7160e01b600052602160045260246000fd5b600080604083850312156111fe57600080fd5b825161120981610e24565b6020939093015192949293505050565b8082018082111561094257610942610fa3565b60006020828403121561123e57600080fd5b8151801515811461124e57600080fd5b9392505050565b60008251611267818460208701611010565b9190910192915050565b60208152600061124e602083018461103456fea2646970667358221220ea4f7fe2fb79a487153a86e34946c46d0dc03e1eb717523b03577a4cf4212c9a64736f6c634300081200334552433230546f6b656e536f757263653a207a65726f2064657374696e617469", } // ERC20TokenSourceABI is the input ABI used to generate the binding from. diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go index c5133c2ce..1c751af93 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go @@ -38,7 +38,7 @@ type TeleporterFeeInfo struct { // NativeTokenDestinationMetaData contains all meta data concerning the NativeTokenDestination contract. var NativeTokenDestinationMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialReserveImbalance_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"burnAddressBalance\",\"type\":\"uint256\"}],\"name\":\"ReportTotalBurnedTxFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"BURN_FOR_TRANSFER_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REPORT_BURNED_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"reportTotalBurnedTxFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalMinted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", - Bin: "0x61012060405273020000000000000000000000000000000000000160805260006002553480156200002f57600080fd5b5060405162001bae38038062001bae833981016040819052620000529162000355565b60016000556001600160a01b038416620000d95760405162461bcd60e51b815260206004820152603860248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2054656c60448201527f65706f727465724d657373656e6765722061646472657373000000000000000060648201526084015b60405180910390fd5b6001600160a01b03841661010052826200013f5760405162461bcd60e51b8152602060048201526031602482015260008051602062001b8e8339815191526044820152701c98d948189b1bd8dad8da185a5b881251607a1b6064820152608401620000d0565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000192573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001b891906200039e565b83036200022e5760405162461bcd60e51b815260206004820152603a60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a2063616e6e6f74206260448201527f726964676520776974682073616d6520626c6f636b636861696e0000000000006064820152608401620000d0565b60a08390526001600160a01b038216620002a05760405162461bcd60e51b8152602060048201526034602482015260008051602062001b8e83398151915260448201527f72636520636f6e747261637420616464726573730000000000000000000000006064820152608401620000d0565b6001600160a01b03821660c0526000819003620003265760405162461bcd60e51b815260206004820152603660248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20696e6960448201527f7469616c207265736572766520696d62616c616e6365000000000000000000006064820152608401620000d0565b60e081905260015550620003b8915050565b80516001600160a01b03811681146200035057600080fd5b919050565b600080600080608085870312156200036c57600080fd5b620003778562000338565b9350602085015192506200038e6040860162000338565b6060959095015193969295505050565b600060208284031215620003b157600080fd5b5051919050565b60805160a05160c05160e0516101005161173d62000451600039600081816102440152818161040c015281816106a50152818161070201526109120152600081816102100152818161030401526103b90152600081816101b10152818161046c015281816107620152610a3501526000818161013c015281816104460152818161073c01526109b101526000610c51015261173d6000f3fe6080604052600436106100e75760003560e01c80638ac7dd201161008a578063ab28523011610059578063ab28523014610297578063c452165e146102ae578063c868efaa146102c6578063d30951261461029757600080fd5b80638ac7dd20146101fe5780639b3e580314610232578063a2309ff814610266578063a2a950171461027c57600080fd5b80633a94fe51116100c65780633a94fe511461015e57806349e3284e146101805780635d93f9af1461019f57806375846562146101eb57600080fd5b8062d872ae146100ec57806318160ddd1461011557806329b7b3fd1461012a575b600080fd5b3480156100f857600080fd5b5061010260015481565b6040519081526020015b60405180910390f35b34801561012157600080fd5b506101026102e6565b34801561013657600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561016a57600080fd5b5061017e6101793660046112bb565b6103f5565b005b34801561018c57600080fd5b506001546040519015815260200161010c565b3480156101ab57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010c565b61017e6101f9366004611327565b6105d0565b34801561020a57600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561023e57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b34801561027257600080fd5b5061010260025481565b34801561028857600080fd5b506101d36001600160981b0181565b3480156102a357600080fd5b50610102620186a081565b3480156102ba57600080fd5b506101d3600160981b81565b3480156102d257600080fd5b5061017e6102e136600461138b565b6108ff565b6000806103006001600160981b0131600160981b3161142a565b90507f0000000000000000000000000000000000000000000000000000000000000000600254610330919061142a565b8111156103b65760405162461bcd60e51b815260206004820152604360248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20464154414c202d2060448201527f636f6e74726163742068617320746f6b656e7320756e6163636f756e746564206064820152623337b960e91b608482015260a4015b60405180910390fd5b807f00000000000000000000000000000000000000000000000000000000000000006002546103e5919061142a565b6103ef919061143d565b91505090565b6000600160981b6001600160a01b031631905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906104aa9190611450565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505050908252506040805160208082018990528251808303820181528284019093529092019161051c91600191606001611506565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161054a9190611581565b6020604051808303816000875af1158015610569573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058d91906115ff565b9050807f2550fa6041684d40e635e29e93dde9017d70c25b46aa88393317b5182ed6ae7c836040516105c191815260200190565b60405180910390a25050505050565b6105d8610d10565b6001600160a01b0384166105fe5760405162461bcd60e51b81526004016103ad90611618565b6001541561066b5760405162461bcd60e51b815260206004820152603460248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20636f6e7472616374604482015273081d5b99195c98dbdb1b185d195c985b1a5e995960621b60648201526084016103ad565b60006020840135156106ca576106916106876020860186611666565b8560200135610d69565b90506106ca6106a36020860186611666565b7f000000000000000000000000000000000000000000000000000000000000000083610ed3565b6040516001600160981b01903480156108fc02916000818181858888f193505050501580156106fd573d6000803e3d6000fd5b5060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906107a09190611450565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250938552505060405160209384019361080e92508d913491016001600160a01b03929092168252602082015260400190565b60408051601f198184030181529082905261082c9291602001611506565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161085a9190611581565b6020604051808303816000875af1158015610879573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061089d91906115ff565b905080866001600160a01b0316336001600160a01b03167f0322cbb1d3c23f6dbf1deddb3b4ef3ce0f93ae6eec7b44e4f395804104466d14346040516108e591815260200190565b60405180910390a450506108f96001600055565b50505050565b610907610d10565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146109af5760405162461bcd60e51b815260206004820152604160248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201527f697a65642054656c65706f727465724d657373656e67657220636f6e747261636064820152601d60fa1b608482015260a4016103ad565b7f00000000000000000000000000000000000000000000000000000000000000008414610a335760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20696e76616c69642060448201526b39b7bab931b29031b430b4b760a11b60648201526084016103ad565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031614610ac85760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201526a34bd32b21039b2b73232b960a91b60648201526084016103ad565b600080610ad78385018561168a565b90925090506001600160a01b038216610b025760405162461bcd60e51b81526004016103ad90611618565b80600003610b665760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2074726160448201526a6e736665722076616c756560a81b60648201526084016103ad565b600154819015610c2b57600154821115610bcf5760015460408051918252600060208301527f244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449910160405180910390a1600154610bc3908361143d565b60006001559050610c2b565b8160016000828254610be1919061143d565b90915550506001546040805184815260208101929092527f244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449910160405180910390a1505050610d06565b6040516327ad555d60e11b81526001600160a01b038481166004830152602482018390527f00000000000000000000000000000000000000000000000000000000000000001690634f5aaaba90604401600060405180830381600087803b158015610c9557600080fd5b505af1158015610ca9573d6000803e3d6000fd5b505050508060026000828254610cbf919061142a565b90915550506040518181526001600160a01b038416907fd949ea0e9d5db53492d77f28fd5467fb2f6c4f5b88e3350e3c36729b76e99cf29060200160405180910390a25050505b6108f96001600055565b600260005403610d625760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016103ad565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015610db2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dd691906115ff565b9050610ded6001600160a01b038516333086610fb8565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610e34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e5891906115ff565b9050818111610ebe5760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016103ad565b610ec8828261143d565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610f24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f4891906115ff565b610f52919061142a565b6040516001600160a01b0385166024820152604481018290529091506108f990859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610ff0565b6040516001600160a01b03808516602483015283166044820152606481018290526108f99085906323b872dd60e01b90608401610f81565b6000611045826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166110c79092919063ffffffff16565b8051909150156110c2578080602001905181019061106391906116b6565b6110c25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103ad565b505050565b60606110d684846000856110de565b949350505050565b60608247101561113f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016103ad565b600080866001600160a01b0316858760405161115b91906116d8565b60006040518083038185875af1925050503d8060008114611198576040519150601f19603f3d011682016040523d82523d6000602084013e61119d565b606091505b50915091506111ae878383876111b9565b979650505050505050565b60608315611228578251600003611221576001600160a01b0385163b6112215760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103ad565b50816110d6565b6110d6838381511561123d5781518083602001fd5b8060405162461bcd60e51b81526004016103ad91906116f4565b60006040828403121561126957600080fd5b50919050565b60008083601f84011261128157600080fd5b50813567ffffffffffffffff81111561129957600080fd5b6020830191508360208260051b85010111156112b457600080fd5b9250929050565b6000806000606084860312156112d057600080fd5b6112da8585611257565b9250604084013567ffffffffffffffff8111156112f657600080fd5b6113028682870161126f565b9497909650939450505050565b6001600160a01b038116811461132457600080fd5b50565b6000806000806080858703121561133d57600080fd5b84356113488161130f565b93506113578660208701611257565b9250606085013567ffffffffffffffff81111561137357600080fd5b61137f8782880161126f565b95989497509550505050565b600080600080606085870312156113a157600080fd5b8435935060208501356113b38161130f565b9250604085013567ffffffffffffffff808211156113d057600080fd5b818701915087601f8301126113e457600080fd5b8135818111156113f357600080fd5b88602082850101111561140557600080fd5b95989497505060200194505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610ecd57610ecd611414565b81810381811115610ecd57610ecd611414565b60006040828403121561146257600080fd5b6040516040810181811067ffffffffffffffff8211171561149357634e487b7160e01b600052604160045260246000fd5b60405282356114a18161130f565b81526020928301359281019290925250919050565b60005b838110156114d15781810151838201526020016114b9565b50506000910152565b600081518084526114f28160208601602086016114b6565b601f01601f19169290920160200192915050565b60006002841061152657634e487b7160e01b600052602160045260246000fd5b838252604060208301526110d660408301846114da565b600081518084526020808501945080840160005b838110156115765781516001600160a01b031687529582019590820190600101611551565b509495945050505050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526115e261010084018261153d565b905060a0840151601f198483030160e0850152610ec882826114da565b60006020828403121561161157600080fd5b5051919050565b6020808252602e908201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2072656360408201526d697069656e74206164647265737360901b606082015260800190565b60006020828403121561167857600080fd5b81356116838161130f565b9392505050565b6000806040838503121561169d57600080fd5b82356116a88161130f565b946020939093013593505050565b6000602082840312156116c857600080fd5b8151801515811461168357600080fd5b600082516116ea8184602087016114b6565b9190910192915050565b60208152600061168360208301846114da56fea26469706673582212203e788042f3e702711fff43e16b2fe5b4ba57bcaa7ce99474ec58f977be39e37b64736f6c634300081200334e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20736f75", + Bin: "0x6101206040527302000000000000000000000000000000000000016080523480156200002a57600080fd5b5060405162001b7938038062001b798339810160408190526200004d9162000350565b60016000556001600160a01b038416620000d45760405162461bcd60e51b815260206004820152603860248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2054656c60448201527f65706f727465724d657373656e6765722061646472657373000000000000000060648201526084015b60405180910390fd5b6001600160a01b03841661010052826200013a5760405162461bcd60e51b8152602060048201526031602482015260008051602062001b598339815191526044820152701c98d948189b1bd8dad8da185a5b881251607a1b6064820152608401620000cb565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200018d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001b3919062000399565b8303620002295760405162461bcd60e51b815260206004820152603a60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a2063616e6e6f74206260448201527f726964676520776974682073616d6520626c6f636b636861696e0000000000006064820152608401620000cb565b60a08390526001600160a01b0382166200029b5760405162461bcd60e51b8152602060048201526034602482015260008051602062001b5983398151915260448201527f72636520636f6e747261637420616464726573730000000000000000000000006064820152608401620000cb565b6001600160a01b03821660c0526000819003620003215760405162461bcd60e51b815260206004820152603660248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20696e6960448201527f7469616c207265736572766520696d62616c616e6365000000000000000000006064820152608401620000cb565b60e081905260015550620003b3915050565b80516001600160a01b03811681146200034b57600080fd5b919050565b600080600080608085870312156200036757600080fd5b620003728562000333565b935060208501519250620003896040860162000333565b6060959095015193969295505050565b600060208284031215620003ac57600080fd5b5051919050565b60805160a05160c05160e051610100516117146200044560003960008181610244015281816103e30152818161067c015281816106d901526108e901526000818161021001526103060152600081816101b101528181610443015281816107390152610a0c01526000818161013c0152818161041d01528181610713015261098801526000610c7d01526117146000f3fe6080604052600436106100e75760003560e01c80638ac7dd201161008a578063ab28523011610059578063ab28523014610297578063c452165e146102ae578063c868efaa146102c6578063d30951261461029757600080fd5b80638ac7dd20146101fe5780639b3e580314610232578063a2309ff814610266578063a2a950171461027c57600080fd5b80633a94fe51116100c65780633a94fe511461015e57806349e3284e146101805780635d93f9af1461019f57806375846562146101eb57600080fd5b8062d872ae146100ec57806318160ddd1461011557806329b7b3fd1461012a575b600080fd5b3480156100f857600080fd5b5061010260015481565b6040519081526020015b60405180910390f35b34801561012157600080fd5b506101026102e6565b34801561013657600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561016a57600080fd5b5061017e610179366004611292565b6103cc565b005b34801561018c57600080fd5b506001546040519015815260200161010c565b3480156101ab57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010c565b61017e6101f93660046112fe565b6105a7565b34801561020a57600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561023e57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b34801561027257600080fd5b5061010260025481565b34801561028857600080fd5b506101d36001600160981b0181565b3480156102a357600080fd5b50610102620186a081565b3480156102ba57600080fd5b506101d3600160981b81565b3480156102d257600080fd5b5061017e6102e1366004611362565b6108d6565b6000806103006001600160981b0131600160981b31611401565b905060007f00000000000000000000000000000000000000000000000000000000000000006002546103329190611401565b9050808211156103bb5760405162461bcd60e51b815260206004820152604360248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20464154414c202d2060448201527f636f6e74726163742068617320746f6b656e7320756e6163636f756e746564206064820152623337b960e91b608482015260a4015b60405180910390fd5b6103c58282611414565b9250505090565b6000600160981b6001600160a01b031631905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906104819190611427565b8152602001620186a08152602001878780806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250604080516020808201899052825180830382018152828401909352909201916104f3916001916060016114dd565b6040516020818303038152906040528152506040518263ffffffff1660e01b81526004016105219190611558565b6020604051808303816000875af1158015610540573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061056491906115d6565b9050807f2550fa6041684d40e635e29e93dde9017d70c25b46aa88393317b5182ed6ae7c8360405161059891815260200190565b60405180910390a25050505050565b6105af610ce7565b6001600160a01b0384166105d55760405162461bcd60e51b81526004016103b2906115ef565b600154156106425760405162461bcd60e51b815260206004820152603460248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20636f6e7472616374604482015273081d5b99195c98dbdb1b185d195c985b1a5e995960621b60648201526084016103b2565b60006020840135156106a15761066861065e602086018661163d565b8560200135610d40565b90506106a161067a602086018661163d565b7f000000000000000000000000000000000000000000000000000000000000000083610eaa565b6040516001600160981b01903480156108fc02916000818181858888f193505050501580156106d4573d6000803e3d6000fd5b5060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906107779190611427565b8152602001620186a08152602001878780806020026020016040519081016040528093929190818152602001838360200280828437600092018290525093855250506040516020938401936107e592508d913491016001600160a01b03929092168252602082015260400190565b60408051601f198184030181529082905261080392916020016114dd565b6040516020818303038152906040528152506040518263ffffffff1660e01b81526004016108319190611558565b6020604051808303816000875af1158015610850573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061087491906115d6565b905080866001600160a01b0316336001600160a01b03167f0322cbb1d3c23f6dbf1deddb3b4ef3ce0f93ae6eec7b44e4f395804104466d14346040516108bc91815260200190565b60405180910390a450506108d06001600055565b50505050565b6108de610ce7565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146109865760405162461bcd60e51b815260206004820152604160248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201527f697a65642054656c65706f727465724d657373656e67657220636f6e747261636064820152601d60fa1b608482015260a4016103b2565b7f00000000000000000000000000000000000000000000000000000000000000008414610a0a5760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20696e76616c69642060448201526b39b7bab931b29031b430b4b760a11b60648201526084016103b2565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031614610a9f5760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201526a34bd32b21039b2b73232b960a91b60648201526084016103b2565b600080610aae83850185611661565b90925090506001600160a01b038216610ad95760405162461bcd60e51b81526004016103b2906115ef565b80600003610b3d5760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2074726160448201526a6e736665722076616c756560a81b60648201526084016103b2565b600154819015610c0257600154821115610ba65760015460408051918252600060208301527f244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449910160405180910390a1600154610b9a9083611414565b60006001559050610c02565b8160016000828254610bb89190611414565b90915550506001546040805184815260208101929092527f244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449910160405180910390a1505050610cdd565b8060026000828254610c149190611401565b90915550506040518181526001600160a01b038416907fd949ea0e9d5db53492d77f28fd5467fb2f6c4f5b88e3350e3c36729b76e99cf29060200160405180910390a26040516327ad555d60e11b81526001600160a01b038481166004830152602482018390527f00000000000000000000000000000000000000000000000000000000000000001690634f5aaaba90604401600060405180830381600087803b158015610cc157600080fd5b505af1158015610cd5573d6000803e3d6000fd5b505050505050505b6108d06001600055565b600260005403610d395760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016103b2565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015610d89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dad91906115d6565b9050610dc46001600160a01b038516333086610f8f565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610e0b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2f91906115d6565b9050818111610e955760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016103b2565b610e9f8282611414565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610efb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1f91906115d6565b610f299190611401565b6040516001600160a01b0385166024820152604481018290529091506108d090859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610fc7565b6040516001600160a01b03808516602483015283166044820152606481018290526108d09085906323b872dd60e01b90608401610f58565b600061101c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661109e9092919063ffffffff16565b805190915015611099578080602001905181019061103a919061168d565b6110995760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103b2565b505050565b60606110ad84846000856110b5565b949350505050565b6060824710156111165760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016103b2565b600080866001600160a01b0316858760405161113291906116af565b60006040518083038185875af1925050503d806000811461116f576040519150601f19603f3d011682016040523d82523d6000602084013e611174565b606091505b509150915061118587838387611190565b979650505050505050565b606083156111ff5782516000036111f8576001600160a01b0385163b6111f85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103b2565b50816110ad565b6110ad83838151156112145781518083602001fd5b8060405162461bcd60e51b81526004016103b291906116cb565b60006040828403121561124057600080fd5b50919050565b60008083601f84011261125857600080fd5b50813567ffffffffffffffff81111561127057600080fd5b6020830191508360208260051b850101111561128b57600080fd5b9250929050565b6000806000606084860312156112a757600080fd5b6112b1858561122e565b9250604084013567ffffffffffffffff8111156112cd57600080fd5b6112d986828701611246565b9497909650939450505050565b6001600160a01b03811681146112fb57600080fd5b50565b6000806000806080858703121561131457600080fd5b843561131f816112e6565b935061132e866020870161122e565b9250606085013567ffffffffffffffff81111561134a57600080fd5b61135687828801611246565b95989497509550505050565b6000806000806060858703121561137857600080fd5b84359350602085013561138a816112e6565b9250604085013567ffffffffffffffff808211156113a757600080fd5b818701915087601f8301126113bb57600080fd5b8135818111156113ca57600080fd5b8860208285010111156113dc57600080fd5b95989497505060200194505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610ea457610ea46113eb565b81810381811115610ea457610ea46113eb565b60006040828403121561143957600080fd5b6040516040810181811067ffffffffffffffff8211171561146a57634e487b7160e01b600052604160045260246000fd5b6040528235611478816112e6565b81526020928301359281019290925250919050565b60005b838110156114a8578181015183820152602001611490565b50506000910152565b600081518084526114c981602086016020860161148d565b601f01601f19169290920160200192915050565b6000600284106114fd57634e487b7160e01b600052602160045260246000fd5b838252604060208301526110ad60408301846114b1565b600081518084526020808501945080840160005b8381101561154d5781516001600160a01b031687529582019590820190600101611528565b509495945050505050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526115b9610100840182611514565b905060a0840151601f198483030160e0850152610e9f82826114b1565b6000602082840312156115e857600080fd5b5051919050565b6020808252602e908201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2072656360408201526d697069656e74206164647265737360901b606082015260800190565b60006020828403121561164f57600080fd5b813561165a816112e6565b9392505050565b6000806040838503121561167457600080fd5b823561167f816112e6565b946020939093013593505050565b60006020828403121561169f57600080fd5b8151801515811461165a57600080fd5b600082516116c181846020870161148d565b9190910192915050565b60208152600061165a60208301846114b156fea2646970667358221220e4ff8375afe0a7438d4c5446853ab4d184e745332a484d87a3229480c294208764736f6c634300081200334e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20736f75", } // NativeTokenDestinationABI is the input ABI used to generate the binding from. diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go index 92906f1dc..2269b57fc 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go @@ -38,7 +38,7 @@ type TeleporterFeeInfo struct { // NativeTokenSourceMetaData contains all meta data concerning the NativeTokenSource contract. var NativeTokenSourceMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBurnedTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", - Bin: "0x60e06040523480156200001157600080fd5b5060405162001675380380620016758339810160408190526200003491620002b3565b60016000556001600160a01b038316620000bb5760405162461bcd60e51b815260206004820152603360248201527f4e6174697665546f6b656e536f757263653a207a65726f2054656c65706f727460448201527f65724d657373656e67657220616464726573730000000000000000000000000060648201526084015b60405180910390fd5b6001600160a01b03831660c05281620001205760405162461bcd60e51b81526020600482015260316024820152600080516020620016558339815191526044820152701a5bdb88189b1bd8dad8da185a5b881251607a1b6064820152608401620000b2565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000173573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001999190620002f4565b82036200020f5760405162461bcd60e51b815260206004820152603560248201527f4e6174697665546f6b656e536f757263653a2063616e6e6f742062726964676560448201527f20776974682073616d6520626c6f636b636861696e00000000000000000000006064820152608401620000b2565b60808290526001600160a01b038116620002815760405162461bcd60e51b815260206004820152603460248201526000805160206200165583398151915260448201527f696f6e20636f6e747261637420616464726573730000000000000000000000006064820152608401620000b2565b6001600160a01b031660a052506200030e9050565b80516001600160a01b0381168114620002ae57600080fd5b919050565b600080600060608486031215620002c957600080fd5b620002d48462000296565b925060208401519150620002eb6040850162000296565b90509250925092565b6000602082840312156200030757600080fd5b5051919050565b60805160a05160c0516112e86200036d6000396000818160ef015281816102320152818161025b015261044e015260008181610167015281816102bb015261056701526000818160920152818161029501526104e301526112e86000f3fe60806040526004361061007b5760003560e01c8063b6171f731161004e578063b6171f731461013e578063b8c9091a14610155578063c452165e14610189578063c868efaa146101a157600080fd5b806341d3014d1461008057806355db3e9e146100c75780639b3e5803146100dd578063ad0aee2514610129575b600080fd5b34801561008c57600080fd5b506100b47f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b3480156100d357600080fd5b506100b460015481565b3480156100e957600080fd5b506101117f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100be565b61013c610137366004610de5565b6101c1565b005b34801561014a57600080fd5b506100b4620186a081565b34801561016157600080fd5b506101117f000000000000000000000000000000000000000000000000000000000000000081565b34801561019557600080fd5b50610111600160981b81565b3480156101ad57600080fd5b5061013c6101bc366004610e84565b61043b565b6101c96106ec565b6001600160a01b0384166101f85760405162461bcd60e51b81526004016101ef90610efe565b60405180910390fd5b60006020840135156102575761021e6102146020860186610f47565b8560200135610745565b90506102576102306020860186610f47565b7f0000000000000000000000000000000000000000000000000000000000000000836108af565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906102f99190610fb2565b8152602001620186a08152602001878780806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250604051602091820191610368918c913491016001600160a01b03929092168252602082015260400190565b6040516020818303038152906040528152506040518263ffffffff1660e01b8152600401610396919061109e565b6020604051808303816000875af11580156103b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d9919061111c565b905080866001600160a01b0316336001600160a01b03167f2b4e8f08417773e367064a6aea9ca2df303a60876676f70b6c3c5e66b314ca5a3460405161042191815260200190565b60405180910390a450506104356001600055565b50505050565b6104436106ec565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146104e15760405162461bcd60e51b815260206004820152603c60248201527f4e6174697665546f6b656e536f757263653a20756e617574686f72697a65642060448201527f54656c65706f727465724d657373656e67657220636f6e74726163740000000060648201526084016101ef565b7f000000000000000000000000000000000000000000000000000000000000000084146105655760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e536f757263653a20696e76616c696420646573746960448201526b3730ba34b7b71031b430b4b760a11b60648201526084016101ef565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316146105f55760405162461bcd60e51b815260206004820152602660248201527f4e6174697665546f6b656e536f757263653a20756e617574686f72697a65642060448201526539b2b73232b960d11b60648201526084016101ef565b60008061060483850185611135565b9092509050600082600181111561061d5761061d6111e1565b0361064e576000808280602001905181019061063991906111f7565b915091506106478282610994565b50506106e0565b6001826001811115610662576106626111e1565b0361068e5760008180602001905181019061067d919061111c565b905061068881610a9a565b506106e0565b60405162461bcd60e51b815260206004820152602160248201527f4e6174697665546f6b656e536f757263653a20696e76616c696420616374696f6044820152603760f91b60648201526084016101ef565b50506104356001600055565b60026000540361073e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101ef565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa15801561078e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b2919061111c565b90506107c96001600160a01b038516333086610ac9565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610810573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610834919061111c565b905081811161089a5760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016101ef565b6108a4828261123b565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610900573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610924919061111c565b61092e919061124e565b6040516001600160a01b03851660248201526044810182905290915061043590859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610b01565b6001600160a01b0382166109ba5760405162461bcd60e51b81526004016101ef90610efe565b80471015610a1d5760405162461bcd60e51b815260206004820152602a60248201527f4e6174697665546f6b656e536f757263653a20696e73756666696369656e742060448201526918dbdb1b185d195c985b60b21b60648201526084016101ef565b6040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015610a53573d6000803e3d6000fd5b50604080516001600160a01b0384168152602081018390527f55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407910160405180910390a15050565b600154811115610ac657600060015482610ab4919061123b565b9050610abf81610bd8565b5060018190555b50565b6040516001600160a01b03808516602483015283166044820152606481018290526104359085906323b872dd60e01b9060840161095d565b6000610b56826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c409092919063ffffffff16565b805190915015610bd35780806020019051810190610b749190611261565b610bd35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016101ef565b505050565b604051600160981b9082156108fc029083906000818181858888f19350505050158015610c09573d6000803e3d6000fd5b506040518181527f2cd3fd70cd5a5d6d805e90d22741aa1a84590ace7cf01b244719558d266143829060200160405180910390a150565b6060610c4f8484600085610c57565b949350505050565b606082471015610cb85760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016101ef565b600080866001600160a01b03168587604051610cd49190611283565b60006040518083038185875af1925050503d8060008114610d11576040519150601f19603f3d011682016040523d82523d6000602084013e610d16565b606091505b5091509150610d2787838387610d32565b979650505050505050565b60608315610da1578251600003610d9a576001600160a01b0385163b610d9a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101ef565b5081610c4f565b610c4f8383815115610db65781518083602001fd5b8060405162461bcd60e51b81526004016101ef919061129f565b6001600160a01b0381168114610ac657600080fd5b6000806000808486036080811215610dfc57600080fd5b8535610e0781610dd0565b94506040601f1982011215610e1b57600080fd5b50602085019250606085013567ffffffffffffffff80821115610e3d57600080fd5b818701915087601f830112610e5157600080fd5b813581811115610e6057600080fd5b8860208260051b8501011115610e7557600080fd5b95989497505060200194505050565b60008060008060608587031215610e9a57600080fd5b843593506020850135610eac81610dd0565b9250604085013567ffffffffffffffff80821115610ec957600080fd5b818701915087601f830112610edd57600080fd5b813581811115610eec57600080fd5b886020828501011115610e7557600080fd5b60208082526029908201527f4e6174697665546f6b656e536f757263653a207a65726f20726563697069656e60408201526874206164647265737360b81b606082015260800190565b600060208284031215610f5957600080fd5b8135610f6481610dd0565b9392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610faa57610faa610f6b565b604052919050565b600060408284031215610fc457600080fd5b6040516040810181811067ffffffffffffffff82111715610fe757610fe7610f6b565b6040528235610ff581610dd0565b81526020928301359281019290925250919050565b600081518084526020808501945080840160005b838110156110435781516001600160a01b03168752958201959082019060010161101e565b509495945050505050565b60005b83811015611069578181015183820152602001611051565b50506000910152565b6000815180845261108a81602086016020860161104e565b601f01601f19169290920160200192915050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526110ff61010084018261100a565b905060a0840151601f198483030160e08501526108a48282611072565b60006020828403121561112e57600080fd5b5051919050565b6000806040838503121561114857600080fd5b82356002811061115757600080fd5b915060208381013567ffffffffffffffff8082111561117557600080fd5b818601915086601f83011261118957600080fd5b81358181111561119b5761119b610f6b565b6111ad601f8201601f19168501610f81565b915080825287848285010111156111c357600080fd5b80848401858401376000848284010152508093505050509250929050565b634e487b7160e01b600052602160045260246000fd5b6000806040838503121561120a57600080fd5b825161121581610dd0565b6020939093015192949293505050565b634e487b7160e01b600052601160045260246000fd5b818103818111156108a9576108a9611225565b808201808211156108a9576108a9611225565b60006020828403121561127357600080fd5b81518015158114610f6457600080fd5b6000825161129581846020870161104e565b9190910192915050565b602081526000610f64602083018461107256fea26469706673582212202de39d30a1e98266c786b6775ff737a5f0c1b3469b5b69292101ed33301eab8a64736f6c634300081200334e6174697665546f6b656e536f757263653a207a65726f2064657374696e6174", + Bin: "0x60e06040523480156200001157600080fd5b5060405162001670380380620016708339810160408190526200003491620002b3565b60016000556001600160a01b038316620000bb5760405162461bcd60e51b815260206004820152603360248201527f4e6174697665546f6b656e536f757263653a207a65726f2054656c65706f727460448201527f65724d657373656e67657220616464726573730000000000000000000000000060648201526084015b60405180910390fd5b6001600160a01b03831660c05281620001205760405162461bcd60e51b81526020600482015260316024820152600080516020620016508339815191526044820152701a5bdb88189b1bd8dad8da185a5b881251607a1b6064820152608401620000b2565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000173573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001999190620002f4565b82036200020f5760405162461bcd60e51b815260206004820152603560248201527f4e6174697665546f6b656e536f757263653a2063616e6e6f742062726964676560448201527f20776974682073616d6520626c6f636b636861696e00000000000000000000006064820152608401620000b2565b60808290526001600160a01b038116620002815760405162461bcd60e51b815260206004820152603460248201526000805160206200165083398151915260448201527f696f6e20636f6e747261637420616464726573730000000000000000000000006064820152608401620000b2565b6001600160a01b031660a052506200030e9050565b80516001600160a01b0381168114620002ae57600080fd5b919050565b600080600060608486031215620002c957600080fd5b620002d48462000296565b925060208401519150620002eb6040850162000296565b90509250925092565b6000602082840312156200030757600080fd5b5051919050565b60805160a05160c0516112e36200036d6000396000818160ef015281816102320152818161025b015261044e015260008181610167015281816102bb015261056701526000818160920152818161029501526104e301526112e36000f3fe60806040526004361061007b5760003560e01c8063b6171f731161004e578063b6171f731461013e578063b8c9091a14610155578063c452165e14610189578063c868efaa146101a157600080fd5b806341d3014d1461008057806355db3e9e146100c75780639b3e5803146100dd578063ad0aee2514610129575b600080fd5b34801561008c57600080fd5b506100b47f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b3480156100d357600080fd5b506100b460015481565b3480156100e957600080fd5b506101117f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100be565b61013c610137366004610de0565b6101c1565b005b34801561014a57600080fd5b506100b4620186a081565b34801561016157600080fd5b506101117f000000000000000000000000000000000000000000000000000000000000000081565b34801561019557600080fd5b50610111600160981b81565b3480156101ad57600080fd5b5061013c6101bc366004610e7f565b61043b565b6101c96106ec565b6001600160a01b0384166101f85760405162461bcd60e51b81526004016101ef90610ef9565b60405180910390fd5b60006020840135156102575761021e6102146020860186610f42565b8560200135610745565b90506102576102306020860186610f42565b7f0000000000000000000000000000000000000000000000000000000000000000836108af565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906102f99190610fad565b8152602001620186a08152602001878780806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250604051602091820191610368918c913491016001600160a01b03929092168252602082015260400190565b6040516020818303038152906040528152506040518263ffffffff1660e01b81526004016103969190611099565b6020604051808303816000875af11580156103b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d99190611117565b905080866001600160a01b0316336001600160a01b03167f2b4e8f08417773e367064a6aea9ca2df303a60876676f70b6c3c5e66b314ca5a3460405161042191815260200190565b60405180910390a450506104356001600055565b50505050565b6104436106ec565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146104e15760405162461bcd60e51b815260206004820152603c60248201527f4e6174697665546f6b656e536f757263653a20756e617574686f72697a65642060448201527f54656c65706f727465724d657373656e67657220636f6e74726163740000000060648201526084016101ef565b7f000000000000000000000000000000000000000000000000000000000000000084146105655760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e536f757263653a20696e76616c696420646573746960448201526b3730ba34b7b71031b430b4b760a11b60648201526084016101ef565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316146105f55760405162461bcd60e51b815260206004820152602660248201527f4e6174697665546f6b656e536f757263653a20756e617574686f72697a65642060448201526539b2b73232b960d11b60648201526084016101ef565b60008061060483850185611130565b9092509050600082600181111561061d5761061d6111dc565b0361064e576000808280602001905181019061063991906111f2565b915091506106478282610994565b50506106e0565b6001826001811115610662576106626111dc565b0361068e5760008180602001905181019061067d9190611117565b905061068881610a9a565b506106e0565b60405162461bcd60e51b815260206004820152602160248201527f4e6174697665546f6b656e536f757263653a20696e76616c696420616374696f6044820152603760f91b60648201526084016101ef565b50506104356001600055565b60026000540361073e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101ef565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa15801561078e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b29190611117565b90506107c96001600160a01b038516333086610ac9565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610810573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108349190611117565b905081811161089a5760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016101ef565b6108a48282611236565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610900573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109249190611117565b61092e9190611249565b6040516001600160a01b03851660248201526044810182905290915061043590859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610b01565b6001600160a01b0382166109ba5760405162461bcd60e51b81526004016101ef90610ef9565b80471015610a1d5760405162461bcd60e51b815260206004820152602a60248201527f4e6174697665546f6b656e536f757263653a20696e73756666696369656e742060448201526918dbdb1b185d195c985b60b21b60648201526084016101ef565b604080516001600160a01b0384168152602081018390527f55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407910160405180910390a16040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015610a95573d6000803e3d6000fd5b505050565b600154811115610ac657600060015482610ab49190611236565b9050610abf81610bd3565b5060018190555b50565b6040516001600160a01b03808516602483015283166044820152606481018290526104359085906323b872dd60e01b9060840161095d565b6000610b56826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c3b9092919063ffffffff16565b805190915015610a955780806020019051810190610b74919061125c565b610a955760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016101ef565b6040518181527f2cd3fd70cd5a5d6d805e90d22741aa1a84590ace7cf01b244719558d266143829060200160405180910390a1604051600160981b9082156108fc029083906000818181858888f19350505050158015610c37573d6000803e3d6000fd5b5050565b6060610c4a8484600085610c52565b949350505050565b606082471015610cb35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016101ef565b600080866001600160a01b03168587604051610ccf919061127e565b60006040518083038185875af1925050503d8060008114610d0c576040519150601f19603f3d011682016040523d82523d6000602084013e610d11565b606091505b5091509150610d2287838387610d2d565b979650505050505050565b60608315610d9c578251600003610d95576001600160a01b0385163b610d955760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101ef565b5081610c4a565b610c4a8383815115610db15781518083602001fd5b8060405162461bcd60e51b81526004016101ef919061129a565b6001600160a01b0381168114610ac657600080fd5b6000806000808486036080811215610df757600080fd5b8535610e0281610dcb565b94506040601f1982011215610e1657600080fd5b50602085019250606085013567ffffffffffffffff80821115610e3857600080fd5b818701915087601f830112610e4c57600080fd5b813581811115610e5b57600080fd5b8860208260051b8501011115610e7057600080fd5b95989497505060200194505050565b60008060008060608587031215610e9557600080fd5b843593506020850135610ea781610dcb565b9250604085013567ffffffffffffffff80821115610ec457600080fd5b818701915087601f830112610ed857600080fd5b813581811115610ee757600080fd5b886020828501011115610e7057600080fd5b60208082526029908201527f4e6174697665546f6b656e536f757263653a207a65726f20726563697069656e60408201526874206164647265737360b81b606082015260800190565b600060208284031215610f5457600080fd5b8135610f5f81610dcb565b9392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610fa557610fa5610f66565b604052919050565b600060408284031215610fbf57600080fd5b6040516040810181811067ffffffffffffffff82111715610fe257610fe2610f66565b6040528235610ff081610dcb565b81526020928301359281019290925250919050565b600081518084526020808501945080840160005b8381101561103e5781516001600160a01b031687529582019590820190600101611019565b509495945050505050565b60005b8381101561106457818101518382015260200161104c565b50506000910152565b60008151808452611085816020860160208601611049565b601f01601f19169290920160200192915050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526110fa610100840182611005565b905060a0840151601f198483030160e08501526108a4828261106d565b60006020828403121561112957600080fd5b5051919050565b6000806040838503121561114357600080fd5b82356002811061115257600080fd5b915060208381013567ffffffffffffffff8082111561117057600080fd5b818601915086601f83011261118457600080fd5b81358181111561119657611196610f66565b6111a8601f8201601f19168501610f7c565b915080825287848285010111156111be57600080fd5b80848401858401376000848284010152508093505050509250929050565b634e487b7160e01b600052602160045260246000fd5b6000806040838503121561120557600080fd5b825161121081610dcb565b6020939093015192949293505050565b634e487b7160e01b600052601160045260246000fd5b818103818111156108a9576108a9611220565b808201808211156108a9576108a9611220565b60006020828403121561126e57600080fd5b81518015158114610f5f57600080fd5b60008251611290818460208701611049565b9190910192915050565b602081526000610f5f602083018461106d56fea2646970667358221220c9ebc52d00bfb00d8357a20ede43fe06a3f9ec0e2fe10a9ea08132fdcf6a570264736f6c634300081200334e6174697665546f6b656e536f757263653a207a65726f2064657374696e6174", } // NativeTokenSourceABI is the input ABI used to generate the binding from. diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol index b38af09bd..0b07a7283 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol @@ -195,21 +195,20 @@ contract ERC20TokenSource is ); // Transfer to recipient - SafeERC20.safeTransfer(IERC20(erc20ContractAddress), recipient, amount); - emit UnlockTokens(recipient, amount); + SafeERC20.safeTransfer(IERC20(erc20ContractAddress), recipient, amount); } /** * @dev Sends tokens to BURNED_TX_FEES_ADDRESS. */ function _burnTokens(uint256 amount) private { + emit BurnTokens(amount); SafeERC20.safeTransfer( IERC20(erc20ContractAddress), BURNED_TX_FEES_ADDRESS, amount ); - emit BurnTokens(amount); } /** diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol index b34d74105..f789a201e 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol @@ -61,4 +61,12 @@ interface INativeTokenDestination { * @dev Returns a best-estimate (upper bound) of tokens in circulation on this chain. */ function totalSupply() external view returns (uint256); + + /** + * @dev Reports the current total burned transaction fees on this chain to the source chain. + */ + function reportTotalBurnedTxFees( + TeleporterFeeInfo calldata feeInfo, + address[] calldata allowedRelayerAddresses + ) external; } diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index f961451ad..f1709f200 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -45,7 +45,7 @@ contract NativeTokenDestination is // This means tokens will not be minted until the source contact is collateralized. uint256 public immutable initialReserveImbalance; uint256 public currentReserveImbalance; - uint256 public totalMinted = 0; + uint256 public totalMinted; // Used for sending and receiving Teleporter messages. ITeleporterMessenger public immutable teleporterMessenger; @@ -149,10 +149,10 @@ contract NativeTokenDestination is } } - // Calls NativeMinter precompile through INativeMinter interface. - _nativeMinter.mintNativeCoin(recipient, adjustedAmount); totalMinted += adjustedAmount; emit NativeTokensMinted(recipient, adjustedAmount); + // Calls NativeMinter precompile through INativeMinter interface. + _nativeMinter.mintNativeCoin(recipient, adjustedAmount); } /** @@ -256,13 +256,14 @@ contract NativeTokenDestination is function totalSupply() external view returns (uint256) { uint256 burned = address(BURNED_TX_FEES_ADDRESS).balance + address(BURN_FOR_TRANSFER_ADDRESS).balance; + uint256 created = totalMinted + initialReserveImbalance; // This scenario should never happen, but this check will prevent an underflow // where the contract would return a garbage value. require( - burned <= totalMinted + initialReserveImbalance, + burned <= created, "NativeTokenDestination: FATAL - contract has tokens unaccounted for" ); - return totalMinted + initialReserveImbalance - burned; + return created - burned; } } diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index 057028e75..890c30a96 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -179,17 +179,16 @@ contract NativeTokenSource is ); // Transfer to recipient - payable(recipient).transfer(amount); - emit UnlockTokens(recipient, amount); + payable(recipient).transfer(amount); } /** * @dev Sends tokens to BURNED_TX_FEES_ADDRESS. */ function _burnTokens(uint256 amount) private { - payable(BURNED_TX_FEES_ADDRESS).transfer(amount); emit BurnTokens(amount); + payable(BURNED_TX_FEES_ADDRESS).transfer(amount); } /** diff --git a/tests/flows/erc20_to_native_token_bridge.go b/tests/flows/erc20_to_native_token_bridge.go index 04c1f7c40..4a9d0504e 100644 --- a/tests/flows/erc20_to_native_token_bridge.go +++ b/tests/flows/erc20_to_native_token_bridge.go @@ -19,7 +19,7 @@ import ( . "github.com/onsi/gomega" ) -func ERC20ToNativeTokenBridge(network interfaces.Network) { +func ERC20ToNativeTokenBridge(network interfaces.LocalNetwork) { const ( // This test needs a unique deployer key, whose nonce 0 is used to deploy the bridge contract // on each chain. The address of the resulting contract has been added to the genesis file as @@ -46,9 +46,7 @@ func ERC20ToNativeTokenBridge(network interfaces.Network) { } ) - subnets := network.GetSubnetsInfo() - subnetA := subnets[0] - subnetB := subnets[1] + subnetA, subnetB, _ := utils.GetThreeSubnets(network) teleporterContractAddress := network.GetTeleporterContractAddress() // Info we need to calculate for the test @@ -196,7 +194,8 @@ func ERC20ToNativeTokenBridge(network interfaces.Network) { return receipt } - { // Give erc20TokenSource allowance to spend all of the deployer's ERC20 Tokens + { + // Give erc20TokenSource allowance to spend all of the deployer's ERC20 Tokens bal, err := exampleERC20.BalanceOf(nil, deployerAddress) Expect(err).Should(BeNil()) @@ -208,9 +207,9 @@ func ERC20ToNativeTokenBridge(network interfaces.Network) { utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetA) } - { // Transfer some tokens A -> B + { + // Transfer some tokens A -> B // Check starting balance is 0 - utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) checkReserveImbalance(initialReserveImbalance, nativeTokenDestination) @@ -236,7 +235,8 @@ func ERC20ToNativeTokenBridge(network interfaces.Network) { utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) } - { // Fail to Transfer tokens B -> A because bridge is not collateralized + { + // Fail to Transfer tokens B -> A because bridge is not collateralized // Check starting balance is 0 utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) @@ -290,7 +290,8 @@ func ERC20ToNativeTokenBridge(network interfaces.Network) { utils.CheckBalance(ctx, tokenReceiverAddress, valueToSend, subnetB.WSClient) } - { // Transfer tokens B -> A + { + // Transfer tokens B -> A sourceChainReceipt := sendTokensToSource(valueToReturn, deployerPK, tokenReceiverAddress) checkUnlockERC20Event( @@ -305,7 +306,8 @@ func ERC20ToNativeTokenBridge(network interfaces.Network) { utils.ExpectBigEqual(bal, valueToReturn) } - { // Check reporting of burned tx fees to Source Chain + { + // Check reporting of burned tx fees to Source Chain burnedTxFeesBalanceDest, err := subnetB.WSClient.BalanceAt( ctx, burnedTxFeeAddress, diff --git a/tests/flows/native_token_bridge.go b/tests/flows/native_token_bridge.go index b814a9795..88b1bae47 100644 --- a/tests/flows/native_token_bridge.go +++ b/tests/flows/native_token_bridge.go @@ -18,7 +18,7 @@ import ( . "github.com/onsi/gomega" ) -func NativeTokenBridge(network interfaces.Network) { +func NativeTokenBridge(network interfaces.LocalNetwork) { const ( // This test needs a unique deployer key, whose nonce 0 is used to deploy the bridge contract // on each chain. The address of the resulting contract has been added to the genesis file as @@ -46,9 +46,7 @@ func NativeTokenBridge(network interfaces.Network) { } ) - subnets := network.GetSubnetsInfo() - subnetA := subnets[0] - subnetB := subnets[1] + subnetA, subnetB, _ := utils.GetThreeSubnets(network) teleporterContractAddress := network.GetTeleporterContractAddress() // Info we need to calculate for the test @@ -58,7 +56,8 @@ func NativeTokenBridge(network interfaces.Network) { Expect(err).Should(BeNil()) log.Info("Native Token Bridge Contract Address: " + bridgeContractAddress.Hex()) - { // Deploy the contracts + { + // Deploy the contracts // Both contracts in this test will be deployed to 0xAcB633F5B00099c7ec187eB00156c5cd9D854b5B, // though they do not necessarily have to be deployed at the same address, each contract needs // to know the address of the other. @@ -181,7 +180,8 @@ func NativeTokenBridge(network interfaces.Network) { return receipt } - { // Transfer some tokens A -> B + { + // Transfer some tokens A -> B // Check starting balance is 0 utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) @@ -210,7 +210,8 @@ func NativeTokenBridge(network interfaces.Network) { utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) } - { // Fail to Transfer tokens B -> A because bridge is not collateralized + { + // Fail to Transfer tokens B -> A because bridge is not collateralized // Check starting balance is 0 utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetA.WSClient) @@ -231,7 +232,8 @@ func NativeTokenBridge(network interfaces.Network) { utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetA.WSClient) } - { // Transfer more tokens A -> B to collateralize the bridge + { + // Transfer more tokens A -> B to collateralize the bridge // Check starting balance is 0 utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) checkReserveImbalance( @@ -263,7 +265,8 @@ func NativeTokenBridge(network interfaces.Network) { utils.CheckBalance(ctx, tokenReceiverAddress, valueToSend, subnetB.WSClient) } - { // Transfer tokens B -> A + { + // Transfer tokens B -> A sourceChainReceipt := sendTokensToSource(valueToReturn, deployerPK, tokenReceiverAddress) checkUnlockNativeEvent( @@ -276,7 +279,8 @@ func NativeTokenBridge(network interfaces.Network) { utils.CheckBalance(ctx, tokenReceiverAddress, valueToReturn, subnetA.WSClient) } - { // Check reporting of burned tx fees to Source Chain + { + // Check reporting of burned tx fees to Source Chain burnedTxFeesBalanceDest, err := subnetB.WSClient.BalanceAt( ctx, burnedTxFeeAddress, From c21713976a2163a7f70a30147a6825319dd67afb Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Thu, 7 Dec 2023 10:01:53 -0500 Subject: [PATCH 178/183] linter --- .../INativeTokenDestination.sol | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol index f789a201e..285711acb 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol @@ -50,6 +50,14 @@ interface INativeTokenDestination { address[] calldata allowedRelayerAddresses ) external payable; + /** + * @dev Reports the current total burned transaction fees on this chain to the source chain. + */ + function reportTotalBurnedTxFees( + TeleporterFeeInfo calldata feeInfo, + address[] calldata allowedRelayerAddresses + ) external; + /** * @dev Returns true if the reserve imbalance for this contract has been accounted for. * When this is true, all tokens sent to this chain will be minted, and sending tokens @@ -61,12 +69,4 @@ interface INativeTokenDestination { * @dev Returns a best-estimate (upper bound) of tokens in circulation on this chain. */ function totalSupply() external view returns (uint256); - - /** - * @dev Reports the current total burned transaction fees on this chain to the source chain. - */ - function reportTotalBurnedTxFees( - TeleporterFeeInfo calldata feeInfo, - address[] calldata allowedRelayerAddresses - ) external; } From 712538cf4c701c8078e638a7f11165a1dd1be9c4 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Thu, 7 Dec 2023 10:07:12 -0500 Subject: [PATCH 179/183] bindings --- .../NativeTokenDestination/NativeTokenDestination.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go index 1c751af93..7e7c2ad6a 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go @@ -38,7 +38,7 @@ type TeleporterFeeInfo struct { // NativeTokenDestinationMetaData contains all meta data concerning the NativeTokenDestination contract. var NativeTokenDestinationMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialReserveImbalance_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"burnAddressBalance\",\"type\":\"uint256\"}],\"name\":\"ReportTotalBurnedTxFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"BURN_FOR_TRANSFER_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REPORT_BURNED_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"reportTotalBurnedTxFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalMinted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", - Bin: "0x6101206040527302000000000000000000000000000000000000016080523480156200002a57600080fd5b5060405162001b7938038062001b798339810160408190526200004d9162000350565b60016000556001600160a01b038416620000d45760405162461bcd60e51b815260206004820152603860248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2054656c60448201527f65706f727465724d657373656e6765722061646472657373000000000000000060648201526084015b60405180910390fd5b6001600160a01b03841661010052826200013a5760405162461bcd60e51b8152602060048201526031602482015260008051602062001b598339815191526044820152701c98d948189b1bd8dad8da185a5b881251607a1b6064820152608401620000cb565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200018d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001b3919062000399565b8303620002295760405162461bcd60e51b815260206004820152603a60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a2063616e6e6f74206260448201527f726964676520776974682073616d6520626c6f636b636861696e0000000000006064820152608401620000cb565b60a08390526001600160a01b0382166200029b5760405162461bcd60e51b8152602060048201526034602482015260008051602062001b5983398151915260448201527f72636520636f6e747261637420616464726573730000000000000000000000006064820152608401620000cb565b6001600160a01b03821660c0526000819003620003215760405162461bcd60e51b815260206004820152603660248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20696e6960448201527f7469616c207265736572766520696d62616c616e6365000000000000000000006064820152608401620000cb565b60e081905260015550620003b3915050565b80516001600160a01b03811681146200034b57600080fd5b919050565b600080600080608085870312156200036757600080fd5b620003728562000333565b935060208501519250620003896040860162000333565b6060959095015193969295505050565b600060208284031215620003ac57600080fd5b5051919050565b60805160a05160c05160e051610100516117146200044560003960008181610244015281816103e30152818161067c015281816106d901526108e901526000818161021001526103060152600081816101b101528181610443015281816107390152610a0c01526000818161013c0152818161041d01528181610713015261098801526000610c7d01526117146000f3fe6080604052600436106100e75760003560e01c80638ac7dd201161008a578063ab28523011610059578063ab28523014610297578063c452165e146102ae578063c868efaa146102c6578063d30951261461029757600080fd5b80638ac7dd20146101fe5780639b3e580314610232578063a2309ff814610266578063a2a950171461027c57600080fd5b80633a94fe51116100c65780633a94fe511461015e57806349e3284e146101805780635d93f9af1461019f57806375846562146101eb57600080fd5b8062d872ae146100ec57806318160ddd1461011557806329b7b3fd1461012a575b600080fd5b3480156100f857600080fd5b5061010260015481565b6040519081526020015b60405180910390f35b34801561012157600080fd5b506101026102e6565b34801561013657600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561016a57600080fd5b5061017e610179366004611292565b6103cc565b005b34801561018c57600080fd5b506001546040519015815260200161010c565b3480156101ab57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010c565b61017e6101f93660046112fe565b6105a7565b34801561020a57600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561023e57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b34801561027257600080fd5b5061010260025481565b34801561028857600080fd5b506101d36001600160981b0181565b3480156102a357600080fd5b50610102620186a081565b3480156102ba57600080fd5b506101d3600160981b81565b3480156102d257600080fd5b5061017e6102e1366004611362565b6108d6565b6000806103006001600160981b0131600160981b31611401565b905060007f00000000000000000000000000000000000000000000000000000000000000006002546103329190611401565b9050808211156103bb5760405162461bcd60e51b815260206004820152604360248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20464154414c202d2060448201527f636f6e74726163742068617320746f6b656e7320756e6163636f756e746564206064820152623337b960e91b608482015260a4015b60405180910390fd5b6103c58282611414565b9250505090565b6000600160981b6001600160a01b031631905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906104819190611427565b8152602001620186a08152602001878780806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250604080516020808201899052825180830382018152828401909352909201916104f3916001916060016114dd565b6040516020818303038152906040528152506040518263ffffffff1660e01b81526004016105219190611558565b6020604051808303816000875af1158015610540573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061056491906115d6565b9050807f2550fa6041684d40e635e29e93dde9017d70c25b46aa88393317b5182ed6ae7c8360405161059891815260200190565b60405180910390a25050505050565b6105af610ce7565b6001600160a01b0384166105d55760405162461bcd60e51b81526004016103b2906115ef565b600154156106425760405162461bcd60e51b815260206004820152603460248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20636f6e7472616374604482015273081d5b99195c98dbdb1b185d195c985b1a5e995960621b60648201526084016103b2565b60006020840135156106a15761066861065e602086018661163d565b8560200135610d40565b90506106a161067a602086018661163d565b7f000000000000000000000000000000000000000000000000000000000000000083610eaa565b6040516001600160981b01903480156108fc02916000818181858888f193505050501580156106d4573d6000803e3d6000fd5b5060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906107779190611427565b8152602001620186a08152602001878780806020026020016040519081016040528093929190818152602001838360200280828437600092018290525093855250506040516020938401936107e592508d913491016001600160a01b03929092168252602082015260400190565b60408051601f198184030181529082905261080392916020016114dd565b6040516020818303038152906040528152506040518263ffffffff1660e01b81526004016108319190611558565b6020604051808303816000875af1158015610850573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061087491906115d6565b905080866001600160a01b0316336001600160a01b03167f0322cbb1d3c23f6dbf1deddb3b4ef3ce0f93ae6eec7b44e4f395804104466d14346040516108bc91815260200190565b60405180910390a450506108d06001600055565b50505050565b6108de610ce7565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146109865760405162461bcd60e51b815260206004820152604160248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201527f697a65642054656c65706f727465724d657373656e67657220636f6e747261636064820152601d60fa1b608482015260a4016103b2565b7f00000000000000000000000000000000000000000000000000000000000000008414610a0a5760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20696e76616c69642060448201526b39b7bab931b29031b430b4b760a11b60648201526084016103b2565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031614610a9f5760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201526a34bd32b21039b2b73232b960a91b60648201526084016103b2565b600080610aae83850185611661565b90925090506001600160a01b038216610ad95760405162461bcd60e51b81526004016103b2906115ef565b80600003610b3d5760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2074726160448201526a6e736665722076616c756560a81b60648201526084016103b2565b600154819015610c0257600154821115610ba65760015460408051918252600060208301527f244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449910160405180910390a1600154610b9a9083611414565b60006001559050610c02565b8160016000828254610bb89190611414565b90915550506001546040805184815260208101929092527f244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449910160405180910390a1505050610cdd565b8060026000828254610c149190611401565b90915550506040518181526001600160a01b038416907fd949ea0e9d5db53492d77f28fd5467fb2f6c4f5b88e3350e3c36729b76e99cf29060200160405180910390a26040516327ad555d60e11b81526001600160a01b038481166004830152602482018390527f00000000000000000000000000000000000000000000000000000000000000001690634f5aaaba90604401600060405180830381600087803b158015610cc157600080fd5b505af1158015610cd5573d6000803e3d6000fd5b505050505050505b6108d06001600055565b600260005403610d395760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016103b2565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015610d89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dad91906115d6565b9050610dc46001600160a01b038516333086610f8f565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610e0b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2f91906115d6565b9050818111610e955760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016103b2565b610e9f8282611414565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610efb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1f91906115d6565b610f299190611401565b6040516001600160a01b0385166024820152604481018290529091506108d090859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610fc7565b6040516001600160a01b03808516602483015283166044820152606481018290526108d09085906323b872dd60e01b90608401610f58565b600061101c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661109e9092919063ffffffff16565b805190915015611099578080602001905181019061103a919061168d565b6110995760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103b2565b505050565b60606110ad84846000856110b5565b949350505050565b6060824710156111165760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016103b2565b600080866001600160a01b0316858760405161113291906116af565b60006040518083038185875af1925050503d806000811461116f576040519150601f19603f3d011682016040523d82523d6000602084013e611174565b606091505b509150915061118587838387611190565b979650505050505050565b606083156111ff5782516000036111f8576001600160a01b0385163b6111f85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103b2565b50816110ad565b6110ad83838151156112145781518083602001fd5b8060405162461bcd60e51b81526004016103b291906116cb565b60006040828403121561124057600080fd5b50919050565b60008083601f84011261125857600080fd5b50813567ffffffffffffffff81111561127057600080fd5b6020830191508360208260051b850101111561128b57600080fd5b9250929050565b6000806000606084860312156112a757600080fd5b6112b1858561122e565b9250604084013567ffffffffffffffff8111156112cd57600080fd5b6112d986828701611246565b9497909650939450505050565b6001600160a01b03811681146112fb57600080fd5b50565b6000806000806080858703121561131457600080fd5b843561131f816112e6565b935061132e866020870161122e565b9250606085013567ffffffffffffffff81111561134a57600080fd5b61135687828801611246565b95989497509550505050565b6000806000806060858703121561137857600080fd5b84359350602085013561138a816112e6565b9250604085013567ffffffffffffffff808211156113a757600080fd5b818701915087601f8301126113bb57600080fd5b8135818111156113ca57600080fd5b8860208285010111156113dc57600080fd5b95989497505060200194505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610ea457610ea46113eb565b81810381811115610ea457610ea46113eb565b60006040828403121561143957600080fd5b6040516040810181811067ffffffffffffffff8211171561146a57634e487b7160e01b600052604160045260246000fd5b6040528235611478816112e6565b81526020928301359281019290925250919050565b60005b838110156114a8578181015183820152602001611490565b50506000910152565b600081518084526114c981602086016020860161148d565b601f01601f19169290920160200192915050565b6000600284106114fd57634e487b7160e01b600052602160045260246000fd5b838252604060208301526110ad60408301846114b1565b600081518084526020808501945080840160005b8381101561154d5781516001600160a01b031687529582019590820190600101611528565b509495945050505050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526115b9610100840182611514565b905060a0840151601f198483030160e0850152610e9f82826114b1565b6000602082840312156115e857600080fd5b5051919050565b6020808252602e908201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2072656360408201526d697069656e74206164647265737360901b606082015260800190565b60006020828403121561164f57600080fd5b813561165a816112e6565b9392505050565b6000806040838503121561167457600080fd5b823561167f816112e6565b946020939093013593505050565b60006020828403121561169f57600080fd5b8151801515811461165a57600080fd5b600082516116c181846020870161148d565b9190910192915050565b60208152600061165a60208301846114b156fea2646970667358221220e4ff8375afe0a7438d4c5446853ab4d184e745332a484d87a3229480c294208764736f6c634300081200334e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20736f75", + Bin: "0x6101206040527302000000000000000000000000000000000000016080523480156200002a57600080fd5b5060405162001b7938038062001b798339810160408190526200004d9162000350565b60016000556001600160a01b038416620000d45760405162461bcd60e51b815260206004820152603860248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2054656c60448201527f65706f727465724d657373656e6765722061646472657373000000000000000060648201526084015b60405180910390fd5b6001600160a01b03841661010052826200013a5760405162461bcd60e51b8152602060048201526031602482015260008051602062001b598339815191526044820152701c98d948189b1bd8dad8da185a5b881251607a1b6064820152608401620000cb565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200018d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001b3919062000399565b8303620002295760405162461bcd60e51b815260206004820152603a60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a2063616e6e6f74206260448201527f726964676520776974682073616d6520626c6f636b636861696e0000000000006064820152608401620000cb565b60a08390526001600160a01b0382166200029b5760405162461bcd60e51b8152602060048201526034602482015260008051602062001b5983398151915260448201527f72636520636f6e747261637420616464726573730000000000000000000000006064820152608401620000cb565b6001600160a01b03821660c0526000819003620003215760405162461bcd60e51b815260206004820152603660248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20696e6960448201527f7469616c207265736572766520696d62616c616e6365000000000000000000006064820152608401620000cb565b60e081905260015550620003b3915050565b80516001600160a01b03811681146200034b57600080fd5b919050565b600080600080608085870312156200036757600080fd5b620003728562000333565b935060208501519250620003896040860162000333565b6060959095015193969295505050565b600060208284031215620003ac57600080fd5b5051919050565b60805160a05160c05160e051610100516117146200044560003960008181610244015281816103e30152818161067c015281816106d901526108e901526000818161021001526103060152600081816101b101528181610443015281816107390152610a0c01526000818161013c0152818161041d01528181610713015261098801526000610c7d01526117146000f3fe6080604052600436106100e75760003560e01c80638ac7dd201161008a578063ab28523011610059578063ab28523014610297578063c452165e146102ae578063c868efaa146102c6578063d30951261461029757600080fd5b80638ac7dd20146101fe5780639b3e580314610232578063a2309ff814610266578063a2a950171461027c57600080fd5b80633a94fe51116100c65780633a94fe511461015e57806349e3284e146101805780635d93f9af1461019f57806375846562146101eb57600080fd5b8062d872ae146100ec57806318160ddd1461011557806329b7b3fd1461012a575b600080fd5b3480156100f857600080fd5b5061010260015481565b6040519081526020015b60405180910390f35b34801561012157600080fd5b506101026102e6565b34801561013657600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561016a57600080fd5b5061017e610179366004611292565b6103cc565b005b34801561018c57600080fd5b506001546040519015815260200161010c565b3480156101ab57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010c565b61017e6101f93660046112fe565b6105a7565b34801561020a57600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561023e57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b34801561027257600080fd5b5061010260025481565b34801561028857600080fd5b506101d36001600160981b0181565b3480156102a357600080fd5b50610102620186a081565b3480156102ba57600080fd5b506101d3600160981b81565b3480156102d257600080fd5b5061017e6102e1366004611362565b6108d6565b6000806103006001600160981b0131600160981b31611401565b905060007f00000000000000000000000000000000000000000000000000000000000000006002546103329190611401565b9050808211156103bb5760405162461bcd60e51b815260206004820152604360248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20464154414c202d2060448201527f636f6e74726163742068617320746f6b656e7320756e6163636f756e746564206064820152623337b960e91b608482015260a4015b60405180910390fd5b6103c58282611414565b9250505090565b6000600160981b6001600160a01b031631905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906104819190611427565b8152602001620186a08152602001878780806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250604080516020808201899052825180830382018152828401909352909201916104f3916001916060016114dd565b6040516020818303038152906040528152506040518263ffffffff1660e01b81526004016105219190611558565b6020604051808303816000875af1158015610540573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061056491906115d6565b9050807f2550fa6041684d40e635e29e93dde9017d70c25b46aa88393317b5182ed6ae7c8360405161059891815260200190565b60405180910390a25050505050565b6105af610ce7565b6001600160a01b0384166105d55760405162461bcd60e51b81526004016103b2906115ef565b600154156106425760405162461bcd60e51b815260206004820152603460248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20636f6e7472616374604482015273081d5b99195c98dbdb1b185d195c985b1a5e995960621b60648201526084016103b2565b60006020840135156106a15761066861065e602086018661163d565b8560200135610d40565b90506106a161067a602086018661163d565b7f000000000000000000000000000000000000000000000000000000000000000083610eaa565b6040516001600160981b01903480156108fc02916000818181858888f193505050501580156106d4573d6000803e3d6000fd5b5060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906107779190611427565b8152602001620186a08152602001878780806020026020016040519081016040528093929190818152602001838360200280828437600092018290525093855250506040516020938401936107e592508d913491016001600160a01b03929092168252602082015260400190565b60408051601f198184030181529082905261080392916020016114dd565b6040516020818303038152906040528152506040518263ffffffff1660e01b81526004016108319190611558565b6020604051808303816000875af1158015610850573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061087491906115d6565b905080866001600160a01b0316336001600160a01b03167f0322cbb1d3c23f6dbf1deddb3b4ef3ce0f93ae6eec7b44e4f395804104466d14346040516108bc91815260200190565b60405180910390a450506108d06001600055565b50505050565b6108de610ce7565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146109865760405162461bcd60e51b815260206004820152604160248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201527f697a65642054656c65706f727465724d657373656e67657220636f6e747261636064820152601d60fa1b608482015260a4016103b2565b7f00000000000000000000000000000000000000000000000000000000000000008414610a0a5760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20696e76616c69642060448201526b39b7bab931b29031b430b4b760a11b60648201526084016103b2565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031614610a9f5760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201526a34bd32b21039b2b73232b960a91b60648201526084016103b2565b600080610aae83850185611661565b90925090506001600160a01b038216610ad95760405162461bcd60e51b81526004016103b2906115ef565b80600003610b3d5760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2074726160448201526a6e736665722076616c756560a81b60648201526084016103b2565b600154819015610c0257600154821115610ba65760015460408051918252600060208301527f244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449910160405180910390a1600154610b9a9083611414565b60006001559050610c02565b8160016000828254610bb89190611414565b90915550506001546040805184815260208101929092527f244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449910160405180910390a1505050610cdd565b8060026000828254610c149190611401565b90915550506040518181526001600160a01b038416907fd949ea0e9d5db53492d77f28fd5467fb2f6c4f5b88e3350e3c36729b76e99cf29060200160405180910390a26040516327ad555d60e11b81526001600160a01b038481166004830152602482018390527f00000000000000000000000000000000000000000000000000000000000000001690634f5aaaba90604401600060405180830381600087803b158015610cc157600080fd5b505af1158015610cd5573d6000803e3d6000fd5b505050505050505b6108d06001600055565b600260005403610d395760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016103b2565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015610d89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dad91906115d6565b9050610dc46001600160a01b038516333086610f8f565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610e0b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2f91906115d6565b9050818111610e955760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016103b2565b610e9f8282611414565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610efb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1f91906115d6565b610f299190611401565b6040516001600160a01b0385166024820152604481018290529091506108d090859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610fc7565b6040516001600160a01b03808516602483015283166044820152606481018290526108d09085906323b872dd60e01b90608401610f58565b600061101c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661109e9092919063ffffffff16565b805190915015611099578080602001905181019061103a919061168d565b6110995760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103b2565b505050565b60606110ad84846000856110b5565b949350505050565b6060824710156111165760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016103b2565b600080866001600160a01b0316858760405161113291906116af565b60006040518083038185875af1925050503d806000811461116f576040519150601f19603f3d011682016040523d82523d6000602084013e611174565b606091505b509150915061118587838387611190565b979650505050505050565b606083156111ff5782516000036111f8576001600160a01b0385163b6111f85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103b2565b50816110ad565b6110ad83838151156112145781518083602001fd5b8060405162461bcd60e51b81526004016103b291906116cb565b60006040828403121561124057600080fd5b50919050565b60008083601f84011261125857600080fd5b50813567ffffffffffffffff81111561127057600080fd5b6020830191508360208260051b850101111561128b57600080fd5b9250929050565b6000806000606084860312156112a757600080fd5b6112b1858561122e565b9250604084013567ffffffffffffffff8111156112cd57600080fd5b6112d986828701611246565b9497909650939450505050565b6001600160a01b03811681146112fb57600080fd5b50565b6000806000806080858703121561131457600080fd5b843561131f816112e6565b935061132e866020870161122e565b9250606085013567ffffffffffffffff81111561134a57600080fd5b61135687828801611246565b95989497509550505050565b6000806000806060858703121561137857600080fd5b84359350602085013561138a816112e6565b9250604085013567ffffffffffffffff808211156113a757600080fd5b818701915087601f8301126113bb57600080fd5b8135818111156113ca57600080fd5b8860208285010111156113dc57600080fd5b95989497505060200194505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610ea457610ea46113eb565b81810381811115610ea457610ea46113eb565b60006040828403121561143957600080fd5b6040516040810181811067ffffffffffffffff8211171561146a57634e487b7160e01b600052604160045260246000fd5b6040528235611478816112e6565b81526020928301359281019290925250919050565b60005b838110156114a8578181015183820152602001611490565b50506000910152565b600081518084526114c981602086016020860161148d565b601f01601f19169290920160200192915050565b6000600284106114fd57634e487b7160e01b600052602160045260246000fd5b838252604060208301526110ad60408301846114b1565b600081518084526020808501945080840160005b8381101561154d5781516001600160a01b031687529582019590820190600101611528565b509495945050505050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526115b9610100840182611514565b905060a0840151601f198483030160e0850152610e9f82826114b1565b6000602082840312156115e857600080fd5b5051919050565b6020808252602e908201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2072656360408201526d697069656e74206164647265737360901b606082015260800190565b60006020828403121561164f57600080fd5b813561165a816112e6565b9392505050565b6000806040838503121561167457600080fd5b823561167f816112e6565b946020939093013593505050565b60006020828403121561169f57600080fd5b8151801515811461165a57600080fd5b600082516116c181846020870161148d565b9190910192915050565b60208152600061165a60208301846114b156fea2646970667358221220ce89275c126671cd0bd194362db113cc6f9073978088cbfd89e591b63745e9be64736f6c634300081200334e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20736f75", } // NativeTokenDestinationABI is the input ABI used to generate the binding from. From 2ab9ec8aeed4c25c107c62faa81f6abf35443bfa Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Fri, 8 Dec 2023 12:13:30 -0500 Subject: [PATCH 180/183] Review fixes --- .../ERC20Bridge/ERC20Bridge/ERC20Bridge.go | 2 +- .../ExampleCrossChainMessenger.go | 2 +- .../NativeTokenDestination/NativeTokenDestination.go | 2 +- .../NativeTokenSource/NativeTokenSource.go | 2 +- .../CrossChainApplications/ERC20Bridge/ERC20Bridge.sol | 2 +- .../ExampleMessenger/ExampleCrossChainMessenger.sol | 2 +- .../NativeTokenBridge/NativeTokenDestination.sol | 8 +------- .../NativeTokenBridge/NativeTokenSource.sol | 2 +- tests/flows/erc20_to_native_token_bridge.go | 3 ++- 9 files changed, 10 insertions(+), 15 deletions(-) diff --git a/abi-bindings/go/CrossChainApplications/ERC20Bridge/ERC20Bridge/ERC20Bridge.go b/abi-bindings/go/CrossChainApplications/ERC20Bridge/ERC20Bridge/ERC20Bridge.go index 0b540aa4b..c810572b5 100644 --- a/abi-bindings/go/CrossChainApplications/ERC20Bridge/ERC20Bridge/ERC20Bridge.go +++ b/abi-bindings/go/CrossChainApplications/ERC20Bridge/ERC20Bridge/ERC20Bridge.go @@ -32,7 +32,7 @@ var ( // ERC20BridgeMetaData contains all meta data concerning the ERC20Bridge contract. var ERC20BridgeMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterRegistryAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"tokenContractAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destinationBridgeAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BridgeTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"nativeBlockchainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nativeBridgeAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nativeContractAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"bridgeTokenAddress\",\"type\":\"address\"}],\"name\":\"CreateBridgeToken\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"oldMinTeleporterVersion\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"newMinTeleporterVersion\",\"type\":\"uint256\"}],\"name\":\"MinTeleporterVersionUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"MintBridgeTokens\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"destinationBridgeAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nativeContractAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"SubmitCreateBridgeToken\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"CREATE_BRIDGE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_BRIDGE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TRANSFER_BRIDGE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WARP_PRECOMPILE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationBridgeAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenContractAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"primaryFeeAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"secondaryFeeAmount\",\"type\":\"uint256\"}],\"name\":\"bridgeTokens\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationBridgeAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"nativeTokenContract\",\"type\":\"address\"}],\"name\":\"bridgedBalances\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"balance\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nativeContractAddress\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"nativeName\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"nativeSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"nativeDecimals\",\"type\":\"uint8\"}],\"name\":\"encodeCreateBridgeTokenData\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nativeContractAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"bridgeAmount\",\"type\":\"uint256\"}],\"name\":\"encodeMintBridgeTokensData\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationBridgeAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"nativeContractAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"encodeTransferBridgeTokensData\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minTeleporterVersion\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"nativeBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeBridgeAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"nativeTokenAddress\",\"type\":\"address\"}],\"name\":\"nativeToWrappedTokens\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"bridgeTokenAddress\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"nativeBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeBridgeAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationBridgeAddress\",\"type\":\"address\"},{\"internalType\":\"contractERC20\",\"name\":\"nativeToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"messageFeeAsset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"messageFeeAmount\",\"type\":\"uint256\"}],\"name\":\"submitCreateBridgeToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationBridgeAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"nativeTokenContract\",\"type\":\"address\"}],\"name\":\"submittedBridgeTokenCreations\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"tokenCreationSubmitted\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterRegistry\",\"outputs\":[{\"internalType\":\"contractTeleporterRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"updateMinTeleporterVersion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"bridgeToken\",\"type\":\"address\"}],\"name\":\"wrappedTokenContracts\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"bridgeTokenExists\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", - Bin: "0x60c06040523480156200001157600080fd5b506040516200408c3803806200408c833981016040819052620000349162000212565b600160005580806001600160a01b038116620000bc5760405162461bcd60e51b815260206004820152603760248201527f54656c65706f727465725570677261646561626c653a207a65726f2074656c6560448201527f706f727465722072656769737472792061646472657373000000000000000000606482015260840160405180910390fd5b6001600160a01b03811660808190526040805163301fd1f560e21b8152905163c07f47d4916004808201926020929091908290030181865afa15801562000107573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200012d919062000244565b600155506200013c33620001c0565b507302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000190573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001b6919062000244565b60a052506200025e565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000602082840312156200022557600080fd5b81516001600160a01b03811681146200023d57600080fd5b9392505050565b6000602082840312156200025757600080fd5b5051919050565b60805160a051613dd0620002bc600039600081816101c7015281816109cb015281816117ba0152611e8001526000818161015c015281816104620152818161087d01528181610c8b015281816112d901526117fe0152613dd06000f3fe60806040523480156200001157600080fd5b5060043610620001515760003560e01c80638343f66111620000c7578063b9e55da11162000086578063b9e55da11462000329578063c60da612146200035d578063c63d22071462000374578063c868efaa146200038b578063e49cc55314620003a2578063f2fde38b14620003ac57600080fd5b80638343f66114620002885780638c56fcf014620002d05780638da5cb5b14620002e75780639bd9abc014620002f9578063b6109d9d146200031f57600080fd5b80636b47cd9a11620001145780636b47cd9a14620002405780636c7e40d1146200024b578063715018a6146200026457806374971856146200026e5780637a465fd9146200027d57600080fd5b80631a7f5bec1462000156578063367e9584146200019b5780634950d2d014620001c15780635f217bcc14620001f8578063654355681462000203575b600080fd5b6200017e7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b620001b2620001ac36600462002292565b620003c3565b6040516200019291906200237a565b620001e97f000000000000000000000000000000000000000000000000000000000000000081565b60405190815260200162000192565b620001e9621e848081565b6200017e620002143660046200238f565b60066020908152600093845260408085208252928452828420905282529020546001600160a01b031681565b620001e9620493e081565b620002626200025c366004620023d6565b62000422565b005b62000262620007f7565b6200017e6005600160991b0181565b620001e962030d4081565b620002bf620002993660046200238f565b600360209081526000938452604080852082529284528284209052825290205460ff1681565b604051901515815260200162000192565b620001b2620002e136600462002438565b6200080f565b6002546001600160a01b03166200017e565b620002bf6200030a3660046200247e565b60056020526000908152604090205460ff1681565b620002626200086a565b620001e96200033a3660046200238f565b600460209081526000938452604080852082529284528284209052825290205481565b620001b26200036e3660046200249e565b6200093f565b62000262620003853660046200250a565b620009bf565b620002626200039c3660046200257f565b62000c73565b620001e960015481565b62000262620003bd3660046200247e565b62000ee8565b6060600085858585604051602001620003e094939291906200260f565b60405160208183030381529060405290506000816040516020016200040792919062002674565b6040516020818303038152906040529150505b949350505050565b6200042c62000f64565b6001600160a01b0384166200045e5760405162461bcd60e51b81526004016200045590620026ae565b60405180910390fd5b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d820e64f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015620004bf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620004e59190620026fa565b9050600082156200051457620004fc848462000fbf565b9050620005146001600160a01b038516838362001135565b60006200065286876001600160a01b03166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa1580156200055a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405262000584919081019062002766565b886001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa158015620005c3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052620005ed919081019062002766565b896001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200062c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001ac91906200279f565b90506000836001600160a01b031663624488506040518060c001604052808c81526020018b6001600160a01b0316815260200160405180604001604052808b6001600160a01b03168152602001888152508152602001621e84808152602001600067ffffffffffffffff811115620006ce57620006ce620021a0565b604051908082528060200260200182016040528015620006f8578160200160208202803683370190505b508152602001858152506040518263ffffffff1660e01b815260040162000720919062002805565b6020604051808303816000875af115801562000740573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000766919062002887565b60008a81526003602090815260408083206001600160a01b03808e16808652918452828520908d16808652935292819020805460ff1916600117905551929350918b907f110b902745a3d7d6b66732479f01de654a3bc6e501be7c8ba2c3a6f9868cb53990620007d99086815260200190565b60405180910390a450505050620007f06001600055565b5050505050565b6200080162001227565b6200080d600062001283565b565b606060008484846040516020016200082a93929190620028a1565b60405160208183030381529060405290506001816040516020016200085192919062002674565b6040516020818303038152906040529150509392505050565b6200087462001227565b600060015490507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c07f47d46040518163ffffffff1660e01b8152600401602060405180830381865afa158015620008da573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000900919062002887565b60018190558110156200093c5760015460405182907fa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d90600090a35b50565b60408051602081018890526001600160a01b0387811682840152868116606080840191909152908616608083015260a0820185905260c08083018590528351808403909101815260e083019093529190620009a39060029083906101000162002674565b6040516020818303038152906040529150509695505050505050565b620009c962000f64565b7f0000000000000000000000000000000000000000000000000000000000000000870362000a0b5760405162461bcd60e51b81526004016200045590620028c5565b6001600160a01b03841662000a345760405162461bcd60e51b815260040162000455906200290d565b6001600160a01b03861662000a5d5760405162461bcd60e51b81526004016200045590620026ae565b6001600160a01b03851660009081526005602052604090205460ff161562000b485762000a8b818362002966565b831162000aea5760405162461bcd60e51b815260206004820152602660248201527f45524332304272696467653a20696e73756666696369656e7420746f74616c20604482015265185b5bdd5b9d60d21b606482015260840162000455565b62000b426040518060e00160405280898152602001886001600160a01b03168152602001876001600160a01b03168152602001866001600160a01b0316815260200185815260200184815260200183815250620012d5565b62000c5f565b60008781526003602090815260408083206001600160a01b03808b168552908352818420908916845290915290205460ff1662000bda5760405162461bcd60e51b815260206004820152602960248201527f45524332304272696467653a20696e76616c69642062726964676520746f6b656044820152686e206164647265737360b81b606482015260840162000455565b600062000be8868562000fbf565b905082811162000c4d5760405162461bcd60e51b815260206004820152602960248201527f45524332304272696467653a20696e73756666696369656e742061646a757374604482015268195908185b5bdd5b9d60ba1b606482015260840162000455565b62000c5d8888888885886200173c565b505b62000c6a6001600055565b50505050505050565b60015460405163260f846760e11b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690634c1f08ce90602401602060405180830381865afa15801562000cdb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000d01919062002887565b101562000d6a5760405162461bcd60e51b815260206004820152603060248201527f54656c65706f727465725570677261646561626c653a20696e76616c6964207460448201526f32b632b837b93a32b91039b2b73232b960811b606482015260840162000455565b60008062000d7b838501856200297c565b9092509050600082600281111562000d975762000d976200265e565b0362000ddb576000806000808480602001905181019062000db99190620029ea565b935093509350935062000dd18a8a8686868662001a73565b5050505062000ee0565b600182600281111562000df25762000df26200265e565b0362000e315760008060008380602001905181019062000e13919062002a74565b92509250925062000e28898985858562001be2565b50505062000ee0565b600282600281111562000e485762000e486200265e565b0362000e97576000806000806000808680602001905181019062000e6d919062002abc565b95509550955095509550955062000e8b8c8c88888888888862001d5c565b50505050505062000ee0565b60405162461bcd60e51b815260206004820152601b60248201527f45524332304272696467653a20696e76616c696420616374696f6e0000000000604482015260640162000455565b505050505050565b62000ef262001227565b6001600160a01b03811662000f595760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840162000455565b6200093c8162001283565b60026000540362000fb85760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640162000455565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa15801562001009573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200102f919062002887565b9050620010486001600160a01b03851633308662001f15565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa15801562001090573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620010b6919062002887565b90508181116200111e5760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b606482015260840162000455565b6200112a828262002b2c565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa15801562001187573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620011ad919062002887565b620011b9919062002966565b6040516001600160a01b0385166024820152604481018290529091506200122190859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915262001f39565b50505050565b6002546001600160a01b031633146200080d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000455565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d820e64f6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562001336573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200135c9190620026fa565b90506000808360a0015111156200139f576200138183604001518460a0015162000fbf565b60408401519091506200139f906001600160a01b0316838362001135565b60008360a001518460800151620013b7919062002b2c565b604085810151905163079cc67960e41b815233600482015260248101839052919250906001600160a01b038216906379cc679090604401600060405180830381600087803b1580156200140957600080fd5b505af11580156200141e573d6000803e3d6000fd5b505050506000816001600160a01b031663f72539686040518163ffffffff1660e01b8152600401602060405180830381865afa15801562001463573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001489919062002887565b90506000826001600160a01b0316631a0b79bf6040518163ffffffff1660e01b8152600401602060405180830381865afa158015620014cc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620014f29190620026fa565b9050818760000151036200153857806001600160a01b031687602001516001600160a01b031614620015385760405162461bcd60e51b8152600401620004559062002b42565b6000620015be88600001518960200151866001600160a01b03166374d32ad46040518163ffffffff1660e01b8152600401602060405180830381865afa15801562001587573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620015ad9190620026fa565b8b60600151898d60c001516200093f565b90506000876001600160a01b031663624488506040518060c00160405280878152602001866001600160a01b0316815260200160405180604001604052808e604001516001600160a01b031681526020018c8152508152602001620493e08152602001600067ffffffffffffffff8111156200163e576200163e620021a0565b60405190808252806020026020018201604052801562001668578160200160208202803683370190505b508152602001858152506040518263ffffffff1660e01b815260040162001690919062002805565b6020604051808303816000875af1158015620016b0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620016d6919062002887565b90508089600001518a604001516001600160a01b03167f97935c4470efae40c8440c3abfe968a5512232dd375cc974e712f487c2b99c318c602001518d606001518b6040516200172993929190620028a1565b60405180910390a4505050505050505050565b6001600160a01b03841660009081526005602052604090205460ff1615620017b85760405162461bcd60e51b815260206004820152602860248201527f45524332304272696467653a2063616e6e6f742062726964676520777261707060448201526732b2103a37b5b2b760c11b606482015260840162000455565b7f00000000000000000000000000000000000000000000000000000000000000008603620017fa5760405162461bcd60e51b81526004016200045590620028c5565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d820e64f6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200185b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620018819190620026fa565b90508115620018a057620018a06001600160a01b038616828462001135565b6000620018ae838562002b2c565b60008981526004602090815260408083206001600160a01b03808d168552908352818420908b168452909152812080549293508392909190620018f390849062002966565b9091555060009050620019088787846200080f565b90506000836001600160a01b031663624488506040518060c001604052808d81526020018c6001600160a01b0316815260200160405180604001604052808d6001600160a01b031681526020018a815250815260200162030d408152602001600067ffffffffffffffff811115620019845762001984620021a0565b604051908082528060200260200182016040528015620019ae578160200160208202803683370190505b508152602001858152506040518263ffffffff1660e01b8152600401620019d6919062002805565b6020604051808303816000875af1158015620019f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001a1c919062002887565b9050808a896001600160a01b03167f97935c4470efae40c8440c3abfe968a5512232dd375cc974e712f487c2b99c318c8b8860405162001a5f93929190620028a1565b60405180910390a450505050505050505050565b60008681526006602090815260408083206001600160a01b038981168552908352818420888216855290925290912054161562001b045760405162461bcd60e51b815260206004820152602860248201527f45524332304272696467653a2062726964676520746f6b656e20616c72656164604482015267792065786973747360c01b606482015260840162000455565b600086868686868660405162001b1a906200217c565b62001b2b9695949392919062002b91565b604051809103906000f08015801562001b48573d6000803e3d6000fd5b506001600160a01b038181166000818152600560209081526040808320805460ff191660011790558c8352600682528083208c8616808552908352818420958c168085529583529281902080546001600160a01b031916851790555192835293945091928a917fe1c61a845f79534e11924517ddbedc668d0c20e467eafb4d3bd2858e2815f3b5910160405180910390a450505050505050565b62001bec62000f64565b6001600160a01b03821662001c155760405162461bcd60e51b815260040162000455906200290d565b60008581526006602090815260408083206001600160a01b038089168552908352818420878216855290925290912054168062001ca65760405162461bcd60e51b815260206004820152602860248201527f45524332304272696467653a2062726964676520746f6b656e20646f6573206e6044820152671bdd08195e1a5cdd60c21b606482015260840162000455565b6040516340c10f1960e01b81526001600160a01b038481166004830152602482018490528216906340c10f1990604401600060405180830381600087803b15801562001cf157600080fd5b505af115801562001d06573d6000803e3d6000fd5b5050604080516001600160a01b03878116825260208201879052851693507fc0767f158f0d5394b598489a51ed607cd55a8be2dcef113ba1626efcf4c6395492500160405180910390a250620007f06001600055565b62001d6662000f64565b6001600160a01b03831662001d8f5760405162461bcd60e51b815260040162000455906200290d565b6001600160a01b03851662001db85760405162461bcd60e51b81526004016200045590620026ae565b60008881526004602090815260408083206001600160a01b03808c16855290835281842090881684529091529020548281101562001e435760405162461bcd60e51b815260206004820152602160248201527f45524332304272696467653a20696e73756666696369656e742062616c616e636044820152606560f81b606482015260840162000455565b62001e4f838262002b2c565b60008a81526004602090815260408083206001600160a01b03808e168552908352818420908a1684529091529020557f0000000000000000000000000000000000000000000000000000000000000000870362001eee576001600160a01b038616301462001ed15760405162461bcd60e51b8152600401620004559062002b42565b62001ee76001600160a01b038616858562002017565b5062001f00565b62001efe8787878787876200173c565b505b62001f0b6001600055565b5050505050505050565b62001221846323b872dd60e01b858585604051602401620011e993929190620028a1565b600062001f90826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316620020499092919063ffffffff16565b80519091501562002012578080602001905181019062001fb1919062002bf0565b620020125760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840162000455565b505050565b6040516001600160a01b0383166024820152604481018290526200201290849063a9059cbb60e01b90606401620011e9565b60606200041a848460008585600080866001600160a01b0316858760405162002073919062002c14565b60006040518083038185875af1925050503d8060008114620020b2576040519150601f19603f3d011682016040523d82523d6000602084013e620020b7565b606091505b5091509150620020ca87838387620020d5565b979650505050505050565b606083156200214957825160000362002141576001600160a01b0385163b620021415760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640162000455565b50816200041a565b6200041a8383815115620021605781518083602001fd5b8060405162461bcd60e51b81526004016200045591906200237a565b6111688062002c3383390190565b6001600160a01b03811681146200093c57600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715620021e257620021e2620021a0565b604052919050565b600067ffffffffffffffff821115620022075762002207620021a0565b50601f01601f191660200190565b60006200222c6200222684620021ea565b620021b6565b90508281528383830111156200224157600080fd5b828260208301376000602084830101529392505050565b600082601f8301126200226a57600080fd5b6200227b8383356020850162002215565b9392505050565b60ff811681146200093c57600080fd5b60008060008060808587031215620022a957600080fd5b8435620022b6816200218a565b9350602085013567ffffffffffffffff80821115620022d457600080fd5b620022e28883890162002258565b94506040870135915080821115620022f957600080fd5b50620023088782880162002258565b92505060608501356200231b8162002282565b939692955090935050565b60005b838110156200234357818101518382015260200162002329565b50506000910152565b600081518084526200236681602086016020860162002326565b601f01601f19169290920160200192915050565b6020815260006200227b60208301846200234c565b600080600060608486031215620023a557600080fd5b833592506020840135620023b9816200218a565b91506040840135620023cb816200218a565b809150509250925092565b600080600080600060a08688031215620023ef57600080fd5b85359450602086013562002403816200218a565b9350604086013562002415816200218a565b9250606086013562002427816200218a565b949793965091946080013592915050565b6000806000606084860312156200244e57600080fd5b83356200245b816200218a565b925060208401356200246d816200218a565b929592945050506040919091013590565b6000602082840312156200249157600080fd5b81356200227b816200218a565b60008060008060008060c08789031215620024b857600080fd5b863595506020870135620024cc816200218a565b94506040870135620024de816200218a565b93506060870135620024f0816200218a565b9598949750929560808101359460a0909101359350915050565b600080600080600080600060e0888a0312156200252657600080fd5b8735965060208801356200253a816200218a565b955060408801356200254c816200218a565b945060608801356200255e816200218a565b9699959850939660808101359560a0820135955060c0909101359350915050565b600080600080606085870312156200259657600080fd5b843593506020850135620025aa816200218a565b9250604085013567ffffffffffffffff80821115620025c857600080fd5b818701915087601f830112620025dd57600080fd5b813581811115620025ed57600080fd5b8860208285010111156200260057600080fd5b95989497505060200194505050565b6001600160a01b038516815260806020820181905260009062002635908301866200234c565b82810360408401526200264981866200234c565b91505060ff8316606083015295945050505050565b634e487b7160e01b600052602160045260246000fd5b6000600384106200269557634e487b7160e01b600052602160045260246000fd5b838252604060208301526200041a60408301846200234c565b6020808252602c908201527f45524332304272696467653a207a65726f2064657374696e6174696f6e20627260408201526b69646765206164647265737360a01b606082015260800190565b6000602082840312156200270d57600080fd5b81516200227b816200218a565b600082601f8301126200272c57600080fd5b81516200273d6200222682620021ea565b8181528460208386010111156200275357600080fd5b6200041a82602083016020870162002326565b6000602082840312156200277957600080fd5b815167ffffffffffffffff8111156200279157600080fd5b6200041a848285016200271a565b600060208284031215620027b257600080fd5b81516200227b8162002282565b600081518084526020808501945080840160005b83811015620027fa5781516001600160a01b031687529582019590820190600101620027d3565b509495945050505050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c084015262002868610100840182620027bf565b905060a0840151601f198483030160e08501526200112a82826200234c565b6000602082840312156200289a57600080fd5b5051919050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b60208082526028908201527f45524332304272696467653a2063616e6e6f742062726964676520746f20736160408201526736b29031b430b4b760c11b606082015260800190565b60208082526023908201527f45524332304272696467653a207a65726f20726563697069656e74206164647260408201526265737360e81b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b808201808211156200112f576200112f62002950565b600080604083850312156200299057600080fd5b823560038110620029a057600080fd5b9150602083013567ffffffffffffffff811115620029bd57600080fd5b8301601f81018513620029cf57600080fd5b620029e08582356020840162002215565b9150509250929050565b6000806000806080858703121562002a0157600080fd5b845162002a0e816200218a565b602086015190945067ffffffffffffffff8082111562002a2d57600080fd5b62002a3b888389016200271a565b9450604087015191508082111562002a5257600080fd5b5062002a61878288016200271a565b92505060608501516200231b8162002282565b60008060006060848603121562002a8a57600080fd5b835162002a97816200218a565b602085015190935062002aaa816200218a565b80925050604084015190509250925092565b60008060008060008060c0878903121562002ad657600080fd5b86519550602087015162002aea816200218a565b604088015190955062002afd816200218a565b606088015190945062002b10816200218a565b809350506080870151915060a087015190509295509295509295565b818103818111156200112f576200112f62002950565b6020808252602f908201527f45524332304272696467653a20696e76616c69642064657374696e6174696f6e60408201526e20627269646765206164647265737360881b606082015260800190565b8681526001600160a01b0386811660208301528516604082015260c06060820181905260009062002bc5908301866200234c565b828103608084015262002bd981866200234c565b91505060ff831660a0830152979650505050505050565b60006020828403121562002c0357600080fd5b815180151581146200227b57600080fd5b6000825162002c2881846020870162002326565b919091019291505056fe6101206040523480156200001257600080fd5b506040516200116838038062001168833981016040819052620000359162000292565b82826003620000458382620003d5565b506004620000548282620003d5565b50879150620000b690505760405162461bcd60e51b815260206004820152602160248201527f427269646765546f6b656e3a207a65726f20736f7572636520636861696e20696044820152601960fa1b60648201526084015b60405180910390fd5b6001600160a01b0385166200011e5760405162461bcd60e51b815260206004820152602760248201527f427269646765546f6b656e3a207a65726f20736f7572636520627269646765206044820152666164647265737360c81b6064820152608401620000ad565b6001600160a01b038416620001855760405162461bcd60e51b815260206004820152602660248201527f427269646765546f6b656e3a207a65726f20736f75726365206173736574206160448201526564647265737360d01b6064820152608401620000ad565b3360805260a09590955250506001600160a01b0391821660c0521660e05260ff1661010052620004a1565b80516001600160a01b0381168114620001c857600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620001f557600080fd5b81516001600160401b0380821115620002125762000212620001cd565b604051601f8301601f19908116603f011681019082821181831017156200023d576200023d620001cd565b816040528381526020925086838588010111156200025a57600080fd5b600091505b838210156200027e57858201830151818301840152908201906200025f565b600093810190920192909252949350505050565b60008060008060008060c08789031215620002ac57600080fd5b86519550620002be60208801620001b0565b9450620002ce60408801620001b0565b60608801519094506001600160401b0380821115620002ec57600080fd5b620002fa8a838b01620001e3565b945060808901519150808211156200031157600080fd5b506200032089828a01620001e3565b92505060a087015160ff811681146200033857600080fd5b809150509295509295509295565b600181811c908216806200035b57607f821691505b6020821081036200037c57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620003d057600081815260208120601f850160051c81016020861015620003ab5750805b601f850160051c820191505b81811015620003cc57828155600101620003b7565b5050505b505050565b81516001600160401b03811115620003f157620003f1620001cd565b620004098162000402845462000346565b8462000382565b602080601f831160018114620004415760008415620004285750858301515b600019600386901b1c1916600185901b178555620003cc565b600085815260208120601f198616915b82811015620004725788860151825594840194600190910190840162000451565b5085821015620004915787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e05161010051610c7b620004ed60003960006101c70152600061025a01526000610173015260006102fc0152600081816102c2015261041b0152610c7b6000f3fe608060405234801561001057600080fd5b50600436106101165760003560e01c806370a08231116100a2578063a457c2d711610071578063a457c2d714610297578063a9059cbb146102aa578063cd596583146102bd578063dd62ed3e146102e4578063f7253968146102f757600080fd5b806370a082311461022c57806374d32ad41461025557806379cc67901461027c57806395d89b411461028f57600080fd5b806323b872dd116100e957806323b872dd146101ad578063313ce567146101c057806339509351146101f157806340c10f191461020457806342966c681461021957600080fd5b806306fdde031461011b578063095ea7b31461013957806318160ddd1461015c5780631a0b79bf1461016e575b600080fd5b61012361031e565b6040516101309190610aac565b60405180910390f35b61014c610147366004610b16565b6103b0565b6040519015158152602001610130565b6002545b604051908152602001610130565b6101957f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610130565b61014c6101bb366004610b40565b6103ca565b60405160ff7f0000000000000000000000000000000000000000000000000000000000000000168152602001610130565b61014c6101ff366004610b16565b6103ee565b610217610212366004610b16565b610410565b005b610217610227366004610b7c565b61049b565b61016061023a366004610b95565b6001600160a01b031660009081526020819052604090205490565b6101957f000000000000000000000000000000000000000000000000000000000000000081565b61021761028a366004610b16565b6104a8565b6101236104bd565b61014c6102a5366004610b16565b6104cc565b61014c6102b8366004610b16565b610547565b6101957f000000000000000000000000000000000000000000000000000000000000000081565b6101606102f2366004610bb7565b610555565b6101607f000000000000000000000000000000000000000000000000000000000000000081565b60606003805461032d90610bea565b80601f016020809104026020016040519081016040528092919081815260200182805461035990610bea565b80156103a65780601f1061037b576101008083540402835291602001916103a6565b820191906000526020600020905b81548152906001019060200180831161038957829003601f168201915b5050505050905090565b6000336103be818585610580565b60019150505b92915050565b6000336103d88582856106a5565b6103e385858561071f565b506001949350505050565b6000336103be8185856104018383610555565b61040b9190610c24565b610580565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461048d5760405162461bcd60e51b815260206004820152601960248201527f427269646765546f6b656e3a20756e617574686f72697a65640000000000000060448201526064015b60405180910390fd5b61049782826108c3565b5050565b6104a53382610982565b50565b6104b38233836106a5565b6104978282610982565b60606004805461032d90610bea565b600033816104da8286610555565b90508381101561053a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610484565b6103e38286868403610580565b6000336103be81858561071f565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6001600160a01b0383166105e25760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610484565b6001600160a01b0382166106435760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610484565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b60006106b18484610555565b90506000198114610719578181101561070c5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610484565b6107198484848403610580565b50505050565b6001600160a01b0383166107835760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610484565b6001600160a01b0382166107e55760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610484565b6001600160a01b0383166000908152602081905260409020548181101561085d5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610484565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610719565b6001600160a01b0382166109195760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610484565b806002600082825461092b9190610c24565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6001600160a01b0382166109e25760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610484565b6001600160a01b03821660009081526020819052604090205481811015610a565760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610484565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610698565b600060208083528351808285015260005b81811015610ad957858101830151858201604001528201610abd565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b0381168114610b1157600080fd5b919050565b60008060408385031215610b2957600080fd5b610b3283610afa565b946020939093013593505050565b600080600060608486031215610b5557600080fd5b610b5e84610afa565b9250610b6c60208501610afa565b9150604084013590509250925092565b600060208284031215610b8e57600080fd5b5035919050565b600060208284031215610ba757600080fd5b610bb082610afa565b9392505050565b60008060408385031215610bca57600080fd5b610bd383610afa565b9150610be160208401610afa565b90509250929050565b600181811c90821680610bfe57607f821691505b602082108103610c1e57634e487b7160e01b600052602260045260246000fd5b50919050565b808201808211156103c457634e487b7160e01b600052601160045260246000fdfea26469706673582212208a8e82a679ec260481bb5d10cf7933d8213beeeb9291c42d2ad6b12aa8eb16e264736f6c63430008120033a26469706673582212200154a4130f205f5650af65dc28d67856563d7ace97ac7837c10fce0fae8a0d7564736f6c63430008120033", + Bin: "0x60c06040523480156200001157600080fd5b506040516200408c3803806200408c833981016040819052620000349162000212565b600160005580806001600160a01b038116620000bc5760405162461bcd60e51b815260206004820152603760248201527f54656c65706f727465725570677261646561626c653a207a65726f2074656c6560448201527f706f727465722072656769737472792061646472657373000000000000000000606482015260840160405180910390fd5b6001600160a01b03811660808190526040805163301fd1f560e21b8152905163c07f47d4916004808201926020929091908290030181865afa15801562000107573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200012d919062000244565b600155506200013c33620001c0565b507302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000190573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001b6919062000244565b60a052506200025e565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000602082840312156200022557600080fd5b81516001600160a01b03811681146200023d57600080fd5b9392505050565b6000602082840312156200025757600080fd5b5051919050565b60805160a051613dd0620002bc600039600081816101c7015281816109cb015281816117ba0152611e8001526000818161015c015281816104620152818161087d01528181610c8b015281816112d901526117fe0152613dd06000f3fe60806040523480156200001157600080fd5b5060043610620001515760003560e01c80638343f66111620000c7578063b9e55da11162000086578063b9e55da11462000329578063c60da612146200035d578063c63d22071462000374578063c868efaa146200038b578063e49cc55314620003a2578063f2fde38b14620003ac57600080fd5b80638343f66114620002885780638c56fcf014620002d05780638da5cb5b14620002e75780639bd9abc014620002f9578063b6109d9d146200031f57600080fd5b80636b47cd9a11620001145780636b47cd9a14620002405780636c7e40d1146200024b578063715018a6146200026457806374971856146200026e5780637a465fd9146200027d57600080fd5b80631a7f5bec1462000156578063367e9584146200019b5780634950d2d014620001c15780635f217bcc14620001f8578063654355681462000203575b600080fd5b6200017e7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b620001b2620001ac36600462002292565b620003c3565b6040516200019291906200237a565b620001e97f000000000000000000000000000000000000000000000000000000000000000081565b60405190815260200162000192565b620001e9621e848081565b6200017e620002143660046200238f565b60066020908152600093845260408085208252928452828420905282529020546001600160a01b031681565b620001e9620493e081565b620002626200025c366004620023d6565b62000422565b005b62000262620007f7565b6200017e6005600160991b0181565b620001e962030d4081565b620002bf620002993660046200238f565b600360209081526000938452604080852082529284528284209052825290205460ff1681565b604051901515815260200162000192565b620001b2620002e136600462002438565b6200080f565b6002546001600160a01b03166200017e565b620002bf6200030a3660046200247e565b60056020526000908152604090205460ff1681565b620002626200086a565b620001e96200033a3660046200238f565b600460209081526000938452604080852082529284528284209052825290205481565b620001b26200036e3660046200249e565b6200093f565b62000262620003853660046200250a565b620009bf565b620002626200039c3660046200257f565b62000c73565b620001e960015481565b62000262620003bd3660046200247e565b62000ee8565b6060600085858585604051602001620003e094939291906200260f565b60405160208183030381529060405290506000816040516020016200040792919062002674565b6040516020818303038152906040529150505b949350505050565b6200042c62000f64565b6001600160a01b0384166200045e5760405162461bcd60e51b81526004016200045590620026ae565b60405180910390fd5b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d820e64f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015620004bf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620004e59190620026fa565b9050600082156200051457620004fc848462000fbf565b9050620005146001600160a01b038516838362001135565b60006200065286876001600160a01b03166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa1580156200055a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405262000584919081019062002766565b886001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa158015620005c3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052620005ed919081019062002766565b896001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200062c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001ac91906200279f565b90506000836001600160a01b031663624488506040518060c001604052808c81526020018b6001600160a01b0316815260200160405180604001604052808b6001600160a01b03168152602001888152508152602001621e84808152602001600067ffffffffffffffff811115620006ce57620006ce620021a0565b604051908082528060200260200182016040528015620006f8578160200160208202803683370190505b508152602001858152506040518263ffffffff1660e01b815260040162000720919062002805565b6020604051808303816000875af115801562000740573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000766919062002887565b60008a81526003602090815260408083206001600160a01b03808e16808652918452828520908d16808652935292819020805460ff1916600117905551929350918b907f110b902745a3d7d6b66732479f01de654a3bc6e501be7c8ba2c3a6f9868cb53990620007d99086815260200190565b60405180910390a450505050620007f06001600055565b5050505050565b6200080162001227565b6200080d600062001283565b565b606060008484846040516020016200082a93929190620028a1565b60405160208183030381529060405290506001816040516020016200085192919062002674565b6040516020818303038152906040529150509392505050565b6200087462001227565b600060015490507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c07f47d46040518163ffffffff1660e01b8152600401602060405180830381865afa158015620008da573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000900919062002887565b60018190558110156200093c5760015460405182907fa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d90600090a35b50565b60408051602081018890526001600160a01b0387811682840152868116606080840191909152908616608083015260a0820185905260c08083018590528351808403909101815260e083019093529190620009a39060029083906101000162002674565b6040516020818303038152906040529150509695505050505050565b620009c962000f64565b7f0000000000000000000000000000000000000000000000000000000000000000870362000a0b5760405162461bcd60e51b81526004016200045590620028c5565b6001600160a01b03841662000a345760405162461bcd60e51b815260040162000455906200290d565b6001600160a01b03861662000a5d5760405162461bcd60e51b81526004016200045590620026ae565b6001600160a01b03851660009081526005602052604090205460ff161562000b485762000a8b818362002966565b831162000aea5760405162461bcd60e51b815260206004820152602660248201527f45524332304272696467653a20696e73756666696369656e7420746f74616c20604482015265185b5bdd5b9d60d21b606482015260840162000455565b62000b426040518060e00160405280898152602001886001600160a01b03168152602001876001600160a01b03168152602001866001600160a01b0316815260200185815260200184815260200183815250620012d5565b62000c5f565b60008781526003602090815260408083206001600160a01b03808b168552908352818420908916845290915290205460ff1662000bda5760405162461bcd60e51b815260206004820152602960248201527f45524332304272696467653a20696e76616c69642062726964676520746f6b656044820152686e206164647265737360b81b606482015260840162000455565b600062000be8868562000fbf565b905082811162000c4d5760405162461bcd60e51b815260206004820152602960248201527f45524332304272696467653a20696e73756666696369656e742061646a757374604482015268195908185b5bdd5b9d60ba1b606482015260840162000455565b62000c5d8888888885886200173c565b505b62000c6a6001600055565b50505050505050565b60015460405163260f846760e11b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690634c1f08ce90602401602060405180830381865afa15801562000cdb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000d01919062002887565b101562000d6a5760405162461bcd60e51b815260206004820152603060248201527f54656c65706f727465725570677261646561626c653a20696e76616c6964207460448201526f32b632b837b93a32b91039b2b73232b960811b606482015260840162000455565b60008062000d7b838501856200297c565b9092509050600082600281111562000d975762000d976200265e565b0362000ddb576000806000808480602001905181019062000db99190620029ea565b935093509350935062000dd18a8a8686868662001a73565b5050505062000ee0565b600182600281111562000df25762000df26200265e565b0362000e315760008060008380602001905181019062000e13919062002a74565b92509250925062000e28898985858562001be2565b50505062000ee0565b600282600281111562000e485762000e486200265e565b0362000e97576000806000806000808680602001905181019062000e6d919062002abc565b95509550955095509550955062000e8b8c8c88888888888862001d5c565b50505050505062000ee0565b60405162461bcd60e51b815260206004820152601b60248201527f45524332304272696467653a20696e76616c696420616374696f6e0000000000604482015260640162000455565b505050505050565b62000ef262001227565b6001600160a01b03811662000f595760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840162000455565b6200093c8162001283565b60026000540362000fb85760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640162000455565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa15801562001009573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200102f919062002887565b9050620010486001600160a01b03851633308662001f15565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa15801562001090573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620010b6919062002887565b90508181116200111e5760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b606482015260840162000455565b6200112a828262002b2c565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa15801562001187573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620011ad919062002887565b620011b9919062002966565b6040516001600160a01b0385166024820152604481018290529091506200122190859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915262001f39565b50505050565b6002546001600160a01b031633146200080d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000455565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d820e64f6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562001336573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200135c9190620026fa565b90506000808360a0015111156200139f576200138183604001518460a0015162000fbf565b60408401519091506200139f906001600160a01b0316838362001135565b60008360a001518460800151620013b7919062002b2c565b604085810151905163079cc67960e41b815233600482015260248101839052919250906001600160a01b038216906379cc679090604401600060405180830381600087803b1580156200140957600080fd5b505af11580156200141e573d6000803e3d6000fd5b505050506000816001600160a01b031663f72539686040518163ffffffff1660e01b8152600401602060405180830381865afa15801562001463573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001489919062002887565b90506000826001600160a01b0316631a0b79bf6040518163ffffffff1660e01b8152600401602060405180830381865afa158015620014cc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620014f29190620026fa565b9050818760000151036200153857806001600160a01b031687602001516001600160a01b031614620015385760405162461bcd60e51b8152600401620004559062002b42565b6000620015be88600001518960200151866001600160a01b03166374d32ad46040518163ffffffff1660e01b8152600401602060405180830381865afa15801562001587573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620015ad9190620026fa565b8b60600151898d60c001516200093f565b90506000876001600160a01b031663624488506040518060c00160405280878152602001866001600160a01b0316815260200160405180604001604052808e604001516001600160a01b031681526020018c8152508152602001620493e08152602001600067ffffffffffffffff8111156200163e576200163e620021a0565b60405190808252806020026020018201604052801562001668578160200160208202803683370190505b508152602001858152506040518263ffffffff1660e01b815260040162001690919062002805565b6020604051808303816000875af1158015620016b0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620016d6919062002887565b90508089600001518a604001516001600160a01b03167f97935c4470efae40c8440c3abfe968a5512232dd375cc974e712f487c2b99c318c602001518d606001518b6040516200172993929190620028a1565b60405180910390a4505050505050505050565b6001600160a01b03841660009081526005602052604090205460ff1615620017b85760405162461bcd60e51b815260206004820152602860248201527f45524332304272696467653a2063616e6e6f742062726964676520777261707060448201526732b2103a37b5b2b760c11b606482015260840162000455565b7f00000000000000000000000000000000000000000000000000000000000000008603620017fa5760405162461bcd60e51b81526004016200045590620028c5565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d820e64f6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200185b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620018819190620026fa565b90508115620018a057620018a06001600160a01b038616828462001135565b6000620018ae838562002b2c565b60008981526004602090815260408083206001600160a01b03808d168552908352818420908b168452909152812080549293508392909190620018f390849062002966565b9091555060009050620019088787846200080f565b90506000836001600160a01b031663624488506040518060c001604052808d81526020018c6001600160a01b0316815260200160405180604001604052808d6001600160a01b031681526020018a815250815260200162030d408152602001600067ffffffffffffffff811115620019845762001984620021a0565b604051908082528060200260200182016040528015620019ae578160200160208202803683370190505b508152602001858152506040518263ffffffff1660e01b8152600401620019d6919062002805565b6020604051808303816000875af1158015620019f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001a1c919062002887565b9050808a896001600160a01b03167f97935c4470efae40c8440c3abfe968a5512232dd375cc974e712f487c2b99c318c8b8860405162001a5f93929190620028a1565b60405180910390a450505050505050505050565b60008681526006602090815260408083206001600160a01b038981168552908352818420888216855290925290912054161562001b045760405162461bcd60e51b815260206004820152602860248201527f45524332304272696467653a2062726964676520746f6b656e20616c72656164604482015267792065786973747360c01b606482015260840162000455565b600086868686868660405162001b1a906200217c565b62001b2b9695949392919062002b91565b604051809103906000f08015801562001b48573d6000803e3d6000fd5b506001600160a01b038181166000818152600560209081526040808320805460ff191660011790558c8352600682528083208c8616808552908352818420958c168085529583529281902080546001600160a01b031916851790555192835293945091928a917fe1c61a845f79534e11924517ddbedc668d0c20e467eafb4d3bd2858e2815f3b5910160405180910390a450505050505050565b62001bec62000f64565b6001600160a01b03821662001c155760405162461bcd60e51b815260040162000455906200290d565b60008581526006602090815260408083206001600160a01b038089168552908352818420878216855290925290912054168062001ca65760405162461bcd60e51b815260206004820152602860248201527f45524332304272696467653a2062726964676520746f6b656e20646f6573206e6044820152671bdd08195e1a5cdd60c21b606482015260840162000455565b6040516340c10f1960e01b81526001600160a01b038481166004830152602482018490528216906340c10f1990604401600060405180830381600087803b15801562001cf157600080fd5b505af115801562001d06573d6000803e3d6000fd5b5050604080516001600160a01b03878116825260208201879052851693507fc0767f158f0d5394b598489a51ed607cd55a8be2dcef113ba1626efcf4c6395492500160405180910390a250620007f06001600055565b62001d6662000f64565b6001600160a01b03831662001d8f5760405162461bcd60e51b815260040162000455906200290d565b6001600160a01b03851662001db85760405162461bcd60e51b81526004016200045590620026ae565b60008881526004602090815260408083206001600160a01b03808c16855290835281842090881684529091529020548281101562001e435760405162461bcd60e51b815260206004820152602160248201527f45524332304272696467653a20696e73756666696369656e742062616c616e636044820152606560f81b606482015260840162000455565b62001e4f838262002b2c565b60008a81526004602090815260408083206001600160a01b03808e168552908352818420908a1684529091529020557f0000000000000000000000000000000000000000000000000000000000000000870362001eee576001600160a01b038616301462001ed15760405162461bcd60e51b8152600401620004559062002b42565b62001ee76001600160a01b038616858562002017565b5062001f00565b62001efe8787878787876200173c565b505b62001f0b6001600055565b5050505050505050565b62001221846323b872dd60e01b858585604051602401620011e993929190620028a1565b600062001f90826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316620020499092919063ffffffff16565b80519091501562002012578080602001905181019062001fb1919062002bf0565b620020125760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840162000455565b505050565b6040516001600160a01b0383166024820152604481018290526200201290849063a9059cbb60e01b90606401620011e9565b60606200041a848460008585600080866001600160a01b0316858760405162002073919062002c14565b60006040518083038185875af1925050503d8060008114620020b2576040519150601f19603f3d011682016040523d82523d6000602084013e620020b7565b606091505b5091509150620020ca87838387620020d5565b979650505050505050565b606083156200214957825160000362002141576001600160a01b0385163b620021415760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640162000455565b50816200041a565b6200041a8383815115620021605781518083602001fd5b8060405162461bcd60e51b81526004016200045591906200237a565b6111688062002c3383390190565b6001600160a01b03811681146200093c57600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715620021e257620021e2620021a0565b604052919050565b600067ffffffffffffffff821115620022075762002207620021a0565b50601f01601f191660200190565b60006200222c6200222684620021ea565b620021b6565b90508281528383830111156200224157600080fd5b828260208301376000602084830101529392505050565b600082601f8301126200226a57600080fd5b6200227b8383356020850162002215565b9392505050565b60ff811681146200093c57600080fd5b60008060008060808587031215620022a957600080fd5b8435620022b6816200218a565b9350602085013567ffffffffffffffff80821115620022d457600080fd5b620022e28883890162002258565b94506040870135915080821115620022f957600080fd5b50620023088782880162002258565b92505060608501356200231b8162002282565b939692955090935050565b60005b838110156200234357818101518382015260200162002329565b50506000910152565b600081518084526200236681602086016020860162002326565b601f01601f19169290920160200192915050565b6020815260006200227b60208301846200234c565b600080600060608486031215620023a557600080fd5b833592506020840135620023b9816200218a565b91506040840135620023cb816200218a565b809150509250925092565b600080600080600060a08688031215620023ef57600080fd5b85359450602086013562002403816200218a565b9350604086013562002415816200218a565b9250606086013562002427816200218a565b949793965091946080013592915050565b6000806000606084860312156200244e57600080fd5b83356200245b816200218a565b925060208401356200246d816200218a565b929592945050506040919091013590565b6000602082840312156200249157600080fd5b81356200227b816200218a565b60008060008060008060c08789031215620024b857600080fd5b863595506020870135620024cc816200218a565b94506040870135620024de816200218a565b93506060870135620024f0816200218a565b9598949750929560808101359460a0909101359350915050565b600080600080600080600060e0888a0312156200252657600080fd5b8735965060208801356200253a816200218a565b955060408801356200254c816200218a565b945060608801356200255e816200218a565b9699959850939660808101359560a0820135955060c0909101359350915050565b600080600080606085870312156200259657600080fd5b843593506020850135620025aa816200218a565b9250604085013567ffffffffffffffff80821115620025c857600080fd5b818701915087601f830112620025dd57600080fd5b813581811115620025ed57600080fd5b8860208285010111156200260057600080fd5b95989497505060200194505050565b6001600160a01b038516815260806020820181905260009062002635908301866200234c565b82810360408401526200264981866200234c565b91505060ff8316606083015295945050505050565b634e487b7160e01b600052602160045260246000fd5b6000600384106200269557634e487b7160e01b600052602160045260246000fd5b838252604060208301526200041a60408301846200234c565b6020808252602c908201527f45524332304272696467653a207a65726f2064657374696e6174696f6e20627260408201526b69646765206164647265737360a01b606082015260800190565b6000602082840312156200270d57600080fd5b81516200227b816200218a565b600082601f8301126200272c57600080fd5b81516200273d6200222682620021ea565b8181528460208386010111156200275357600080fd5b6200041a82602083016020870162002326565b6000602082840312156200277957600080fd5b815167ffffffffffffffff8111156200279157600080fd5b6200041a848285016200271a565b600060208284031215620027b257600080fd5b81516200227b8162002282565b600081518084526020808501945080840160005b83811015620027fa5781516001600160a01b031687529582019590820190600101620027d3565b509495945050505050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c084015262002868610100840182620027bf565b905060a0840151601f198483030160e08501526200112a82826200234c565b6000602082840312156200289a57600080fd5b5051919050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b60208082526028908201527f45524332304272696467653a2063616e6e6f742062726964676520746f20736160408201526736b29031b430b4b760c11b606082015260800190565b60208082526023908201527f45524332304272696467653a207a65726f20726563697069656e74206164647260408201526265737360e81b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b808201808211156200112f576200112f62002950565b600080604083850312156200299057600080fd5b823560038110620029a057600080fd5b9150602083013567ffffffffffffffff811115620029bd57600080fd5b8301601f81018513620029cf57600080fd5b620029e08582356020840162002215565b9150509250929050565b6000806000806080858703121562002a0157600080fd5b845162002a0e816200218a565b602086015190945067ffffffffffffffff8082111562002a2d57600080fd5b62002a3b888389016200271a565b9450604087015191508082111562002a5257600080fd5b5062002a61878288016200271a565b92505060608501516200231b8162002282565b60008060006060848603121562002a8a57600080fd5b835162002a97816200218a565b602085015190935062002aaa816200218a565b80925050604084015190509250925092565b60008060008060008060c0878903121562002ad657600080fd5b86519550602087015162002aea816200218a565b604088015190955062002afd816200218a565b606088015190945062002b10816200218a565b809350506080870151915060a087015190509295509295509295565b818103818111156200112f576200112f62002950565b6020808252602f908201527f45524332304272696467653a20696e76616c69642064657374696e6174696f6e60408201526e20627269646765206164647265737360881b606082015260800190565b8681526001600160a01b0386811660208301528516604082015260c06060820181905260009062002bc5908301866200234c565b828103608084015262002bd981866200234c565b91505060ff831660a0830152979650505050505050565b60006020828403121562002c0357600080fd5b815180151581146200227b57600080fd5b6000825162002c2881846020870162002326565b919091019291505056fe6101206040523480156200001257600080fd5b506040516200116838038062001168833981016040819052620000359162000292565b82826003620000458382620003d5565b506004620000548282620003d5565b50879150620000b690505760405162461bcd60e51b815260206004820152602160248201527f427269646765546f6b656e3a207a65726f20736f7572636520636861696e20696044820152601960fa1b60648201526084015b60405180910390fd5b6001600160a01b0385166200011e5760405162461bcd60e51b815260206004820152602760248201527f427269646765546f6b656e3a207a65726f20736f7572636520627269646765206044820152666164647265737360c81b6064820152608401620000ad565b6001600160a01b038416620001855760405162461bcd60e51b815260206004820152602660248201527f427269646765546f6b656e3a207a65726f20736f75726365206173736574206160448201526564647265737360d01b6064820152608401620000ad565b3360805260a09590955250506001600160a01b0391821660c0521660e05260ff1661010052620004a1565b80516001600160a01b0381168114620001c857600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620001f557600080fd5b81516001600160401b0380821115620002125762000212620001cd565b604051601f8301601f19908116603f011681019082821181831017156200023d576200023d620001cd565b816040528381526020925086838588010111156200025a57600080fd5b600091505b838210156200027e57858201830151818301840152908201906200025f565b600093810190920192909252949350505050565b60008060008060008060c08789031215620002ac57600080fd5b86519550620002be60208801620001b0565b9450620002ce60408801620001b0565b60608801519094506001600160401b0380821115620002ec57600080fd5b620002fa8a838b01620001e3565b945060808901519150808211156200031157600080fd5b506200032089828a01620001e3565b92505060a087015160ff811681146200033857600080fd5b809150509295509295509295565b600181811c908216806200035b57607f821691505b6020821081036200037c57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620003d057600081815260208120601f850160051c81016020861015620003ab5750805b601f850160051c820191505b81811015620003cc57828155600101620003b7565b5050505b505050565b81516001600160401b03811115620003f157620003f1620001cd565b620004098162000402845462000346565b8462000382565b602080601f831160018114620004415760008415620004285750858301515b600019600386901b1c1916600185901b178555620003cc565b600085815260208120601f198616915b82811015620004725788860151825594840194600190910190840162000451565b5085821015620004915787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e05161010051610c7b620004ed60003960006101c70152600061025a01526000610173015260006102fc0152600081816102c2015261041b0152610c7b6000f3fe608060405234801561001057600080fd5b50600436106101165760003560e01c806370a08231116100a2578063a457c2d711610071578063a457c2d714610297578063a9059cbb146102aa578063cd596583146102bd578063dd62ed3e146102e4578063f7253968146102f757600080fd5b806370a082311461022c57806374d32ad41461025557806379cc67901461027c57806395d89b411461028f57600080fd5b806323b872dd116100e957806323b872dd146101ad578063313ce567146101c057806339509351146101f157806340c10f191461020457806342966c681461021957600080fd5b806306fdde031461011b578063095ea7b31461013957806318160ddd1461015c5780631a0b79bf1461016e575b600080fd5b61012361031e565b6040516101309190610aac565b60405180910390f35b61014c610147366004610b16565b6103b0565b6040519015158152602001610130565b6002545b604051908152602001610130565b6101957f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610130565b61014c6101bb366004610b40565b6103ca565b60405160ff7f0000000000000000000000000000000000000000000000000000000000000000168152602001610130565b61014c6101ff366004610b16565b6103ee565b610217610212366004610b16565b610410565b005b610217610227366004610b7c565b61049b565b61016061023a366004610b95565b6001600160a01b031660009081526020819052604090205490565b6101957f000000000000000000000000000000000000000000000000000000000000000081565b61021761028a366004610b16565b6104a8565b6101236104bd565b61014c6102a5366004610b16565b6104cc565b61014c6102b8366004610b16565b610547565b6101957f000000000000000000000000000000000000000000000000000000000000000081565b6101606102f2366004610bb7565b610555565b6101607f000000000000000000000000000000000000000000000000000000000000000081565b60606003805461032d90610bea565b80601f016020809104026020016040519081016040528092919081815260200182805461035990610bea565b80156103a65780601f1061037b576101008083540402835291602001916103a6565b820191906000526020600020905b81548152906001019060200180831161038957829003601f168201915b5050505050905090565b6000336103be818585610580565b60019150505b92915050565b6000336103d88582856106a5565b6103e385858561071f565b506001949350505050565b6000336103be8185856104018383610555565b61040b9190610c24565b610580565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461048d5760405162461bcd60e51b815260206004820152601960248201527f427269646765546f6b656e3a20756e617574686f72697a65640000000000000060448201526064015b60405180910390fd5b61049782826108c3565b5050565b6104a53382610982565b50565b6104b38233836106a5565b6104978282610982565b60606004805461032d90610bea565b600033816104da8286610555565b90508381101561053a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610484565b6103e38286868403610580565b6000336103be81858561071f565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6001600160a01b0383166105e25760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610484565b6001600160a01b0382166106435760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610484565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b60006106b18484610555565b90506000198114610719578181101561070c5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610484565b6107198484848403610580565b50505050565b6001600160a01b0383166107835760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610484565b6001600160a01b0382166107e55760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610484565b6001600160a01b0383166000908152602081905260409020548181101561085d5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610484565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610719565b6001600160a01b0382166109195760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610484565b806002600082825461092b9190610c24565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6001600160a01b0382166109e25760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610484565b6001600160a01b03821660009081526020819052604090205481811015610a565760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610484565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610698565b600060208083528351808285015260005b81811015610ad957858101830151858201604001528201610abd565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b0381168114610b1157600080fd5b919050565b60008060408385031215610b2957600080fd5b610b3283610afa565b946020939093013593505050565b600080600060608486031215610b5557600080fd5b610b5e84610afa565b9250610b6c60208501610afa565b9150604084013590509250925092565b600060208284031215610b8e57600080fd5b5035919050565b600060208284031215610ba757600080fd5b610bb082610afa565b9392505050565b60008060408385031215610bca57600080fd5b610bd383610afa565b9150610be160208401610afa565b90509250929050565b600181811c90821680610bfe57607f821691505b602082108103610c1e57634e487b7160e01b600052602260045260246000fd5b50919050565b808201808211156103c457634e487b7160e01b600052601160045260246000fdfea26469706673582212208a8e82a679ec260481bb5d10cf7933d8213beeeb9291c42d2ad6b12aa8eb16e264736f6c63430008120033a264697066735822122056cceaf1cb8b3bc8415cf4096cf808718ecbf3b4166fe866184bca1de92029e964736f6c63430008120033", } // ERC20BridgeABI is the input ABI used to generate the binding from. diff --git a/abi-bindings/go/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger/ExampleCrossChainMessenger.go b/abi-bindings/go/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger/ExampleCrossChainMessenger.go index 730343efe..ef4e4e700 100644 --- a/abi-bindings/go/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger/ExampleCrossChainMessenger.go +++ b/abi-bindings/go/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger/ExampleCrossChainMessenger.go @@ -32,7 +32,7 @@ var ( // ExampleCrossChainMessengerMetaData contains all meta data concerning the ExampleCrossChainMessenger contract. var ExampleCrossChainMessengerMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterRegistryAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"oldMinTeleporterVersion\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"newMinTeleporterVersion\",\"type\":\"uint256\"}],\"name\":\"MinTeleporterVersionUpdated\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originBlockchainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"originSenderAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"name\":\"ReceiveMessage\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"name\":\"SendMessage\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originBlockchainID\",\"type\":\"bytes32\"}],\"name\":\"getCurrentMessage\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minTeleporterVersion\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"originSenderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"name\":\"sendMessage\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterRegistry\",\"outputs\":[{\"internalType\":\"contractTeleporterRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"updateMinTeleporterVersion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x60a06040523480156200001157600080fd5b50604051620015aa380380620015aa833981016040819052620000349162000196565b600160005580806001600160a01b038116620000bc5760405162461bcd60e51b815260206004820152603760248201527f54656c65706f727465725570677261646561626c653a207a65726f2074656c6560448201527f706f727465722072656769737472792061646472657373000000000000000000606482015260840160405180910390fd5b6001600160a01b03811660808190526040805163301fd1f560e21b8152905163c07f47d4916004808201926020929091908290030181865afa15801562000107573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200012d9190620001c8565b600155506200013c3362000144565b5050620001e2565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600060208284031215620001a957600080fd5b81516001600160a01b0381168114620001c157600080fd5b9392505050565b600060208284031215620001db57600080fd5b5051919050565b6080516113986200021260003960008181609d0152818161026d01528181610343015261055701526113986000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063b6109d9d11610066578063b6109d9d14610118578063c868efaa14610120578063e49cc55314610133578063f2fde38b1461014a578063f63d09d71461015d57600080fd5b80631a7f5bec14610098578063715018a6146100dc5780638da5cb5b146100e6578063b33fead4146100f7575b600080fd5b6100bf7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6100e4610170565b005b6002546001600160a01b03166100bf565b61010a610105366004610d72565b610184565b6040516100d3929190610ddb565b6100e461025c565b6100e461012e366004610e5d565b61032b565b61013c60015481565b6040519081526020016100d3565b6100e4610158366004610eb9565b6104d3565b61013c61016b366004610edd565b610549565b610178610789565b61018260006107e3565b565b6000818152600360209081526040808320815180830190925280546001600160a01b0316825260018101805460609486949392908401916101c490610f63565b80601f01602080910402602001604051908101604052809291908181526020018280546101f090610f63565b801561023d5780601f106102125761010080835404028352916020019161023d565b820191906000526020600020905b81548152906001019060200180831161022057829003601f168201915b5050505050815250509050806000015181602001519250925050915091565b610264610789565b600060015490507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c07f47d46040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102ed9190610f9d565b60018190558110156103285760015460405182907fa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d90600090a35b50565b60015460405163260f846760e11b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690634c1f08ce90602401602060405180830381865afa158015610392573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103b69190610f9d565b10156104225760405162461bcd60e51b815260206004820152603060248201527f54656c65706f727465725570677261646561626c653a20696e76616c6964207460448201526f32b632b837b93a32b91039b2b73232b960811b60648201526084015b60405180910390fd5b600061043082840184610fcc565b6040805180820182526001600160a01b038781168252602080830185815260008b81526003909252939020825181546001600160a01b0319169216919091178155915192935091600182019061048690826110cb565b50905050836001600160a01b0316857f1f5c800b5f2b573929a7948f82a199c2a212851b53a6c5bd703ece23999d24aa836040516104c4919061118b565b60405180910390a35050505050565b6104db610789565b6001600160a01b0381166105405760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610419565b610328816107e3565b6000610553610835565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d820e64f6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105d7919061119e565b905060008615610601576105eb888861088e565b90506106016001600160a01b03891683836109f8565b886001600160a01b03168a7fa06eff1edd0c66b8dc96d086dda7ba263edf88d7417e6cb15073b5e7bff8a8ca8a848a8a8a6040516106439594939291906111e4565b60405180910390a3816001600160a01b031663624488506040518060c001604052808d81526020018c6001600160a01b0316815260200160405180604001604052808d6001600160a01b03168152602001868152508152602001898152602001600067ffffffffffffffff8111156106bd576106bd610fb6565b6040519080825280602002602001820160405280156106e6578160200160208202803683370190505b50815260200188886040516020016106ff929190611212565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161072d919061126a565b6020604051808303816000875af115801561074c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107709190610f9d565b9250505061077e6001600055565b979650505050505050565b6002546001600160a01b031633146101825760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610419565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6002600054036108875760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610419565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa1580156108d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108fb9190610f9d565b90506109126001600160a01b038516333086610ae3565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610959573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097d9190610f9d565b90508181116109e35760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b6064820152608401610419565b6109ed82826112fe565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610a49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6d9190610f9d565b610a779190611311565b6040516001600160a01b038516602482015260448101829052909150610add90859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610b1b565b50505050565b6040516001600160a01b0380851660248301528316604482015260648101829052610add9085906323b872dd60e01b90608401610aa6565b6000610b70826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610bf29092919063ffffffff16565b805190915015610bed5780806020019051810190610b8e9190611324565b610bed5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610419565b505050565b6060610c018484600085610c09565b949350505050565b606082471015610c6a5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610419565b600080866001600160a01b03168587604051610c869190611346565b60006040518083038185875af1925050503d8060008114610cc3576040519150601f19603f3d011682016040523d82523d6000602084013e610cc8565b606091505b509150915061077e8783838760608315610d43578251600003610d3c576001600160a01b0385163b610d3c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610419565b5081610c01565b610c018383815115610d585781518083602001fd5b8060405162461bcd60e51b8152600401610419919061118b565b600060208284031215610d8457600080fd5b5035919050565b60005b83811015610da6578181015183820152602001610d8e565b50506000910152565b60008151808452610dc7816020860160208601610d8b565b601f01601f19169290920160200192915050565b6001600160a01b0383168152604060208201819052600090610c0190830184610daf565b6001600160a01b038116811461032857600080fd5b60008083601f840112610e2657600080fd5b50813567ffffffffffffffff811115610e3e57600080fd5b602083019150836020828501011115610e5657600080fd5b9250929050565b60008060008060608587031215610e7357600080fd5b843593506020850135610e8581610dff565b9250604085013567ffffffffffffffff811115610ea157600080fd5b610ead87828801610e14565b95989497509550505050565b600060208284031215610ecb57600080fd5b8135610ed681610dff565b9392505050565b600080600080600080600060c0888a031215610ef857600080fd5b873596506020880135610f0a81610dff565b95506040880135610f1a81610dff565b9450606088013593506080880135925060a088013567ffffffffffffffff811115610f4457600080fd5b610f508a828b01610e14565b989b979a50959850939692959293505050565b600181811c90821680610f7757607f821691505b602082108103610f9757634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215610faf57600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b600060208284031215610fde57600080fd5b813567ffffffffffffffff80821115610ff657600080fd5b818401915084601f83011261100a57600080fd5b81358181111561101c5761101c610fb6565b604051601f8201601f19908116603f0116810190838211818310171561104457611044610fb6565b8160405282815287602084870101111561105d57600080fd5b826020860160208301376000928101602001929092525095945050505050565b601f821115610bed57600081815260208120601f850160051c810160208610156110a45750805b601f850160051c820191505b818110156110c3578281556001016110b0565b505050505050565b815167ffffffffffffffff8111156110e5576110e5610fb6565b6110f9816110f38454610f63565b8461107d565b602080601f83116001811461112e57600084156111165750858301515b600019600386901b1c1916600185901b1785556110c3565b600085815260208120601f198616915b8281101561115d5788860151825594840194600190910190840161113e565b508582101561117b5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b602081526000610ed66020830184610daf565b6000602082840312156111b057600080fd5b8151610ed681610dff565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60018060a01b038616815284602082015283604082015260806060820152600061077e6080830184866111bb565b602081526000610c016020830184866111bb565b600081518084526020808501945080840160005b8381101561125f5781516001600160a01b03168752958201959082019060010161123a565b509495945050505050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526112cb610100840182611226565b905060a0840151601f198483030160e08501526109ed8282610daf565b634e487b7160e01b600052601160045260246000fd5b818103818111156109f2576109f26112e8565b808201808211156109f2576109f26112e8565b60006020828403121561133657600080fd5b81518015158114610ed657600080fd5b60008251611358818460208701610d8b565b919091019291505056fea26469706673582212200ac3abd1656ec36fe93e285d17b1522d243bab43567aa1d1ae54840806b6eb8d64736f6c63430008120033", + Bin: "0x60a06040523480156200001157600080fd5b50604051620015aa380380620015aa833981016040819052620000349162000196565b600160005580806001600160a01b038116620000bc5760405162461bcd60e51b815260206004820152603760248201527f54656c65706f727465725570677261646561626c653a207a65726f2074656c6560448201527f706f727465722072656769737472792061646472657373000000000000000000606482015260840160405180910390fd5b6001600160a01b03811660808190526040805163301fd1f560e21b8152905163c07f47d4916004808201926020929091908290030181865afa15801562000107573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200012d9190620001c8565b600155506200013c3362000144565b5050620001e2565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600060208284031215620001a957600080fd5b81516001600160a01b0381168114620001c157600080fd5b9392505050565b600060208284031215620001db57600080fd5b5051919050565b6080516113986200021260003960008181609d0152818161026d01528181610343015261055701526113986000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063b6109d9d11610066578063b6109d9d14610118578063c868efaa14610120578063e49cc55314610133578063f2fde38b1461014a578063f63d09d71461015d57600080fd5b80631a7f5bec14610098578063715018a6146100dc5780638da5cb5b146100e6578063b33fead4146100f7575b600080fd5b6100bf7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6100e4610170565b005b6002546001600160a01b03166100bf565b61010a610105366004610d72565b610184565b6040516100d3929190610ddb565b6100e461025c565b6100e461012e366004610e5d565b61032b565b61013c60015481565b6040519081526020016100d3565b6100e4610158366004610eb9565b6104d3565b61013c61016b366004610edd565b610549565b610178610789565b61018260006107e3565b565b6000818152600360209081526040808320815180830190925280546001600160a01b0316825260018101805460609486949392908401916101c490610f63565b80601f01602080910402602001604051908101604052809291908181526020018280546101f090610f63565b801561023d5780601f106102125761010080835404028352916020019161023d565b820191906000526020600020905b81548152906001019060200180831161022057829003601f168201915b5050505050815250509050806000015181602001519250925050915091565b610264610789565b600060015490507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c07f47d46040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102ed9190610f9d565b60018190558110156103285760015460405182907fa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d90600090a35b50565b60015460405163260f846760e11b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690634c1f08ce90602401602060405180830381865afa158015610392573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103b69190610f9d565b10156104225760405162461bcd60e51b815260206004820152603060248201527f54656c65706f727465725570677261646561626c653a20696e76616c6964207460448201526f32b632b837b93a32b91039b2b73232b960811b60648201526084015b60405180910390fd5b600061043082840184610fcc565b6040805180820182526001600160a01b038781168252602080830185815260008b81526003909252939020825181546001600160a01b0319169216919091178155915192935091600182019061048690826110cb565b50905050836001600160a01b0316857f1f5c800b5f2b573929a7948f82a199c2a212851b53a6c5bd703ece23999d24aa836040516104c4919061118b565b60405180910390a35050505050565b6104db610789565b6001600160a01b0381166105405760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610419565b610328816107e3565b6000610553610835565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d820e64f6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105d7919061119e565b905060008615610601576105eb888861088e565b90506106016001600160a01b03891683836109f8565b886001600160a01b03168a7fa06eff1edd0c66b8dc96d086dda7ba263edf88d7417e6cb15073b5e7bff8a8ca8a848a8a8a6040516106439594939291906111e4565b60405180910390a3816001600160a01b031663624488506040518060c001604052808d81526020018c6001600160a01b0316815260200160405180604001604052808d6001600160a01b03168152602001868152508152602001898152602001600067ffffffffffffffff8111156106bd576106bd610fb6565b6040519080825280602002602001820160405280156106e6578160200160208202803683370190505b50815260200188886040516020016106ff929190611212565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161072d919061126a565b6020604051808303816000875af115801561074c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107709190610f9d565b9250505061077e6001600055565b979650505050505050565b6002546001600160a01b031633146101825760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610419565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6002600054036108875760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610419565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa1580156108d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108fb9190610f9d565b90506109126001600160a01b038516333086610ae3565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610959573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097d9190610f9d565b90508181116109e35760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b6064820152608401610419565b6109ed82826112fe565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610a49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6d9190610f9d565b610a779190611311565b6040516001600160a01b038516602482015260448101829052909150610add90859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610b1b565b50505050565b6040516001600160a01b0380851660248301528316604482015260648101829052610add9085906323b872dd60e01b90608401610aa6565b6000610b70826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610bf29092919063ffffffff16565b805190915015610bed5780806020019051810190610b8e9190611324565b610bed5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610419565b505050565b6060610c018484600085610c09565b949350505050565b606082471015610c6a5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610419565b600080866001600160a01b03168587604051610c869190611346565b60006040518083038185875af1925050503d8060008114610cc3576040519150601f19603f3d011682016040523d82523d6000602084013e610cc8565b606091505b509150915061077e8783838760608315610d43578251600003610d3c576001600160a01b0385163b610d3c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610419565b5081610c01565b610c018383815115610d585781518083602001fd5b8060405162461bcd60e51b8152600401610419919061118b565b600060208284031215610d8457600080fd5b5035919050565b60005b83811015610da6578181015183820152602001610d8e565b50506000910152565b60008151808452610dc7816020860160208601610d8b565b601f01601f19169290920160200192915050565b6001600160a01b0383168152604060208201819052600090610c0190830184610daf565b6001600160a01b038116811461032857600080fd5b60008083601f840112610e2657600080fd5b50813567ffffffffffffffff811115610e3e57600080fd5b602083019150836020828501011115610e5657600080fd5b9250929050565b60008060008060608587031215610e7357600080fd5b843593506020850135610e8581610dff565b9250604085013567ffffffffffffffff811115610ea157600080fd5b610ead87828801610e14565b95989497509550505050565b600060208284031215610ecb57600080fd5b8135610ed681610dff565b9392505050565b600080600080600080600060c0888a031215610ef857600080fd5b873596506020880135610f0a81610dff565b95506040880135610f1a81610dff565b9450606088013593506080880135925060a088013567ffffffffffffffff811115610f4457600080fd5b610f508a828b01610e14565b989b979a50959850939692959293505050565b600181811c90821680610f7757607f821691505b602082108103610f9757634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215610faf57600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b600060208284031215610fde57600080fd5b813567ffffffffffffffff80821115610ff657600080fd5b818401915084601f83011261100a57600080fd5b81358181111561101c5761101c610fb6565b604051601f8201601f19908116603f0116810190838211818310171561104457611044610fb6565b8160405282815287602084870101111561105d57600080fd5b826020860160208301376000928101602001929092525095945050505050565b601f821115610bed57600081815260208120601f850160051c810160208610156110a45750805b601f850160051c820191505b818110156110c3578281556001016110b0565b505050505050565b815167ffffffffffffffff8111156110e5576110e5610fb6565b6110f9816110f38454610f63565b8461107d565b602080601f83116001811461112e57600084156111165750858301515b600019600386901b1c1916600185901b1785556110c3565b600085815260208120601f198616915b8281101561115d5788860151825594840194600190910190840161113e565b508582101561117b5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b602081526000610ed66020830184610daf565b6000602082840312156111b057600080fd5b8151610ed681610dff565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60018060a01b038616815284602082015283604082015260806060820152600061077e6080830184866111bb565b602081526000610c016020830184866111bb565b600081518084526020808501945080840160005b8381101561125f5781516001600160a01b03168752958201959082019060010161123a565b509495945050505050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526112cb610100840182611226565b905060a0840151601f198483030160e08501526109ed8282610daf565b634e487b7160e01b600052601160045260246000fd5b818103818111156109f2576109f26112e8565b808201808211156109f2576109f26112e8565b60006020828403121561133657600080fd5b81518015158114610ed657600080fd5b60008251611358818460208701610d8b565b919091019291505056fea264697066735822122003d1f69ec1a11967893c99560c282458714a9ee9401d228d465633d92b11a6f764736f6c63430008120033", } // ExampleCrossChainMessengerABI is the input ABI used to generate the binding from. diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go index 7e7c2ad6a..a8a1ebe2c 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go @@ -38,7 +38,7 @@ type TeleporterFeeInfo struct { // NativeTokenDestinationMetaData contains all meta data concerning the NativeTokenDestination contract. var NativeTokenDestinationMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialReserveImbalance_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"burnAddressBalance\",\"type\":\"uint256\"}],\"name\":\"ReportTotalBurnedTxFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"BURN_FOR_TRANSFER_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REPORT_BURNED_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"reportTotalBurnedTxFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalMinted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", - Bin: "0x6101206040527302000000000000000000000000000000000000016080523480156200002a57600080fd5b5060405162001b7938038062001b798339810160408190526200004d9162000350565b60016000556001600160a01b038416620000d45760405162461bcd60e51b815260206004820152603860248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2054656c60448201527f65706f727465724d657373656e6765722061646472657373000000000000000060648201526084015b60405180910390fd5b6001600160a01b03841661010052826200013a5760405162461bcd60e51b8152602060048201526031602482015260008051602062001b598339815191526044820152701c98d948189b1bd8dad8da185a5b881251607a1b6064820152608401620000cb565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200018d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001b3919062000399565b8303620002295760405162461bcd60e51b815260206004820152603a60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a2063616e6e6f74206260448201527f726964676520776974682073616d6520626c6f636b636861696e0000000000006064820152608401620000cb565b60a08390526001600160a01b0382166200029b5760405162461bcd60e51b8152602060048201526034602482015260008051602062001b5983398151915260448201527f72636520636f6e747261637420616464726573730000000000000000000000006064820152608401620000cb565b6001600160a01b03821660c0526000819003620003215760405162461bcd60e51b815260206004820152603660248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20696e6960448201527f7469616c207265736572766520696d62616c616e6365000000000000000000006064820152608401620000cb565b60e081905260015550620003b3915050565b80516001600160a01b03811681146200034b57600080fd5b919050565b600080600080608085870312156200036757600080fd5b620003728562000333565b935060208501519250620003896040860162000333565b6060959095015193969295505050565b600060208284031215620003ac57600080fd5b5051919050565b60805160a05160c05160e051610100516117146200044560003960008181610244015281816103e30152818161067c015281816106d901526108e901526000818161021001526103060152600081816101b101528181610443015281816107390152610a0c01526000818161013c0152818161041d01528181610713015261098801526000610c7d01526117146000f3fe6080604052600436106100e75760003560e01c80638ac7dd201161008a578063ab28523011610059578063ab28523014610297578063c452165e146102ae578063c868efaa146102c6578063d30951261461029757600080fd5b80638ac7dd20146101fe5780639b3e580314610232578063a2309ff814610266578063a2a950171461027c57600080fd5b80633a94fe51116100c65780633a94fe511461015e57806349e3284e146101805780635d93f9af1461019f57806375846562146101eb57600080fd5b8062d872ae146100ec57806318160ddd1461011557806329b7b3fd1461012a575b600080fd5b3480156100f857600080fd5b5061010260015481565b6040519081526020015b60405180910390f35b34801561012157600080fd5b506101026102e6565b34801561013657600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561016a57600080fd5b5061017e610179366004611292565b6103cc565b005b34801561018c57600080fd5b506001546040519015815260200161010c565b3480156101ab57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010c565b61017e6101f93660046112fe565b6105a7565b34801561020a57600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561023e57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b34801561027257600080fd5b5061010260025481565b34801561028857600080fd5b506101d36001600160981b0181565b3480156102a357600080fd5b50610102620186a081565b3480156102ba57600080fd5b506101d3600160981b81565b3480156102d257600080fd5b5061017e6102e1366004611362565b6108d6565b6000806103006001600160981b0131600160981b31611401565b905060007f00000000000000000000000000000000000000000000000000000000000000006002546103329190611401565b9050808211156103bb5760405162461bcd60e51b815260206004820152604360248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20464154414c202d2060448201527f636f6e74726163742068617320746f6b656e7320756e6163636f756e746564206064820152623337b960e91b608482015260a4015b60405180910390fd5b6103c58282611414565b9250505090565b6000600160981b6001600160a01b031631905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906104819190611427565b8152602001620186a08152602001878780806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250604080516020808201899052825180830382018152828401909352909201916104f3916001916060016114dd565b6040516020818303038152906040528152506040518263ffffffff1660e01b81526004016105219190611558565b6020604051808303816000875af1158015610540573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061056491906115d6565b9050807f2550fa6041684d40e635e29e93dde9017d70c25b46aa88393317b5182ed6ae7c8360405161059891815260200190565b60405180910390a25050505050565b6105af610ce7565b6001600160a01b0384166105d55760405162461bcd60e51b81526004016103b2906115ef565b600154156106425760405162461bcd60e51b815260206004820152603460248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20636f6e7472616374604482015273081d5b99195c98dbdb1b185d195c985b1a5e995960621b60648201526084016103b2565b60006020840135156106a15761066861065e602086018661163d565b8560200135610d40565b90506106a161067a602086018661163d565b7f000000000000000000000000000000000000000000000000000000000000000083610eaa565b6040516001600160981b01903480156108fc02916000818181858888f193505050501580156106d4573d6000803e3d6000fd5b5060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906107779190611427565b8152602001620186a08152602001878780806020026020016040519081016040528093929190818152602001838360200280828437600092018290525093855250506040516020938401936107e592508d913491016001600160a01b03929092168252602082015260400190565b60408051601f198184030181529082905261080392916020016114dd565b6040516020818303038152906040528152506040518263ffffffff1660e01b81526004016108319190611558565b6020604051808303816000875af1158015610850573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061087491906115d6565b905080866001600160a01b0316336001600160a01b03167f0322cbb1d3c23f6dbf1deddb3b4ef3ce0f93ae6eec7b44e4f395804104466d14346040516108bc91815260200190565b60405180910390a450506108d06001600055565b50505050565b6108de610ce7565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146109865760405162461bcd60e51b815260206004820152604160248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201527f697a65642054656c65706f727465724d657373656e67657220636f6e747261636064820152601d60fa1b608482015260a4016103b2565b7f00000000000000000000000000000000000000000000000000000000000000008414610a0a5760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20696e76616c69642060448201526b39b7bab931b29031b430b4b760a11b60648201526084016103b2565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031614610a9f5760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201526a34bd32b21039b2b73232b960a91b60648201526084016103b2565b600080610aae83850185611661565b90925090506001600160a01b038216610ad95760405162461bcd60e51b81526004016103b2906115ef565b80600003610b3d5760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2074726160448201526a6e736665722076616c756560a81b60648201526084016103b2565b600154819015610c0257600154821115610ba65760015460408051918252600060208301527f244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449910160405180910390a1600154610b9a9083611414565b60006001559050610c02565b8160016000828254610bb89190611414565b90915550506001546040805184815260208101929092527f244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449910160405180910390a1505050610cdd565b8060026000828254610c149190611401565b90915550506040518181526001600160a01b038416907fd949ea0e9d5db53492d77f28fd5467fb2f6c4f5b88e3350e3c36729b76e99cf29060200160405180910390a26040516327ad555d60e11b81526001600160a01b038481166004830152602482018390527f00000000000000000000000000000000000000000000000000000000000000001690634f5aaaba90604401600060405180830381600087803b158015610cc157600080fd5b505af1158015610cd5573d6000803e3d6000fd5b505050505050505b6108d06001600055565b600260005403610d395760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016103b2565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015610d89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dad91906115d6565b9050610dc46001600160a01b038516333086610f8f565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610e0b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2f91906115d6565b9050818111610e955760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016103b2565b610e9f8282611414565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610efb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1f91906115d6565b610f299190611401565b6040516001600160a01b0385166024820152604481018290529091506108d090859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610fc7565b6040516001600160a01b03808516602483015283166044820152606481018290526108d09085906323b872dd60e01b90608401610f58565b600061101c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661109e9092919063ffffffff16565b805190915015611099578080602001905181019061103a919061168d565b6110995760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103b2565b505050565b60606110ad84846000856110b5565b949350505050565b6060824710156111165760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016103b2565b600080866001600160a01b0316858760405161113291906116af565b60006040518083038185875af1925050503d806000811461116f576040519150601f19603f3d011682016040523d82523d6000602084013e611174565b606091505b509150915061118587838387611190565b979650505050505050565b606083156111ff5782516000036111f8576001600160a01b0385163b6111f85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103b2565b50816110ad565b6110ad83838151156112145781518083602001fd5b8060405162461bcd60e51b81526004016103b291906116cb565b60006040828403121561124057600080fd5b50919050565b60008083601f84011261125857600080fd5b50813567ffffffffffffffff81111561127057600080fd5b6020830191508360208260051b850101111561128b57600080fd5b9250929050565b6000806000606084860312156112a757600080fd5b6112b1858561122e565b9250604084013567ffffffffffffffff8111156112cd57600080fd5b6112d986828701611246565b9497909650939450505050565b6001600160a01b03811681146112fb57600080fd5b50565b6000806000806080858703121561131457600080fd5b843561131f816112e6565b935061132e866020870161122e565b9250606085013567ffffffffffffffff81111561134a57600080fd5b61135687828801611246565b95989497509550505050565b6000806000806060858703121561137857600080fd5b84359350602085013561138a816112e6565b9250604085013567ffffffffffffffff808211156113a757600080fd5b818701915087601f8301126113bb57600080fd5b8135818111156113ca57600080fd5b8860208285010111156113dc57600080fd5b95989497505060200194505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610ea457610ea46113eb565b81810381811115610ea457610ea46113eb565b60006040828403121561143957600080fd5b6040516040810181811067ffffffffffffffff8211171561146a57634e487b7160e01b600052604160045260246000fd5b6040528235611478816112e6565b81526020928301359281019290925250919050565b60005b838110156114a8578181015183820152602001611490565b50506000910152565b600081518084526114c981602086016020860161148d565b601f01601f19169290920160200192915050565b6000600284106114fd57634e487b7160e01b600052602160045260246000fd5b838252604060208301526110ad60408301846114b1565b600081518084526020808501945080840160005b8381101561154d5781516001600160a01b031687529582019590820190600101611528565b509495945050505050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526115b9610100840182611514565b905060a0840151601f198483030160e0850152610e9f82826114b1565b6000602082840312156115e857600080fd5b5051919050565b6020808252602e908201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2072656360408201526d697069656e74206164647265737360901b606082015260800190565b60006020828403121561164f57600080fd5b813561165a816112e6565b9392505050565b6000806040838503121561167457600080fd5b823561167f816112e6565b946020939093013593505050565b60006020828403121561169f57600080fd5b8151801515811461165a57600080fd5b600082516116c181846020870161148d565b9190910192915050565b60208152600061165a60208301846114b156fea2646970667358221220ce89275c126671cd0bd194362db113cc6f9073978088cbfd89e591b63745e9be64736f6c634300081200334e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20736f75", + Bin: "0x6101206040527302000000000000000000000000000000000000016080523480156200002a57600080fd5b5060405162001afb38038062001afb8339810160408190526200004d9162000350565b60016000556001600160a01b038416620000d45760405162461bcd60e51b815260206004820152603860248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2054656c60448201527f65706f727465724d657373656e6765722061646472657373000000000000000060648201526084015b60405180910390fd5b6001600160a01b03841661010052826200013a5760405162461bcd60e51b8152602060048201526031602482015260008051602062001adb8339815191526044820152701c98d948189b1bd8dad8da185a5b881251607a1b6064820152608401620000cb565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200018d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001b3919062000399565b8303620002295760405162461bcd60e51b815260206004820152603a60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a2063616e6e6f74206260448201527f726964676520776974682073616d6520626c6f636b636861696e0000000000006064820152608401620000cb565b60a08390526001600160a01b0382166200029b5760405162461bcd60e51b8152602060048201526034602482015260008051602062001adb83398151915260448201527f72636520636f6e747261637420616464726573730000000000000000000000006064820152608401620000cb565b6001600160a01b03821660c0526000819003620003215760405162461bcd60e51b815260206004820152603660248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20696e6960448201527f7469616c207265736572766520696d62616c616e6365000000000000000000006064820152608401620000cb565b60e081905260015550620003b3915050565b80516001600160a01b03811681146200034b57600080fd5b919050565b600080600080608085870312156200036757600080fd5b620003728562000333565b935060208501519250620003896040860162000333565b6060959095015193969295505050565b600060208284031215620003ac57600080fd5b5051919050565b60805160a05160c05160e0516101005161169662000445600039600081816102440152818161035c015281816105fe0152818161065b015261086b01526000818161021001526103060152600081816101b1015281816103bc015281816106bb015261098e01526000818161013c0152818161039601528181610695015261090a01526000610bff01526116966000f3fe6080604052600436106100e75760003560e01c80638ac7dd201161008a578063ab28523011610059578063ab28523014610297578063c452165e146102ae578063c868efaa146102c6578063d30951261461029757600080fd5b80638ac7dd20146101fe5780639b3e580314610232578063a2309ff814610266578063a2a950171461027c57600080fd5b80633a94fe51116100c65780633a94fe511461015e57806349e3284e146101805780635d93f9af1461019f57806375846562146101eb57600080fd5b8062d872ae146100ec57806318160ddd1461011557806329b7b3fd1461012a575b600080fd5b3480156100f857600080fd5b5061010260015481565b6040519081526020015b60405180910390f35b34801561012157600080fd5b506101026102e6565b34801561013657600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561016a57600080fd5b5061017e610179366004611214565b610345565b005b34801561018c57600080fd5b506001546040519015815260200161010c565b3480156101ab57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010c565b61017e6101f9366004611280565b610520565b34801561020a57600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561023e57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b34801561027257600080fd5b5061010260025481565b34801561028857600080fd5b506101d36001600160981b0181565b3480156102a357600080fd5b50610102620186a081565b3480156102ba57600080fd5b506101d3600160981b81565b3480156102d257600080fd5b5061017e6102e13660046112e4565b610858565b6000806103006001600160981b0131600160981b31611383565b905060007f00000000000000000000000000000000000000000000000000000000000000006002546103329190611383565b905061033e8282611396565b9250505090565b6000600160981b6001600160a01b031631905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906103fa91906113a9565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505050908252506040805160208082018990528251808303820181528284019093529092019161046c9160019160600161145f565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161049a91906114da565b6020604051808303816000875af11580156104b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104dd9190611558565b9050807f2550fa6041684d40e635e29e93dde9017d70c25b46aa88393317b5182ed6ae7c8360405161051191815260200190565b60405180910390a25050505050565b610528610c69565b6001600160a01b0384166105575760405162461bcd60e51b815260040161054e90611571565b60405180910390fd5b600154156105c45760405162461bcd60e51b815260206004820152603460248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20636f6e7472616374604482015273081d5b99195c98dbdb1b185d195c985b1a5e995960621b606482015260840161054e565b6000602084013515610623576105ea6105e060208601866115bf565b8560200135610cc2565b90506106236105fc60208601866115bf565b7f000000000000000000000000000000000000000000000000000000000000000083610e2c565b6040516001600160981b01903480156108fc02916000818181858888f19350505050158015610656573d6000803e3d6000fd5b5060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906106f991906113a9565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250938552505060405160209384019361076792508d913491016001600160a01b03929092168252602082015260400190565b60408051601f1981840301815290829052610785929160200161145f565b6040516020818303038152906040528152506040518263ffffffff1660e01b81526004016107b391906114da565b6020604051808303816000875af11580156107d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f69190611558565b905080866001600160a01b0316336001600160a01b03167f0322cbb1d3c23f6dbf1deddb3b4ef3ce0f93ae6eec7b44e4f395804104466d143460405161083e91815260200190565b60405180910390a450506108526001600055565b50505050565b610860610c69565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146109085760405162461bcd60e51b815260206004820152604160248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201527f697a65642054656c65706f727465724d657373656e67657220636f6e747261636064820152601d60fa1b608482015260a40161054e565b7f0000000000000000000000000000000000000000000000000000000000000000841461098c5760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20696e76616c69642060448201526b39b7bab931b29031b430b4b760a11b606482015260840161054e565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031614610a215760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201526a34bd32b21039b2b73232b960a91b606482015260840161054e565b600080610a30838501856115e3565b90925090506001600160a01b038216610a5b5760405162461bcd60e51b815260040161054e90611571565b80600003610abf5760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2074726160448201526a6e736665722076616c756560a81b606482015260840161054e565b600154819015610b8457600154821115610b285760015460408051918252600060208301527f244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449910160405180910390a1600154610b1c9083611396565b60006001559050610b84565b8160016000828254610b3a9190611396565b90915550506001546040805184815260208101929092527f244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449910160405180910390a1505050610c5f565b8060026000828254610b969190611383565b90915550506040518181526001600160a01b038416907fd949ea0e9d5db53492d77f28fd5467fb2f6c4f5b88e3350e3c36729b76e99cf29060200160405180910390a26040516327ad555d60e11b81526001600160a01b038481166004830152602482018390527f00000000000000000000000000000000000000000000000000000000000000001690634f5aaaba90604401600060405180830381600087803b158015610c4357600080fd5b505af1158015610c57573d6000803e3d6000fd5b505050505050505b6108526001600055565b600260005403610cbb5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161054e565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015610d0b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2f9190611558565b9050610d466001600160a01b038516333086610f11565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610d8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610db19190611558565b9050818111610e175760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b606482015260840161054e565b610e218282611396565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610e7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea19190611558565b610eab9190611383565b6040516001600160a01b03851660248201526044810182905290915061085290859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610f49565b6040516001600160a01b03808516602483015283166044820152606481018290526108529085906323b872dd60e01b90608401610eda565b6000610f9e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166110209092919063ffffffff16565b80519091501561101b5780806020019051810190610fbc919061160f565b61101b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161054e565b505050565b606061102f8484600085611037565b949350505050565b6060824710156110985760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161054e565b600080866001600160a01b031685876040516110b49190611631565b60006040518083038185875af1925050503d80600081146110f1576040519150601f19603f3d011682016040523d82523d6000602084013e6110f6565b606091505b509150915061110787838387611112565b979650505050505050565b6060831561118157825160000361117a576001600160a01b0385163b61117a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161054e565b508161102f565b61102f83838151156111965781518083602001fd5b8060405162461bcd60e51b815260040161054e919061164d565b6000604082840312156111c257600080fd5b50919050565b60008083601f8401126111da57600080fd5b50813567ffffffffffffffff8111156111f257600080fd5b6020830191508360208260051b850101111561120d57600080fd5b9250929050565b60008060006060848603121561122957600080fd5b61123385856111b0565b9250604084013567ffffffffffffffff81111561124f57600080fd5b61125b868287016111c8565b9497909650939450505050565b6001600160a01b038116811461127d57600080fd5b50565b6000806000806080858703121561129657600080fd5b84356112a181611268565b93506112b086602087016111b0565b9250606085013567ffffffffffffffff8111156112cc57600080fd5b6112d8878288016111c8565b95989497509550505050565b600080600080606085870312156112fa57600080fd5b84359350602085013561130c81611268565b9250604085013567ffffffffffffffff8082111561132957600080fd5b818701915087601f83011261133d57600080fd5b81358181111561134c57600080fd5b88602082850101111561135e57600080fd5b95989497505060200194505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610e2657610e2661136d565b81810381811115610e2657610e2661136d565b6000604082840312156113bb57600080fd5b6040516040810181811067ffffffffffffffff821117156113ec57634e487b7160e01b600052604160045260246000fd5b60405282356113fa81611268565b81526020928301359281019290925250919050565b60005b8381101561142a578181015183820152602001611412565b50506000910152565b6000815180845261144b81602086016020860161140f565b601f01601f19169290920160200192915050565b60006002841061147f57634e487b7160e01b600052602160045260246000fd5b8382526040602083015261102f6040830184611433565b600081518084526020808501945080840160005b838110156114cf5781516001600160a01b0316875295820195908201906001016114aa565b509495945050505050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c084015261153b610100840182611496565b905060a0840151601f198483030160e0850152610e218282611433565b60006020828403121561156a57600080fd5b5051919050565b6020808252602e908201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2072656360408201526d697069656e74206164647265737360901b606082015260800190565b6000602082840312156115d157600080fd5b81356115dc81611268565b9392505050565b600080604083850312156115f657600080fd5b823561160181611268565b946020939093013593505050565b60006020828403121561162157600080fd5b815180151581146115dc57600080fd5b6000825161164381846020870161140f565b9190910192915050565b6020815260006115dc602083018461143356fea264697066735822122036381db71b2a300b550256a4421bf86a40ce0e13273cc88afda92e6ccaa615bb64736f6c634300081200334e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20736f75", } // NativeTokenDestinationABI is the input ABI used to generate the binding from. diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go index 2269b57fc..ea5da2229 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go @@ -38,7 +38,7 @@ type TeleporterFeeInfo struct { // NativeTokenSourceMetaData contains all meta data concerning the NativeTokenSource contract. var NativeTokenSourceMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBurnedTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", - Bin: "0x60e06040523480156200001157600080fd5b5060405162001670380380620016708339810160408190526200003491620002b3565b60016000556001600160a01b038316620000bb5760405162461bcd60e51b815260206004820152603360248201527f4e6174697665546f6b656e536f757263653a207a65726f2054656c65706f727460448201527f65724d657373656e67657220616464726573730000000000000000000000000060648201526084015b60405180910390fd5b6001600160a01b03831660c05281620001205760405162461bcd60e51b81526020600482015260316024820152600080516020620016508339815191526044820152701a5bdb88189b1bd8dad8da185a5b881251607a1b6064820152608401620000b2565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000173573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001999190620002f4565b82036200020f5760405162461bcd60e51b815260206004820152603560248201527f4e6174697665546f6b656e536f757263653a2063616e6e6f742062726964676560448201527f20776974682073616d6520626c6f636b636861696e00000000000000000000006064820152608401620000b2565b60808290526001600160a01b038116620002815760405162461bcd60e51b815260206004820152603460248201526000805160206200165083398151915260448201527f696f6e20636f6e747261637420616464726573730000000000000000000000006064820152608401620000b2565b6001600160a01b031660a052506200030e9050565b80516001600160a01b0381168114620002ae57600080fd5b919050565b600080600060608486031215620002c957600080fd5b620002d48462000296565b925060208401519150620002eb6040850162000296565b90509250925092565b6000602082840312156200030757600080fd5b5051919050565b60805160a05160c0516112e36200036d6000396000818160ef015281816102320152818161025b015261044e015260008181610167015281816102bb015261056701526000818160920152818161029501526104e301526112e36000f3fe60806040526004361061007b5760003560e01c8063b6171f731161004e578063b6171f731461013e578063b8c9091a14610155578063c452165e14610189578063c868efaa146101a157600080fd5b806341d3014d1461008057806355db3e9e146100c75780639b3e5803146100dd578063ad0aee2514610129575b600080fd5b34801561008c57600080fd5b506100b47f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b3480156100d357600080fd5b506100b460015481565b3480156100e957600080fd5b506101117f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100be565b61013c610137366004610de0565b6101c1565b005b34801561014a57600080fd5b506100b4620186a081565b34801561016157600080fd5b506101117f000000000000000000000000000000000000000000000000000000000000000081565b34801561019557600080fd5b50610111600160981b81565b3480156101ad57600080fd5b5061013c6101bc366004610e7f565b61043b565b6101c96106ec565b6001600160a01b0384166101f85760405162461bcd60e51b81526004016101ef90610ef9565b60405180910390fd5b60006020840135156102575761021e6102146020860186610f42565b8560200135610745565b90506102576102306020860186610f42565b7f0000000000000000000000000000000000000000000000000000000000000000836108af565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906102f99190610fad565b8152602001620186a08152602001878780806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250604051602091820191610368918c913491016001600160a01b03929092168252602082015260400190565b6040516020818303038152906040528152506040518263ffffffff1660e01b81526004016103969190611099565b6020604051808303816000875af11580156103b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d99190611117565b905080866001600160a01b0316336001600160a01b03167f2b4e8f08417773e367064a6aea9ca2df303a60876676f70b6c3c5e66b314ca5a3460405161042191815260200190565b60405180910390a450506104356001600055565b50505050565b6104436106ec565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146104e15760405162461bcd60e51b815260206004820152603c60248201527f4e6174697665546f6b656e536f757263653a20756e617574686f72697a65642060448201527f54656c65706f727465724d657373656e67657220636f6e74726163740000000060648201526084016101ef565b7f000000000000000000000000000000000000000000000000000000000000000084146105655760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e536f757263653a20696e76616c696420646573746960448201526b3730ba34b7b71031b430b4b760a11b60648201526084016101ef565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316146105f55760405162461bcd60e51b815260206004820152602660248201527f4e6174697665546f6b656e536f757263653a20756e617574686f72697a65642060448201526539b2b73232b960d11b60648201526084016101ef565b60008061060483850185611130565b9092509050600082600181111561061d5761061d6111dc565b0361064e576000808280602001905181019061063991906111f2565b915091506106478282610994565b50506106e0565b6001826001811115610662576106626111dc565b0361068e5760008180602001905181019061067d9190611117565b905061068881610a9a565b506106e0565b60405162461bcd60e51b815260206004820152602160248201527f4e6174697665546f6b656e536f757263653a20696e76616c696420616374696f6044820152603760f91b60648201526084016101ef565b50506104356001600055565b60026000540361073e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101ef565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa15801561078e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b29190611117565b90506107c96001600160a01b038516333086610ac9565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610810573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108349190611117565b905081811161089a5760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016101ef565b6108a48282611236565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610900573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109249190611117565b61092e9190611249565b6040516001600160a01b03851660248201526044810182905290915061043590859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610b01565b6001600160a01b0382166109ba5760405162461bcd60e51b81526004016101ef90610ef9565b80471015610a1d5760405162461bcd60e51b815260206004820152602a60248201527f4e6174697665546f6b656e536f757263653a20696e73756666696369656e742060448201526918dbdb1b185d195c985b60b21b60648201526084016101ef565b604080516001600160a01b0384168152602081018390527f55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407910160405180910390a16040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015610a95573d6000803e3d6000fd5b505050565b600154811115610ac657600060015482610ab49190611236565b9050610abf81610bd3565b5060018190555b50565b6040516001600160a01b03808516602483015283166044820152606481018290526104359085906323b872dd60e01b9060840161095d565b6000610b56826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c3b9092919063ffffffff16565b805190915015610a955780806020019051810190610b74919061125c565b610a955760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016101ef565b6040518181527f2cd3fd70cd5a5d6d805e90d22741aa1a84590ace7cf01b244719558d266143829060200160405180910390a1604051600160981b9082156108fc029083906000818181858888f19350505050158015610c37573d6000803e3d6000fd5b5050565b6060610c4a8484600085610c52565b949350505050565b606082471015610cb35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016101ef565b600080866001600160a01b03168587604051610ccf919061127e565b60006040518083038185875af1925050503d8060008114610d0c576040519150601f19603f3d011682016040523d82523d6000602084013e610d11565b606091505b5091509150610d2287838387610d2d565b979650505050505050565b60608315610d9c578251600003610d95576001600160a01b0385163b610d955760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101ef565b5081610c4a565b610c4a8383815115610db15781518083602001fd5b8060405162461bcd60e51b81526004016101ef919061129a565b6001600160a01b0381168114610ac657600080fd5b6000806000808486036080811215610df757600080fd5b8535610e0281610dcb565b94506040601f1982011215610e1657600080fd5b50602085019250606085013567ffffffffffffffff80821115610e3857600080fd5b818701915087601f830112610e4c57600080fd5b813581811115610e5b57600080fd5b8860208260051b8501011115610e7057600080fd5b95989497505060200194505050565b60008060008060608587031215610e9557600080fd5b843593506020850135610ea781610dcb565b9250604085013567ffffffffffffffff80821115610ec457600080fd5b818701915087601f830112610ed857600080fd5b813581811115610ee757600080fd5b886020828501011115610e7057600080fd5b60208082526029908201527f4e6174697665546f6b656e536f757263653a207a65726f20726563697069656e60408201526874206164647265737360b81b606082015260800190565b600060208284031215610f5457600080fd5b8135610f5f81610dcb565b9392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610fa557610fa5610f66565b604052919050565b600060408284031215610fbf57600080fd5b6040516040810181811067ffffffffffffffff82111715610fe257610fe2610f66565b6040528235610ff081610dcb565b81526020928301359281019290925250919050565b600081518084526020808501945080840160005b8381101561103e5781516001600160a01b031687529582019590820190600101611019565b509495945050505050565b60005b8381101561106457818101518382015260200161104c565b50506000910152565b60008151808452611085816020860160208601611049565b601f01601f19169290920160200192915050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526110fa610100840182611005565b905060a0840151601f198483030160e08501526108a4828261106d565b60006020828403121561112957600080fd5b5051919050565b6000806040838503121561114357600080fd5b82356002811061115257600080fd5b915060208381013567ffffffffffffffff8082111561117057600080fd5b818601915086601f83011261118457600080fd5b81358181111561119657611196610f66565b6111a8601f8201601f19168501610f7c565b915080825287848285010111156111be57600080fd5b80848401858401376000848284010152508093505050509250929050565b634e487b7160e01b600052602160045260246000fd5b6000806040838503121561120557600080fd5b825161121081610dcb565b6020939093015192949293505050565b634e487b7160e01b600052601160045260246000fd5b818103818111156108a9576108a9611220565b808201808211156108a9576108a9611220565b60006020828403121561126e57600080fd5b81518015158114610f5f57600080fd5b60008251611290818460208701611049565b9190910192915050565b602081526000610f5f602083018461106d56fea2646970667358221220c9ebc52d00bfb00d8357a20ede43fe06a3f9ec0e2fe10a9ea08132fdcf6a570264736f6c634300081200334e6174697665546f6b656e536f757263653a207a65726f2064657374696e6174", + Bin: "0x60e06040523480156200001157600080fd5b5060405162001670380380620016708339810160408190526200003491620002b3565b60016000556001600160a01b038316620000bb5760405162461bcd60e51b815260206004820152603360248201527f4e6174697665546f6b656e536f757263653a207a65726f2054656c65706f727460448201527f65724d657373656e67657220616464726573730000000000000000000000000060648201526084015b60405180910390fd5b6001600160a01b03831660c05281620001205760405162461bcd60e51b81526020600482015260316024820152600080516020620016508339815191526044820152701a5bdb88189b1bd8dad8da185a5b881251607a1b6064820152608401620000b2565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000173573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001999190620002f4565b82036200020f5760405162461bcd60e51b815260206004820152603560248201527f4e6174697665546f6b656e536f757263653a2063616e6e6f742062726964676560448201527f20776974682073616d6520626c6f636b636861696e00000000000000000000006064820152608401620000b2565b60808290526001600160a01b038116620002815760405162461bcd60e51b815260206004820152603460248201526000805160206200165083398151915260448201527f696f6e20636f6e747261637420616464726573730000000000000000000000006064820152608401620000b2565b6001600160a01b031660a052506200030e9050565b80516001600160a01b0381168114620002ae57600080fd5b919050565b600080600060608486031215620002c957600080fd5b620002d48462000296565b925060208401519150620002eb6040850162000296565b90509250925092565b6000602082840312156200030757600080fd5b5051919050565b60805160a05160c0516112e36200036d6000396000818160ef015281816102320152818161025b015261044e015260008181610167015281816102bb015261056701526000818160920152818161029501526104e301526112e36000f3fe60806040526004361061007b5760003560e01c8063b6171f731161004e578063b6171f731461013e578063b8c9091a14610155578063c452165e14610189578063c868efaa146101a157600080fd5b806341d3014d1461008057806355db3e9e146100c75780639b3e5803146100dd578063ad0aee2514610129575b600080fd5b34801561008c57600080fd5b506100b47f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b3480156100d357600080fd5b506100b460015481565b3480156100e957600080fd5b506101117f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100be565b61013c610137366004610de0565b6101c1565b005b34801561014a57600080fd5b506100b4620186a081565b34801561016157600080fd5b506101117f000000000000000000000000000000000000000000000000000000000000000081565b34801561019557600080fd5b50610111600160981b81565b3480156101ad57600080fd5b5061013c6101bc366004610e7f565b61043b565b6101c96106ec565b6001600160a01b0384166101f85760405162461bcd60e51b81526004016101ef90610ef9565b60405180910390fd5b60006020840135156102575761021e6102146020860186610f42565b8560200135610745565b90506102576102306020860186610f42565b7f0000000000000000000000000000000000000000000000000000000000000000836108af565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906102f99190610fad565b8152602001620186a08152602001878780806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250604051602091820191610368918c913491016001600160a01b03929092168252602082015260400190565b6040516020818303038152906040528152506040518263ffffffff1660e01b81526004016103969190611099565b6020604051808303816000875af11580156103b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d99190611117565b905080866001600160a01b0316336001600160a01b03167f2b4e8f08417773e367064a6aea9ca2df303a60876676f70b6c3c5e66b314ca5a3460405161042191815260200190565b60405180910390a450506104356001600055565b50505050565b6104436106ec565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146104e15760405162461bcd60e51b815260206004820152603c60248201527f4e6174697665546f6b656e536f757263653a20756e617574686f72697a65642060448201527f54656c65706f727465724d657373656e67657220636f6e74726163740000000060648201526084016101ef565b7f000000000000000000000000000000000000000000000000000000000000000084146105655760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e536f757263653a20696e76616c696420646573746960448201526b3730ba34b7b71031b430b4b760a11b60648201526084016101ef565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316146105f55760405162461bcd60e51b815260206004820152602660248201527f4e6174697665546f6b656e536f757263653a20756e617574686f72697a65642060448201526539b2b73232b960d11b60648201526084016101ef565b60008061060483850185611130565b9092509050600082600181111561061d5761061d6111dc565b0361064e576000808280602001905181019061063991906111f2565b915091506106478282610994565b50506106e0565b6001826001811115610662576106626111dc565b0361068e5760008180602001905181019061067d9190611117565b905061068881610a9a565b506106e0565b60405162461bcd60e51b815260206004820152602160248201527f4e6174697665546f6b656e536f757263653a20696e76616c696420616374696f6044820152603760f91b60648201526084016101ef565b50506104356001600055565b60026000540361073e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101ef565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa15801561078e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b29190611117565b90506107c96001600160a01b038516333086610ac9565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610810573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108349190611117565b905081811161089a5760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016101ef565b6108a48282611236565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610900573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109249190611117565b61092e9190611249565b6040516001600160a01b03851660248201526044810182905290915061043590859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610b01565b6001600160a01b0382166109ba5760405162461bcd60e51b81526004016101ef90610ef9565b80471015610a1d5760405162461bcd60e51b815260206004820152602a60248201527f4e6174697665546f6b656e536f757263653a20696e73756666696369656e742060448201526918dbdb1b185d195c985b60b21b60648201526084016101ef565b604080516001600160a01b0384168152602081018390527f55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407910160405180910390a16040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015610a95573d6000803e3d6000fd5b505050565b600154811115610ac657600060015482610ab49190611236565b9050610abf81610bd3565b5060018190555b50565b6040516001600160a01b03808516602483015283166044820152606481018290526104359085906323b872dd60e01b9060840161095d565b6000610b56826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c3b9092919063ffffffff16565b805190915015610a955780806020019051810190610b74919061125c565b610a955760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016101ef565b6040518181527f2cd3fd70cd5a5d6d805e90d22741aa1a84590ace7cf01b244719558d266143829060200160405180910390a1604051600160981b9082156108fc029083906000818181858888f19350505050158015610c37573d6000803e3d6000fd5b5050565b6060610c4a8484600085610c52565b949350505050565b606082471015610cb35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016101ef565b600080866001600160a01b03168587604051610ccf919061127e565b60006040518083038185875af1925050503d8060008114610d0c576040519150601f19603f3d011682016040523d82523d6000602084013e610d11565b606091505b5091509150610d2287838387610d2d565b979650505050505050565b60608315610d9c578251600003610d95576001600160a01b0385163b610d955760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101ef565b5081610c4a565b610c4a8383815115610db15781518083602001fd5b8060405162461bcd60e51b81526004016101ef919061129a565b6001600160a01b0381168114610ac657600080fd5b6000806000808486036080811215610df757600080fd5b8535610e0281610dcb565b94506040601f1982011215610e1657600080fd5b50602085019250606085013567ffffffffffffffff80821115610e3857600080fd5b818701915087601f830112610e4c57600080fd5b813581811115610e5b57600080fd5b8860208260051b8501011115610e7057600080fd5b95989497505060200194505050565b60008060008060608587031215610e9557600080fd5b843593506020850135610ea781610dcb565b9250604085013567ffffffffffffffff80821115610ec457600080fd5b818701915087601f830112610ed857600080fd5b813581811115610ee757600080fd5b886020828501011115610e7057600080fd5b60208082526029908201527f4e6174697665546f6b656e536f757263653a207a65726f20726563697069656e60408201526874206164647265737360b81b606082015260800190565b600060208284031215610f5457600080fd5b8135610f5f81610dcb565b9392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610fa557610fa5610f66565b604052919050565b600060408284031215610fbf57600080fd5b6040516040810181811067ffffffffffffffff82111715610fe257610fe2610f66565b6040528235610ff081610dcb565b81526020928301359281019290925250919050565b600081518084526020808501945080840160005b8381101561103e5781516001600160a01b031687529582019590820190600101611019565b509495945050505050565b60005b8381101561106457818101518382015260200161104c565b50506000910152565b60008151808452611085816020860160208601611049565b601f01601f19169290920160200192915050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526110fa610100840182611005565b905060a0840151601f198483030160e08501526108a4828261106d565b60006020828403121561112957600080fd5b5051919050565b6000806040838503121561114357600080fd5b82356002811061115257600080fd5b915060208381013567ffffffffffffffff8082111561117057600080fd5b818601915086601f83011261118457600080fd5b81358181111561119657611196610f66565b6111a8601f8201601f19168501610f7c565b915080825287848285010111156111be57600080fd5b80848401858401376000848284010152508093505050509250929050565b634e487b7160e01b600052602160045260246000fd5b6000806040838503121561120557600080fd5b825161121081610dcb565b6020939093015192949293505050565b634e487b7160e01b600052601160045260246000fd5b818103818111156108a9576108a9611220565b808201808211156108a9576108a9611220565b60006020828403121561126e57600080fd5b81518015158114610f5f57600080fd5b60008251611290818460208701611049565b9190910192915050565b602081526000610f5f602083018461106d56fea264697066735822122050f2661eccfff266ad546e178a378058827591f8c21151a460c37fce152709f564736f6c634300081200334e6174697665546f6b656e536f757263653a207a65726f2064657374696e6174", } // NativeTokenSourceABI is the input ABI used to generate the binding from. diff --git a/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol b/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol index 9a2ed44d1..b581c15d2 100644 --- a/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol +++ b/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol @@ -203,7 +203,7 @@ contract ERC20Bridge is // For non-zero fee amounts, first transfer the fee to this contract, and then // allow the Teleporter contract to spend it. - uint256 adjustedFeeAmount = 0; + uint256 adjustedFeeAmount; if (messageFeeAmount > 0) { adjustedFeeAmount = SafeERC20TransferFrom.safeTransferFrom( IERC20(messageFeeAsset), diff --git a/contracts/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol b/contracts/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol index d459cdcb2..0d42f7c6a 100644 --- a/contracts/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol +++ b/contracts/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol @@ -88,7 +88,7 @@ contract ExampleCrossChainMessenger is .getLatestTeleporter(); // For non-zero fee amounts, first transfer the fee to this contract, and then // allow the Teleporter contract to spend it. - uint256 adjustedFeeAmount = 0; + uint256 adjustedFeeAmount; if (feeAmount > 0) { adjustedFeeAmount = SafeERC20TransferFrom.safeTransferFrom( IERC20(feeTokenAddress), diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index f1709f200..40793d4cb 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -177,7 +177,7 @@ contract NativeTokenDestination is // Lock tokens in this bridge instance. Supports "fee/burn on transfer" ERC20 token // implementations by only bridging the actual balance increase reflected by the call // to transferFrom. - uint256 adjustedFeeAmount = 0; + uint256 adjustedFeeAmount; if (feeInfo.amount > 0) { adjustedFeeAmount = SafeERC20TransferFrom.safeTransferFrom( IERC20(feeInfo.feeTokenAddress), @@ -258,12 +258,6 @@ contract NativeTokenDestination is address(BURN_FOR_TRANSFER_ADDRESS).balance; uint256 created = totalMinted + initialReserveImbalance; - // This scenario should never happen, but this check will prevent an underflow - // where the contract would return a garbage value. - require( - burned <= created, - "NativeTokenDestination: FATAL - contract has tokens unaccounted for" - ); return created - burned; } } diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index 890c30a96..9e3712176 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -133,7 +133,7 @@ contract NativeTokenSource is // Lock tokens in this bridge instance. Supports "fee/burn on transfer" ERC20 token // implementations by only bridging the actual balance increase reflected by the call // to transferFrom. - uint256 adjustedFeeAmount = 0; + uint256 adjustedFeeAmount; if (feeInfo.amount > 0) { adjustedFeeAmount = SafeERC20TransferFrom.safeTransferFrom( IERC20(feeInfo.feeTokenAddress), diff --git a/tests/flows/erc20_to_native_token_bridge.go b/tests/flows/erc20_to_native_token_bridge.go index 4a9d0504e..3f3a2318c 100644 --- a/tests/flows/erc20_to_native_token_bridge.go +++ b/tests/flows/erc20_to_native_token_bridge.go @@ -258,7 +258,8 @@ func ERC20ToNativeTokenBridge(network interfaces.LocalNetwork) { utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) } - { // Transfer more tokens A -> B to collateralize the bridge + { + // Transfer more tokens A -> B to collateralize the bridge // Check starting balance is 0 utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) From 2b304950dbb545d97f0e2d58c9561a0330864d23 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Fri, 8 Dec 2023 12:36:02 -0500 Subject: [PATCH 181/183] Factor out helper functions --- tests/flows/erc20_to_native_token_bridge.go | 193 ++++++++--------- tests/flows/native_token_bridge.go | 224 +++++++++++--------- 2 files changed, 216 insertions(+), 201 deletions(-) diff --git a/tests/flows/erc20_to_native_token_bridge.go b/tests/flows/erc20_to_native_token_bridge.go index 3f3a2318c..61ec05dd5 100644 --- a/tests/flows/erc20_to_native_token_bridge.go +++ b/tests/flows/erc20_to_native_token_bridge.go @@ -46,7 +46,7 @@ func ERC20ToNativeTokenBridge(network interfaces.LocalNetwork) { } ) - subnetA, subnetB, _ := utils.GetThreeSubnets(network) + sourceSubnet, destSubnet, _ := utils.GetThreeSubnets(network) teleporterContractAddress := network.GetTeleporterContractAddress() // Info we need to calculate for the test @@ -71,10 +71,10 @@ func ERC20ToNativeTokenBridge(network interfaces.LocalNetwork) { ctx, ERC20TokenSourceByteCodeFile, deployerPK, - subnetA, + sourceSubnet, erc20TokenSourceAbi, teleporterContractAddress, - subnetB.BlockchainID, + destSubnet.BlockchainID, bridgeContractAddress, exampleERC20ContractAddress, ) @@ -85,136 +85,69 @@ func ERC20ToNativeTokenBridge(network interfaces.LocalNetwork) { ctx, NativeTokenDestinationByteCodeFile, deployerPK, - subnetB, + destSubnet, nativeTokenDestinationAbi, teleporterContractAddress, - subnetA.BlockchainID, + sourceSubnet.BlockchainID, bridgeContractAddress, initialReserveImbalance, ) exampleERC20Abi, err := exampleerc20.ExampleERC20MetaData.GetAbi() Expect(err).Should(BeNil()) - utils.DeployContract(ctx, ExampleERC20ByteCodeFile, deployerPK, subnetA, exampleERC20Abi) + utils.DeployContract(ctx, ExampleERC20ByteCodeFile, deployerPK, sourceSubnet, exampleERC20Abi) log.Info("Finished deploying contracts") // Create abi objects to call the contract with nativeTokenDestination, err := nativetokendestination.NewNativeTokenDestination( bridgeContractAddress, - subnetB.WSClient, + destSubnet.WSClient, ) Expect(err).Should(BeNil()) erc20TokenSource, err := erc20tokensource.NewERC20TokenSource( bridgeContractAddress, - subnetA.WSClient, + sourceSubnet.WSClient, ) Expect(err).Should(BeNil()) exampleERC20, err := exampleerc20.NewExampleERC20( exampleERC20ContractAddress, - subnetA.WSClient, + sourceSubnet.WSClient, ) Expect(err).Should(BeNil()) - // Helper function - sendTokensToSource := func( - valueToSend *big.Int, - fromKey *ecdsa.PrivateKey, - toAddress common.Address, - ) *types.Receipt { - transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, subnetB.EVMChainID) - Expect(err).Should(BeNil()) - transactor.Value = valueToSend - - tx, err := nativeTokenDestination.TransferToSource( - transactor, - toAddress, - emptyDestFeeInfo, - []common.Address{}, - ) - Expect(err).Should(BeNil()) - log.Info( - "Sent TransferToSource transaction on destination chain", - "sourceChainID", - subnetA.BlockchainID, - "txHash", - tx.Hash().Hex(), - ) - - sourceChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetB) - - transferEvent, err := utils.GetEventFromLogs( - sourceChainReceipt.Logs, - nativeTokenDestination.ParseTransferToSource, - ) - Expect(err).Should(BeNil()) - utils.ExpectBigEqual(transferEvent.Amount, valueToSend) - - receipt := network.RelayMessage(ctx, sourceChainReceipt, subnetB, subnetA, true) - - return receipt - } - - // Helper function - sendTokensToDestination := func( - valueToSend *big.Int, - fromKey *ecdsa.PrivateKey, - toAddress common.Address, - ) *types.Receipt { - transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, subnetA.EVMChainID) - Expect(err).Should(BeNil()) - - tx, err := erc20TokenSource.TransferToDestination( - transactor, - toAddress, - valueToSend, - big.NewInt(0), - []common.Address{}, - ) - Expect(err).Should(BeNil()) - log.Info( - "Sent TransferToDestination transaction on source chain", - "destinationChainID", - subnetB.BlockchainID, - "txHash", - tx.Hash().Hex(), - ) - - sourceChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetA) - - transferEvent, err := utils.GetEventFromLogs( - sourceChainReceipt.Logs, - erc20TokenSource.ParseTransferToDestination, - ) - Expect(err).Should(BeNil()) - utils.ExpectBigEqual(transferEvent.Amount, valueToSend) - - receipt := network.RelayMessage(ctx, sourceChainReceipt, subnetA, subnetB, true) - - return receipt - } - { // Give erc20TokenSource allowance to spend all of the deployer's ERC20 Tokens bal, err := exampleERC20.BalanceOf(nil, deployerAddress) Expect(err).Should(BeNil()) - transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetA.EVMChainID) + transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, sourceSubnet.EVMChainID) Expect(err).Should(BeNil()) tx, err := exampleERC20.Approve(transactor, bridgeContractAddress, bal) Expect(err).Should(BeNil()) - utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetA) + utils.WaitForTransactionSuccess(ctx, tx.Hash(), sourceSubnet) } { // Transfer some tokens A -> B // Check starting balance is 0 - utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, destSubnet.WSClient) checkReserveImbalance(initialReserveImbalance, nativeTokenDestination) - destChainReceipt := sendTokensToDestination(valueToSend, deployerPK, tokenReceiverAddress) + destChainReceipt := + sendERC20TokensToDestination( + ctx, + network, + valueToSend, + deployerPK, + tokenReceiverAddress, + sourceSubnet, + destSubnet, + erc20TokenSource, + common.Big0, + ) collateralEvent, err := utils.GetEventFromLogs( destChainReceipt.Logs, @@ -232,15 +165,15 @@ func ERC20ToNativeTokenBridge(network interfaces.LocalNetwork) { checkReserveImbalance(intermediateReserveImbalance, nativeTokenDestination) // Check intermediate balance, no tokens should be minted because we haven't collateralized - utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, destSubnet.WSClient) } { // Fail to Transfer tokens B -> A because bridge is not collateralized // Check starting balance is 0 - utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, destSubnet.WSClient) - transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetB.EVMChainID) + transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, destSubnet.EVMChainID) Expect(err).Should(BeNil()) transactor.Value = valueToSend @@ -255,20 +188,26 @@ func ERC20ToNativeTokenBridge(network interfaces.LocalNetwork) { checkReserveImbalance(intermediateReserveImbalance, nativeTokenDestination) // Check we failed to send because we're not collateralized - utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, destSubnet.WSClient) } { // Transfer more tokens A -> B to collateralize the bridge // Check starting balance is 0 - utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, destSubnet.WSClient) checkReserveImbalance(intermediateReserveImbalance, nativeTokenDestination) - destChainReceipt := sendTokensToDestination( + destChainReceipt := sendERC20TokensToDestination( + ctx, + network, initialReserveImbalance, deployerPK, tokenReceiverAddress, + sourceSubnet, + destSubnet, + erc20TokenSource, + common.Big0, ) collateralEvent, err := utils.GetEventFromLogs( @@ -288,12 +227,23 @@ func ERC20ToNativeTokenBridge(network interfaces.LocalNetwork) { checkReserveImbalance(common.Big0, nativeTokenDestination) // We should have minted the excess coins after checking the collateral - utils.CheckBalance(ctx, tokenReceiverAddress, valueToSend, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, valueToSend, destSubnet.WSClient) } { // Transfer tokens B -> A - sourceChainReceipt := sendTokensToSource(valueToReturn, deployerPK, tokenReceiverAddress) + sourceChainReceipt := + sendTokensToSource( + ctx, + network, + valueToReturn, + deployerPK, + tokenReceiverAddress, + sourceSubnet, + destSubnet, + nativeTokenDestination, + emptyDestFeeInfo, + ) checkUnlockERC20Event( sourceChainReceipt.Logs, @@ -309,7 +259,7 @@ func ERC20ToNativeTokenBridge(network interfaces.LocalNetwork) { { // Check reporting of burned tx fees to Source Chain - burnedTxFeesBalanceDest, err := subnetB.WSClient.BalanceAt( + burnedTxFeesBalanceDest, err := destSubnet.WSClient.BalanceAt( ctx, burnedTxFeeAddress, nil, @@ -317,7 +267,7 @@ func ERC20ToNativeTokenBridge(network interfaces.LocalNetwork) { Expect(err).Should(BeNil()) Expect(burnedTxFeesBalanceDest.Cmp(common.Big0) > 0).Should(BeTrue()) - transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetB.EVMChainID) + transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, destSubnet.EVMChainID) Expect(err).Should(BeNil()) tx, err := nativeTokenDestination.ReportTotalBurnedTxFees( transactor, @@ -326,7 +276,7 @@ func ERC20ToNativeTokenBridge(network interfaces.LocalNetwork) { ) Expect(err).Should(BeNil()) - destChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetB) + destChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), destSubnet) reportEvent, err := utils.GetEventFromLogs( destChainReceipt.Logs, @@ -339,7 +289,7 @@ func ERC20ToNativeTokenBridge(network interfaces.LocalNetwork) { Expect(err).Should(BeNil()) utils.ExpectBigEqual(burnedTxFeesBalanceSource, common.Big0) - sourceChainReceipt := network.RelayMessage(ctx, destChainReceipt, subnetB, subnetA, true) + sourceChainReceipt := network.RelayMessage(ctx, destChainReceipt, destSubnet, sourceSubnet, true) burnEvent, err := utils.GetEventFromLogs( sourceChainReceipt.Logs, @@ -365,3 +315,40 @@ func checkUnlockERC20Event( Expect(unlockEvent.Recipient).Should(Equal(recipient)) utils.ExpectBigEqual(unlockEvent.Amount, value) } + +func sendERC20TokensToDestination( + ctx context.Context, + network interfaces.LocalNetwork, + valueToSend *big.Int, + fromKey *ecdsa.PrivateKey, + toAddress common.Address, + sourceSubnet interfaces.SubnetTestInfo, + destinationSubnet interfaces.SubnetTestInfo, + erc20TokenSource *erc20tokensource.ERC20TokenSource, + feeAmount *big.Int, +) *types.Receipt { + transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, sourceSubnet.EVMChainID) + Expect(err).Should(BeNil()) + + tx, err := erc20TokenSource.TransferToDestination( + transactor, + toAddress, + valueToSend, + feeAmount, + []common.Address{}, + ) + Expect(err).Should(BeNil()) + + sourceChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), sourceSubnet) + + transferEvent, err := utils.GetEventFromLogs( + sourceChainReceipt.Logs, + erc20TokenSource.ParseTransferToDestination, + ) + Expect(err).Should(BeNil()) + utils.ExpectBigEqual(transferEvent.Amount, valueToSend) + + receipt := network.RelayMessage(ctx, sourceChainReceipt, sourceSubnet, destinationSubnet, true) + + return receipt +} diff --git a/tests/flows/native_token_bridge.go b/tests/flows/native_token_bridge.go index 88b1bae47..417a1db5d 100644 --- a/tests/flows/native_token_bridge.go +++ b/tests/flows/native_token_bridge.go @@ -46,7 +46,7 @@ func NativeTokenBridge(network interfaces.LocalNetwork) { } ) - subnetA, subnetB, _ := utils.GetThreeSubnets(network) + sourceSubnet, destSubnet, _ := utils.GetThreeSubnets(network) teleporterContractAddress := network.GetTeleporterContractAddress() // Info we need to calculate for the test @@ -69,10 +69,10 @@ func NativeTokenBridge(network interfaces.LocalNetwork) { ctx, NativeTokenSourceByteCodeFile, deployerPK, - subnetA, + sourceSubnet, erc20TokenSourceAbi, teleporterContractAddress, - subnetB.BlockchainID, + destSubnet.BlockchainID, bridgeContractAddress, ) Expect(err).Should(BeNil()) @@ -83,10 +83,10 @@ func NativeTokenBridge(network interfaces.LocalNetwork) { ctx, NativeTokenDestinationByteCodeFile, deployerPK, - subnetB, + destSubnet, nativeTokenDestinationAbi, teleporterContractAddress, - subnetA.BlockchainID, + sourceSubnet.BlockchainID, bridgeContractAddress, initialReserveImbalance, ) @@ -97,97 +97,34 @@ func NativeTokenBridge(network interfaces.LocalNetwork) { // Create abi objects to call the contract with nativeTokenDestination, err := nativetokendestination.NewNativeTokenDestination( bridgeContractAddress, - subnetB.WSClient, + destSubnet.WSClient, ) Expect(err).Should(BeNil()) nativeTokenSource, err := nativetokensource.NewNativeTokenSource( bridgeContractAddress, - subnetA.WSClient, + sourceSubnet.WSClient, ) Expect(err).Should(BeNil()) - // Helper function - sendTokensToSource := func(valueToSend *big.Int, fromKey *ecdsa.PrivateKey, toAddress common.Address) *types.Receipt { - transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, subnetB.EVMChainID) - Expect(err).Should(BeNil()) - transactor.Value = valueToSend - - tx, err := nativeTokenDestination.TransferToSource( - transactor, - toAddress, - emptyDestFeeInfo, - []common.Address{}, - ) - Expect(err).Should(BeNil()) - log.Info( - "Sent TransferToSource transaction on destination chain", - "sourceBlockchainID", - subnetA.BlockchainID, - "txHash", - tx.Hash().Hex(), - ) - - destChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetB) - - transferEvent, err := utils.GetEventFromLogs( - destChainReceipt.Logs, - nativeTokenDestination.ParseTransferToSource, - ) - Expect(err).Should(BeNil()) - utils.ExpectBigEqual(transferEvent.Amount, valueToSend) - - receipt := network.RelayMessage(ctx, destChainReceipt, subnetB, subnetA, true) - - return receipt - } - - // Helper function - sendTokensToDestination := func( - valueToSend *big.Int, - fromKey *ecdsa.PrivateKey, - toAddress common.Address, - ) *types.Receipt { - transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, subnetA.EVMChainID) - Expect(err).Should(BeNil()) - transactor.Value = valueToSend - - tx, err := nativeTokenSource.TransferToDestination( - transactor, - toAddress, - emptySourceFeeInfo, - []common.Address{}, - ) - Expect(err).Should(BeNil()) - log.Info( - "Sent TransferToDestination transaction on source chain", - "destinationBlockchainID", - subnetB.BlockchainID, - "txHash", - tx.Hash().Hex(), - ) - - sourceChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetA) - - transferEvent, err := utils.GetEventFromLogs( - sourceChainReceipt.Logs, - nativeTokenSource.ParseTransferToDestination, - ) - Expect(err).Should(BeNil()) - utils.ExpectBigEqual(transferEvent.Amount, valueToSend) - - receipt := network.RelayMessage(ctx, sourceChainReceipt, subnetA, subnetB, true) - - return receipt - } - { // Transfer some tokens A -> B // Check starting balance is 0 - utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, destSubnet.WSClient) checkReserveImbalance(initialReserveImbalance, nativeTokenDestination) - destChainReceipt := sendTokensToDestination(valueToSend, deployerPK, tokenReceiverAddress) + destChainReceipt := + sendNativeTokensToDestination( + ctx, + network, + valueToSend, + deployerPK, + tokenReceiverAddress, + sourceSubnet, + destSubnet, + nativeTokenSource, + emptySourceFeeInfo, + ) checkCollateralEvent( destChainReceipt.Logs, @@ -207,15 +144,15 @@ func NativeTokenBridge(network interfaces.LocalNetwork) { Expect(err).ShouldNot(BeNil()) // Check intermediate balance, no tokens should be minted because we haven't collateralized - utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, destSubnet.WSClient) } { // Fail to Transfer tokens B -> A because bridge is not collateralized // Check starting balance is 0 - utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetA.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, sourceSubnet.WSClient) - transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetB.EVMChainID) + transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, destSubnet.EVMChainID) Expect(err).Should(BeNil()) transactor.Value = valueToSend @@ -229,22 +166,28 @@ func NativeTokenBridge(network interfaces.LocalNetwork) { Expect(err).ShouldNot(BeNil()) // Check we should fail to send because we're not collateralized - utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetA.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, sourceSubnet.WSClient) } { // Transfer more tokens A -> B to collateralize the bridge // Check starting balance is 0 - utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, common.Big0, destSubnet.WSClient) checkReserveImbalance( big.NewInt(0).Sub(initialReserveImbalance, valueToSend), nativeTokenDestination, ) - destChainReceipt := sendTokensToDestination( + destChainReceipt := sendNativeTokensToDestination( + ctx, + network, initialReserveImbalance, deployerPK, tokenReceiverAddress, + sourceSubnet, + destSubnet, + nativeTokenSource, + emptySourceFeeInfo, ) checkCollateralEvent( @@ -262,12 +205,23 @@ func NativeTokenBridge(network interfaces.LocalNetwork) { checkReserveImbalance(common.Big0, nativeTokenDestination) // We should have minted the excess coins after checking the collateral - utils.CheckBalance(ctx, tokenReceiverAddress, valueToSend, subnetB.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, valueToSend, destSubnet.WSClient) } { // Transfer tokens B -> A - sourceChainReceipt := sendTokensToSource(valueToReturn, deployerPK, tokenReceiverAddress) + sourceChainReceipt := + sendTokensToSource( + ctx, + network, + valueToReturn, + deployerPK, + tokenReceiverAddress, + sourceSubnet, + destSubnet, + nativeTokenDestination, + emptyDestFeeInfo, + ) checkUnlockNativeEvent( sourceChainReceipt.Logs, @@ -276,12 +230,12 @@ func NativeTokenBridge(network interfaces.LocalNetwork) { valueToReturn, ) - utils.CheckBalance(ctx, tokenReceiverAddress, valueToReturn, subnetA.WSClient) + utils.CheckBalance(ctx, tokenReceiverAddress, valueToReturn, sourceSubnet.WSClient) } { // Check reporting of burned tx fees to Source Chain - burnedTxFeesBalanceDest, err := subnetB.WSClient.BalanceAt( + burnedTxFeesBalanceDest, err := destSubnet.WSClient.BalanceAt( ctx, burnedTxFeeAddress, nil, @@ -289,7 +243,7 @@ func NativeTokenBridge(network interfaces.LocalNetwork) { Expect(err).Should(BeNil()) Expect(burnedTxFeesBalanceDest.Cmp(common.Big0) > 0).Should(BeTrue()) - transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, subnetB.EVMChainID) + transactor, err := bind.NewKeyedTransactorWithChainID(deployerPK, destSubnet.EVMChainID) Expect(err).Should(BeNil()) tx, err := nativeTokenDestination.ReportTotalBurnedTxFees( transactor, @@ -298,7 +252,7 @@ func NativeTokenBridge(network interfaces.LocalNetwork) { ) Expect(err).Should(BeNil()) - destChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), subnetB) + destChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), destSubnet) reportEvent, err := utils.GetEventFromLogs( destChainReceipt.Logs, @@ -307,7 +261,7 @@ func NativeTokenBridge(network interfaces.LocalNetwork) { Expect(err).Should(BeNil()) utils.ExpectBigEqual(reportEvent.BurnAddressBalance, burnedTxFeesBalanceDest) - burnedTxFeesBalanceSource, err := subnetA.WSClient.BalanceAt( + burnedTxFeesBalanceSource, err := sourceSubnet.WSClient.BalanceAt( ctx, burnedTxFeeAddress, nil, @@ -315,7 +269,7 @@ func NativeTokenBridge(network interfaces.LocalNetwork) { Expect(err).Should(BeNil()) Expect(burnedTxFeesBalanceSource.Cmp(common.Big0) > 0).Should(BeTrue()) - sourceChainReceipt := network.RelayMessage(ctx, destChainReceipt, subnetB, subnetA, true) + sourceChainReceipt := network.RelayMessage(ctx, destChainReceipt, destSubnet, sourceSubnet, true) burnEvent, err := utils.GetEventFromLogs( sourceChainReceipt.Logs, @@ -324,7 +278,7 @@ func NativeTokenBridge(network interfaces.LocalNetwork) { Expect(err).Should(BeNil()) utils.ExpectBigEqual(burnedTxFeesBalanceDest, burnEvent.Amount) - burnedTxFeesBalanceSource2, err := subnetA.WSClient.BalanceAt( + burnedTxFeesBalanceSource2, err := sourceSubnet.WSClient.BalanceAt( ctx, burnedTxFeeAddress, nil, @@ -385,3 +339,77 @@ func checkReserveImbalance( Expect(err).Should(BeNil()) utils.ExpectBigEqual(imbalance, value) } + +func sendTokensToSource( + ctx context.Context, + network interfaces.LocalNetwork, + valueToSend *big.Int, + fromKey *ecdsa.PrivateKey, + toAddress common.Address, + sourceSubnet interfaces.SubnetTestInfo, + destinationSubnet interfaces.SubnetTestInfo, + nativeTokenDestination *nativetokendestination.NativeTokenDestination, + feeInfo nativetokendestination.TeleporterFeeInfo, +) *types.Receipt { + transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, destinationSubnet.EVMChainID) + Expect(err).Should(BeNil()) + transactor.Value = valueToSend + + tx, err := nativeTokenDestination.TransferToSource( + transactor, + toAddress, + feeInfo, + []common.Address{}, + ) + Expect(err).Should(BeNil()) + + destChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), destinationSubnet) + + transferEvent, err := utils.GetEventFromLogs( + destChainReceipt.Logs, + nativeTokenDestination.ParseTransferToSource, + ) + Expect(err).Should(BeNil()) + utils.ExpectBigEqual(transferEvent.Amount, valueToSend) + + receipt := network.RelayMessage(ctx, destChainReceipt, destinationSubnet, destinationSubnet, true) + + return receipt +} + +func sendNativeTokensToDestination( + ctx context.Context, + network interfaces.LocalNetwork, + valueToSend *big.Int, + fromKey *ecdsa.PrivateKey, + toAddress common.Address, + sourceSubnet interfaces.SubnetTestInfo, + destinationSubnet interfaces.SubnetTestInfo, + nativeTokenSource *nativetokensource.NativeTokenSource, + feeInfo nativetokensource.TeleporterFeeInfo, +) *types.Receipt { + transactor, err := bind.NewKeyedTransactorWithChainID(fromKey, sourceSubnet.EVMChainID) + Expect(err).Should(BeNil()) + transactor.Value = valueToSend + + tx, err := nativeTokenSource.TransferToDestination( + transactor, + toAddress, + feeInfo, + []common.Address{}, + ) + Expect(err).Should(BeNil()) + + sourceChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), sourceSubnet) + + transferEvent, err := utils.GetEventFromLogs( + sourceChainReceipt.Logs, + nativeTokenSource.ParseTransferToDestination, + ) + Expect(err).Should(BeNil()) + utils.ExpectBigEqual(transferEvent.Amount, valueToSend) + + receipt := network.RelayMessage(ctx, sourceChainReceipt, sourceSubnet, destinationSubnet, true) + + return receipt +} From 1e09c2e237b60980d380d2805f2edccf86cd6b49 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Fri, 8 Dec 2023 12:50:07 -0500 Subject: [PATCH 182/183] Fix --- tests/flows/native_token_bridge.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/flows/native_token_bridge.go b/tests/flows/native_token_bridge.go index 417a1db5d..4ab292e6d 100644 --- a/tests/flows/native_token_bridge.go +++ b/tests/flows/native_token_bridge.go @@ -372,7 +372,7 @@ func sendTokensToSource( Expect(err).Should(BeNil()) utils.ExpectBigEqual(transferEvent.Amount, valueToSend) - receipt := network.RelayMessage(ctx, destChainReceipt, destinationSubnet, destinationSubnet, true) + receipt := network.RelayMessage(ctx, destChainReceipt, destinationSubnet, sourceSubnet, true) return receipt } From 2f1059716797391a2ad5d7efdea3d4276c130da9 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Fri, 8 Dec 2023 14:18:50 -0500 Subject: [PATCH 183/183] Use Address.sendValue for transfers --- .../NativeTokenDestination/NativeTokenDestination.go | 2 +- .../NativeTokenBridge/NativeTokenSource/NativeTokenSource.go | 2 +- .../NativeTokenBridge/NativeTokenDestination.sol | 3 ++- .../NativeTokenBridge/NativeTokenSource.sol | 5 +++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go index a8a1ebe2c..3ac3a2f87 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go @@ -38,7 +38,7 @@ type TeleporterFeeInfo struct { // NativeTokenDestinationMetaData contains all meta data concerning the NativeTokenDestination contract. var NativeTokenDestinationMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialReserveImbalance_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"burnAddressBalance\",\"type\":\"uint256\"}],\"name\":\"ReportTotalBurnedTxFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"BURN_FOR_TRANSFER_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REPORT_BURNED_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"reportTotalBurnedTxFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalMinted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", - Bin: "0x6101206040527302000000000000000000000000000000000000016080523480156200002a57600080fd5b5060405162001afb38038062001afb8339810160408190526200004d9162000350565b60016000556001600160a01b038416620000d45760405162461bcd60e51b815260206004820152603860248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2054656c60448201527f65706f727465724d657373656e6765722061646472657373000000000000000060648201526084015b60405180910390fd5b6001600160a01b03841661010052826200013a5760405162461bcd60e51b8152602060048201526031602482015260008051602062001adb8339815191526044820152701c98d948189b1bd8dad8da185a5b881251607a1b6064820152608401620000cb565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200018d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001b3919062000399565b8303620002295760405162461bcd60e51b815260206004820152603a60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a2063616e6e6f74206260448201527f726964676520776974682073616d6520626c6f636b636861696e0000000000006064820152608401620000cb565b60a08390526001600160a01b0382166200029b5760405162461bcd60e51b8152602060048201526034602482015260008051602062001adb83398151915260448201527f72636520636f6e747261637420616464726573730000000000000000000000006064820152608401620000cb565b6001600160a01b03821660c0526000819003620003215760405162461bcd60e51b815260206004820152603660248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20696e6960448201527f7469616c207265736572766520696d62616c616e6365000000000000000000006064820152608401620000cb565b60e081905260015550620003b3915050565b80516001600160a01b03811681146200034b57600080fd5b919050565b600080600080608085870312156200036757600080fd5b620003728562000333565b935060208501519250620003896040860162000333565b6060959095015193969295505050565b600060208284031215620003ac57600080fd5b5051919050565b60805160a05160c05160e0516101005161169662000445600039600081816102440152818161035c015281816105fe0152818161065b015261086b01526000818161021001526103060152600081816101b1015281816103bc015281816106bb015261098e01526000818161013c0152818161039601528181610695015261090a01526000610bff01526116966000f3fe6080604052600436106100e75760003560e01c80638ac7dd201161008a578063ab28523011610059578063ab28523014610297578063c452165e146102ae578063c868efaa146102c6578063d30951261461029757600080fd5b80638ac7dd20146101fe5780639b3e580314610232578063a2309ff814610266578063a2a950171461027c57600080fd5b80633a94fe51116100c65780633a94fe511461015e57806349e3284e146101805780635d93f9af1461019f57806375846562146101eb57600080fd5b8062d872ae146100ec57806318160ddd1461011557806329b7b3fd1461012a575b600080fd5b3480156100f857600080fd5b5061010260015481565b6040519081526020015b60405180910390f35b34801561012157600080fd5b506101026102e6565b34801561013657600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561016a57600080fd5b5061017e610179366004611214565b610345565b005b34801561018c57600080fd5b506001546040519015815260200161010c565b3480156101ab57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010c565b61017e6101f9366004611280565b610520565b34801561020a57600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561023e57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b34801561027257600080fd5b5061010260025481565b34801561028857600080fd5b506101d36001600160981b0181565b3480156102a357600080fd5b50610102620186a081565b3480156102ba57600080fd5b506101d3600160981b81565b3480156102d257600080fd5b5061017e6102e13660046112e4565b610858565b6000806103006001600160981b0131600160981b31611383565b905060007f00000000000000000000000000000000000000000000000000000000000000006002546103329190611383565b905061033e8282611396565b9250505090565b6000600160981b6001600160a01b031631905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906103fa91906113a9565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505050908252506040805160208082018990528251808303820181528284019093529092019161046c9160019160600161145f565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161049a91906114da565b6020604051808303816000875af11580156104b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104dd9190611558565b9050807f2550fa6041684d40e635e29e93dde9017d70c25b46aa88393317b5182ed6ae7c8360405161051191815260200190565b60405180910390a25050505050565b610528610c69565b6001600160a01b0384166105575760405162461bcd60e51b815260040161054e90611571565b60405180910390fd5b600154156105c45760405162461bcd60e51b815260206004820152603460248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20636f6e7472616374604482015273081d5b99195c98dbdb1b185d195c985b1a5e995960621b606482015260840161054e565b6000602084013515610623576105ea6105e060208601866115bf565b8560200135610cc2565b90506106236105fc60208601866115bf565b7f000000000000000000000000000000000000000000000000000000000000000083610e2c565b6040516001600160981b01903480156108fc02916000818181858888f19350505050158015610656573d6000803e3d6000fd5b5060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906106f991906113a9565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250938552505060405160209384019361076792508d913491016001600160a01b03929092168252602082015260400190565b60408051601f1981840301815290829052610785929160200161145f565b6040516020818303038152906040528152506040518263ffffffff1660e01b81526004016107b391906114da565b6020604051808303816000875af11580156107d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f69190611558565b905080866001600160a01b0316336001600160a01b03167f0322cbb1d3c23f6dbf1deddb3b4ef3ce0f93ae6eec7b44e4f395804104466d143460405161083e91815260200190565b60405180910390a450506108526001600055565b50505050565b610860610c69565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146109085760405162461bcd60e51b815260206004820152604160248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201527f697a65642054656c65706f727465724d657373656e67657220636f6e747261636064820152601d60fa1b608482015260a40161054e565b7f0000000000000000000000000000000000000000000000000000000000000000841461098c5760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20696e76616c69642060448201526b39b7bab931b29031b430b4b760a11b606482015260840161054e565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031614610a215760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201526a34bd32b21039b2b73232b960a91b606482015260840161054e565b600080610a30838501856115e3565b90925090506001600160a01b038216610a5b5760405162461bcd60e51b815260040161054e90611571565b80600003610abf5760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2074726160448201526a6e736665722076616c756560a81b606482015260840161054e565b600154819015610b8457600154821115610b285760015460408051918252600060208301527f244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449910160405180910390a1600154610b1c9083611396565b60006001559050610b84565b8160016000828254610b3a9190611396565b90915550506001546040805184815260208101929092527f244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449910160405180910390a1505050610c5f565b8060026000828254610b969190611383565b90915550506040518181526001600160a01b038416907fd949ea0e9d5db53492d77f28fd5467fb2f6c4f5b88e3350e3c36729b76e99cf29060200160405180910390a26040516327ad555d60e11b81526001600160a01b038481166004830152602482018390527f00000000000000000000000000000000000000000000000000000000000000001690634f5aaaba90604401600060405180830381600087803b158015610c4357600080fd5b505af1158015610c57573d6000803e3d6000fd5b505050505050505b6108526001600055565b600260005403610cbb5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161054e565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015610d0b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2f9190611558565b9050610d466001600160a01b038516333086610f11565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610d8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610db19190611558565b9050818111610e175760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b606482015260840161054e565b610e218282611396565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610e7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea19190611558565b610eab9190611383565b6040516001600160a01b03851660248201526044810182905290915061085290859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610f49565b6040516001600160a01b03808516602483015283166044820152606481018290526108529085906323b872dd60e01b90608401610eda565b6000610f9e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166110209092919063ffffffff16565b80519091501561101b5780806020019051810190610fbc919061160f565b61101b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161054e565b505050565b606061102f8484600085611037565b949350505050565b6060824710156110985760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161054e565b600080866001600160a01b031685876040516110b49190611631565b60006040518083038185875af1925050503d80600081146110f1576040519150601f19603f3d011682016040523d82523d6000602084013e6110f6565b606091505b509150915061110787838387611112565b979650505050505050565b6060831561118157825160000361117a576001600160a01b0385163b61117a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161054e565b508161102f565b61102f83838151156111965781518083602001fd5b8060405162461bcd60e51b815260040161054e919061164d565b6000604082840312156111c257600080fd5b50919050565b60008083601f8401126111da57600080fd5b50813567ffffffffffffffff8111156111f257600080fd5b6020830191508360208260051b850101111561120d57600080fd5b9250929050565b60008060006060848603121561122957600080fd5b61123385856111b0565b9250604084013567ffffffffffffffff81111561124f57600080fd5b61125b868287016111c8565b9497909650939450505050565b6001600160a01b038116811461127d57600080fd5b50565b6000806000806080858703121561129657600080fd5b84356112a181611268565b93506112b086602087016111b0565b9250606085013567ffffffffffffffff8111156112cc57600080fd5b6112d8878288016111c8565b95989497509550505050565b600080600080606085870312156112fa57600080fd5b84359350602085013561130c81611268565b9250604085013567ffffffffffffffff8082111561132957600080fd5b818701915087601f83011261133d57600080fd5b81358181111561134c57600080fd5b88602082850101111561135e57600080fd5b95989497505060200194505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610e2657610e2661136d565b81810381811115610e2657610e2661136d565b6000604082840312156113bb57600080fd5b6040516040810181811067ffffffffffffffff821117156113ec57634e487b7160e01b600052604160045260246000fd5b60405282356113fa81611268565b81526020928301359281019290925250919050565b60005b8381101561142a578181015183820152602001611412565b50506000910152565b6000815180845261144b81602086016020860161140f565b601f01601f19169290920160200192915050565b60006002841061147f57634e487b7160e01b600052602160045260246000fd5b8382526040602083015261102f6040830184611433565b600081518084526020808501945080840160005b838110156114cf5781516001600160a01b0316875295820195908201906001016114aa565b509495945050505050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c084015261153b610100840182611496565b905060a0840151601f198483030160e0850152610e218282611433565b60006020828403121561156a57600080fd5b5051919050565b6020808252602e908201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2072656360408201526d697069656e74206164647265737360901b606082015260800190565b6000602082840312156115d157600080fd5b81356115dc81611268565b9392505050565b600080604083850312156115f657600080fd5b823561160181611268565b946020939093013593505050565b60006020828403121561162157600080fd5b815180151581146115dc57600080fd5b6000825161164381846020870161140f565b9190910192915050565b6020815260006115dc602083018461143356fea264697066735822122036381db71b2a300b550256a4421bf86a40ce0e13273cc88afda92e6ccaa615bb64736f6c634300081200334e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20736f75", + Bin: "0x6101206040527302000000000000000000000000000000000000016080523480156200002a57600080fd5b5060405162001bf138038062001bf18339810160408190526200004d9162000350565b60016000556001600160a01b038416620000d45760405162461bcd60e51b815260206004820152603860248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2054656c60448201527f65706f727465724d657373656e6765722061646472657373000000000000000060648201526084015b60405180910390fd5b6001600160a01b03841661010052826200013a5760405162461bcd60e51b8152602060048201526031602482015260008051602062001bd18339815191526044820152701c98d948189b1bd8dad8da185a5b881251607a1b6064820152608401620000cb565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200018d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001b3919062000399565b8303620002295760405162461bcd60e51b815260206004820152603a60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a2063616e6e6f74206260448201527f726964676520776974682073616d6520626c6f636b636861696e0000000000006064820152608401620000cb565b60a08390526001600160a01b0382166200029b5760405162461bcd60e51b8152602060048201526034602482015260008051602062001bd183398151915260448201527f72636520636f6e747261637420616464726573730000000000000000000000006064820152608401620000cb565b6001600160a01b03821660c0526000819003620003215760405162461bcd60e51b815260206004820152603660248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20696e6960448201527f7469616c207265736572766520696d62616c616e6365000000000000000000006064820152608401620000cb565b60e081905260015550620003b3915050565b80516001600160a01b03811681146200034b57600080fd5b919050565b600080600080608085870312156200036757600080fd5b620003728562000333565b935060208501519250620003896040860162000333565b6060959095015193969295505050565b600060208284031215620003ac57600080fd5b5051919050565b60805160a05160c05160e0516101005161178c62000445600039600081816102440152818161035c015281816105fe01528181610638015261084801526000818161021001526103060152600081816101b1015281816103bc01528181610698015261096b01526000818161013c015281816103960152818161067201526108e701526000610bdc015261178c6000f3fe6080604052600436106100e75760003560e01c80638ac7dd201161008a578063ab28523011610059578063ab28523014610297578063c452165e146102ae578063c868efaa146102c6578063d30951261461029757600080fd5b80638ac7dd20146101fe5780639b3e580314610232578063a2309ff814610266578063a2a950171461027c57600080fd5b80633a94fe51116100c65780633a94fe511461015e57806349e3284e146101805780635d93f9af1461019f57806375846562146101eb57600080fd5b8062d872ae146100ec57806318160ddd1461011557806329b7b3fd1461012a575b600080fd5b3480156100f857600080fd5b5061010260015481565b6040519081526020015b60405180910390f35b34801561012157600080fd5b506101026102e6565b34801561013657600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561016a57600080fd5b5061017e61017936600461130a565b610345565b005b34801561018c57600080fd5b506001546040519015815260200161010c565b3480156101ab57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010c565b61017e6101f9366004611376565b610520565b34801561020a57600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561023e57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b34801561027257600080fd5b5061010260025481565b34801561028857600080fd5b506101d36001600160981b0181565b3480156102a357600080fd5b50610102620186a081565b3480156102ba57600080fd5b506101d3600160981b81565b3480156102d257600080fd5b5061017e6102e13660046113da565b610835565b6000806103006001600160981b0131600160981b31611479565b905060007f00000000000000000000000000000000000000000000000000000000000000006002546103329190611479565b905061033e828261148c565b9250505090565b6000600160981b6001600160a01b031631905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906103fa919061149f565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505050908252506040805160208082018990528251808303820181528284019093529092019161046c91600191606001611555565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161049a91906115d0565b6020604051808303816000875af11580156104b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104dd919061164e565b9050807f2550fa6041684d40e635e29e93dde9017d70c25b46aa88393317b5182ed6ae7c8360405161051191815260200190565b60405180910390a25050505050565b610528610c46565b6001600160a01b0384166105575760405162461bcd60e51b815260040161054e90611667565b60405180910390fd5b600154156105c45760405162461bcd60e51b815260206004820152603460248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20636f6e7472616374604482015273081d5b99195c98dbdb1b185d195c985b1a5e995960621b606482015260840161054e565b6000602084013515610623576105ea6105e060208601866116b5565b8560200135610c9f565b90506106236105fc60208601866116b5565b7f000000000000000000000000000000000000000000000000000000000000000083610e09565b6106346001600160981b0134610eee565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906106d6919061149f565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250938552505060405160209384019361074492508d913491016001600160a01b03929092168252602082015260400190565b60408051601f19818403018152908290526107629291602001611555565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161079091906115d0565b6020604051808303816000875af11580156107af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d3919061164e565b905080866001600160a01b0316336001600160a01b03167f0322cbb1d3c23f6dbf1deddb3b4ef3ce0f93ae6eec7b44e4f395804104466d143460405161081b91815260200190565b60405180910390a4505061082f6001600055565b50505050565b61083d610c46565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146108e55760405162461bcd60e51b815260206004820152604160248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201527f697a65642054656c65706f727465724d657373656e67657220636f6e747261636064820152601d60fa1b608482015260a40161054e565b7f000000000000000000000000000000000000000000000000000000000000000084146109695760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20696e76616c69642060448201526b39b7bab931b29031b430b4b760a11b606482015260840161054e565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316146109fe5760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201526a34bd32b21039b2b73232b960a91b606482015260840161054e565b600080610a0d838501856116d9565b90925090506001600160a01b038216610a385760405162461bcd60e51b815260040161054e90611667565b80600003610a9c5760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2074726160448201526a6e736665722076616c756560a81b606482015260840161054e565b600154819015610b6157600154821115610b055760015460408051918252600060208301527f244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449910160405180910390a1600154610af9908361148c565b60006001559050610b61565b8160016000828254610b17919061148c565b90915550506001546040805184815260208101929092527f244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449910160405180910390a1505050610c3c565b8060026000828254610b739190611479565b90915550506040518181526001600160a01b038416907fd949ea0e9d5db53492d77f28fd5467fb2f6c4f5b88e3350e3c36729b76e99cf29060200160405180910390a26040516327ad555d60e11b81526001600160a01b038481166004830152602482018390527f00000000000000000000000000000000000000000000000000000000000000001690634f5aaaba90604401600060405180830381600087803b158015610c2057600080fd5b505af1158015610c34573d6000803e3d6000fd5b505050505050505b61082f6001600055565b600260005403610c985760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161054e565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015610ce8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d0c919061164e565b9050610d236001600160a01b03851633308661100c565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610d6a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d8e919061164e565b9050818111610df45760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b606482015260840161054e565b610dfe828261148c565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610e5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7e919061164e565b610e889190611479565b6040516001600160a01b03851660248201526044810182905290915061082f90859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611044565b80471015610f3e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015260640161054e565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610f8b576040519150601f19603f3d011682016040523d82523d6000602084013e610f90565b606091505b50509050806110075760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d61792068617665207265766572746564000000000000606482015260840161054e565b505050565b6040516001600160a01b038085166024830152831660448201526064810182905261082f9085906323b872dd60e01b90608401610eb7565b6000611099826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166111169092919063ffffffff16565b80519091501561100757808060200190518101906110b79190611705565b6110075760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161054e565b6060611125848460008561112d565b949350505050565b60608247101561118e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161054e565b600080866001600160a01b031685876040516111aa9190611727565b60006040518083038185875af1925050503d80600081146111e7576040519150601f19603f3d011682016040523d82523d6000602084013e6111ec565b606091505b50915091506111fd87838387611208565b979650505050505050565b60608315611277578251600003611270576001600160a01b0385163b6112705760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161054e565b5081611125565b611125838381511561128c5781518083602001fd5b8060405162461bcd60e51b815260040161054e9190611743565b6000604082840312156112b857600080fd5b50919050565b60008083601f8401126112d057600080fd5b50813567ffffffffffffffff8111156112e857600080fd5b6020830191508360208260051b850101111561130357600080fd5b9250929050565b60008060006060848603121561131f57600080fd5b61132985856112a6565b9250604084013567ffffffffffffffff81111561134557600080fd5b611351868287016112be565b9497909650939450505050565b6001600160a01b038116811461137357600080fd5b50565b6000806000806080858703121561138c57600080fd5b84356113978161135e565b93506113a686602087016112a6565b9250606085013567ffffffffffffffff8111156113c257600080fd5b6113ce878288016112be565b95989497509550505050565b600080600080606085870312156113f057600080fd5b8435935060208501356114028161135e565b9250604085013567ffffffffffffffff8082111561141f57600080fd5b818701915087601f83011261143357600080fd5b81358181111561144257600080fd5b88602082850101111561145457600080fd5b95989497505060200194505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610e0357610e03611463565b81810381811115610e0357610e03611463565b6000604082840312156114b157600080fd5b6040516040810181811067ffffffffffffffff821117156114e257634e487b7160e01b600052604160045260246000fd5b60405282356114f08161135e565b81526020928301359281019290925250919050565b60005b83811015611520578181015183820152602001611508565b50506000910152565b60008151808452611541816020860160208601611505565b601f01601f19169290920160200192915050565b60006002841061157557634e487b7160e01b600052602160045260246000fd5b838252604060208301526111256040830184611529565b600081518084526020808501945080840160005b838110156115c55781516001600160a01b0316875295820195908201906001016115a0565b509495945050505050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c084015261163161010084018261158c565b905060a0840151601f198483030160e0850152610dfe8282611529565b60006020828403121561166057600080fd5b5051919050565b6020808252602e908201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2072656360408201526d697069656e74206164647265737360901b606082015260800190565b6000602082840312156116c757600080fd5b81356116d28161135e565b9392505050565b600080604083850312156116ec57600080fd5b82356116f78161135e565b946020939093013593505050565b60006020828403121561171757600080fd5b815180151581146116d257600080fd5b60008251611739818460208701611505565b9190910192915050565b6020815260006116d2602083018461152956fea26469706673582212205d326fcb3551f8c55e1f7f5b63b34a003743c912c76760197098dab12cb9165764736f6c634300081200334e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20736f75", } // NativeTokenDestinationABI is the input ABI used to generate the binding from. diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go index ea5da2229..6a481c666 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go @@ -38,7 +38,7 @@ type TeleporterFeeInfo struct { // NativeTokenSourceMetaData contains all meta data concerning the NativeTokenSource contract. var NativeTokenSourceMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBurnedTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", - Bin: "0x60e06040523480156200001157600080fd5b5060405162001670380380620016708339810160408190526200003491620002b3565b60016000556001600160a01b038316620000bb5760405162461bcd60e51b815260206004820152603360248201527f4e6174697665546f6b656e536f757263653a207a65726f2054656c65706f727460448201527f65724d657373656e67657220616464726573730000000000000000000000000060648201526084015b60405180910390fd5b6001600160a01b03831660c05281620001205760405162461bcd60e51b81526020600482015260316024820152600080516020620016508339815191526044820152701a5bdb88189b1bd8dad8da185a5b881251607a1b6064820152608401620000b2565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000173573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001999190620002f4565b82036200020f5760405162461bcd60e51b815260206004820152603560248201527f4e6174697665546f6b656e536f757263653a2063616e6e6f742062726964676560448201527f20776974682073616d6520626c6f636b636861696e00000000000000000000006064820152608401620000b2565b60808290526001600160a01b038116620002815760405162461bcd60e51b815260206004820152603460248201526000805160206200165083398151915260448201527f696f6e20636f6e747261637420616464726573730000000000000000000000006064820152608401620000b2565b6001600160a01b031660a052506200030e9050565b80516001600160a01b0381168114620002ae57600080fd5b919050565b600080600060608486031215620002c957600080fd5b620002d48462000296565b925060208401519150620002eb6040850162000296565b90509250925092565b6000602082840312156200030757600080fd5b5051919050565b60805160a05160c0516112e36200036d6000396000818160ef015281816102320152818161025b015261044e015260008181610167015281816102bb015261056701526000818160920152818161029501526104e301526112e36000f3fe60806040526004361061007b5760003560e01c8063b6171f731161004e578063b6171f731461013e578063b8c9091a14610155578063c452165e14610189578063c868efaa146101a157600080fd5b806341d3014d1461008057806355db3e9e146100c75780639b3e5803146100dd578063ad0aee2514610129575b600080fd5b34801561008c57600080fd5b506100b47f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b3480156100d357600080fd5b506100b460015481565b3480156100e957600080fd5b506101117f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100be565b61013c610137366004610de0565b6101c1565b005b34801561014a57600080fd5b506100b4620186a081565b34801561016157600080fd5b506101117f000000000000000000000000000000000000000000000000000000000000000081565b34801561019557600080fd5b50610111600160981b81565b3480156101ad57600080fd5b5061013c6101bc366004610e7f565b61043b565b6101c96106ec565b6001600160a01b0384166101f85760405162461bcd60e51b81526004016101ef90610ef9565b60405180910390fd5b60006020840135156102575761021e6102146020860186610f42565b8560200135610745565b90506102576102306020860186610f42565b7f0000000000000000000000000000000000000000000000000000000000000000836108af565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906102f99190610fad565b8152602001620186a08152602001878780806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250604051602091820191610368918c913491016001600160a01b03929092168252602082015260400190565b6040516020818303038152906040528152506040518263ffffffff1660e01b81526004016103969190611099565b6020604051808303816000875af11580156103b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d99190611117565b905080866001600160a01b0316336001600160a01b03167f2b4e8f08417773e367064a6aea9ca2df303a60876676f70b6c3c5e66b314ca5a3460405161042191815260200190565b60405180910390a450506104356001600055565b50505050565b6104436106ec565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146104e15760405162461bcd60e51b815260206004820152603c60248201527f4e6174697665546f6b656e536f757263653a20756e617574686f72697a65642060448201527f54656c65706f727465724d657373656e67657220636f6e74726163740000000060648201526084016101ef565b7f000000000000000000000000000000000000000000000000000000000000000084146105655760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e536f757263653a20696e76616c696420646573746960448201526b3730ba34b7b71031b430b4b760a11b60648201526084016101ef565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316146105f55760405162461bcd60e51b815260206004820152602660248201527f4e6174697665546f6b656e536f757263653a20756e617574686f72697a65642060448201526539b2b73232b960d11b60648201526084016101ef565b60008061060483850185611130565b9092509050600082600181111561061d5761061d6111dc565b0361064e576000808280602001905181019061063991906111f2565b915091506106478282610994565b50506106e0565b6001826001811115610662576106626111dc565b0361068e5760008180602001905181019061067d9190611117565b905061068881610a9a565b506106e0565b60405162461bcd60e51b815260206004820152602160248201527f4e6174697665546f6b656e536f757263653a20696e76616c696420616374696f6044820152603760f91b60648201526084016101ef565b50506104356001600055565b60026000540361073e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101ef565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa15801561078e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b29190611117565b90506107c96001600160a01b038516333086610ac9565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610810573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108349190611117565b905081811161089a5760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016101ef565b6108a48282611236565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610900573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109249190611117565b61092e9190611249565b6040516001600160a01b03851660248201526044810182905290915061043590859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610b01565b6001600160a01b0382166109ba5760405162461bcd60e51b81526004016101ef90610ef9565b80471015610a1d5760405162461bcd60e51b815260206004820152602a60248201527f4e6174697665546f6b656e536f757263653a20696e73756666696369656e742060448201526918dbdb1b185d195c985b60b21b60648201526084016101ef565b604080516001600160a01b0384168152602081018390527f55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407910160405180910390a16040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015610a95573d6000803e3d6000fd5b505050565b600154811115610ac657600060015482610ab49190611236565b9050610abf81610bd3565b5060018190555b50565b6040516001600160a01b03808516602483015283166044820152606481018290526104359085906323b872dd60e01b9060840161095d565b6000610b56826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c3b9092919063ffffffff16565b805190915015610a955780806020019051810190610b74919061125c565b610a955760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016101ef565b6040518181527f2cd3fd70cd5a5d6d805e90d22741aa1a84590ace7cf01b244719558d266143829060200160405180910390a1604051600160981b9082156108fc029083906000818181858888f19350505050158015610c37573d6000803e3d6000fd5b5050565b6060610c4a8484600085610c52565b949350505050565b606082471015610cb35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016101ef565b600080866001600160a01b03168587604051610ccf919061127e565b60006040518083038185875af1925050503d8060008114610d0c576040519150601f19603f3d011682016040523d82523d6000602084013e610d11565b606091505b5091509150610d2287838387610d2d565b979650505050505050565b60608315610d9c578251600003610d95576001600160a01b0385163b610d955760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101ef565b5081610c4a565b610c4a8383815115610db15781518083602001fd5b8060405162461bcd60e51b81526004016101ef919061129a565b6001600160a01b0381168114610ac657600080fd5b6000806000808486036080811215610df757600080fd5b8535610e0281610dcb565b94506040601f1982011215610e1657600080fd5b50602085019250606085013567ffffffffffffffff80821115610e3857600080fd5b818701915087601f830112610e4c57600080fd5b813581811115610e5b57600080fd5b8860208260051b8501011115610e7057600080fd5b95989497505060200194505050565b60008060008060608587031215610e9557600080fd5b843593506020850135610ea781610dcb565b9250604085013567ffffffffffffffff80821115610ec457600080fd5b818701915087601f830112610ed857600080fd5b813581811115610ee757600080fd5b886020828501011115610e7057600080fd5b60208082526029908201527f4e6174697665546f6b656e536f757263653a207a65726f20726563697069656e60408201526874206164647265737360b81b606082015260800190565b600060208284031215610f5457600080fd5b8135610f5f81610dcb565b9392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610fa557610fa5610f66565b604052919050565b600060408284031215610fbf57600080fd5b6040516040810181811067ffffffffffffffff82111715610fe257610fe2610f66565b6040528235610ff081610dcb565b81526020928301359281019290925250919050565b600081518084526020808501945080840160005b8381101561103e5781516001600160a01b031687529582019590820190600101611019565b509495945050505050565b60005b8381101561106457818101518382015260200161104c565b50506000910152565b60008151808452611085816020860160208601611049565b601f01601f19169290920160200192915050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526110fa610100840182611005565b905060a0840151601f198483030160e08501526108a4828261106d565b60006020828403121561112957600080fd5b5051919050565b6000806040838503121561114357600080fd5b82356002811061115257600080fd5b915060208381013567ffffffffffffffff8082111561117057600080fd5b818601915086601f83011261118457600080fd5b81358181111561119657611196610f66565b6111a8601f8201601f19168501610f7c565b915080825287848285010111156111be57600080fd5b80848401858401376000848284010152508093505050509250929050565b634e487b7160e01b600052602160045260246000fd5b6000806040838503121561120557600080fd5b825161121081610dcb565b6020939093015192949293505050565b634e487b7160e01b600052601160045260246000fd5b818103818111156108a9576108a9611220565b808201808211156108a9576108a9611220565b60006020828403121561126e57600080fd5b81518015158114610f5f57600080fd5b60008251611290818460208701611049565b9190910192915050565b602081526000610f5f602083018461106d56fea264697066735822122050f2661eccfff266ad546e178a378058827591f8c21151a460c37fce152709f564736f6c634300081200334e6174697665546f6b656e536f757263653a207a65726f2064657374696e6174", + Bin: "0x60e06040523480156200001157600080fd5b506040516200173a3803806200173a8339810160408190526200003491620002b3565b60016000556001600160a01b038316620000bb5760405162461bcd60e51b815260206004820152603360248201527f4e6174697665546f6b656e536f757263653a207a65726f2054656c65706f727460448201527f65724d657373656e67657220616464726573730000000000000000000000000060648201526084015b60405180910390fd5b6001600160a01b03831660c05281620001205760405162461bcd60e51b815260206004820152603160248201526000805160206200171a8339815191526044820152701a5bdb88189b1bd8dad8da185a5b881251607a1b6064820152608401620000b2565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000173573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001999190620002f4565b82036200020f5760405162461bcd60e51b815260206004820152603560248201527f4e6174697665546f6b656e536f757263653a2063616e6e6f742062726964676560448201527f20776974682073616d6520626c6f636b636861696e00000000000000000000006064820152608401620000b2565b60808290526001600160a01b038116620002815760405162461bcd60e51b815260206004820152603460248201526000805160206200171a83398151915260448201527f696f6e20636f6e747261637420616464726573730000000000000000000000006064820152608401620000b2565b6001600160a01b031660a052506200030e9050565b80516001600160a01b0381168114620002ae57600080fd5b919050565b600080600060608486031215620002c957600080fd5b620002d48462000296565b925060208401519150620002eb6040850162000296565b90509250925092565b6000602082840312156200030757600080fd5b5051919050565b60805160a05160c0516113ad6200036d6000396000818160ef015281816102320152818161025b015261044e015260008181610167015281816102bb015261056701526000818160920152818161029501526104e301526113ad6000f3fe60806040526004361061007b5760003560e01c8063b6171f731161004e578063b6171f731461013e578063b8c9091a14610155578063c452165e14610189578063c868efaa146101a157600080fd5b806341d3014d1461008057806355db3e9e146100c75780639b3e5803146100dd578063ad0aee2514610129575b600080fd5b34801561008c57600080fd5b506100b47f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b3480156100d357600080fd5b506100b460015481565b3480156100e957600080fd5b506101117f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100be565b61013c610137366004610eaa565b6101c1565b005b34801561014a57600080fd5b506100b4620186a081565b34801561016157600080fd5b506101117f000000000000000000000000000000000000000000000000000000000000000081565b34801561019557600080fd5b50610111600160981b81565b3480156101ad57600080fd5b5061013c6101bc366004610f49565b61043b565b6101c96106ec565b6001600160a01b0384166101f85760405162461bcd60e51b81526004016101ef90610fc3565b60405180910390fd5b60006020840135156102575761021e610214602086018661100c565b8560200135610745565b9050610257610230602086018661100c565b7f0000000000000000000000000000000000000000000000000000000000000000836108af565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906102f99190611077565b8152602001620186a08152602001878780806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250604051602091820191610368918c913491016001600160a01b03929092168252602082015260400190565b6040516020818303038152906040528152506040518263ffffffff1660e01b81526004016103969190611163565b6020604051808303816000875af11580156103b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d991906111e1565b905080866001600160a01b0316336001600160a01b03167f2b4e8f08417773e367064a6aea9ca2df303a60876676f70b6c3c5e66b314ca5a3460405161042191815260200190565b60405180910390a450506104356001600055565b50505050565b6104436106ec565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146104e15760405162461bcd60e51b815260206004820152603c60248201527f4e6174697665546f6b656e536f757263653a20756e617574686f72697a65642060448201527f54656c65706f727465724d657373656e67657220636f6e74726163740000000060648201526084016101ef565b7f000000000000000000000000000000000000000000000000000000000000000084146105655760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e536f757263653a20696e76616c696420646573746960448201526b3730ba34b7b71031b430b4b760a11b60648201526084016101ef565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316146105f55760405162461bcd60e51b815260206004820152602660248201527f4e6174697665546f6b656e536f757263653a20756e617574686f72697a65642060448201526539b2b73232b960d11b60648201526084016101ef565b600080610604838501856111fa565b9092509050600082600181111561061d5761061d6112a6565b0361064e576000808280602001905181019061063991906112bc565b915091506106478282610994565b50506106e0565b6001826001811115610662576106626112a6565b0361068e5760008180602001905181019061067d91906111e1565b905061068881610a6d565b506106e0565b60405162461bcd60e51b815260206004820152602160248201527f4e6174697665546f6b656e536f757263653a20696e76616c696420616374696f6044820152603760f91b60648201526084016101ef565b50506104356001600055565b60026000540361073e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101ef565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa15801561078e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b291906111e1565b90506107c96001600160a01b038516333086610a9c565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610810573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061083491906111e1565b905081811161089a5760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016101ef565b6108a48282611300565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610900573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092491906111e1565b61092e9190611313565b6040516001600160a01b03851660248201526044810182905290915061043590859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610ad4565b6001600160a01b0382166109ba5760405162461bcd60e51b81526004016101ef90610fc3565b80471015610a1d5760405162461bcd60e51b815260206004820152602a60248201527f4e6174697665546f6b656e536f757263653a20696e73756666696369656e742060448201526918dbdb1b185d195c985b60b21b60648201526084016101ef565b604080516001600160a01b0384168152602081018390527f55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407910160405180910390a1610a698282610bab565b5050565b600154811115610a9957600060015482610a879190611300565b9050610a9281610cc4565b5060018190555b50565b6040516001600160a01b03808516602483015283166044820152606481018290526104359085906323b872dd60e01b9060840161095d565b6000610b29826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610d059092919063ffffffff16565b805190915015610ba65780806020019051810190610b479190611326565b610ba65760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016101ef565b505050565b80471015610bfb5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016101ef565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610c48576040519150601f19603f3d011682016040523d82523d6000602084013e610c4d565b606091505b5050905080610ba65760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016101ef565b6040518181527f2cd3fd70cd5a5d6d805e90d22741aa1a84590ace7cf01b244719558d266143829060200160405180910390a1610a99600160981b82610bab565b6060610d148484600085610d1c565b949350505050565b606082471015610d7d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016101ef565b600080866001600160a01b03168587604051610d999190611348565b60006040518083038185875af1925050503d8060008114610dd6576040519150601f19603f3d011682016040523d82523d6000602084013e610ddb565b606091505b5091509150610dec87838387610df7565b979650505050505050565b60608315610e66578251600003610e5f576001600160a01b0385163b610e5f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101ef565b5081610d14565b610d148383815115610e7b5781518083602001fd5b8060405162461bcd60e51b81526004016101ef9190611364565b6001600160a01b0381168114610a9957600080fd5b6000806000808486036080811215610ec157600080fd5b8535610ecc81610e95565b94506040601f1982011215610ee057600080fd5b50602085019250606085013567ffffffffffffffff80821115610f0257600080fd5b818701915087601f830112610f1657600080fd5b813581811115610f2557600080fd5b8860208260051b8501011115610f3a57600080fd5b95989497505060200194505050565b60008060008060608587031215610f5f57600080fd5b843593506020850135610f7181610e95565b9250604085013567ffffffffffffffff80821115610f8e57600080fd5b818701915087601f830112610fa257600080fd5b813581811115610fb157600080fd5b886020828501011115610f3a57600080fd5b60208082526029908201527f4e6174697665546f6b656e536f757263653a207a65726f20726563697069656e60408201526874206164647265737360b81b606082015260800190565b60006020828403121561101e57600080fd5b813561102981610e95565b9392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561106f5761106f611030565b604052919050565b60006040828403121561108957600080fd5b6040516040810181811067ffffffffffffffff821117156110ac576110ac611030565b60405282356110ba81610e95565b81526020928301359281019290925250919050565b600081518084526020808501945080840160005b838110156111085781516001600160a01b0316875295820195908201906001016110e3565b509495945050505050565b60005b8381101561112e578181015183820152602001611116565b50506000910152565b6000815180845261114f816020860160208601611113565b601f01601f19169290920160200192915050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526111c46101008401826110cf565b905060a0840151601f198483030160e08501526108a48282611137565b6000602082840312156111f357600080fd5b5051919050565b6000806040838503121561120d57600080fd5b82356002811061121c57600080fd5b915060208381013567ffffffffffffffff8082111561123a57600080fd5b818601915086601f83011261124e57600080fd5b81358181111561126057611260611030565b611272601f8201601f19168501611046565b9150808252878482850101111561128857600080fd5b80848401858401376000848284010152508093505050509250929050565b634e487b7160e01b600052602160045260246000fd5b600080604083850312156112cf57600080fd5b82516112da81610e95565b6020939093015192949293505050565b634e487b7160e01b600052601160045260246000fd5b818103818111156108a9576108a96112ea565b808201808211156108a9576108a96112ea565b60006020828403121561133857600080fd5b8151801515811461102957600080fd5b6000825161135a818460208701611113565b9190910192915050565b602081526000611029602083018461113756fea2646970667358221220f70e4662c2679fb4a73f670c09d6430821f46cf73e7d1213af9e4e3ec525091f64736f6c634300081200334e6174697665546f6b656e536f757263653a207a65726f2064657374696e6174", } // NativeTokenSourceABI is the input ABI used to generate the binding from. diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index 40793d4cb..3d8648619 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -6,6 +6,7 @@ pragma solidity 0.8.18; import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol"; +import {Address} from "@openzeppelin/contracts/utils/Address.sol"; import {IWarpMessenger} from "@subnet-evm-contracts/interfaces/IWarpMessenger.sol"; import {INativeMinter} from "@subnet-evm-contracts/interfaces/INativeMinter.sol"; import {INativeTokenDestination} from "./INativeTokenDestination.sol"; @@ -191,7 +192,7 @@ contract NativeTokenDestination is } // Burn native token by sending to BURN_FOR_TRANSFER_ADDRESS - payable(BURN_FOR_TRANSFER_ADDRESS).transfer(msg.value); + Address.sendValue(payable(BURN_FOR_TRANSFER_ADDRESS), msg.value); uint256 messageID = teleporterMessenger.sendCrossChainMessage( TeleporterMessageInput({ diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index 9e3712176..75a238518 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -6,6 +6,7 @@ pragma solidity 0.8.18; import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol"; +import {Address} from "@openzeppelin/contracts/utils/Address.sol"; import {IWarpMessenger} from "@subnet-evm-contracts/interfaces/IWarpMessenger.sol"; import {INativeTokenSource} from "./INativeTokenSource.sol"; import {ITokenSource} from "./ITokenSource.sol"; @@ -180,7 +181,7 @@ contract NativeTokenSource is // Transfer to recipient emit UnlockTokens(recipient, amount); - payable(recipient).transfer(amount); + Address.sendValue(payable(recipient), amount); } /** @@ -188,7 +189,7 @@ contract NativeTokenSource is */ function _burnTokens(uint256 amount) private { emit BurnTokens(amount); - payable(BURNED_TX_FEES_ADDRESS).transfer(amount); + Address.sendValue(payable(BURNED_TX_FEES_ADDRESS), amount); } /**