From c8ec8efd3467c989a5b7de09027d9dc2e0eb7614 Mon Sep 17 00:00:00 2001 From: Matthew Lam Date: Fri, 13 Oct 2023 21:12:48 +0000 Subject: [PATCH 01/20] revert custom errors and remove redundant teleporter sender checks --- .../ERC20Bridge/ERC20Bridge.sol | 50 +++-- .../src/Teleporter/TeleporterMessenger.sol | 212 +++++++++--------- .../Teleporter/tests/AddFeeAmountTests.t.sol | 16 +- .../tests/SendCrossChainMessageTests.t.sol | 4 +- 4 files changed, 149 insertions(+), 133 deletions(-) diff --git a/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol b/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol index ec3ede225..ac73737b5 100644 --- a/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol +++ b/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol @@ -79,7 +79,10 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { error CannotBridgeWrappedToken(address nativeTokenAddress); error InsufficientAdjustedAmount(uint256 adjustedAmount, uint256 feeAmount); error InsufficientTotalAmount(uint256 totalAmount, uint256 feeAmount); - error InsufficientWrappedTokenBalance(uint256 currentBalance, uint256 requestAmount); + error InsufficientWrappedTokenBalance( + uint256 currentBalance, + uint256 requestAmount + ); error InvalidAction(); error InvalidBridgeTokenAddress(); error InvalidDestinationBridgeAddress(); @@ -144,7 +147,10 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { // is not a "fee/burn on transfer" token, since it was deployed by this // contract itself. if (totalAmount <= primaryFeeAmount + secondaryFeeAmount) { - revert InsufficientTotalAmount(totalAmount, primaryFeeAmount + secondaryFeeAmount); + revert InsufficientTotalAmount( + totalAmount, + primaryFeeAmount + secondaryFeeAmount + ); } return @@ -162,9 +168,11 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { } // Otherwise, this is a token "native" to this chain. - if (!submittedBridgeTokenCreations[destinationChainID][ - destinationBridgeAddress - ][tokenContractAddress]) { + if ( + !submittedBridgeTokenCreations[destinationChainID][ + destinationBridgeAddress + ][tokenContractAddress] + ) { revert InvalidBridgeTokenAddress(); } @@ -408,6 +416,9 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { * @dev Teleporter message receiver for creating a new bridge token on this chain. * * Emits a {CreateBridgeToken} event. + * + * Note: This function is only called within `receiveTeleporterMessage`, which can only be + * called by the Teleporter messenger. */ function _createBridgeToken( bytes32 nativeChainID, @@ -418,9 +429,11 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { uint8 nativeDecimals ) private { // Check that the bridge token doesn't already exist. - if (nativeToWrappedTokens[nativeChainID][nativeBridgeAddress][ - nativeContractAddress - ] != address(0)) { + if ( + nativeToWrappedTokens[nativeChainID][nativeBridgeAddress][ + nativeContractAddress + ] != address(0) + ) { revert BridgeTokenAlreadyExists( nativeToWrappedTokens[nativeChainID][nativeBridgeAddress][ nativeContractAddress @@ -456,6 +469,9 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { * @dev Teleporter message receiver for minting of an existing bridge token on this chain. * * Emits a {MintBridgeTokens} event. + * + * Note: This function is only called within `receiveTeleporterMessage`, which can only be + * called by the Teleporter messenger. */ function _mintBridgeTokens( bytes32 nativeChainID, @@ -464,11 +480,6 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { address recipient, uint256 amount ) private nonReentrant { - // Only allow the Teleporter messenger to deliver messages. - if (msg.sender != address(teleporterMessenger)) { - revert Unauthorized(); - } - // The recipient cannot be the zero address. if (recipient == address(0)) { revert InvalidRecipientAddress(); @@ -493,6 +504,9 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { /** * @dev Teleporter message receiver for handling bridge tokens transfers back from another chain * and optionally routing them to a different third chain. + * + * Note: This function is only called within `receiveTeleporterMessage`, which can only be + * called by the Teleporter messenger. */ function _transferBridgeTokens( bytes32 sourceChainID, @@ -504,11 +518,6 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { uint256 totalAmount, uint256 secondaryFeeAmount ) private nonReentrant { - // Only allow the teleporter messenger to deliver messages. - if (msg.sender != address(teleporterMessenger)) { - revert Unauthorized(); - } - // Neither the recipient nor the destination bridge can be the zero address. if (recipient == address(0)) { revert InvalidRecipientAddress(); @@ -684,7 +693,10 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { bytes32 nativeChainID = bridgeToken.nativeChainID(); address nativeBridgeAddress = bridgeToken.nativeBridge(); if (wrappedTransferInfo.destinationChainID == nativeChainID) { - if (wrappedTransferInfo.destinationBridgeAddress != nativeBridgeAddress) { + if ( + wrappedTransferInfo.destinationBridgeAddress != + nativeBridgeAddress + ) { revert InvalidDestinationBridgeAddress(); } } diff --git a/contracts/src/Teleporter/TeleporterMessenger.sol b/contracts/src/Teleporter/TeleporterMessenger.sol index cba1df20d..c0f8ba779 100644 --- a/contracts/src/Teleporter/TeleporterMessenger.sol +++ b/contracts/src/Teleporter/TeleporterMessenger.sol @@ -14,6 +14,31 @@ import "./SafeERC20TransferFrom.sol"; import "./ITeleporterReceiver.sol"; import "./ReentrancyGuards.sol"; + // Errors + string public constant ERR_INSUFFICIENT_GAS = "Insufficient gas"; + string public constant ERR_INVALID_ADDITIONAL_FEE_AMOUNT = + "Invalid additional fee amount"; + string public constant ERR_INVALID_DESTINATION_ADDRESS = + "Invalid destination address"; + string public constant ERR_INVALID_DESTINATION_CHAIN_ID = + "Invalid destination chain ID"; + string public constant ERR_INVALID_FEE_ASSET_CONTRACT_ADDRESS = + "Invalid fee asset contract address"; + string public constant ERR_INVALID_MESSAGE_HASH = "Invalid message hash"; + string public constant ERR_INVALID_ORIGIN_SENDER_ADDRESS = + "Invalid origin sender address"; + string public constant ERR_INVALID_RELAYER_REWARD_ADDRESS = + "Invalid relayer reward address"; + string public constant ERR_INVALID_WARP_MESSAGE = "Invalid warp message"; + string public constant ERR_MESSAGE_ALREADY_DELIVERED = "Message already delivered"; + string public constant ERR_MESSAGE_NOT_FOUND = "Message not found"; + string public constant ERR_MESSAGE_RETRY_EXECUTION_FAILED = + "Message retry execution failed"; + string public constant ERR_NO_RELAYER_REWARD_TO_REDEEM = + "No relayer reward to redeem"; + string public constant ERR_RECEIPT_NOT_FOUND = "Receipt not found"; + string public constant ERR_UNAUTHORIZED_RELAYER = "Unauthorized relayer"; + /** * @dev Implementation of the {ITeleporterMessenger} interface. * @@ -41,7 +66,8 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { // Tracks the outstanding receipts to send back to a given subnet in subsequent messages sent to it. // Key is the subnet ID of the other subnet, and the value is a queue of pending receipts for messages // we have received from that subnet. - mapping(bytes32 => ReceiptQueue.TeleporterMessageReceiptQueue) public outstandingReceipts; + mapping(bytes32 => ReceiptQueue.TeleporterMessageReceiptQueue) + public outstandingReceipts; // Tracks the message hash and fee information for each message sent that we have not yet received // a receipt for. The messages are tracked per subnet and keyed by message ID. @@ -78,23 +104,6 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { // The blockchain ID of the chain the contract is deployed on. Determined by warp messenger precompile. bytes32 public immutable blockchainID; - // Errors - error InsufficientGas(); - error InvalidAdditionalFeeAmount(); - error InvalidDestinationAddress(); - error InvalidDestinationChainID(); - error InvalidFeeAssetContractAddress(); - error InvalidMessageHash(); - error InvalidOriginSenderAddress(); - error InvalidRelayerRewardAddress(); - error InvalidWarpMessage(); - error MessageAlreadyDelivered(); - error MessageNotFound(); - error MessageRetryExecutionFailed(); - error NoRelayerRewardToRedeem(); - error ReceiptNotFound(); - error UnauthorizedRelayer(); - /** * @dev Sets the value of `blockchainID` to the value determined by the warp messenger precompile. */ @@ -124,7 +133,8 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { requiredGasLimit: messageInput.requiredGasLimit, allowedRelayerAddresses: messageInput.allowedRelayerAddresses, message: messageInput.message, - receipts: outstandingReceipts[messageInput.destinationChainID].getOutstandingReceiptsToSend() + receipts: outstandingReceipts[messageInput.destinationChainID] + .getOutstandingReceiptsToSend() }); } @@ -145,16 +155,15 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { bytes32 messageHash = sentMessageInfo[destinationChainID][ message.messageID ].messageHash; - if (messageHash == bytes32(0)) { - // If the message hash is zero, the message was never sent. - revert MessageNotFound(); - } + // If the message hash is zero, the message was never sent. + require(messageHash != bytes32(0), ERR_MESSAGE_NOT_FOUND); // Check that the hash of the provided message matches the one that was originally submitted. bytes memory messageBytes = abi.encode(message); - if (keccak256(messageBytes) != messageHash) { - revert InvalidMessageHash(); - } + require( + keccak256(messageBytes) == messageHash, + ERR_INVALID_MESSAGE_HASH + ); // Emit and make state variable changes before external calls when possible, // though this function is protected by sender reentrancy guard. @@ -190,37 +199,34 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { uint256 additionalFeeAmount ) external senderNonReentrant { // The additional fee amount must be non-zero. - if (additionalFeeAmount == 0) { - revert InvalidAdditionalFeeAmount(); - } + require(additionalFeeAmount > 0, ERR_INVALID_ADDITIONAL_FEE_AMOUNT); // Do not allow adding a fee asset with contract address zero. - if (feeContractAddress == address(0)) { - revert InvalidFeeAssetContractAddress(); - } + require( + feeContractAddress != address(0), + ERR_INVALID_FEE_ASSET_CONTRACT_ADDRESS + ); // If we have received the delivery receipt for this message, its hash and fee information // will be cleared from state. At this point, you can not add to its fee. This is also the // case if the given message never existed. - if ( - sentMessageInfo[destinationChainID][messageID].messageHash == - bytes32(0) - ) { - revert MessageAlreadyDelivered(); - } + require( + sentMessageInfo[destinationChainID][messageID].messageHash != + bytes32(0), + ERR_MESSAGE_ALREADY_DELIVERED + ); // Check that the fee contract address matches the one that was originally used. Only a single // fee asset can be used to incentivize the delivery of a given message. // We require users to explicitly pass the same fee asset contract address here rather than just using // the previously submitted asset type as a defensive measure to avoid having users accidentally confuse // which asset they are paying. - if ( + require( sentMessageInfo[destinationChainID][messageID] .feeInfo - .contractAddress != feeContractAddress - ) { - revert InvalidFeeAssetContractAddress(); - } + .contractAddress == feeContractAddress, + ERR_INVALID_FEE_ASSET_CONTRACT_ADDRESS + ); // Transfer the additional fee amount to this Teleporter instance. uint256 adjustedAmount = SafeERC20TransferFrom.safeTransferFrom( @@ -261,35 +267,35 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { ) external receiverNonReentrant { // The relayer reward address is not allowed to be the zero address because it is how we track // whether or not a message has been delivered. - if (relayerRewardAddress == address(0)) { - revert InvalidRelayerRewardAddress(); - } + require( + relayerRewardAddress != address(0), + ERR_INVALID_RELAYER_REWARD_ADDRESS + ); // Verify and parse the cross chain message included in the transaction access list // using the warp message precompile. (WarpMessage memory warpMessage, bool success) = WARP_MESSENGER .getVerifiedWarpMessage(messageIndex); - - if (!success) { - revert InvalidWarpMessage(); - } + require(success, ERR_INVALID_WARP_MESSAGE); // Only allow for messages to be received from the same address as this teleporter contract. // The contract should be deployed using the universal deployer pattern, such that it knows messages // received from the same address on other chains were constructed using the same bytecode of this contract. // This allows for trusting the message format and uniqueness as specified by sendCrossChainMessage. - if (warpMessage.originSenderAddress != address(this)) { - revert InvalidOriginSenderAddress(); - } + require( + warpMessage.originSenderAddress == address(this), + ERR_INVALID_ORIGIN_SENDER_ADDRESS + ); // Require that the message was intended for this blockchain and teleporter contract. - if (warpMessage.destinationChainID != blockchainID) { - revert InvalidDestinationChainID(); - } - - if (warpMessage.destinationAddress != address(this)) { - revert InvalidDestinationAddress(); - } + require( + warpMessage.destinationChainID == blockchainID, + ERR_INVALID_DESTINATION_CHAIN_ID + ); + require( + warpMessage.destinationAddress == address(this), + ERR_INVALID_DESTINATION_ADDRESS + ); // Parse the payload of the message. TeleporterMessage memory teleporterMessage = abi.decode( @@ -299,23 +305,21 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { // Check the message has not been delivered before by checking that there is no relayer reward // address stored for it already. - if ( + require( relayerRewardAddresses[warpMessage.sourceChainID][ teleporterMessage.messageID - ] != address(0) - ) { - revert MessageAlreadyDelivered(); - } + ] == address(0), + ERR_MESSAGE_ALREADY_DELIVERED + ); // Check that the caller is allowed to deliver this message. - if ( - !_checkIsAllowedRelayer( + require( + _checkIsAllowedRelayer( msg.sender, teleporterMessage.allowedRelayerAddresses - ) - ) { - revert UnauthorizedRelayer(); - } + ), + ERR_UNAUTHORIZED_RELAYER + ); // Store the relayer reward address provided, effectively marking the message as received. relayerRewardAddresses[warpMessage.sourceChainID][ @@ -346,9 +350,10 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { // Store the receipt of this message delivery. When a subsquent message is sent back // to the origin of this message, we will clean up the receipt state. // If the receipts queue contract for this chain doesn't exist yet, create it now. - ReceiptQueue.TeleporterMessageReceiptQueue storage receiptsQueue = outstandingReceipts[ - warpMessage.sourceChainID - ]; + ReceiptQueue.TeleporterMessageReceiptQueue + storage receiptsQueue = outstandingReceipts[ + warpMessage.sourceChainID + ]; receiptsQueue.enqueue( TeleporterMessageReceipt({ @@ -380,20 +385,19 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { bytes32 failedMessageHash = receivedFailedMessageHashes[originChainID][ message.messageID ]; - if (failedMessageHash == bytes32(0)) { - revert MessageNotFound(); - } - - if (keccak256(abi.encode(message)) != failedMessageHash) { - revert InvalidMessageHash(); - } + require(failedMessageHash != bytes32(0), ERR_MESSAGE_NOT_FOUND); + require( + keccak256(abi.encode(message)) == failedMessageHash, + ERR_INVALID_MESSAGE_HASH + ); // Check that the target address has fully initialized contract code prior to calling it. // If the target address does not have code, the execution automatically fails because // we disallow calling EOA addresses. - if (message.destinationAddress.code.length == 0) { - revert InvalidDestinationAddress(); - } + require( + message.destinationAddress.code.length > 0, + ERR_INVALID_DESTINATION_ADDRESS + ); // Clear the failed message hash from state prior to retrying its execution to redundantly prevent // reentrance attacks (on top of the nonReentrant guard). @@ -413,9 +417,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { (originChainID, message.senderAddress, message.message) ) ); - if (!success) { - revert MessageRetryExecutionFailed(); - } + require(success, ERR_MESSAGE_RETRY_EXECUTION_FAILED); } /** @@ -452,9 +454,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { address relayerRewardAddress = relayerRewardAddresses[ originChainID ][receivedMessageID]; - if (relayerRewardAddress == address(0)) { - revert ReceiptNotFound(); - } + require(relayerRewardAddress != address(0), ERR_RECEIPT_NOT_FOUND); receiptsToSend[i] = TeleporterMessageReceipt({ receivedMessageID: receivedMessageID, @@ -483,9 +483,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { */ function redeemRelayerRewards(address feeAsset) external { uint256 rewardAmount = relayerRewardAmounts[msg.sender][feeAsset]; - if (rewardAmount == 0) { - revert NoRelayerRewardToRedeem(); - } + require(rewardAmount != 0, ERR_NO_RELAYER_REWARD_TO_REDEEM); // Zero the reward balance before calling the external ERC20 to transfer the // reward to prevent any possible re-entrancy. @@ -562,22 +560,19 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { /** * @dev See {ITeleporterMessenger-getReceiptQueueSize} */ - function getReceiptQueueSize(bytes32 chainID) - external - view - returns (uint256) - { + function getReceiptQueueSize( + bytes32 chainID + ) external view returns (uint256) { return outstandingReceipts[chainID].size(); } /** * @dev See {ITeleporterMessenger-getReceiptAtIndex} */ - function getReceiptAtIndex(bytes32 chainID, uint256 index) - external - view - returns (TeleporterMessageReceipt memory) - { + function getReceiptAtIndex( + bytes32 chainID, + uint256 index + ) external view returns (TeleporterMessageReceipt memory) { return outstandingReceipts[chainID].getReceiptAtIndex(index); } @@ -632,9 +627,10 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { uint256 adjustedFeeAmount = 0; if (feeInfo.amount > 0) { // If the fee amount is non-zero, check that the contract address is not address(0) - if (feeInfo.contractAddress == address(0)) { - revert InvalidFeeAssetContractAddress(); - } + require( + feeInfo.contractAddress != address(0), + ERR_INVALID_FEE_ASSET_CONTRACT_ADDRESS + ); adjustedFeeAmount = SafeERC20TransferFrom.safeTransferFrom( IERC20(feeInfo.contractAddress), @@ -726,9 +722,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { // its execution succeeds, such that the relayer can claim their fee reward. However, if the message // execution fails, the message hash will be stored in state such that anyone can try to provide more // gas to successfully execute the message. - if (gasleft() < message.requiredGasLimit) { - revert InsufficientGas(); - } + require(gasleft() >= message.requiredGasLimit, ERR_INSUFFICIENT_GAS); // The destination address must have fully initialized contract code in order for the message // to call it. If the destination address does not have code, we store the message as a failed diff --git a/contracts/src/Teleporter/tests/AddFeeAmountTests.t.sol b/contracts/src/Teleporter/tests/AddFeeAmountTests.t.sol index d5a9cd1de..c97be12c2 100644 --- a/contracts/src/Teleporter/tests/AddFeeAmountTests.t.sol +++ b/contracts/src/Teleporter/tests/AddFeeAmountTests.t.sol @@ -64,7 +64,9 @@ contract AddFeeAmountTest is TeleporterMessengerTest { // Add to the fee amount of a message that doesn't exist. Expect revert. uint256 additionalFeeAmount = 131313; uint256 fakeMessageID = 13; - vm.expectRevert(TeleporterMessenger.MessageAlreadyDelivered.selector); + vm.expectRevert( + TeleporterMessenger.ERR_MESSAGE_ALREADY_DELIVERED.selector + ); teleporterMessenger.addFeeAmount( DEFAULT_DESTINATION_CHAIN_ID, fakeMessageID, @@ -118,7 +120,9 @@ contract AddFeeAmountTest is TeleporterMessengerTest { // Expect revert when adding 0 additional amount. uint256 additionalFeeAmount = 0; - vm.expectRevert(TeleporterMessenger.InvalidAdditionalFeeAmount.selector); + vm.expectRevert( + TeleporterMessenger.InvalidAdditionalFeeAmount.selector + ); teleporterMessenger.addFeeAmount( DEFAULT_DESTINATION_CHAIN_ID, messageID, @@ -138,7 +142,9 @@ contract AddFeeAmountTest is TeleporterMessengerTest { // Expect revert when using a different fee asset than originally used. uint256 additionalFeeAmount = 131313; address differentFeeAsset = 0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664; - vm.expectRevert(TeleporterMessenger.InvalidFeeAssetContractAddress.selector); + vm.expectRevert( + TeleporterMessenger.InvalidFeeAssetContractAddress.selector + ); teleporterMessenger.addFeeAmount( DEFAULT_DESTINATION_CHAIN_ID, messageID, @@ -158,7 +164,9 @@ contract AddFeeAmountTest is TeleporterMessengerTest { // Expect revert when using an invalid fee asset. uint256 additionalFeeAmount = 131313; address invalidFeeAsset = address(0); - vm.expectRevert(TeleporterMessenger.InvalidFeeAssetContractAddress.selector); + vm.expectRevert( + TeleporterMessenger.InvalidFeeAssetContractAddress.selector + ); teleporterMessenger.addFeeAmount( DEFAULT_DESTINATION_CHAIN_ID, messageID, diff --git a/contracts/src/Teleporter/tests/SendCrossChainMessageTests.t.sol b/contracts/src/Teleporter/tests/SendCrossChainMessageTests.t.sol index 0b68e3fc4..c7559df17 100644 --- a/contracts/src/Teleporter/tests/SendCrossChainMessageTests.t.sol +++ b/contracts/src/Teleporter/tests/SendCrossChainMessageTests.t.sol @@ -206,7 +206,9 @@ contract SendCrossChainMessageTest is TeleporterMessengerTest { message: new bytes(0) }); - vm.expectRevert(TeleporterMessenger.InvalidFeeAssetContractAddress.selector); + vm.expectRevert( + TeleporterMessenger.ERR_INVALID_FEE_ASSET_CONTRACT_ADDRESS + ); teleporterMessenger.sendCrossChainMessage(messageInput); } } From e47a0a32a21076cca20a6bde3c58c400a4705c45 Mon Sep 17 00:00:00 2001 From: Matthew Lam Date: Mon, 16 Oct 2023 18:25:41 +0000 Subject: [PATCH 02/20] update to use error strings in require --- .../src/Teleporter/TeleporterMessenger.sol | 82 ++++++++----------- .../Teleporter/tests/AddFeeAmountTests.t.sol | 16 ++-- .../HandleInitialMessageExecutionTests.t.sol | 10 +-- .../tests/ReceiveCrossChainMessageTests.t.sol | 32 +++----- .../tests/RedeemRelayerRewardsTests.t.sol | 2 +- .../tests/RetryMessageExecutionTests.t.sol | 12 ++- .../Teleporter/tests/RetryReceiptTests.t.sol | 2 +- .../RetrySendCrossChainMessageTests.t.sol | 4 +- .../tests/SendCrossChainMessageTests.t.sol | 4 +- .../tests/TeleporterMessengerTest.t.sol | 14 +++- 10 files changed, 77 insertions(+), 101 deletions(-) diff --git a/contracts/src/Teleporter/TeleporterMessenger.sol b/contracts/src/Teleporter/TeleporterMessenger.sol index c0f8ba779..30b92c25d 100644 --- a/contracts/src/Teleporter/TeleporterMessenger.sol +++ b/contracts/src/Teleporter/TeleporterMessenger.sol @@ -14,31 +14,6 @@ import "./SafeERC20TransferFrom.sol"; import "./ITeleporterReceiver.sol"; import "./ReentrancyGuards.sol"; - // Errors - string public constant ERR_INSUFFICIENT_GAS = "Insufficient gas"; - string public constant ERR_INVALID_ADDITIONAL_FEE_AMOUNT = - "Invalid additional fee amount"; - string public constant ERR_INVALID_DESTINATION_ADDRESS = - "Invalid destination address"; - string public constant ERR_INVALID_DESTINATION_CHAIN_ID = - "Invalid destination chain ID"; - string public constant ERR_INVALID_FEE_ASSET_CONTRACT_ADDRESS = - "Invalid fee asset contract address"; - string public constant ERR_INVALID_MESSAGE_HASH = "Invalid message hash"; - string public constant ERR_INVALID_ORIGIN_SENDER_ADDRESS = - "Invalid origin sender address"; - string public constant ERR_INVALID_RELAYER_REWARD_ADDRESS = - "Invalid relayer reward address"; - string public constant ERR_INVALID_WARP_MESSAGE = "Invalid warp message"; - string public constant ERR_MESSAGE_ALREADY_DELIVERED = "Message already delivered"; - string public constant ERR_MESSAGE_NOT_FOUND = "Message not found"; - string public constant ERR_MESSAGE_RETRY_EXECUTION_FAILED = - "Message retry execution failed"; - string public constant ERR_NO_RELAYER_REWARD_TO_REDEEM = - "No relayer reward to redeem"; - string public constant ERR_RECEIPT_NOT_FOUND = "Receipt not found"; - string public constant ERR_UNAUTHORIZED_RELAYER = "Unauthorized relayer"; - /** * @dev Implementation of the {ITeleporterMessenger} interface. * @@ -156,13 +131,16 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { message.messageID ].messageHash; // If the message hash is zero, the message was never sent. - require(messageHash != bytes32(0), ERR_MESSAGE_NOT_FOUND); + require( + messageHash != bytes32(0), + "TeleporterMessenger: message hash not found" + ); // Check that the hash of the provided message matches the one that was originally submitted. bytes memory messageBytes = abi.encode(message); require( keccak256(messageBytes) == messageHash, - ERR_INVALID_MESSAGE_HASH + "TeleporterMessenger: invalid message hash" ); // Emit and make state variable changes before external calls when possible, @@ -199,12 +177,15 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { uint256 additionalFeeAmount ) external senderNonReentrant { // The additional fee amount must be non-zero. - require(additionalFeeAmount > 0, ERR_INVALID_ADDITIONAL_FEE_AMOUNT); + require( + additionalFeeAmount > 0, + "TeleporterMessenger: zero fee amount" + ); // Do not allow adding a fee asset with contract address zero. require( feeContractAddress != address(0), - ERR_INVALID_FEE_ASSET_CONTRACT_ADDRESS + "TeleporterMessenger: zero fee asset contract address" ); // If we have received the delivery receipt for this message, its hash and fee information @@ -213,7 +194,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { require( sentMessageInfo[destinationChainID][messageID].messageHash != bytes32(0), - ERR_MESSAGE_ALREADY_DELIVERED + "TeleporterMessenger: message not found" ); // Check that the fee contract address matches the one that was originally used. Only a single @@ -225,7 +206,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { sentMessageInfo[destinationChainID][messageID] .feeInfo .contractAddress == feeContractAddress, - ERR_INVALID_FEE_ASSET_CONTRACT_ADDRESS + "TeleporterMessenger: invalid fee asset contract address" ); // Transfer the additional fee amount to this Teleporter instance. @@ -269,14 +250,14 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { // whether or not a message has been delivered. require( relayerRewardAddress != address(0), - ERR_INVALID_RELAYER_REWARD_ADDRESS + "TeleporterMessenger: zero relayer reward address" ); // Verify and parse the cross chain message included in the transaction access list // using the warp message precompile. (WarpMessage memory warpMessage, bool success) = WARP_MESSENGER .getVerifiedWarpMessage(messageIndex); - require(success, ERR_INVALID_WARP_MESSAGE); + require(success, "TeleporterMessenger: invalid warp message"); // Only allow for messages to be received from the same address as this teleporter contract. // The contract should be deployed using the universal deployer pattern, such that it knows messages @@ -284,17 +265,17 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { // This allows for trusting the message format and uniqueness as specified by sendCrossChainMessage. require( warpMessage.originSenderAddress == address(this), - ERR_INVALID_ORIGIN_SENDER_ADDRESS + "TeleporterMessenger: invalid origin sender address" ); // Require that the message was intended for this blockchain and teleporter contract. require( warpMessage.destinationChainID == blockchainID, - ERR_INVALID_DESTINATION_CHAIN_ID + "TeleporterMessenger: invalid destination chain ID" ); require( warpMessage.destinationAddress == address(this), - ERR_INVALID_DESTINATION_ADDRESS + "TeleporterMessenger: invalid destination address" ); // Parse the payload of the message. @@ -309,7 +290,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { relayerRewardAddresses[warpMessage.sourceChainID][ teleporterMessage.messageID ] == address(0), - ERR_MESSAGE_ALREADY_DELIVERED + "TeleporterMessenger: message already delivered" ); // Check that the caller is allowed to deliver this message. @@ -318,7 +299,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { msg.sender, teleporterMessage.allowedRelayerAddresses ), - ERR_UNAUTHORIZED_RELAYER + "TeleporterMessenger: unauthorized relayer" ); // Store the relayer reward address provided, effectively marking the message as received. @@ -385,10 +366,13 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { bytes32 failedMessageHash = receivedFailedMessageHashes[originChainID][ message.messageID ]; - require(failedMessageHash != bytes32(0), ERR_MESSAGE_NOT_FOUND); + require( + failedMessageHash != bytes32(0), + "TeleporterMessenger: message not found" + ); require( keccak256(abi.encode(message)) == failedMessageHash, - ERR_INVALID_MESSAGE_HASH + "TeleporterMessenger: invalid message hash" ); // Check that the target address has fully initialized contract code prior to calling it. @@ -396,7 +380,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { // we disallow calling EOA addresses. require( message.destinationAddress.code.length > 0, - ERR_INVALID_DESTINATION_ADDRESS + "TeleporterMessenger: destination address has no code" ); // Clear the failed message hash from state prior to retrying its execution to redundantly prevent @@ -417,7 +401,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { (originChainID, message.senderAddress, message.message) ) ); - require(success, ERR_MESSAGE_RETRY_EXECUTION_FAILED); + require(success, "TeleporterMessenger: retry execution failed"); } /** @@ -454,7 +438,10 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { address relayerRewardAddress = relayerRewardAddresses[ originChainID ][receivedMessageID]; - require(relayerRewardAddress != address(0), ERR_RECEIPT_NOT_FOUND); + require( + relayerRewardAddress != address(0), + "TeleporterMessenger: receipt not found" + ); receiptsToSend[i] = TeleporterMessageReceipt({ receivedMessageID: receivedMessageID, @@ -483,7 +470,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { */ function redeemRelayerRewards(address feeAsset) external { uint256 rewardAmount = relayerRewardAmounts[msg.sender][feeAsset]; - require(rewardAmount != 0, ERR_NO_RELAYER_REWARD_TO_REDEEM); + require(rewardAmount != 0, "TeleporterMessenger: no reward to redeem"); // Zero the reward balance before calling the external ERC20 to transfer the // reward to prevent any possible re-entrancy. @@ -629,7 +616,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { // If the fee amount is non-zero, check that the contract address is not address(0) require( feeInfo.contractAddress != address(0), - ERR_INVALID_FEE_ASSET_CONTRACT_ADDRESS + "TeleporterMessenger: zero fee asset contract address" ); adjustedFeeAmount = SafeERC20TransferFrom.safeTransferFrom( @@ -722,7 +709,10 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { // its execution succeeds, such that the relayer can claim their fee reward. However, if the message // execution fails, the message hash will be stored in state such that anyone can try to provide more // gas to successfully execute the message. - require(gasleft() >= message.requiredGasLimit, ERR_INSUFFICIENT_GAS); + require( + gasleft() >= message.requiredGasLimit, + "TeleporterMessenger: insufficient gas" + ); // The destination address must have fully initialized contract code in order for the message // to call it. If the destination address does not have code, we store the message as a failed diff --git a/contracts/src/Teleporter/tests/AddFeeAmountTests.t.sol b/contracts/src/Teleporter/tests/AddFeeAmountTests.t.sol index c97be12c2..5c417f4dc 100644 --- a/contracts/src/Teleporter/tests/AddFeeAmountTests.t.sol +++ b/contracts/src/Teleporter/tests/AddFeeAmountTests.t.sol @@ -64,9 +64,7 @@ contract AddFeeAmountTest is TeleporterMessengerTest { // Add to the fee amount of a message that doesn't exist. Expect revert. uint256 additionalFeeAmount = 131313; uint256 fakeMessageID = 13; - vm.expectRevert( - TeleporterMessenger.ERR_MESSAGE_ALREADY_DELIVERED.selector - ); + vm.expectRevert(_formatErrorMessage("message not found")); teleporterMessenger.addFeeAmount( DEFAULT_DESTINATION_CHAIN_ID, fakeMessageID, @@ -101,7 +99,7 @@ contract AddFeeAmountTest is TeleporterMessengerTest { // Now try to add to the fee of the message. Should revert since the message receipt was received already. uint256 additionalFeeAmount = 131313; - vm.expectRevert(TeleporterMessenger.MessageAlreadyDelivered.selector); + vm.expectRevert(_formatErrorMessage("message not found")); teleporterMessenger.addFeeAmount( DEFAULT_DESTINATION_CHAIN_ID, messageID, @@ -120,9 +118,7 @@ contract AddFeeAmountTest is TeleporterMessengerTest { // Expect revert when adding 0 additional amount. uint256 additionalFeeAmount = 0; - vm.expectRevert( - TeleporterMessenger.InvalidAdditionalFeeAmount.selector - ); + vm.expectRevert(_formatErrorMessage("zero fee amount")); teleporterMessenger.addFeeAmount( DEFAULT_DESTINATION_CHAIN_ID, messageID, @@ -143,7 +139,7 @@ contract AddFeeAmountTest is TeleporterMessengerTest { uint256 additionalFeeAmount = 131313; address differentFeeAsset = 0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664; vm.expectRevert( - TeleporterMessenger.InvalidFeeAssetContractAddress.selector + _formatErrorMessage("invalid fee asset contract address") ); teleporterMessenger.addFeeAmount( DEFAULT_DESTINATION_CHAIN_ID, @@ -164,9 +160,7 @@ contract AddFeeAmountTest is TeleporterMessengerTest { // Expect revert when using an invalid fee asset. uint256 additionalFeeAmount = 131313; address invalidFeeAsset = address(0); - vm.expectRevert( - TeleporterMessenger.InvalidFeeAssetContractAddress.selector - ); + vm.expectRevert(_formatErrorMessage("zero fee asset contract address")); teleporterMessenger.addFeeAmount( DEFAULT_DESTINATION_CHAIN_ID, messageID, diff --git a/contracts/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol b/contracts/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol index 25f9cb182..4431e71af 100644 --- a/contracts/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol +++ b/contracts/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol @@ -189,7 +189,7 @@ contract HandleInitialMessageExecutionTest is TeleporterMessengerTest { _setUpSuccessGetVerifiedWarpMessageMock(0, warpMessage); // Receive the message. - vm.expectRevert(TeleporterMessenger.InsufficientGas.selector); + vm.expectRevert(_formatErrorMessage("insufficient gas")); teleporterMessenger.receiveCrossChainMessage( 0, DEFAULT_RELAYER_REWARD_ADDRESS @@ -244,9 +244,7 @@ contract HandleInitialMessageExecutionTest is TeleporterMessengerTest { ), DEFAULT_RELAYER_REWARD_ADDRESS ); - vm.expectRevert( - TeleporterMessenger.MessageRetryExecutionFailed.selector - ); + vm.expectRevert(_formatErrorMessage("retry execution failed")); teleporterMessenger.retryMessageExecution( DEFAULT_ORIGIN_CHAIN_ID, messageToReceive @@ -299,9 +297,7 @@ contract HandleInitialMessageExecutionTest is TeleporterMessengerTest { ), DEFAULT_RELAYER_REWARD_ADDRESS ); - vm.expectRevert( - TeleporterMessenger.MessageRetryExecutionFailed.selector - ); + vm.expectRevert(_formatErrorMessage("retry execution failed")); teleporterMessenger.retryMessageExecution( DEFAULT_ORIGIN_CHAIN_ID, messageToReceive diff --git a/contracts/src/Teleporter/tests/ReceiveCrossChainMessageTests.t.sol b/contracts/src/Teleporter/tests/ReceiveCrossChainMessageTests.t.sol index e065b81fc..17d515fbc 100644 --- a/contracts/src/Teleporter/tests/ReceiveCrossChainMessageTests.t.sol +++ b/contracts/src/Teleporter/tests/ReceiveCrossChainMessageTests.t.sol @@ -48,9 +48,7 @@ contract ReceiveCrossChainMessagedTest is TeleporterMessengerTest { // Check receipt queue size assertEq( - teleporterMessenger.getReceiptQueueSize( - DEFAULT_ORIGIN_CHAIN_ID - ), + teleporterMessenger.getReceiptQueueSize(DEFAULT_ORIGIN_CHAIN_ID), 0 ); @@ -62,9 +60,7 @@ contract ReceiveCrossChainMessagedTest is TeleporterMessengerTest { // Check receipt queue size assertEq( - teleporterMessenger.getReceiptQueueSize( - DEFAULT_ORIGIN_CHAIN_ID - ), + teleporterMessenger.getReceiptQueueSize(DEFAULT_ORIGIN_CHAIN_ID), 1 ); @@ -90,9 +86,7 @@ contract ReceiveCrossChainMessagedTest is TeleporterMessengerTest { // Check receipt queue size assertEq( - teleporterMessenger.getReceiptQueueSize( - DEFAULT_ORIGIN_CHAIN_ID - ), + teleporterMessenger.getReceiptQueueSize(DEFAULT_ORIGIN_CHAIN_ID), 2 ); @@ -125,7 +119,7 @@ contract ReceiveCrossChainMessagedTest is TeleporterMessengerTest { abi.encodeCall(WarpMessenger.getVerifiedWarpMessage, (0)) ); - vm.expectRevert(TeleporterMessenger.InvalidWarpMessage.selector); + vm.expectRevert(_formatErrorMessage("invalid warp message")); teleporterMessenger.receiveCrossChainMessage(0, address(1)); // Receive invalid message at index 3 @@ -139,7 +133,7 @@ contract ReceiveCrossChainMessagedTest is TeleporterMessengerTest { abi.encodeCall(WarpMessenger.getVerifiedWarpMessage, (3)) ); - vm.expectRevert(TeleporterMessenger.InvalidWarpMessage.selector); + vm.expectRevert(_formatErrorMessage("invalid warp message")); teleporterMessenger.receiveCrossChainMessage(3, address(1)); } @@ -161,9 +155,7 @@ contract ReceiveCrossChainMessagedTest is TeleporterMessengerTest { // Mock the call to the warp precompile to get the message. _setUpSuccessGetVerifiedWarpMessageMock(0, warpMessage); - vm.expectRevert( - TeleporterMessenger.InvalidOriginSenderAddress.selector - ); + vm.expectRevert(_formatErrorMessage("invalid origin sender address")); teleporterMessenger.receiveCrossChainMessage( 0, DEFAULT_RELAYER_REWARD_ADDRESS @@ -190,7 +182,7 @@ contract ReceiveCrossChainMessagedTest is TeleporterMessengerTest { // Mock the call to the warp precompile to get the message. _setUpSuccessGetVerifiedWarpMessageMock(0, warpMessage); - vm.expectRevert(TeleporterMessenger.InvalidDestinationChainID.selector); + vm.expectRevert(_formatErrorMessage("invalid destination chain ID")); teleporterMessenger.receiveCrossChainMessage( 0, DEFAULT_RELAYER_REWARD_ADDRESS @@ -215,7 +207,7 @@ contract ReceiveCrossChainMessagedTest is TeleporterMessengerTest { // Mock the call to the warp precompile to get the message. _setUpSuccessGetVerifiedWarpMessageMock(0, warpMessage); - vm.expectRevert(TeleporterMessenger.InvalidDestinationAddress.selector); + vm.expectRevert(_formatErrorMessage("invalid destination address")); teleporterMessenger.receiveCrossChainMessage( 0, DEFAULT_RELAYER_REWARD_ADDRESS @@ -223,9 +215,7 @@ contract ReceiveCrossChainMessagedTest is TeleporterMessengerTest { } function testInvalidRelayerAddress() public { - vm.expectRevert( - TeleporterMessenger.InvalidRelayerRewardAddress.selector - ); + vm.expectRevert(_formatErrorMessage("zero relayer reward address")); teleporterMessenger.receiveCrossChainMessage(0, address(0)); } @@ -234,7 +224,7 @@ contract ReceiveCrossChainMessagedTest is TeleporterMessengerTest { testSuccess(); // Check you can't deliver it again. - vm.expectRevert(TeleporterMessenger.MessageAlreadyDelivered.selector); + vm.expectRevert(_formatErrorMessage("message already delivered")); teleporterMessenger.receiveCrossChainMessage( 0, DEFAULT_RELAYER_REWARD_ADDRESS @@ -266,7 +256,7 @@ contract ReceiveCrossChainMessagedTest is TeleporterMessengerTest { _setUpSuccessGetVerifiedWarpMessageMock(0, warpMessage); // Receive the message. - vm.expectRevert(TeleporterMessenger.UnauthorizedRelayer.selector); + vm.expectRevert(_formatErrorMessage("unauthorized relayer")); teleporterMessenger.receiveCrossChainMessage( 0, DEFAULT_RELAYER_REWARD_ADDRESS diff --git a/contracts/src/Teleporter/tests/RedeemRelayerRewardsTests.t.sol b/contracts/src/Teleporter/tests/RedeemRelayerRewardsTests.t.sol index 9a21ea9b9..dfdcbbf14 100644 --- a/contracts/src/Teleporter/tests/RedeemRelayerRewardsTests.t.sol +++ b/contracts/src/Teleporter/tests/RedeemRelayerRewardsTests.t.sol @@ -22,7 +22,7 @@ contract RedeemRelayerRewardsTest is TeleporterMessengerTest { } function testZeroRewardBalance() public { - vm.expectRevert(TeleporterMessenger.NoRelayerRewardToRedeem.selector); + vm.expectRevert(_formatErrorMessage("no reward to redeem")); teleporterMessenger.redeemRelayerRewards(address(_mockFeeAsset)); } diff --git a/contracts/src/Teleporter/tests/RetryMessageExecutionTests.t.sol b/contracts/src/Teleporter/tests/RetryMessageExecutionTests.t.sol index e55cfb16c..d5bd11f47 100644 --- a/contracts/src/Teleporter/tests/RetryMessageExecutionTests.t.sol +++ b/contracts/src/Teleporter/tests/RetryMessageExecutionTests.t.sol @@ -119,9 +119,7 @@ contract RetryMessageExecutionTest is TeleporterMessengerTest { ) = _receiveFailedMessage(false); // Now retry it in another block with an even timestamp so that it fails again. - vm.expectRevert( - TeleporterMessenger.MessageRetryExecutionFailed.selector - ); + vm.expectRevert(_formatErrorMessage("retry execution failed")); teleporterMessenger.retryMessageExecution(originChainID, message); } @@ -137,7 +135,7 @@ contract RetryMessageExecutionTest is TeleporterMessengerTest { message: new bytes(0) }); - vm.expectRevert(TeleporterMessenger.MessageNotFound.selector); + vm.expectRevert(_formatErrorMessage("message not found")); teleporterMessenger.retryMessageExecution( DEFAULT_ORIGIN_CHAIN_ID, fakeMessage @@ -154,7 +152,7 @@ contract RetryMessageExecutionTest is TeleporterMessengerTest { // Alter the message before retrying it. message.message = "altered message"; - vm.expectRevert(TeleporterMessenger.InvalidMessageHash.selector); + vm.expectRevert(_formatErrorMessage("invalid message hash")); teleporterMessenger.retryMessageExecution(originChainID, message); } @@ -166,7 +164,7 @@ contract RetryMessageExecutionTest is TeleporterMessengerTest { ) = _successfullyRetryMessage(); // Now try again and make sure it's been cleared from state - vm.expectRevert(TeleporterMessenger.MessageNotFound.selector); + vm.expectRevert(_formatErrorMessage("message not found")); teleporterMessenger.retryMessageExecution(originChainID, message); } @@ -208,7 +206,7 @@ contract RetryMessageExecutionTest is TeleporterMessengerTest { // Retrying the message execution should revert since there is still no contract deployed // to the destination address. - vm.expectRevert(TeleporterMessenger.InvalidDestinationAddress.selector); + vm.expectRevert(_formatErrorMessage("destination address has no code")); teleporterMessenger.retryMessageExecution(originChainID, message); } diff --git a/contracts/src/Teleporter/tests/RetryReceiptTests.t.sol b/contracts/src/Teleporter/tests/RetryReceiptTests.t.sol index 1a3b37aad..a1caf10fd 100644 --- a/contracts/src/Teleporter/tests/RetryReceiptTests.t.sol +++ b/contracts/src/Teleporter/tests/RetryReceiptTests.t.sol @@ -168,7 +168,7 @@ contract RetryReceiptTest is TeleporterMessengerTest { missingIDs[0] = 21; // Try to retry a receipt for an unreceived message from that chain - should fail. - vm.expectRevert(TeleporterMessenger.ReceiptNotFound.selector); + vm.expectRevert(_formatErrorMessage("receipt not found")); _retryTestReceiptsWithNoFee(DEFAULT_DESTINATION_CHAIN_ID, missingIDs); } diff --git a/contracts/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol b/contracts/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol index c33d0773f..37ffaee14 100644 --- a/contracts/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol +++ b/contracts/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol @@ -48,7 +48,7 @@ contract RetrySendCrossChainMessageTest is TeleporterMessengerTest { receipts: new TeleporterMessageReceipt[](0), message: new bytes(0) }); - vm.expectRevert(TeleporterMessenger.MessageNotFound.selector); + vm.expectRevert(_formatErrorMessage("message hash not found")); teleporterMessenger.retrySendCrossChainMessage( DEFAULT_DESTINATION_CHAIN_ID, fakeMessage @@ -72,7 +72,7 @@ contract RetrySendCrossChainMessageTest is TeleporterMessengerTest { }); // Retry it - should fail. - vm.expectRevert(TeleporterMessenger.InvalidMessageHash.selector); + vm.expectRevert(_formatErrorMessage("invalid message hash")); teleporterMessenger.retrySendCrossChainMessage( DEFAULT_DESTINATION_CHAIN_ID, alteredMessage diff --git a/contracts/src/Teleporter/tests/SendCrossChainMessageTests.t.sol b/contracts/src/Teleporter/tests/SendCrossChainMessageTests.t.sol index c7559df17..9f309ad6b 100644 --- a/contracts/src/Teleporter/tests/SendCrossChainMessageTests.t.sol +++ b/contracts/src/Teleporter/tests/SendCrossChainMessageTests.t.sol @@ -206,9 +206,7 @@ contract SendCrossChainMessageTest is TeleporterMessengerTest { message: new bytes(0) }); - vm.expectRevert( - TeleporterMessenger.ERR_INVALID_FEE_ASSET_CONTRACT_ADDRESS - ); + vm.expectRevert(_formatErrorMessage("zero fee asset contract address")); teleporterMessenger.sendCrossChainMessage(messageInput); } } diff --git a/contracts/src/Teleporter/tests/TeleporterMessengerTest.t.sol b/contracts/src/Teleporter/tests/TeleporterMessengerTest.t.sol index 8abe497bf..638436180 100644 --- a/contracts/src/Teleporter/tests/TeleporterMessengerTest.t.sol +++ b/contracts/src/Teleporter/tests/TeleporterMessengerTest.t.sol @@ -83,10 +83,14 @@ contract TeleporterMessengerTest is Test { } function testEmptyReceiptQueue() public { - assertEq(teleporterMessenger.getReceiptQueueSize(DEFAULT_ORIGIN_CHAIN_ID), 0); + assertEq( + teleporterMessenger.getReceiptQueueSize(DEFAULT_ORIGIN_CHAIN_ID), + 0 + ); vm.expectRevert(ReceiptQueue.OutofIndex.selector); - TeleporterMessageReceipt memory receipt = teleporterMessenger.getReceiptAtIndex(DEFAULT_ORIGIN_CHAIN_ID, 0); + TeleporterMessageReceipt memory receipt = teleporterMessenger + .getReceiptAtIndex(DEFAULT_ORIGIN_CHAIN_ID, 0); assertEq(receipt.receivedMessageID, 0); assertEq(receipt.relayerRewardAddress, address(0)); } @@ -260,4 +264,10 @@ contract TeleporterMessengerTest is Test { payload: payload }); } + + function _formatErrorMessage( + string memory errorMessage + ) internal pure returns (bytes memory) { + return bytes(string.concat("TeleporterMessenger: ", errorMessage)); + } } From f31b07fed21f4bf8cf6bc8771f99d611d2993e66 Mon Sep 17 00:00:00 2001 From: Matthew Lam Date: Mon, 16 Oct 2023 18:42:03 +0000 Subject: [PATCH 03/20] add reason string lint and lint script --- README.md | 8 ++++++-- contracts/src/.solhint.json | 3 ++- scripts/local/lint.sh | 14 ++++++++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) create mode 100755 scripts/local/lint.sh diff --git a/README.md b/README.md index 89a9dab7f..76822deff 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,12 @@ The Teleporter protocol, on the other hand, is implemented at the smart contract - [Overview](#overview) - [Setup](#setup) + - [Docker Setup](#docker-setup) + - [General Setup](#general-setup) - [Structure](#structure) - - [Building and Running](#building-and-running) + - [Build + Run + Test](#build--run--test) + - [Run tests on Fuji Testnet](#run-tests-on-fuji-testnet) + - [E2E tests](#e2e-tests) - [Docs](#docs) - [Resources](#resources) @@ -70,7 +74,7 @@ The above steps are sufficient to run the included integration tests inside Dock - `scripts/fuji/example-workflows/` includes example workflows that send transactions to interact with Teleporter contracts on Fuji subnets. - `docker/` includes containerized setup for running a local setup of Teleporter, as well as a script to run each of the integration tests against the local network. -## Building and Running +## Build + Run + Test - Get all submodules: `git submodule update --init --recursive` - Install Docker as described in the setup section of the README in the root of this repository. diff --git a/contracts/src/.solhint.json b/contracts/src/.solhint.json index 457ab6485..2e434bafa 100644 --- a/contracts/src/.solhint.json +++ b/contracts/src/.solhint.json @@ -16,7 +16,8 @@ "strict": true } ], - "reason-string": ["off"], + "reason-string": ["warn", { "maxLength": 60 }], + "custom-errors": "off", "ordering": "warn", "immutable-vars-naming": [ "warn", diff --git a/scripts/local/lint.sh b/scripts/local/lint.sh new file mode 100755 index 000000000..889daf1e1 --- /dev/null +++ b/scripts/local/lint.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +# Copyright (C) 2023, Ava Labs, Inc. All rights reserved. +# See the file LICENSE for licensing terms. + +set -e + +TELEPORTER_PATH=$( + cd "$(dirname "${BASH_SOURCE[0]}")" + cd ../.. && pwd +) + +cd $TELEPORTER_PATH/contracts/src +solhint '**/*.sol' +exit 0 \ No newline at end of file From 5590b593a500804a8a1c63cb15058d947fb10fac Mon Sep 17 00:00:00 2001 From: Matthew Lam Date: Mon, 16 Oct 2023 19:22:34 +0000 Subject: [PATCH 04/20] update erc20Bridge to use require statements --- .../ERC20Bridge/BridgeToken.sol | 31 ++-- .../ERC20Bridge/ERC20Bridge.sol | 168 ++++++++---------- .../ERC20Bridge/tests/ERC20BridgeTests.t.sol | 20 +-- 3 files changed, 93 insertions(+), 126 deletions(-) diff --git a/contracts/src/CrossChainApplications/ERC20Bridge/BridgeToken.sol b/contracts/src/CrossChainApplications/ERC20Bridge/BridgeToken.sol index 04fb16721..9c5683f6c 100644 --- a/contracts/src/CrossChainApplications/ERC20Bridge/BridgeToken.sol +++ b/contracts/src/CrossChainApplications/ERC20Bridge/BridgeToken.sol @@ -19,12 +19,6 @@ contract BridgeToken is ERC20Burnable { uint8 private immutable _decimals; - // Errors - error InvalidSourceAsset(); - error InvalidSourceBridgeAddress(); - error InvalidSourceChainID(); - error Unauthorized(); - /** * @dev Initializes a BridgeToken instance. */ @@ -36,15 +30,18 @@ contract BridgeToken is ERC20Burnable { string memory tokenSymbol, uint8 tokenDecimals ) ERC20(tokenName, tokenSymbol) { - if (sourceChainID == bytes32(0)) { - revert InvalidSourceChainID(); - } - if (sourceBridge == address(0)) { - revert InvalidSourceBridgeAddress(); - } - if (sourceAsset == address(0)) { - revert InvalidSourceAsset(); - } + require( + sourceChainID != bytes32(0), + "BridgeToken: invalid source chain id" + ); + require( + sourceBridge != address(0), + "BridgeToken: invalid source bridge address" + ); + require( + sourceAsset != address(0), + "BridgeToken: invalid source asset address" + ); bridgeContract = msg.sender; nativeChainID = sourceChainID; nativeBridge = sourceBridge; @@ -56,9 +53,7 @@ contract BridgeToken is ERC20Burnable { * @dev Mints tokens to `account` if called by original `bridgeContract`. */ function mint(address account, uint256 amount) public { - if (msg.sender != bridgeContract) { - revert Unauthorized(); - } + require(msg.sender == bridgeContract, "BridgeToken: unauthorized"); _mint(account, amount); } diff --git a/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol b/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol index ac73737b5..4d26b8a75 100644 --- a/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol +++ b/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol @@ -15,12 +15,6 @@ import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; -struct TokenID { - bytes32 chainID; - address bridgeContract; - address asset; -} - /** * @dev Implementation of the {IERC20Bridge} interface. * @@ -73,31 +67,15 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { uint256 public constant MINT_BRIDGE_TOKENS_REQUIRED_GAS = 200_000; uint256 public constant TRANSFER_BRIDGE_TOKENS_REQUIRED_GAS = 300_000; - // Errors - error BridgeTokenAlreadyExists(address bridgeTokenAddress); - error CannotBridgeTokenWithinSameChain(); - error CannotBridgeWrappedToken(address nativeTokenAddress); - error InsufficientAdjustedAmount(uint256 adjustedAmount, uint256 feeAmount); - error InsufficientTotalAmount(uint256 totalAmount, uint256 feeAmount); - error InsufficientWrappedTokenBalance( - uint256 currentBalance, - uint256 requestAmount - ); - error InvalidAction(); - error InvalidBridgeTokenAddress(); - error InvalidDestinationBridgeAddress(); - error InvalidRecipientAddress(); - error InvalidTeleporterMessengerAddress(); - error Unauthorized(); - /** * @dev Initializes the Teleporter messenger used for sending and receiving messages, * and initializes the current chain ID. */ constructor(address teleporterMessengerAddress) { - if (teleporterMessengerAddress == address(0)) { - revert InvalidTeleporterMessengerAddress(); - } + require( + teleporterMessengerAddress != address(0), + "ERC20Bridge: Invalid teleporter messenger address" + ); teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); currentChainID = WarpMessenger(WARP_PRECOMPILE_ADDRESS) @@ -123,18 +101,17 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { uint256 secondaryFeeAmount ) external nonReentrant { // Bridging tokens within a single chain is not allowed. - if (destinationChainID == currentChainID) { - revert CannotBridgeTokenWithinSameChain(); - } + require( + destinationChainID != currentChainID, + "ERC20Bridge: bridging to same chain" + ); // Neither the recipient nor the destination bridge can be the zero address. - if (recipient == address(0)) { - revert InvalidRecipientAddress(); - } - - if (destinationBridgeAddress == address(0)) { - revert InvalidDestinationBridgeAddress(); - } + require(recipient != address(0), "ERC20Bridge: zero recipient address"); + require( + destinationBridgeAddress != address(0), + "ERC20Bridge: zero destination bridge address" + ); // If the token to be bridged is an existing wrapped token of this bridge, // then handle it as an "unwrap" by burning the tokens, and sending a message @@ -146,12 +123,10 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { // In the wrapped token case, we know that the bridgeToken to be burned // is not a "fee/burn on transfer" token, since it was deployed by this // contract itself. - if (totalAmount <= primaryFeeAmount + secondaryFeeAmount) { - revert InsufficientTotalAmount( - totalAmount, - primaryFeeAmount + secondaryFeeAmount - ); - } + require( + totalAmount > primaryFeeAmount + secondaryFeeAmount, + "ERC20Bridge: insufficient total fee amount" + ); return _processWrappedTokenTransfer( @@ -168,13 +143,12 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { } // Otherwise, this is a token "native" to this chain. - if ( - !submittedBridgeTokenCreations[destinationChainID][ + require( + submittedBridgeTokenCreations[destinationChainID][ destinationBridgeAddress - ][tokenContractAddress] - ) { - revert InvalidBridgeTokenAddress(); - } + ][tokenContractAddress], + "ERC20Bridge: invalid bridge token 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 @@ -187,9 +161,10 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { // 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 <= primaryFeeAmount) { - revert InsufficientAdjustedAmount(adjustedAmount, primaryFeeAmount); - } + require( + adjustedAmount > primaryFeeAmount, + "ERC20Bridge: insufficient adjusted amount" + ); return _processNativeTokenTransfer({ @@ -219,9 +194,10 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { address messageFeeAsset, uint256 messageFeeAmount ) external nonReentrant { - if (destinationBridgeAddress == address(0)) { - revert InvalidDestinationBridgeAddress(); - } + require( + destinationBridgeAddress != address(0), + "ERC20Bridge: zero destination bridge address" + ); // For non-zero fee amounts, transfer the fee into the control of this contract first, and then // allow the Teleporter contract to spend it. @@ -283,9 +259,10 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { bytes calldata message ) external { // Only allow the Teleporter messenger to deliver messages. - if (msg.sender != address(teleporterMessenger)) { - revert Unauthorized(); - } + require( + msg.sender == address(teleporterMessenger), + "ERC20Bridge: unauthoried sender" + ); // Decode the payload to recover the action and corresponding function parameters (BridgeAction action, bytes memory actionData) = abi.decode( @@ -345,7 +322,7 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { secondaryFeeAmount: secondaryFeeAmount }); } else { - revert InvalidAction(); + revert("ERC20Bridge: invalid action"); } } @@ -429,17 +406,12 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { uint8 nativeDecimals ) private { // Check that the bridge token doesn't already exist. - if ( + require( nativeToWrappedTokens[nativeChainID][nativeBridgeAddress][ nativeContractAddress - ] != address(0) - ) { - revert BridgeTokenAlreadyExists( - nativeToWrappedTokens[nativeChainID][nativeBridgeAddress][ - nativeContractAddress - ] - ); - } + ] == address(0), + "ERC20Bridge: bridge token already exists" + ); address bridgeTokenAddress = address( new BridgeToken({ @@ -481,9 +453,7 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { uint256 amount ) private nonReentrant { // The recipient cannot be the zero address. - if (recipient == address(0)) { - revert InvalidRecipientAddress(); - } + require(recipient != address(0), "ERC20Bridge: zero recipient address"); // Check that a bridge token exists for this native asset. // If not, one needs to be created by the delivery of a "createBridgeToken" message first @@ -492,9 +462,10 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { address bridgeTokenAddress = nativeToWrappedTokens[nativeChainID][ nativeBridgeAddress ][nativeContractAddress]; - if (bridgeTokenAddress == address(0)) { - revert InvalidBridgeTokenAddress(); - } + require( + bridgeTokenAddress != address(0), + "ERC20Bridge: bridge token does not exist" + ); // Mint the wrapped tokens. BridgeToken(bridgeTokenAddress).mint(recipient, amount); @@ -519,21 +490,20 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { uint256 secondaryFeeAmount ) private nonReentrant { // Neither the recipient nor the destination bridge can be the zero address. - if (recipient == address(0)) { - revert InvalidRecipientAddress(); - } - - if (destinationBridgeAddress == address(0)) { - revert InvalidDestinationBridgeAddress(); - } + require(recipient != address(0), "ERC20Bridge: zero recipient address"); + require( + destinationBridgeAddress != address(0), + "ERC20Bridge: zero destination bridge address" + ); // Check that the bridge returning the tokens has sufficient balance to do so. uint256 currentBalance = bridgedBalances[sourceChainID][ sourceBridgeAddress ][nativeContractAddress]; - if (currentBalance < totalAmount) { - revert InsufficientWrappedTokenBalance(currentBalance, totalAmount); - } + require( + currentBalance >= totalAmount, + "ERC20Bridge: insufficient balance" + ); bridgedBalances[sourceChainID][sourceBridgeAddress][ nativeContractAddress @@ -542,9 +512,10 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { // If the destination chain ID and bridge is this bridge instance, then release the tokens back to the recipient. // In this case, since there is no secondary Teleporter message, the secondary fee amount is not used. if (destinationChainID == currentChainID) { - if (destinationBridgeAddress != address(this)) { - revert InvalidDestinationBridgeAddress(); - } + require( + destinationBridgeAddress == address(this), + "ERC20Bridge: invalid destination bridge address" + ); // Transfer tokens to the recipient. // We don't need have a special case for handling "fee/burn on transfer" ERC20 token implementations @@ -590,16 +561,18 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { uint256 feeAmount ) private { // Do not allow nested bridging of wrapped tokens. - if (wrappedTokenContracts[nativeContractAddress]) { - revert CannotBridgeWrappedToken(nativeContractAddress); - } + require( + !wrappedTokenContracts[nativeContractAddress], + "ERC20Bridge: cannot bridge wrapped token" + ); // Bridging tokens within a single chain is not allowed. // This function is called by bridgeTokens and transferBridgeTokens which both already make this check, // so this check is redundant but left in for clarity. - if (destinationChainID == currentChainID) { - revert CannotBridgeTokenWithinSameChain(); - } + require( + destinationChainID != currentChainID, + "ERC20Bridge: bridging to same chain" + ); // Allow the Teleporter messenger to spend the fee amount. if (feeAmount > 0) { @@ -693,12 +666,11 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { bytes32 nativeChainID = bridgeToken.nativeChainID(); address nativeBridgeAddress = bridgeToken.nativeBridge(); if (wrappedTransferInfo.destinationChainID == nativeChainID) { - if ( - wrappedTransferInfo.destinationBridgeAddress != - nativeBridgeAddress - ) { - revert InvalidDestinationBridgeAddress(); - } + require( + wrappedTransferInfo.destinationBridgeAddress == + nativeBridgeAddress, + "ERC20Bridge: invalid destination bridge address" + ); } // Send a message to the native chain and bridge of the wrapped asset that was burned. diff --git a/contracts/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol b/contracts/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol index 206f8cfe6..219cff66d 100644 --- a/contracts/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol +++ b/contracts/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol @@ -71,7 +71,7 @@ contract ERC20BridgeTest is Test { } function testSameChainID() public { - vm.expectRevert(ERC20Bridge.CannotBridgeTokenWithinSameChain.selector); + vm.expectRevert(_formatErrorMessage("bridging to same chain")); erc20Bridge.bridgeTokens({ destinationChainID: _MOCK_BLOCKCHAIN_ID, destinationBridgeAddress: _DEFAULT_OTHER_BRIDGE_ADDRESS, @@ -90,9 +90,7 @@ contract ERC20BridgeTest is Test { _DEFAULT_OTHER_BRIDGE_ADDRESS, address(mockERC20) ); - vm.expectRevert(abi.encodePacked( - ERC20Bridge.InsufficientAdjustedAmount.selector, - uint256(130), uint256(130))); + vm.expectRevert(_formatErrorMessage("insufficient adjusted amount")); erc20Bridge.bridgeTokens({ destinationChainID: _DEFAULT_OTHER_CHAIN_ID, destinationBridgeAddress: _DEFAULT_OTHER_BRIDGE_ADDRESS, @@ -115,9 +113,7 @@ contract ERC20BridgeTest is Test { contractNonce: 1 }); - vm.expectRevert(abi.encodePacked( - ERC20Bridge.InsufficientTotalAmount.selector, - uint256(130), uint256(130))); + vm.expectRevert(_formatErrorMessage("insufficient total fee amount")); erc20Bridge.bridgeTokens({ destinationChainID: _DEFAULT_OTHER_CHAIN_ID, destinationBridgeAddress: _DEFAULT_OTHER_BRIDGE_ADDRESS, @@ -494,9 +490,7 @@ contract ERC20BridgeTest is Test { address(mockERC20) ); - vm.expectRevert(abi.encodePacked( - ERC20Bridge.InsufficientAdjustedAmount.selector, - uint256(totalAmount - tokenFeeOnTransferAmount), uint256(bridgeFeeAmount))); + vm.expectRevert(_formatErrorMessage("insufficient adjusted amount")); erc20Bridge.bridgeTokens({ destinationChainID: _DEFAULT_OTHER_CHAIN_ID, destinationBridgeAddress: _DEFAULT_OTHER_BRIDGE_ADDRESS, @@ -762,4 +756,10 @@ contract ERC20BridgeTest is Test { ) ); } + + function _formatErrorMessage( + string memory errorMessage + ) private pure returns (bytes memory) { + return bytes(string.concat("ERC20Bridge: ", errorMessage)); + } } From 6c2a6cd5c23741ddc225c8a503dcbb2359d4c5ec Mon Sep 17 00:00:00 2001 From: Matthew Lam Date: Mon, 16 Oct 2023 19:26:16 +0000 Subject: [PATCH 05/20] update cross chain apps to use require statements and abi bindings --- .../ERC20Bridge/ERC20Bridge/ERC20Bridge.go | 78 +++++++++++++++---- .../ExampleCrossChainMessenger.go | 78 +++++++++++++++---- .../BlockHashPublisher/BlockHashPublisher.go | 78 +++++++++++++++---- .../BlockHashReceiver/BlockHashReceiver.go | 78 +++++++++++++++---- .../ExampleCrossChainMessenger.sol | 7 +- .../VerifiedBlockHash/BlockHashReceiver.sol | 28 +++---- 6 files changed, 273 insertions(+), 74 deletions(-) diff --git a/abi-bindings/CrossChainApplications/ERC20Bridge/ERC20Bridge/ERC20Bridge.go b/abi-bindings/CrossChainApplications/ERC20Bridge/ERC20Bridge/ERC20Bridge.go index 5a98d6b84..3b152253e 100644 --- a/abi-bindings/CrossChainApplications/ERC20Bridge/ERC20Bridge/ERC20Bridge.go +++ b/abi-bindings/CrossChainApplications/ERC20Bridge/ERC20Bridge/ERC20Bridge.go @@ -31,7 +31,7 @@ var ( // ERC20BridgeMetaData contains all meta data concerning the ERC20Bridge contract. var ERC20BridgeMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"bridgeTokenAddress\",\"type\":\"address\"}],\"name\":\"BridgeTokenAlreadyExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CannotBridgeTokenWithinSameChain\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nativeTokenAddress\",\"type\":\"address\"}],\"name\":\"CannotBridgeWrappedToken\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"adjustedAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"InsufficientAdjustedAmount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"InsufficientTotalAmount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"currentBalance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestAmount\",\"type\":\"uint256\"}],\"name\":\"InsufficientWrappedTokenBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAction\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidBridgeTokenAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidDestinationBridgeAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidRecipientAddress\",\"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\":\"bytes32\",\"name\":\"destinationChainID\",\"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\":\"nativeChainID\",\"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\":\"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\":\"bytes32\",\"name\":\"destinationChainID\",\"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\":\"destinationChainID\",\"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\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"bridgedBalances\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentChainID\",\"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\":\"destinationChainID\",\"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\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"nativeToWrappedTokens\",\"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\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"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\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"submittedBridgeTokenCreations\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"wrappedTokenContracts\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterRegistryAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"bridgeTokenAddress\",\"type\":\"address\"}],\"name\":\"BridgeTokenAlreadyExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CannotBridgeTokenWithinSameChain\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nativeTokenAddress\",\"type\":\"address\"}],\"name\":\"CannotBridgeWrappedToken\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"adjustedAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"InsufficientAdjustedAmount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"InsufficientTotalAmount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"currentBalance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestAmount\",\"type\":\"uint256\"}],\"name\":\"InsufficientWrappedTokenBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAction\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidBridgeTokenAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidDestinationBridgeAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidRecipientAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTeleporterRegistryAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTeleporterSender\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"tokenContractAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"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\":\"nativeChainID\",\"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\":\"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\":\"bytes32\",\"name\":\"destinationChainID\",\"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\":\"destinationChainID\",\"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\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"bridgedBalances\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentChainID\",\"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\":\"destinationChainID\",\"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\":\"getMinTeleporterVersion\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"nativeToWrappedTokens\",\"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\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"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\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"submittedBridgeTokenCreations\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterRegistry\",\"outputs\":[{\"internalType\":\"contractTeleporterRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"updateMinTeleporterVersion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"wrappedTokenContracts\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", } // ERC20BridgeABI is the input ABI used to generate the binding from. @@ -459,6 +459,37 @@ func (_ERC20Bridge *ERC20BridgeCallerSession) EncodeTransferBridgeTokensData(des return _ERC20Bridge.Contract.EncodeTransferBridgeTokensData(&_ERC20Bridge.CallOpts, destinationChainID, destinationBridgeAddress, nativeContractAddress, recipient, amount, feeAmount) } +// GetMinTeleporterVersion is a free data retrieval call binding the contract method 0xd2cc7a70. +// +// Solidity: function getMinTeleporterVersion() view returns(uint256) +func (_ERC20Bridge *ERC20BridgeCaller) GetMinTeleporterVersion(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _ERC20Bridge.contract.Call(opts, &out, "getMinTeleporterVersion") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetMinTeleporterVersion is a free data retrieval call binding the contract method 0xd2cc7a70. +// +// Solidity: function getMinTeleporterVersion() view returns(uint256) +func (_ERC20Bridge *ERC20BridgeSession) GetMinTeleporterVersion() (*big.Int, error) { + return _ERC20Bridge.Contract.GetMinTeleporterVersion(&_ERC20Bridge.CallOpts) +} + +// GetMinTeleporterVersion is a free data retrieval call binding the contract method 0xd2cc7a70. +// +// Solidity: function getMinTeleporterVersion() view returns(uint256) +func (_ERC20Bridge *ERC20BridgeCallerSession) GetMinTeleporterVersion() (*big.Int, error) { + return _ERC20Bridge.Contract.GetMinTeleporterVersion(&_ERC20Bridge.CallOpts) +} + // NativeToWrappedTokens is a free data retrieval call binding the contract method 0x65435568. // // Solidity: function nativeToWrappedTokens(bytes32 , address , address ) view returns(address) @@ -521,12 +552,12 @@ func (_ERC20Bridge *ERC20BridgeCallerSession) SubmittedBridgeTokenCreations(arg0 return _ERC20Bridge.Contract.SubmittedBridgeTokenCreations(&_ERC20Bridge.CallOpts, arg0, arg1, arg2) } -// 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 (_ERC20Bridge *ERC20BridgeCaller) TeleporterMessenger(opts *bind.CallOpts) (common.Address, error) { +// Solidity: function teleporterRegistry() view returns(address) +func (_ERC20Bridge *ERC20BridgeCaller) TeleporterRegistry(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _ERC20Bridge.contract.Call(opts, &out, "teleporterMessenger") + err := _ERC20Bridge.contract.Call(opts, &out, "teleporterRegistry") if err != nil { return *new(common.Address), err @@ -538,18 +569,18 @@ func (_ERC20Bridge *ERC20BridgeCaller) TeleporterMessenger(opts *bind.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 (_ERC20Bridge *ERC20BridgeSession) TeleporterMessenger() (common.Address, error) { - return _ERC20Bridge.Contract.TeleporterMessenger(&_ERC20Bridge.CallOpts) +// Solidity: function teleporterRegistry() view returns(address) +func (_ERC20Bridge *ERC20BridgeSession) TeleporterRegistry() (common.Address, error) { + return _ERC20Bridge.Contract.TeleporterRegistry(&_ERC20Bridge.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 (_ERC20Bridge *ERC20BridgeCallerSession) TeleporterMessenger() (common.Address, error) { - return _ERC20Bridge.Contract.TeleporterMessenger(&_ERC20Bridge.CallOpts) +// Solidity: function teleporterRegistry() view returns(address) +func (_ERC20Bridge *ERC20BridgeCallerSession) TeleporterRegistry() (common.Address, error) { + return _ERC20Bridge.Contract.TeleporterRegistry(&_ERC20Bridge.CallOpts) } // WrappedTokenContracts is a free data retrieval call binding the contract method 0x9bd9abc0. @@ -646,6 +677,27 @@ func (_ERC20Bridge *ERC20BridgeTransactorSession) SubmitCreateBridgeToken(destin return _ERC20Bridge.Contract.SubmitCreateBridgeToken(&_ERC20Bridge.TransactOpts, destinationChainID, destinationBridgeAddress, nativeToken, messageFeeAsset, messageFeeAmount) } +// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. +// +// Solidity: function updateMinTeleporterVersion() returns() +func (_ERC20Bridge *ERC20BridgeTransactor) UpdateMinTeleporterVersion(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ERC20Bridge.contract.Transact(opts, "updateMinTeleporterVersion") +} + +// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. +// +// Solidity: function updateMinTeleporterVersion() returns() +func (_ERC20Bridge *ERC20BridgeSession) UpdateMinTeleporterVersion() (*types.Transaction, error) { + return _ERC20Bridge.Contract.UpdateMinTeleporterVersion(&_ERC20Bridge.TransactOpts) +} + +// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. +// +// Solidity: function updateMinTeleporterVersion() returns() +func (_ERC20Bridge *ERC20BridgeTransactorSession) UpdateMinTeleporterVersion() (*types.Transaction, error) { + return _ERC20Bridge.Contract.UpdateMinTeleporterVersion(&_ERC20Bridge.TransactOpts) +} + // ERC20BridgeBridgeTokensIterator is returned from FilterBridgeTokens and is used to iterate over the raw logs and unpacked data for BridgeTokens events raised by the ERC20Bridge contract. type ERC20BridgeBridgeTokensIterator struct { Event *ERC20BridgeBridgeTokens // Event containing the contract specifics and raw log diff --git a/abi-bindings/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger/ExampleCrossChainMessenger.go b/abi-bindings/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger/ExampleCrossChainMessenger.go index ea2bb9bdd..b65507bb4 100644 --- a/abi-bindings/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger/ExampleCrossChainMessenger.go +++ b/abi-bindings/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger/ExampleCrossChainMessenger.go @@ -31,7 +31,7 @@ var ( // ExampleCrossChainMessengerMetaData contains all meta data concerning the ExampleCrossChainMessenger contract. var ExampleCrossChainMessengerMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Unauthorized\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"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\":\"destinationChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"feeAsset\",\"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\":\"originChainID\",\"type\":\"bytes32\"}],\"name\":\"getCurrentMessage\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"originSenderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"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\":\"messageID\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterRegistryAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTeleporterRegistryAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTeleporterSender\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"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\":\"destinationChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"feeAsset\",\"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\":\"originChainID\",\"type\":\"bytes32\"}],\"name\":\"getCurrentMessage\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMinTeleporterVersion\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"originSenderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"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\":\"messageID\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterRegistry\",\"outputs\":[{\"internalType\":\"contractTeleporterRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"updateMinTeleporterVersion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // ExampleCrossChainMessengerABI is the input ABI used to generate the binding from. @@ -225,12 +225,43 @@ func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerCallerSession) GetC return _ExampleCrossChainMessenger.Contract.GetCurrentMessage(&_ExampleCrossChainMessenger.CallOpts, originChainID) } -// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// GetMinTeleporterVersion is a free data retrieval call binding the contract method 0xd2cc7a70. // -// Solidity: function teleporterMessenger() view returns(address) -func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerCaller) TeleporterMessenger(opts *bind.CallOpts) (common.Address, error) { +// Solidity: function getMinTeleporterVersion() view returns(uint256) +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerCaller) GetMinTeleporterVersion(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _ExampleCrossChainMessenger.contract.Call(opts, &out, "teleporterMessenger") + err := _ExampleCrossChainMessenger.contract.Call(opts, &out, "getMinTeleporterVersion") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetMinTeleporterVersion is a free data retrieval call binding the contract method 0xd2cc7a70. +// +// Solidity: function getMinTeleporterVersion() view returns(uint256) +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerSession) GetMinTeleporterVersion() (*big.Int, error) { + return _ExampleCrossChainMessenger.Contract.GetMinTeleporterVersion(&_ExampleCrossChainMessenger.CallOpts) +} + +// GetMinTeleporterVersion is a free data retrieval call binding the contract method 0xd2cc7a70. +// +// Solidity: function getMinTeleporterVersion() view returns(uint256) +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerCallerSession) GetMinTeleporterVersion() (*big.Int, error) { + return _ExampleCrossChainMessenger.Contract.GetMinTeleporterVersion(&_ExampleCrossChainMessenger.CallOpts) +} + +// TeleporterRegistry is a free data retrieval call binding the contract method 0x1a7f5bec. +// +// Solidity: function teleporterRegistry() view returns(address) +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerCaller) TeleporterRegistry(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _ExampleCrossChainMessenger.contract.Call(opts, &out, "teleporterRegistry") if err != nil { return *new(common.Address), err @@ -242,18 +273,18 @@ func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerCaller) TeleporterM } -// 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 (_ExampleCrossChainMessenger *ExampleCrossChainMessengerSession) TeleporterMessenger() (common.Address, error) { - return _ExampleCrossChainMessenger.Contract.TeleporterMessenger(&_ExampleCrossChainMessenger.CallOpts) +// Solidity: function teleporterRegistry() view returns(address) +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerSession) TeleporterRegistry() (common.Address, error) { + return _ExampleCrossChainMessenger.Contract.TeleporterRegistry(&_ExampleCrossChainMessenger.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 (_ExampleCrossChainMessenger *ExampleCrossChainMessengerCallerSession) TeleporterMessenger() (common.Address, error) { - return _ExampleCrossChainMessenger.Contract.TeleporterMessenger(&_ExampleCrossChainMessenger.CallOpts) +// Solidity: function teleporterRegistry() view returns(address) +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerCallerSession) TeleporterRegistry() (common.Address, error) { + return _ExampleCrossChainMessenger.Contract.TeleporterRegistry(&_ExampleCrossChainMessenger.CallOpts) } // ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. @@ -298,6 +329,27 @@ func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerTransactorSession) return _ExampleCrossChainMessenger.Contract.SendMessage(&_ExampleCrossChainMessenger.TransactOpts, destinationChainID, destinationAddress, feeContractAddress, feeAmount, requiredGasLimit, message) } +// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. +// +// Solidity: function updateMinTeleporterVersion() returns() +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerTransactor) UpdateMinTeleporterVersion(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ExampleCrossChainMessenger.contract.Transact(opts, "updateMinTeleporterVersion") +} + +// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. +// +// Solidity: function updateMinTeleporterVersion() returns() +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerSession) UpdateMinTeleporterVersion() (*types.Transaction, error) { + return _ExampleCrossChainMessenger.Contract.UpdateMinTeleporterVersion(&_ExampleCrossChainMessenger.TransactOpts) +} + +// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. +// +// Solidity: function updateMinTeleporterVersion() returns() +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerTransactorSession) UpdateMinTeleporterVersion() (*types.Transaction, error) { + return _ExampleCrossChainMessenger.Contract.UpdateMinTeleporterVersion(&_ExampleCrossChainMessenger.TransactOpts) +} + // ExampleCrossChainMessengerReceiveMessageIterator is returned from FilterReceiveMessage and is used to iterate over the raw logs and unpacked data for ReceiveMessage events raised by the ExampleCrossChainMessenger contract. type ExampleCrossChainMessengerReceiveMessageIterator struct { Event *ExampleCrossChainMessengerReceiveMessage // Event containing the contract specifics and raw log diff --git a/abi-bindings/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher/BlockHashPublisher.go b/abi-bindings/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher/BlockHashPublisher.go index cc8b99e61..d858584f3 100644 --- a/abi-bindings/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher/BlockHashPublisher.go +++ b/abi-bindings/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher/BlockHashPublisher.go @@ -31,7 +31,7 @@ var ( // BlockHashPublisherMetaData contains all meta data concerning the BlockHashPublisher contract. var BlockHashPublisherMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"blockHeight\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"}],\"name\":\"PublishBlockHash\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"RECEIVE_BLOCK_HASH_REQUIRED_GAS_LIMIT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"}],\"name\":\"publishLatestBlockHash\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterRegistryAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"InvalidTeleporterRegistryAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTeleporterSender\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"blockHeight\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"}],\"name\":\"PublishBlockHash\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"RECEIVE_BLOCK_HASH_REQUIRED_GAS_LIMIT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMinTeleporterVersion\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"}],\"name\":\"publishLatestBlockHash\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterRegistry\",\"outputs\":[{\"internalType\":\"contractTeleporterRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"updateMinTeleporterVersion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // BlockHashPublisherABI is the input ABI used to generate the binding from. @@ -211,12 +211,43 @@ func (_BlockHashPublisher *BlockHashPublisherCallerSession) RECEIVEBLOCKHASHREQU return _BlockHashPublisher.Contract.RECEIVEBLOCKHASHREQUIREDGASLIMIT(&_BlockHashPublisher.CallOpts) } -// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// GetMinTeleporterVersion is a free data retrieval call binding the contract method 0xd2cc7a70. // -// Solidity: function teleporterMessenger() view returns(address) -func (_BlockHashPublisher *BlockHashPublisherCaller) TeleporterMessenger(opts *bind.CallOpts) (common.Address, error) { +// Solidity: function getMinTeleporterVersion() view returns(uint256) +func (_BlockHashPublisher *BlockHashPublisherCaller) GetMinTeleporterVersion(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _BlockHashPublisher.contract.Call(opts, &out, "teleporterMessenger") + err := _BlockHashPublisher.contract.Call(opts, &out, "getMinTeleporterVersion") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetMinTeleporterVersion is a free data retrieval call binding the contract method 0xd2cc7a70. +// +// Solidity: function getMinTeleporterVersion() view returns(uint256) +func (_BlockHashPublisher *BlockHashPublisherSession) GetMinTeleporterVersion() (*big.Int, error) { + return _BlockHashPublisher.Contract.GetMinTeleporterVersion(&_BlockHashPublisher.CallOpts) +} + +// GetMinTeleporterVersion is a free data retrieval call binding the contract method 0xd2cc7a70. +// +// Solidity: function getMinTeleporterVersion() view returns(uint256) +func (_BlockHashPublisher *BlockHashPublisherCallerSession) GetMinTeleporterVersion() (*big.Int, error) { + return _BlockHashPublisher.Contract.GetMinTeleporterVersion(&_BlockHashPublisher.CallOpts) +} + +// TeleporterRegistry is a free data retrieval call binding the contract method 0x1a7f5bec. +// +// Solidity: function teleporterRegistry() view returns(address) +func (_BlockHashPublisher *BlockHashPublisherCaller) TeleporterRegistry(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _BlockHashPublisher.contract.Call(opts, &out, "teleporterRegistry") if err != nil { return *new(common.Address), err @@ -228,18 +259,18 @@ func (_BlockHashPublisher *BlockHashPublisherCaller) TeleporterMessenger(opts *b } -// 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 (_BlockHashPublisher *BlockHashPublisherSession) TeleporterMessenger() (common.Address, error) { - return _BlockHashPublisher.Contract.TeleporterMessenger(&_BlockHashPublisher.CallOpts) +// Solidity: function teleporterRegistry() view returns(address) +func (_BlockHashPublisher *BlockHashPublisherSession) TeleporterRegistry() (common.Address, error) { + return _BlockHashPublisher.Contract.TeleporterRegistry(&_BlockHashPublisher.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 (_BlockHashPublisher *BlockHashPublisherCallerSession) TeleporterMessenger() (common.Address, error) { - return _BlockHashPublisher.Contract.TeleporterMessenger(&_BlockHashPublisher.CallOpts) +// Solidity: function teleporterRegistry() view returns(address) +func (_BlockHashPublisher *BlockHashPublisherCallerSession) TeleporterRegistry() (common.Address, error) { + return _BlockHashPublisher.Contract.TeleporterRegistry(&_BlockHashPublisher.CallOpts) } // PublishLatestBlockHash is a paid mutator transaction binding the contract method 0x82ab2b86. @@ -263,6 +294,27 @@ func (_BlockHashPublisher *BlockHashPublisherTransactorSession) PublishLatestBlo return _BlockHashPublisher.Contract.PublishLatestBlockHash(&_BlockHashPublisher.TransactOpts, destinationChainID, destinationAddress) } +// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. +// +// Solidity: function updateMinTeleporterVersion() returns() +func (_BlockHashPublisher *BlockHashPublisherTransactor) UpdateMinTeleporterVersion(opts *bind.TransactOpts) (*types.Transaction, error) { + return _BlockHashPublisher.contract.Transact(opts, "updateMinTeleporterVersion") +} + +// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. +// +// Solidity: function updateMinTeleporterVersion() returns() +func (_BlockHashPublisher *BlockHashPublisherSession) UpdateMinTeleporterVersion() (*types.Transaction, error) { + return _BlockHashPublisher.Contract.UpdateMinTeleporterVersion(&_BlockHashPublisher.TransactOpts) +} + +// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. +// +// Solidity: function updateMinTeleporterVersion() returns() +func (_BlockHashPublisher *BlockHashPublisherTransactorSession) UpdateMinTeleporterVersion() (*types.Transaction, error) { + return _BlockHashPublisher.Contract.UpdateMinTeleporterVersion(&_BlockHashPublisher.TransactOpts) +} + // BlockHashPublisherPublishBlockHashIterator is returned from FilterPublishBlockHash and is used to iterate over the raw logs and unpacked data for PublishBlockHash events raised by the BlockHashPublisher contract. type BlockHashPublisherPublishBlockHashIterator struct { Event *BlockHashPublisherPublishBlockHash // Event containing the contract specifics and raw log diff --git a/abi-bindings/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver/BlockHashReceiver.go b/abi-bindings/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver/BlockHashReceiver.go index 49167f7b3..f9edd98f2 100644 --- a/abi-bindings/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver/BlockHashReceiver.go +++ b/abi-bindings/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver/BlockHashReceiver.go @@ -31,7 +31,7 @@ var ( // BlockHashReceiverMetaData contains all meta data concerning the BlockHashReceiver contract. var BlockHashReceiverMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"publisherChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"publisherContractAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"InvalidSourceChainID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSourceChainPublisher\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Unauthorized\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"originSenderAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"blockHeight\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"}],\"name\":\"ReceiveBlockHash\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"getLatestBlockInfo\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"height\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"hash\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestBlockHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestBlockHeight\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"originSenderAddress\",\"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\":\"sourcePublisherContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterRegistryAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"publisherChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"publisherContractAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"InvalidSourceChainID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSourceChainPublisher\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTeleporterRegistryAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTeleporterSender\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"originSenderAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"blockHeight\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"}],\"name\":\"ReceiveBlockHash\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"getLatestBlockInfo\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"height\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"hash\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMinTeleporterVersion\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestBlockHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestBlockHeight\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"originSenderAddress\",\"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\":\"sourcePublisherContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterRegistry\",\"outputs\":[{\"internalType\":\"contractTeleporterRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"updateMinTeleporterVersion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // BlockHashReceiverABI is the input ABI used to generate the binding from. @@ -225,6 +225,37 @@ func (_BlockHashReceiver *BlockHashReceiverCallerSession) GetLatestBlockInfo() ( return _BlockHashReceiver.Contract.GetLatestBlockInfo(&_BlockHashReceiver.CallOpts) } +// GetMinTeleporterVersion is a free data retrieval call binding the contract method 0xd2cc7a70. +// +// Solidity: function getMinTeleporterVersion() view returns(uint256) +func (_BlockHashReceiver *BlockHashReceiverCaller) GetMinTeleporterVersion(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _BlockHashReceiver.contract.Call(opts, &out, "getMinTeleporterVersion") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetMinTeleporterVersion is a free data retrieval call binding the contract method 0xd2cc7a70. +// +// Solidity: function getMinTeleporterVersion() view returns(uint256) +func (_BlockHashReceiver *BlockHashReceiverSession) GetMinTeleporterVersion() (*big.Int, error) { + return _BlockHashReceiver.Contract.GetMinTeleporterVersion(&_BlockHashReceiver.CallOpts) +} + +// GetMinTeleporterVersion is a free data retrieval call binding the contract method 0xd2cc7a70. +// +// Solidity: function getMinTeleporterVersion() view returns(uint256) +func (_BlockHashReceiver *BlockHashReceiverCallerSession) GetMinTeleporterVersion() (*big.Int, error) { + return _BlockHashReceiver.Contract.GetMinTeleporterVersion(&_BlockHashReceiver.CallOpts) +} + // LatestBlockHash is a free data retrieval call binding the contract method 0x6c4f6ba9. // // Solidity: function latestBlockHash() view returns(bytes32) @@ -349,12 +380,12 @@ func (_BlockHashReceiver *BlockHashReceiverCallerSession) SourcePublisherContrac return _BlockHashReceiver.Contract.SourcePublisherContractAddress(&_BlockHashReceiver.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 (_BlockHashReceiver *BlockHashReceiverCaller) TeleporterMessenger(opts *bind.CallOpts) (common.Address, error) { +// Solidity: function teleporterRegistry() view returns(address) +func (_BlockHashReceiver *BlockHashReceiverCaller) TeleporterRegistry(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _BlockHashReceiver.contract.Call(opts, &out, "teleporterMessenger") + err := _BlockHashReceiver.contract.Call(opts, &out, "teleporterRegistry") if err != nil { return *new(common.Address), err @@ -366,18 +397,18 @@ func (_BlockHashReceiver *BlockHashReceiverCaller) TeleporterMessenger(opts *bin } -// 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 (_BlockHashReceiver *BlockHashReceiverSession) TeleporterMessenger() (common.Address, error) { - return _BlockHashReceiver.Contract.TeleporterMessenger(&_BlockHashReceiver.CallOpts) +// Solidity: function teleporterRegistry() view returns(address) +func (_BlockHashReceiver *BlockHashReceiverSession) TeleporterRegistry() (common.Address, error) { + return _BlockHashReceiver.Contract.TeleporterRegistry(&_BlockHashReceiver.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 (_BlockHashReceiver *BlockHashReceiverCallerSession) TeleporterMessenger() (common.Address, error) { - return _BlockHashReceiver.Contract.TeleporterMessenger(&_BlockHashReceiver.CallOpts) +// Solidity: function teleporterRegistry() view returns(address) +func (_BlockHashReceiver *BlockHashReceiverCallerSession) TeleporterRegistry() (common.Address, error) { + return _BlockHashReceiver.Contract.TeleporterRegistry(&_BlockHashReceiver.CallOpts) } // ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. @@ -401,6 +432,27 @@ func (_BlockHashReceiver *BlockHashReceiverTransactorSession) ReceiveTeleporterM return _BlockHashReceiver.Contract.ReceiveTeleporterMessage(&_BlockHashReceiver.TransactOpts, originChainID, originSenderAddress, message) } +// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. +// +// Solidity: function updateMinTeleporterVersion() returns() +func (_BlockHashReceiver *BlockHashReceiverTransactor) UpdateMinTeleporterVersion(opts *bind.TransactOpts) (*types.Transaction, error) { + return _BlockHashReceiver.contract.Transact(opts, "updateMinTeleporterVersion") +} + +// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. +// +// Solidity: function updateMinTeleporterVersion() returns() +func (_BlockHashReceiver *BlockHashReceiverSession) UpdateMinTeleporterVersion() (*types.Transaction, error) { + return _BlockHashReceiver.Contract.UpdateMinTeleporterVersion(&_BlockHashReceiver.TransactOpts) +} + +// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. +// +// Solidity: function updateMinTeleporterVersion() returns() +func (_BlockHashReceiver *BlockHashReceiverTransactorSession) UpdateMinTeleporterVersion() (*types.Transaction, error) { + return _BlockHashReceiver.Contract.UpdateMinTeleporterVersion(&_BlockHashReceiver.TransactOpts) +} + // BlockHashReceiverReceiveBlockHashIterator is returned from FilterReceiveBlockHash and is used to iterate over the raw logs and unpacked data for ReceiveBlockHash events raised by the BlockHashReceiver contract. type BlockHashReceiverReceiveBlockHashIterator struct { Event *BlockHashReceiverReceiveBlockHash // Event containing the contract specifics and raw log diff --git a/contracts/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol b/contracts/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol index 57f3598c9..451d39515 100644 --- a/contracts/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol +++ b/contracts/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol @@ -49,9 +49,6 @@ contract ExampleCrossChainMessenger is ITeleporterReceiver, ReentrancyGuard { string message ); - // Errors - error Unauthorized(); - constructor(address teleporterMessengerAddress) { teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); } @@ -67,9 +64,7 @@ contract ExampleCrossChainMessenger is ITeleporterReceiver, ReentrancyGuard { bytes calldata message ) external { // Only the Teleporter receiver can deliver a message. - if (msg.sender != address(teleporterMessenger)) { - revert Unauthorized(); - } + require(msg.sender == address(teleporterMessenger), "ExampleCrossChainMessenger: unauthorized"); // Store the message. string memory messageString = abi.decode(message, (string)); diff --git a/contracts/src/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver.sol b/contracts/src/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver.sol index 5b8afb0ca..a5f0bf1fa 100644 --- a/contracts/src/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver.sol +++ b/contracts/src/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver.sol @@ -32,11 +32,6 @@ contract BlockHashReceiver is ITeleporterReceiver { bytes32 blockHash ); - // Errors - error Unauthorized(); - error InvalidSourceChainID(); - error InvalidSourceChainPublisher(); - constructor( address teleporterMessengerAddress, bytes32 publisherChainID, @@ -63,17 +58,18 @@ contract BlockHashReceiver is ITeleporterReceiver { address originSenderAddress, bytes calldata message ) external { - if (msg.sender != address(teleporterMessenger)) { - revert Unauthorized(); - } - - if (originChainID != sourceChainID) { - revert InvalidSourceChainID(); - } - - if (originSenderAddress != sourcePublisherContractAddress) { - revert InvalidSourceChainPublisher(); - } + require( + msg.sender == address(teleporterMessenger), + "BlockHashReceiver: unauthorized" + ); + require( + originChainID == sourceChainID, + "BlockHashReceiver: invalid source chain ID" + ); + require( + originSenderAddress == sourcePublisherContractAddress, + "BlockHashReceiver: invalid source chain publisher" + ); (uint256 blockHeight, bytes32 blockHash) = abi.decode( message, From a47b9e604be6a2e0f8b4799f78af7249e8f660c2 Mon Sep 17 00:00:00 2001 From: Matthew Lam Date: Mon, 16 Oct 2023 21:21:59 +0000 Subject: [PATCH 06/20] cleanup error messages for require --- .../src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol | 2 +- contracts/src/Teleporter/TeleporterMessenger.sol | 2 +- .../src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol b/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol index 4d26b8a75..197494d23 100644 --- a/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol +++ b/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol @@ -261,7 +261,7 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { // Only allow the Teleporter messenger to deliver messages. require( msg.sender == address(teleporterMessenger), - "ERC20Bridge: unauthoried sender" + "ERC20Bridge: unauthorized" ); // Decode the payload to recover the action and corresponding function parameters diff --git a/contracts/src/Teleporter/TeleporterMessenger.sol b/contracts/src/Teleporter/TeleporterMessenger.sol index 30b92c25d..16e1a2568 100644 --- a/contracts/src/Teleporter/TeleporterMessenger.sol +++ b/contracts/src/Teleporter/TeleporterMessenger.sol @@ -133,7 +133,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { // If the message hash is zero, the message was never sent. require( messageHash != bytes32(0), - "TeleporterMessenger: message hash not found" + "TeleporterMessenger: message not found" ); // Check that the hash of the provided message matches the one that was originally submitted. diff --git a/contracts/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol b/contracts/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol index 37ffaee14..d23a81fcb 100644 --- a/contracts/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol +++ b/contracts/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol @@ -48,7 +48,7 @@ contract RetrySendCrossChainMessageTest is TeleporterMessengerTest { receipts: new TeleporterMessageReceipt[](0), message: new bytes(0) }); - vm.expectRevert(_formatErrorMessage("message hash not found")); + vm.expectRevert(_formatErrorMessage("message not found")); teleporterMessenger.retrySendCrossChainMessage( DEFAULT_DESTINATION_CHAIN_ID, fakeMessage From 3e5d6c166510ff23e50d7515abf84e60bbfdd3f7 Mon Sep 17 00:00:00 2001 From: Matthew Lam Date: Mon, 16 Oct 2023 21:47:08 +0000 Subject: [PATCH 07/20] update abi bindings --- .../ERC20Bridge/BridgeToken/BridgeToken.go | 2 +- .../ERC20Bridge/ERC20Bridge/ERC20Bridge.go | 78 ++++--------------- .../ExampleCrossChainMessenger.go | 78 ++++--------------- .../BlockHashPublisher/BlockHashPublisher.go | 78 ++++--------------- .../BlockHashReceiver/BlockHashReceiver.go | 78 ++++--------------- .../TeleporterMessenger.go | 2 +- 6 files changed, 54 insertions(+), 262 deletions(-) diff --git a/abi-bindings/CrossChainApplications/ERC20Bridge/BridgeToken/BridgeToken.go b/abi-bindings/CrossChainApplications/ERC20Bridge/BridgeToken/BridgeToken.go index e1b93afaa..f99df56d1 100644 --- a/abi-bindings/CrossChainApplications/ERC20Bridge/BridgeToken/BridgeToken.go +++ b/abi-bindings/CrossChainApplications/ERC20Bridge/BridgeToken/BridgeToken.go @@ -31,7 +31,7 @@ var ( // BridgeTokenMetaData contains all meta data concerning the BridgeToken contract. var BridgeTokenMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"sourceChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"sourceBridge\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"sourceAsset\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"tokenName\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"tokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"tokenDecimals\",\"type\":\"uint8\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"InvalidSourceAsset\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSourceBridgeAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSourceChainID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Unauthorized\",\"type\":\"error\"},{\"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\":[],\"name\":\"bridgeContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"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\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"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\":\"nativeAsset\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeBridge\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeChainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"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\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"sourceChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"sourceBridge\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"sourceAsset\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"tokenName\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"tokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"tokenDecimals\",\"type\":\"uint8\"}],\"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\":[],\"name\":\"bridgeContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"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\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"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\":\"nativeAsset\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeBridge\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeChainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"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\"}]", } // BridgeTokenABI is the input ABI used to generate the binding from. diff --git a/abi-bindings/CrossChainApplications/ERC20Bridge/ERC20Bridge/ERC20Bridge.go b/abi-bindings/CrossChainApplications/ERC20Bridge/ERC20Bridge/ERC20Bridge.go index 3b152253e..ffb66f87c 100644 --- a/abi-bindings/CrossChainApplications/ERC20Bridge/ERC20Bridge/ERC20Bridge.go +++ b/abi-bindings/CrossChainApplications/ERC20Bridge/ERC20Bridge/ERC20Bridge.go @@ -31,7 +31,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\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"bridgeTokenAddress\",\"type\":\"address\"}],\"name\":\"BridgeTokenAlreadyExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CannotBridgeTokenWithinSameChain\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nativeTokenAddress\",\"type\":\"address\"}],\"name\":\"CannotBridgeWrappedToken\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"adjustedAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"InsufficientAdjustedAmount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"InsufficientTotalAmount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"currentBalance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestAmount\",\"type\":\"uint256\"}],\"name\":\"InsufficientWrappedTokenBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAction\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidBridgeTokenAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidDestinationBridgeAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidRecipientAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTeleporterRegistryAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTeleporterSender\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"tokenContractAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"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\":\"nativeChainID\",\"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\":\"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\":\"bytes32\",\"name\":\"destinationChainID\",\"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\":\"destinationChainID\",\"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\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"bridgedBalances\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentChainID\",\"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\":\"destinationChainID\",\"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\":\"getMinTeleporterVersion\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"nativeToWrappedTokens\",\"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\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"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\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"submittedBridgeTokenCreations\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterRegistry\",\"outputs\":[{\"internalType\":\"contractTeleporterRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"updateMinTeleporterVersion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"wrappedTokenContracts\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"tokenContractAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"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\":\"nativeChainID\",\"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\":\"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\":\"bytes32\",\"name\":\"destinationChainID\",\"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\":\"destinationChainID\",\"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\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"bridgedBalances\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentChainID\",\"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\":\"destinationChainID\",\"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\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"nativeToWrappedTokens\",\"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\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"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\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"submittedBridgeTokenCreations\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"wrappedTokenContracts\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", } // ERC20BridgeABI is the input ABI used to generate the binding from. @@ -459,37 +459,6 @@ func (_ERC20Bridge *ERC20BridgeCallerSession) EncodeTransferBridgeTokensData(des return _ERC20Bridge.Contract.EncodeTransferBridgeTokensData(&_ERC20Bridge.CallOpts, destinationChainID, destinationBridgeAddress, nativeContractAddress, recipient, amount, feeAmount) } -// GetMinTeleporterVersion is a free data retrieval call binding the contract method 0xd2cc7a70. -// -// Solidity: function getMinTeleporterVersion() view returns(uint256) -func (_ERC20Bridge *ERC20BridgeCaller) GetMinTeleporterVersion(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _ERC20Bridge.contract.Call(opts, &out, "getMinTeleporterVersion") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetMinTeleporterVersion is a free data retrieval call binding the contract method 0xd2cc7a70. -// -// Solidity: function getMinTeleporterVersion() view returns(uint256) -func (_ERC20Bridge *ERC20BridgeSession) GetMinTeleporterVersion() (*big.Int, error) { - return _ERC20Bridge.Contract.GetMinTeleporterVersion(&_ERC20Bridge.CallOpts) -} - -// GetMinTeleporterVersion is a free data retrieval call binding the contract method 0xd2cc7a70. -// -// Solidity: function getMinTeleporterVersion() view returns(uint256) -func (_ERC20Bridge *ERC20BridgeCallerSession) GetMinTeleporterVersion() (*big.Int, error) { - return _ERC20Bridge.Contract.GetMinTeleporterVersion(&_ERC20Bridge.CallOpts) -} - // NativeToWrappedTokens is a free data retrieval call binding the contract method 0x65435568. // // Solidity: function nativeToWrappedTokens(bytes32 , address , address ) view returns(address) @@ -552,12 +521,12 @@ func (_ERC20Bridge *ERC20BridgeCallerSession) SubmittedBridgeTokenCreations(arg0 return _ERC20Bridge.Contract.SubmittedBridgeTokenCreations(&_ERC20Bridge.CallOpts, arg0, arg1, arg2) } -// 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 (_ERC20Bridge *ERC20BridgeCaller) TeleporterRegistry(opts *bind.CallOpts) (common.Address, error) { +// Solidity: function teleporterMessenger() view returns(address) +func (_ERC20Bridge *ERC20BridgeCaller) TeleporterMessenger(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _ERC20Bridge.contract.Call(opts, &out, "teleporterRegistry") + err := _ERC20Bridge.contract.Call(opts, &out, "teleporterMessenger") if err != nil { return *new(common.Address), err @@ -569,18 +538,18 @@ func (_ERC20Bridge *ERC20BridgeCaller) TeleporterRegistry(opts *bind.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 (_ERC20Bridge *ERC20BridgeSession) TeleporterRegistry() (common.Address, error) { - return _ERC20Bridge.Contract.TeleporterRegistry(&_ERC20Bridge.CallOpts) +// Solidity: function teleporterMessenger() view returns(address) +func (_ERC20Bridge *ERC20BridgeSession) TeleporterMessenger() (common.Address, error) { + return _ERC20Bridge.Contract.TeleporterMessenger(&_ERC20Bridge.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 (_ERC20Bridge *ERC20BridgeCallerSession) TeleporterRegistry() (common.Address, error) { - return _ERC20Bridge.Contract.TeleporterRegistry(&_ERC20Bridge.CallOpts) +// Solidity: function teleporterMessenger() view returns(address) +func (_ERC20Bridge *ERC20BridgeCallerSession) TeleporterMessenger() (common.Address, error) { + return _ERC20Bridge.Contract.TeleporterMessenger(&_ERC20Bridge.CallOpts) } // WrappedTokenContracts is a free data retrieval call binding the contract method 0x9bd9abc0. @@ -677,27 +646,6 @@ func (_ERC20Bridge *ERC20BridgeTransactorSession) SubmitCreateBridgeToken(destin return _ERC20Bridge.Contract.SubmitCreateBridgeToken(&_ERC20Bridge.TransactOpts, destinationChainID, destinationBridgeAddress, nativeToken, messageFeeAsset, messageFeeAmount) } -// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. -// -// Solidity: function updateMinTeleporterVersion() returns() -func (_ERC20Bridge *ERC20BridgeTransactor) UpdateMinTeleporterVersion(opts *bind.TransactOpts) (*types.Transaction, error) { - return _ERC20Bridge.contract.Transact(opts, "updateMinTeleporterVersion") -} - -// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. -// -// Solidity: function updateMinTeleporterVersion() returns() -func (_ERC20Bridge *ERC20BridgeSession) UpdateMinTeleporterVersion() (*types.Transaction, error) { - return _ERC20Bridge.Contract.UpdateMinTeleporterVersion(&_ERC20Bridge.TransactOpts) -} - -// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. -// -// Solidity: function updateMinTeleporterVersion() returns() -func (_ERC20Bridge *ERC20BridgeTransactorSession) UpdateMinTeleporterVersion() (*types.Transaction, error) { - return _ERC20Bridge.Contract.UpdateMinTeleporterVersion(&_ERC20Bridge.TransactOpts) -} - // ERC20BridgeBridgeTokensIterator is returned from FilterBridgeTokens and is used to iterate over the raw logs and unpacked data for BridgeTokens events raised by the ERC20Bridge contract. type ERC20BridgeBridgeTokensIterator struct { Event *ERC20BridgeBridgeTokens // Event containing the contract specifics and raw log diff --git a/abi-bindings/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger/ExampleCrossChainMessenger.go b/abi-bindings/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger/ExampleCrossChainMessenger.go index b65507bb4..86906f172 100644 --- a/abi-bindings/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger/ExampleCrossChainMessenger.go +++ b/abi-bindings/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger/ExampleCrossChainMessenger.go @@ -31,7 +31,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\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTeleporterRegistryAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTeleporterSender\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"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\":\"destinationChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"feeAsset\",\"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\":\"originChainID\",\"type\":\"bytes32\"}],\"name\":\"getCurrentMessage\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMinTeleporterVersion\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"originSenderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"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\":\"messageID\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterRegistry\",\"outputs\":[{\"internalType\":\"contractTeleporterRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"updateMinTeleporterVersion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"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\":\"destinationChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"feeAsset\",\"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\":\"originChainID\",\"type\":\"bytes32\"}],\"name\":\"getCurrentMessage\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"originSenderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"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\":\"messageID\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", } // ExampleCrossChainMessengerABI is the input ABI used to generate the binding from. @@ -225,43 +225,12 @@ func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerCallerSession) GetC return _ExampleCrossChainMessenger.Contract.GetCurrentMessage(&_ExampleCrossChainMessenger.CallOpts, originChainID) } -// GetMinTeleporterVersion is a free data retrieval call binding the contract method 0xd2cc7a70. +// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. // -// Solidity: function getMinTeleporterVersion() view returns(uint256) -func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerCaller) GetMinTeleporterVersion(opts *bind.CallOpts) (*big.Int, error) { +// Solidity: function teleporterMessenger() view returns(address) +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerCaller) TeleporterMessenger(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _ExampleCrossChainMessenger.contract.Call(opts, &out, "getMinTeleporterVersion") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetMinTeleporterVersion is a free data retrieval call binding the contract method 0xd2cc7a70. -// -// Solidity: function getMinTeleporterVersion() view returns(uint256) -func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerSession) GetMinTeleporterVersion() (*big.Int, error) { - return _ExampleCrossChainMessenger.Contract.GetMinTeleporterVersion(&_ExampleCrossChainMessenger.CallOpts) -} - -// GetMinTeleporterVersion is a free data retrieval call binding the contract method 0xd2cc7a70. -// -// Solidity: function getMinTeleporterVersion() view returns(uint256) -func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerCallerSession) GetMinTeleporterVersion() (*big.Int, error) { - return _ExampleCrossChainMessenger.Contract.GetMinTeleporterVersion(&_ExampleCrossChainMessenger.CallOpts) -} - -// TeleporterRegistry is a free data retrieval call binding the contract method 0x1a7f5bec. -// -// Solidity: function teleporterRegistry() view returns(address) -func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerCaller) TeleporterRegistry(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _ExampleCrossChainMessenger.contract.Call(opts, &out, "teleporterRegistry") + err := _ExampleCrossChainMessenger.contract.Call(opts, &out, "teleporterMessenger") if err != nil { return *new(common.Address), err @@ -273,18 +242,18 @@ func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerCaller) TeleporterR } -// 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 (_ExampleCrossChainMessenger *ExampleCrossChainMessengerSession) TeleporterRegistry() (common.Address, error) { - return _ExampleCrossChainMessenger.Contract.TeleporterRegistry(&_ExampleCrossChainMessenger.CallOpts) +// Solidity: function teleporterMessenger() view returns(address) +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerSession) TeleporterMessenger() (common.Address, error) { + return _ExampleCrossChainMessenger.Contract.TeleporterMessenger(&_ExampleCrossChainMessenger.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 (_ExampleCrossChainMessenger *ExampleCrossChainMessengerCallerSession) TeleporterRegistry() (common.Address, error) { - return _ExampleCrossChainMessenger.Contract.TeleporterRegistry(&_ExampleCrossChainMessenger.CallOpts) +// Solidity: function teleporterMessenger() view returns(address) +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerCallerSession) TeleporterMessenger() (common.Address, error) { + return _ExampleCrossChainMessenger.Contract.TeleporterMessenger(&_ExampleCrossChainMessenger.CallOpts) } // ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. @@ -329,27 +298,6 @@ func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerTransactorSession) return _ExampleCrossChainMessenger.Contract.SendMessage(&_ExampleCrossChainMessenger.TransactOpts, destinationChainID, destinationAddress, feeContractAddress, feeAmount, requiredGasLimit, message) } -// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. -// -// Solidity: function updateMinTeleporterVersion() returns() -func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerTransactor) UpdateMinTeleporterVersion(opts *bind.TransactOpts) (*types.Transaction, error) { - return _ExampleCrossChainMessenger.contract.Transact(opts, "updateMinTeleporterVersion") -} - -// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. -// -// Solidity: function updateMinTeleporterVersion() returns() -func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerSession) UpdateMinTeleporterVersion() (*types.Transaction, error) { - return _ExampleCrossChainMessenger.Contract.UpdateMinTeleporterVersion(&_ExampleCrossChainMessenger.TransactOpts) -} - -// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. -// -// Solidity: function updateMinTeleporterVersion() returns() -func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerTransactorSession) UpdateMinTeleporterVersion() (*types.Transaction, error) { - return _ExampleCrossChainMessenger.Contract.UpdateMinTeleporterVersion(&_ExampleCrossChainMessenger.TransactOpts) -} - // ExampleCrossChainMessengerReceiveMessageIterator is returned from FilterReceiveMessage and is used to iterate over the raw logs and unpacked data for ReceiveMessage events raised by the ExampleCrossChainMessenger contract. type ExampleCrossChainMessengerReceiveMessageIterator struct { Event *ExampleCrossChainMessengerReceiveMessage // Event containing the contract specifics and raw log diff --git a/abi-bindings/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher/BlockHashPublisher.go b/abi-bindings/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher/BlockHashPublisher.go index d858584f3..cc8b99e61 100644 --- a/abi-bindings/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher/BlockHashPublisher.go +++ b/abi-bindings/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher/BlockHashPublisher.go @@ -31,7 +31,7 @@ var ( // BlockHashPublisherMetaData contains all meta data concerning the BlockHashPublisher contract. var BlockHashPublisherMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterRegistryAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"InvalidTeleporterRegistryAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTeleporterSender\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"blockHeight\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"}],\"name\":\"PublishBlockHash\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"RECEIVE_BLOCK_HASH_REQUIRED_GAS_LIMIT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMinTeleporterVersion\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"}],\"name\":\"publishLatestBlockHash\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterRegistry\",\"outputs\":[{\"internalType\":\"contractTeleporterRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"updateMinTeleporterVersion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"blockHeight\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"}],\"name\":\"PublishBlockHash\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"RECEIVE_BLOCK_HASH_REQUIRED_GAS_LIMIT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"}],\"name\":\"publishLatestBlockHash\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", } // BlockHashPublisherABI is the input ABI used to generate the binding from. @@ -211,43 +211,12 @@ func (_BlockHashPublisher *BlockHashPublisherCallerSession) RECEIVEBLOCKHASHREQU return _BlockHashPublisher.Contract.RECEIVEBLOCKHASHREQUIREDGASLIMIT(&_BlockHashPublisher.CallOpts) } -// GetMinTeleporterVersion is a free data retrieval call binding the contract method 0xd2cc7a70. +// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. // -// Solidity: function getMinTeleporterVersion() view returns(uint256) -func (_BlockHashPublisher *BlockHashPublisherCaller) GetMinTeleporterVersion(opts *bind.CallOpts) (*big.Int, error) { +// Solidity: function teleporterMessenger() view returns(address) +func (_BlockHashPublisher *BlockHashPublisherCaller) TeleporterMessenger(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _BlockHashPublisher.contract.Call(opts, &out, "getMinTeleporterVersion") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetMinTeleporterVersion is a free data retrieval call binding the contract method 0xd2cc7a70. -// -// Solidity: function getMinTeleporterVersion() view returns(uint256) -func (_BlockHashPublisher *BlockHashPublisherSession) GetMinTeleporterVersion() (*big.Int, error) { - return _BlockHashPublisher.Contract.GetMinTeleporterVersion(&_BlockHashPublisher.CallOpts) -} - -// GetMinTeleporterVersion is a free data retrieval call binding the contract method 0xd2cc7a70. -// -// Solidity: function getMinTeleporterVersion() view returns(uint256) -func (_BlockHashPublisher *BlockHashPublisherCallerSession) GetMinTeleporterVersion() (*big.Int, error) { - return _BlockHashPublisher.Contract.GetMinTeleporterVersion(&_BlockHashPublisher.CallOpts) -} - -// TeleporterRegistry is a free data retrieval call binding the contract method 0x1a7f5bec. -// -// Solidity: function teleporterRegistry() view returns(address) -func (_BlockHashPublisher *BlockHashPublisherCaller) TeleporterRegistry(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _BlockHashPublisher.contract.Call(opts, &out, "teleporterRegistry") + err := _BlockHashPublisher.contract.Call(opts, &out, "teleporterMessenger") if err != nil { return *new(common.Address), err @@ -259,18 +228,18 @@ func (_BlockHashPublisher *BlockHashPublisherCaller) TeleporterRegistry(opts *bi } -// 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 (_BlockHashPublisher *BlockHashPublisherSession) TeleporterRegistry() (common.Address, error) { - return _BlockHashPublisher.Contract.TeleporterRegistry(&_BlockHashPublisher.CallOpts) +// Solidity: function teleporterMessenger() view returns(address) +func (_BlockHashPublisher *BlockHashPublisherSession) TeleporterMessenger() (common.Address, error) { + return _BlockHashPublisher.Contract.TeleporterMessenger(&_BlockHashPublisher.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 (_BlockHashPublisher *BlockHashPublisherCallerSession) TeleporterRegistry() (common.Address, error) { - return _BlockHashPublisher.Contract.TeleporterRegistry(&_BlockHashPublisher.CallOpts) +// Solidity: function teleporterMessenger() view returns(address) +func (_BlockHashPublisher *BlockHashPublisherCallerSession) TeleporterMessenger() (common.Address, error) { + return _BlockHashPublisher.Contract.TeleporterMessenger(&_BlockHashPublisher.CallOpts) } // PublishLatestBlockHash is a paid mutator transaction binding the contract method 0x82ab2b86. @@ -294,27 +263,6 @@ func (_BlockHashPublisher *BlockHashPublisherTransactorSession) PublishLatestBlo return _BlockHashPublisher.Contract.PublishLatestBlockHash(&_BlockHashPublisher.TransactOpts, destinationChainID, destinationAddress) } -// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. -// -// Solidity: function updateMinTeleporterVersion() returns() -func (_BlockHashPublisher *BlockHashPublisherTransactor) UpdateMinTeleporterVersion(opts *bind.TransactOpts) (*types.Transaction, error) { - return _BlockHashPublisher.contract.Transact(opts, "updateMinTeleporterVersion") -} - -// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. -// -// Solidity: function updateMinTeleporterVersion() returns() -func (_BlockHashPublisher *BlockHashPublisherSession) UpdateMinTeleporterVersion() (*types.Transaction, error) { - return _BlockHashPublisher.Contract.UpdateMinTeleporterVersion(&_BlockHashPublisher.TransactOpts) -} - -// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. -// -// Solidity: function updateMinTeleporterVersion() returns() -func (_BlockHashPublisher *BlockHashPublisherTransactorSession) UpdateMinTeleporterVersion() (*types.Transaction, error) { - return _BlockHashPublisher.Contract.UpdateMinTeleporterVersion(&_BlockHashPublisher.TransactOpts) -} - // BlockHashPublisherPublishBlockHashIterator is returned from FilterPublishBlockHash and is used to iterate over the raw logs and unpacked data for PublishBlockHash events raised by the BlockHashPublisher contract. type BlockHashPublisherPublishBlockHashIterator struct { Event *BlockHashPublisherPublishBlockHash // Event containing the contract specifics and raw log diff --git a/abi-bindings/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver/BlockHashReceiver.go b/abi-bindings/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver/BlockHashReceiver.go index f9edd98f2..2fc54b476 100644 --- a/abi-bindings/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver/BlockHashReceiver.go +++ b/abi-bindings/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver/BlockHashReceiver.go @@ -31,7 +31,7 @@ var ( // BlockHashReceiverMetaData contains all meta data concerning the BlockHashReceiver contract. var BlockHashReceiverMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterRegistryAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"publisherChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"publisherContractAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"InvalidSourceChainID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSourceChainPublisher\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTeleporterRegistryAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTeleporterSender\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"originSenderAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"blockHeight\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"}],\"name\":\"ReceiveBlockHash\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"getLatestBlockInfo\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"height\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"hash\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMinTeleporterVersion\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestBlockHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestBlockHeight\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"originSenderAddress\",\"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\":\"sourcePublisherContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterRegistry\",\"outputs\":[{\"internalType\":\"contractTeleporterRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"updateMinTeleporterVersion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"publisherChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"publisherContractAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"originSenderAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"blockHeight\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"}],\"name\":\"ReceiveBlockHash\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"getLatestBlockInfo\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"height\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"hash\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestBlockHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestBlockHeight\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"originSenderAddress\",\"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\":\"sourcePublisherContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", } // BlockHashReceiverABI is the input ABI used to generate the binding from. @@ -225,37 +225,6 @@ func (_BlockHashReceiver *BlockHashReceiverCallerSession) GetLatestBlockInfo() ( return _BlockHashReceiver.Contract.GetLatestBlockInfo(&_BlockHashReceiver.CallOpts) } -// GetMinTeleporterVersion is a free data retrieval call binding the contract method 0xd2cc7a70. -// -// Solidity: function getMinTeleporterVersion() view returns(uint256) -func (_BlockHashReceiver *BlockHashReceiverCaller) GetMinTeleporterVersion(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _BlockHashReceiver.contract.Call(opts, &out, "getMinTeleporterVersion") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetMinTeleporterVersion is a free data retrieval call binding the contract method 0xd2cc7a70. -// -// Solidity: function getMinTeleporterVersion() view returns(uint256) -func (_BlockHashReceiver *BlockHashReceiverSession) GetMinTeleporterVersion() (*big.Int, error) { - return _BlockHashReceiver.Contract.GetMinTeleporterVersion(&_BlockHashReceiver.CallOpts) -} - -// GetMinTeleporterVersion is a free data retrieval call binding the contract method 0xd2cc7a70. -// -// Solidity: function getMinTeleporterVersion() view returns(uint256) -func (_BlockHashReceiver *BlockHashReceiverCallerSession) GetMinTeleporterVersion() (*big.Int, error) { - return _BlockHashReceiver.Contract.GetMinTeleporterVersion(&_BlockHashReceiver.CallOpts) -} - // LatestBlockHash is a free data retrieval call binding the contract method 0x6c4f6ba9. // // Solidity: function latestBlockHash() view returns(bytes32) @@ -380,12 +349,12 @@ func (_BlockHashReceiver *BlockHashReceiverCallerSession) SourcePublisherContrac return _BlockHashReceiver.Contract.SourcePublisherContractAddress(&_BlockHashReceiver.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 (_BlockHashReceiver *BlockHashReceiverCaller) TeleporterRegistry(opts *bind.CallOpts) (common.Address, error) { +// Solidity: function teleporterMessenger() view returns(address) +func (_BlockHashReceiver *BlockHashReceiverCaller) TeleporterMessenger(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _BlockHashReceiver.contract.Call(opts, &out, "teleporterRegistry") + err := _BlockHashReceiver.contract.Call(opts, &out, "teleporterMessenger") if err != nil { return *new(common.Address), err @@ -397,18 +366,18 @@ func (_BlockHashReceiver *BlockHashReceiverCaller) TeleporterRegistry(opts *bind } -// 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 (_BlockHashReceiver *BlockHashReceiverSession) TeleporterRegistry() (common.Address, error) { - return _BlockHashReceiver.Contract.TeleporterRegistry(&_BlockHashReceiver.CallOpts) +// Solidity: function teleporterMessenger() view returns(address) +func (_BlockHashReceiver *BlockHashReceiverSession) TeleporterMessenger() (common.Address, error) { + return _BlockHashReceiver.Contract.TeleporterMessenger(&_BlockHashReceiver.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 (_BlockHashReceiver *BlockHashReceiverCallerSession) TeleporterRegistry() (common.Address, error) { - return _BlockHashReceiver.Contract.TeleporterRegistry(&_BlockHashReceiver.CallOpts) +// Solidity: function teleporterMessenger() view returns(address) +func (_BlockHashReceiver *BlockHashReceiverCallerSession) TeleporterMessenger() (common.Address, error) { + return _BlockHashReceiver.Contract.TeleporterMessenger(&_BlockHashReceiver.CallOpts) } // ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. @@ -432,27 +401,6 @@ func (_BlockHashReceiver *BlockHashReceiverTransactorSession) ReceiveTeleporterM return _BlockHashReceiver.Contract.ReceiveTeleporterMessage(&_BlockHashReceiver.TransactOpts, originChainID, originSenderAddress, message) } -// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. -// -// Solidity: function updateMinTeleporterVersion() returns() -func (_BlockHashReceiver *BlockHashReceiverTransactor) UpdateMinTeleporterVersion(opts *bind.TransactOpts) (*types.Transaction, error) { - return _BlockHashReceiver.contract.Transact(opts, "updateMinTeleporterVersion") -} - -// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. -// -// Solidity: function updateMinTeleporterVersion() returns() -func (_BlockHashReceiver *BlockHashReceiverSession) UpdateMinTeleporterVersion() (*types.Transaction, error) { - return _BlockHashReceiver.Contract.UpdateMinTeleporterVersion(&_BlockHashReceiver.TransactOpts) -} - -// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. -// -// Solidity: function updateMinTeleporterVersion() returns() -func (_BlockHashReceiver *BlockHashReceiverTransactorSession) UpdateMinTeleporterVersion() (*types.Transaction, error) { - return _BlockHashReceiver.Contract.UpdateMinTeleporterVersion(&_BlockHashReceiver.TransactOpts) -} - // BlockHashReceiverReceiveBlockHashIterator is returned from FilterReceiveBlockHash and is used to iterate over the raw logs and unpacked data for ReceiveBlockHash events raised by the BlockHashReceiver contract. type BlockHashReceiverReceiveBlockHashIterator struct { Event *BlockHashReceiverReceiveBlockHash // Event containing the contract specifics and raw log diff --git a/abi-bindings/Teleporter/TeleporterMessenger/TeleporterMessenger.go b/abi-bindings/Teleporter/TeleporterMessenger/TeleporterMessenger.go index b88b5bcde..79acbe031 100644 --- a/abi-bindings/Teleporter/TeleporterMessenger/TeleporterMessenger.go +++ b/abi-bindings/Teleporter/TeleporterMessenger/TeleporterMessenger.go @@ -64,7 +64,7 @@ type TeleporterMessageReceipt struct { // TeleporterMessengerMetaData contains all meta data concerning the TeleporterMessenger contract. var TeleporterMessengerMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"EmptyQueue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientGas\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAdditionalFeeAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidDestinationAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidDestinationChainID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidFeeAssetContractAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidMessageHash\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidOriginSenderAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidRelayerRewardAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidWarpMessage\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MessageAlreadyDelivered\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MessageNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MessageRetryExecutionFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoRelayerRewardToRedeem\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OutofIndex\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ReceiptNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ReceiverReentrancy\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SenderReentrancy\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnauthorizedRelayer\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"updatedFeeInfo\",\"type\":\"tuple\"}],\"name\":\"AddFeeAmount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"indexed\":false,\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"FailedMessageExecution\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"MessageExecutionRetried\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"indexed\":false,\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"ReceiveCrossChainMessage\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"indexed\":false,\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"SendCrossChainMessage\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MINIMUM_REQUIRED_CALL_DATA_LENGTH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REQUIRED_ORIGIN_CHAIN_ID_START_INDEX\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WARP_MESSENGER\",\"outputs\":[{\"internalType\":\"contractWarpMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"additionalFeeAmount\",\"type\":\"uint256\"}],\"name\":\"addFeeAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"blockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"delivererAddress\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayers\",\"type\":\"address[]\"}],\"name\":\"checkIsAllowedRelayer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeAsset\",\"type\":\"address\"}],\"name\":\"checkRelayerRewardAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"getFeeInfo\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"feeAsset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"getMessageHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"messageHash\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"chainID\",\"type\":\"bytes32\"}],\"name\":\"getNextMessageID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"chainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getReceiptAtIndex\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"chainID\",\"type\":\"bytes32\"}],\"name\":\"getReceiptQueueSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"getRelayerRewardAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"latestMessageIDs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"messageReceived\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"delivered\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"outstandingReceipts\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"first\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"last\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"name\":\"receiveCrossChainMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"receivedFailedMessageHashes\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"feeAsset\",\"type\":\"address\"}],\"name\":\"redeemRelayerRewards\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"relayerRewardAddresses\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"relayerRewardAmounts\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"retryMessageExecution\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256[]\",\"name\":\"messageIDs\",\"type\":\"uint256[]\"},{\"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\":\"retryReceipts\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"retrySendCrossChainMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"internalType\":\"structTeleporterMessageInput\",\"name\":\"messageInput\",\"type\":\"tuple\"}],\"name\":\"sendCrossChainMessage\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"sentMessageInfo\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"messageHash\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"EmptyQueue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OutofIndex\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ReceiverReentrancy\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SenderReentrancy\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"updatedFeeInfo\",\"type\":\"tuple\"}],\"name\":\"AddFeeAmount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"indexed\":false,\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"FailedMessageExecution\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"MessageExecutionRetried\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"indexed\":false,\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"ReceiveCrossChainMessage\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"indexed\":false,\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"SendCrossChainMessage\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MINIMUM_REQUIRED_CALL_DATA_LENGTH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REQUIRED_ORIGIN_CHAIN_ID_START_INDEX\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WARP_MESSENGER\",\"outputs\":[{\"internalType\":\"contractWarpMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"additionalFeeAmount\",\"type\":\"uint256\"}],\"name\":\"addFeeAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"blockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"delivererAddress\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayers\",\"type\":\"address[]\"}],\"name\":\"checkIsAllowedRelayer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeAsset\",\"type\":\"address\"}],\"name\":\"checkRelayerRewardAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"getFeeInfo\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"feeAsset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"getMessageHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"messageHash\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"chainID\",\"type\":\"bytes32\"}],\"name\":\"getNextMessageID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"chainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getReceiptAtIndex\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"chainID\",\"type\":\"bytes32\"}],\"name\":\"getReceiptQueueSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"getRelayerRewardAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"latestMessageIDs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"messageReceived\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"delivered\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"outstandingReceipts\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"first\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"last\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"name\":\"receiveCrossChainMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"receivedFailedMessageHashes\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"feeAsset\",\"type\":\"address\"}],\"name\":\"redeemRelayerRewards\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"relayerRewardAddresses\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"relayerRewardAmounts\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"retryMessageExecution\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256[]\",\"name\":\"messageIDs\",\"type\":\"uint256[]\"},{\"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\":\"retryReceipts\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"retrySendCrossChainMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"internalType\":\"structTeleporterMessageInput\",\"name\":\"messageInput\",\"type\":\"tuple\"}],\"name\":\"sendCrossChainMessage\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"sentMessageInfo\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"messageHash\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", } // TeleporterMessengerABI is the input ABI used to generate the binding from. From ebc937fb6f8ee9464fb447a38ff5cf033fe9c191 Mon Sep 17 00:00:00 2001 From: Matthew Lam Date: Tue, 17 Oct 2023 22:28:03 +0000 Subject: [PATCH 08/20] update error messages --- .../src/CrossChainApplications/ERC20Bridge/BridgeToken.sol | 6 +++--- .../src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/contracts/src/CrossChainApplications/ERC20Bridge/BridgeToken.sol b/contracts/src/CrossChainApplications/ERC20Bridge/BridgeToken.sol index 9c5683f6c..e9fa050f7 100644 --- a/contracts/src/CrossChainApplications/ERC20Bridge/BridgeToken.sol +++ b/contracts/src/CrossChainApplications/ERC20Bridge/BridgeToken.sol @@ -32,15 +32,15 @@ contract BridgeToken is ERC20Burnable { ) ERC20(tokenName, tokenSymbol) { require( sourceChainID != bytes32(0), - "BridgeToken: invalid source chain id" + "BridgeToken: zero source chain id" ); require( sourceBridge != address(0), - "BridgeToken: invalid source bridge address" + "BridgeToken: zero source bridge address" ); require( sourceAsset != address(0), - "BridgeToken: invalid source asset address" + "BridgeToken: zero source asset address" ); bridgeContract = msg.sender; nativeChainID = sourceChainID; diff --git a/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol b/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol index 197494d23..87ef78b3d 100644 --- a/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol +++ b/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol @@ -74,7 +74,7 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { constructor(address teleporterMessengerAddress) { require( teleporterMessengerAddress != address(0), - "ERC20Bridge: Invalid teleporter messenger address" + "ERC20Bridge: invalid teleporter messenger address" ); teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); From 8f768091e60bf0b292b177f69ce6b2c8d34aea0d Mon Sep 17 00:00:00 2001 From: Matthew Lam Date: Wed, 18 Oct 2023 19:38:07 +0000 Subject: [PATCH 09/20] additional custom error removals --- contracts/src/Mocks/ExampleERC20.sol | 7 +---- contracts/src/Teleporter/ReceiptQueue.sol | 31 +++++++------------ contracts/src/Teleporter/ReentrancyGuards.sol | 18 +++++------ .../src/Teleporter/SafeERC20TransferFrom.sol | 10 +++--- .../HandleInitialMessageExecutionTests.t.sol | 24 +++----------- 5 files changed, 29 insertions(+), 61 deletions(-) diff --git a/contracts/src/Mocks/ExampleERC20.sol b/contracts/src/Mocks/ExampleERC20.sol index f1052d77b..1785ad01e 100644 --- a/contracts/src/Mocks/ExampleERC20.sol +++ b/contracts/src/Mocks/ExampleERC20.sol @@ -13,18 +13,13 @@ contract ExampleERC20 is ERC20Burnable { uint256 private constant _MAX_MINT = 10_000_000_000_000_000; - // Errors - error MaxAmountExceeded(uint256 maxAmount, uint256 mintAmount); - constructor() ERC20(_TOKEN_NAME, _TOKEN_SYMBOL) { _mint(msg.sender, 10_000_000_000_000_000_000_000_000_000); } function mint(uint256 amount) public { // Can only mint 10 at a time. - if (amount > _MAX_MINT) { - revert MaxAmountExceeded(_MAX_MINT, amount); - } + require(amount <= _MAX_MINT, "ExampleERC20: max mint exceeded"); _mint(msg.sender, amount); } diff --git a/contracts/src/Teleporter/ReceiptQueue.sol b/contracts/src/Teleporter/ReceiptQueue.sol index 61f191634..7dcdc452c 100644 --- a/contracts/src/Teleporter/ReceiptQueue.sol +++ b/contracts/src/Teleporter/ReceiptQueue.sol @@ -22,10 +22,6 @@ library ReceiptQueue { // The maximum number of receipts to include in a single message. uint256 private constant _MAXIMUM_RECEIPT_COUNT = 5; - // Errors - error EmptyQueue(); - error OutofIndex(); - /** * @dev Adds a receipt to the queue. */ @@ -44,12 +40,9 @@ library ReceiptQueue { */ function dequeue( TeleporterMessageReceiptQueue storage queue - ) - internal - returns (TeleporterMessageReceipt memory result) - { + ) internal returns (TeleporterMessageReceipt memory result) { uint256 first_ = queue.first; - if (queue.last == first_) revert EmptyQueue(); + require(queue.last != first_, "ReceiptQueue: empty queue"); result = queue.data[first_]; delete queue.data[first_]; queue.first = first_ + 1; @@ -60,10 +53,7 @@ library ReceiptQueue { */ function getOutstandingReceiptsToSend( TeleporterMessageReceiptQueue storage queue - ) - internal - returns (TeleporterMessageReceipt[] memory result) - { + ) internal returns (TeleporterMessageReceipt[] memory result) { // Get the current outstanding receipts for the given chain ID. // If the queue contract doesn't exist, there are no outstanding receipts to send. uint256 resultSize = size(queue); @@ -85,19 +75,20 @@ library ReceiptQueue { /** * @dev Returns the number of open receipts in the queue. */ - function size(TeleporterMessageReceiptQueue storage queue) internal view returns (uint256) { + function size( + TeleporterMessageReceiptQueue storage queue + ) internal view returns (uint256) { return queue.last - queue.first; } /** * @dev Returns the receipt at the given index in the queue. */ - function getReceiptAtIndex(TeleporterMessageReceiptQueue storage queue, uint256 index) - internal - view - returns (TeleporterMessageReceipt memory) - { - if (index >= size(queue)) revert OutofIndex(); + function getReceiptAtIndex( + TeleporterMessageReceiptQueue storage queue, + uint256 index + ) internal view returns (TeleporterMessageReceipt memory) { + require(index < size(queue), "ReceiptQueue: index out of bounds"); return queue.data[queue.first + index]; } } diff --git a/contracts/src/Teleporter/ReentrancyGuards.sol b/contracts/src/Teleporter/ReentrancyGuards.sol index 949c182da..43b04d01b 100644 --- a/contracts/src/Teleporter/ReentrancyGuards.sol +++ b/contracts/src/Teleporter/ReentrancyGuards.sol @@ -21,17 +21,14 @@ abstract contract ReentrancyGuards { uint256 internal _sendEntered; uint256 internal _receiveEntered; - // Errors - error ReceiverReentrancy(); - error SenderReentrancy(); - // senderNonReentrant modifier makes sure we can not reenter between sender calls. // This modifier should be used for messenger sender functions that have external calls and do not want to allow // recursive calls with other sender functions. modifier senderNonReentrant() { - if (_sendEntered != _NOT_ENTERED) { - revert SenderReentrancy(); - } + require( + _sendEntered == _NOT_ENTERED, + "ReentrancyGuards: sender reentrancy" + ); _sendEntered = _ENTERED; _; _sendEntered = _NOT_ENTERED; @@ -41,9 +38,10 @@ abstract contract ReentrancyGuards { // This modifier should be used for messenger receiver functions that have external calls and do not want to allow // recursive calls with other receiver functions. modifier receiverNonReentrant() { - if (_receiveEntered != _NOT_ENTERED) { - revert ReceiverReentrancy(); - } + require( + _receiveEntered == _NOT_ENTERED, + "ReentrancyGuards: receiver reentrancy" + ); _receiveEntered = _ENTERED; _; _receiveEntered = _NOT_ENTERED; diff --git a/contracts/src/Teleporter/SafeERC20TransferFrom.sol b/contracts/src/Teleporter/SafeERC20TransferFrom.sol index d956766a8..27f9ca7d0 100644 --- a/contracts/src/Teleporter/SafeERC20TransferFrom.sol +++ b/contracts/src/Teleporter/SafeERC20TransferFrom.sol @@ -21,9 +21,6 @@ import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; library SafeERC20TransferFrom { using SafeERC20 for IERC20; - // Errors - error BalanceNotIncreased(); - function safeTransferFrom( IERC20 erc20, uint256 amount @@ -32,9 +29,10 @@ library SafeERC20TransferFrom { erc20.safeTransferFrom(msg.sender, address(this), amount); uint256 balanceAfter = erc20.balanceOf(address(this)); - if (balanceAfter <= balanceBefore) { - revert BalanceNotIncreased(); - } + require( + balanceAfter > balanceBefore, + "SafeERC20TransferFrom: balance not increased" + ); return balanceAfter - balanceBefore; } diff --git a/contracts/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol b/contracts/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol index de065ff61..5c9d87b11 100644 --- a/contracts/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol +++ b/contracts/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol @@ -19,11 +19,6 @@ contract SampleMessageReceiver is ITeleporterReceiver { bytes32 public latestMessageSenderSubnetID; address public latestMessageSenderAddress; - // Errors - error IntendedToFail(); - error InvalidAction(); - error Unauthorized(); - constructor(address teleporterContractAddress) { teleporterContract = teleporterContractAddress; } @@ -33,9 +28,7 @@ contract SampleMessageReceiver is ITeleporterReceiver { address originSenderAddress, bytes calldata message ) external { - if (msg.sender != teleporterContract) { - revert Unauthorized(); - } + require(msg.sender == teleporterContract, "unauthorized"); // Decode the payload to recover the action and corresponding function parameters (SampleMessageReceiverAction action, bytes memory actionData) = abi .decode(message, (SampleMessageReceiverAction, bytes)); @@ -58,7 +51,7 @@ contract SampleMessageReceiver is ITeleporterReceiver { messageString ); } else { - revert InvalidAction(); + revert("invalid action"); } } @@ -69,13 +62,8 @@ contract SampleMessageReceiver is ITeleporterReceiver { string memory message, bool succeed ) internal { - if (msg.sender != teleporterContract) { - revert Unauthorized(); - } - - if (!succeed) { - revert IntendedToFail(); - } + require(msg.sender == teleporterContract, "unauthorized"); + require(succeed, "intended to fail"); latestMessage = message; latestMessageSenderSubnetID = originChainID; latestMessageSenderAddress = originSenderAddress; @@ -87,9 +75,7 @@ contract SampleMessageReceiver is ITeleporterReceiver { address originSenderAddress, string memory message ) internal { - if (msg.sender != teleporterContract) { - revert Unauthorized(); - } + require(msg.sender == teleporterContract, "unauthorized"); ITeleporterMessenger messenger = ITeleporterMessenger( teleporterContract ); From 1821c9e35de28fb78c6d783b0a9c4dd894c2e8f8 Mon Sep 17 00:00:00 2001 From: Matthew Lam Date: Wed, 18 Oct 2023 19:51:23 +0000 Subject: [PATCH 10/20] remove additional custom errors and update bindings --- .../ERC20Bridge/ERC20Bridge/ERC20Bridge.go | 2 +- .../ExampleCrossChainMessenger.go | 2 +- .../TeleporterMessenger.go | 6 +-- .../ERC20Bridge/ERC20Bridge.sol | 2 +- .../Teleporter/tests/ReceiptsQueueTests.t.sol | 41 +++++++++++-------- .../tests/ReentrancyGuardsTests.t.sol | 24 ++++------- .../tests/RetryMessageExecutionTests.t.sol | 27 +++--------- .../tests/TeleporterMessengerTest.t.sol | 2 +- 8 files changed, 44 insertions(+), 62 deletions(-) diff --git a/abi-bindings/CrossChainApplications/ERC20Bridge/ERC20Bridge/ERC20Bridge.go b/abi-bindings/CrossChainApplications/ERC20Bridge/ERC20Bridge/ERC20Bridge.go index ffb66f87c..a93965bc3 100644 --- a/abi-bindings/CrossChainApplications/ERC20Bridge/ERC20Bridge/ERC20Bridge.go +++ b/abi-bindings/CrossChainApplications/ERC20Bridge/ERC20Bridge/ERC20Bridge.go @@ -31,7 +31,7 @@ var ( // ERC20BridgeMetaData contains all meta data concerning the ERC20Bridge contract. var ERC20BridgeMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"tokenContractAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"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\":\"nativeChainID\",\"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\":\"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\":\"bytes32\",\"name\":\"destinationChainID\",\"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\":\"destinationChainID\",\"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\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"bridgedBalances\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentChainID\",\"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\":\"destinationChainID\",\"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\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"nativeToWrappedTokens\",\"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\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"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\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"submittedBridgeTokenCreations\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"wrappedTokenContracts\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"tokenContractAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"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\":\"nativeChainID\",\"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\":\"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\":\"bytes32\",\"name\":\"destinationChainID\",\"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\":\"destinationChainID\",\"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\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"bridgedBalances\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentChainID\",\"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\":\"destinationChainID\",\"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\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"nativeToWrappedTokens\",\"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\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"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\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"submittedBridgeTokenCreations\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"wrappedTokenContracts\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", } // ERC20BridgeABI is the input ABI used to generate the binding from. diff --git a/abi-bindings/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger/ExampleCrossChainMessenger.go b/abi-bindings/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger/ExampleCrossChainMessenger.go index 86906f172..596f88b46 100644 --- a/abi-bindings/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger/ExampleCrossChainMessenger.go +++ b/abi-bindings/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger/ExampleCrossChainMessenger.go @@ -31,7 +31,7 @@ var ( // ExampleCrossChainMessengerMetaData contains all meta data concerning the ExampleCrossChainMessenger contract. var ExampleCrossChainMessengerMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"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\":\"destinationChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"feeAsset\",\"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\":\"originChainID\",\"type\":\"bytes32\"}],\"name\":\"getCurrentMessage\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"originSenderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"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\":\"messageID\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"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\":\"destinationChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"feeAsset\",\"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\":\"originChainID\",\"type\":\"bytes32\"}],\"name\":\"getCurrentMessage\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"originSenderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"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\":\"messageID\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", } // ExampleCrossChainMessengerABI is the input ABI used to generate the binding from. diff --git a/abi-bindings/Teleporter/TeleporterMessenger/TeleporterMessenger.go b/abi-bindings/Teleporter/TeleporterMessenger/TeleporterMessenger.go index ceb096531..d8352fdf4 100644 --- a/abi-bindings/Teleporter/TeleporterMessenger/TeleporterMessenger.go +++ b/abi-bindings/Teleporter/TeleporterMessenger/TeleporterMessenger.go @@ -64,11 +64,7 @@ type TeleporterMessageReceipt struct { // TeleporterMessengerMetaData contains all meta data concerning the TeleporterMessenger contract. var TeleporterMessengerMetaData = &bind.MetaData{ -<<<<<<< HEAD - ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"EmptyQueue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OutofIndex\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ReceiverReentrancy\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SenderReentrancy\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"updatedFeeInfo\",\"type\":\"tuple\"}],\"name\":\"AddFeeAmount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"indexed\":false,\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"FailedMessageExecution\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"MessageExecutionRetried\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"indexed\":false,\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"ReceiveCrossChainMessage\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"indexed\":false,\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"SendCrossChainMessage\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MINIMUM_REQUIRED_CALL_DATA_LENGTH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REQUIRED_ORIGIN_CHAIN_ID_START_INDEX\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WARP_MESSENGER\",\"outputs\":[{\"internalType\":\"contractWarpMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"additionalFeeAmount\",\"type\":\"uint256\"}],\"name\":\"addFeeAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"blockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"delivererAddress\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayers\",\"type\":\"address[]\"}],\"name\":\"checkIsAllowedRelayer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeAsset\",\"type\":\"address\"}],\"name\":\"checkRelayerRewardAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"getFeeInfo\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"feeAsset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"getMessageHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"messageHash\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"chainID\",\"type\":\"bytes32\"}],\"name\":\"getNextMessageID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"chainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getReceiptAtIndex\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"chainID\",\"type\":\"bytes32\"}],\"name\":\"getReceiptQueueSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"getRelayerRewardAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"latestMessageIDs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"messageReceived\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"delivered\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"outstandingReceipts\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"first\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"last\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"name\":\"receiveCrossChainMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"receivedFailedMessageHashes\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"feeAsset\",\"type\":\"address\"}],\"name\":\"redeemRelayerRewards\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"relayerRewardAddresses\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"relayerRewardAmounts\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"retryMessageExecution\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256[]\",\"name\":\"messageIDs\",\"type\":\"uint256[]\"},{\"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\":\"retryReceipts\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"retrySendCrossChainMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"internalType\":\"structTeleporterMessageInput\",\"name\":\"messageInput\",\"type\":\"tuple\"}],\"name\":\"sendCrossChainMessage\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"sentMessageInfo\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"messageHash\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", -======= - ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BalanceNotIncreased\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"EmptyQueue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientGas\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAdditionalFeeAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidDestinationAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidDestinationChainID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidFeeAssetContractAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidMessageHash\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidOriginSenderAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidRelayerRewardAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidWarpMessage\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MessageAlreadyDelivered\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MessageNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MessageRetryExecutionFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoRelayerRewardToRedeem\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OutofIndex\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ReceiptNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ReceiverReentrancy\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SenderReentrancy\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnauthorizedRelayer\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"updatedFeeInfo\",\"type\":\"tuple\"}],\"name\":\"AddFeeAmount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"indexed\":false,\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"FailedMessageExecution\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"MessageExecutionRetried\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"deliverer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"rewardRedeemer\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"indexed\":false,\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"ReceiveCrossChainMessage\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"redeemer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RelayerRewardsRedeemed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"indexed\":false,\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"}],\"name\":\"SendCrossChainMessage\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MINIMUM_REQUIRED_CALL_DATA_LENGTH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REQUIRED_ORIGIN_CHAIN_ID_START_INDEX\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WARP_MESSENGER\",\"outputs\":[{\"internalType\":\"contractWarpMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"additionalFeeAmount\",\"type\":\"uint256\"}],\"name\":\"addFeeAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"blockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"delivererAddress\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayers\",\"type\":\"address[]\"}],\"name\":\"checkIsAllowedRelayer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeAsset\",\"type\":\"address\"}],\"name\":\"checkRelayerRewardAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"getFeeInfo\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"feeAsset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"getMessageHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"messageHash\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"chainID\",\"type\":\"bytes32\"}],\"name\":\"getNextMessageID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"chainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getReceiptAtIndex\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"chainID\",\"type\":\"bytes32\"}],\"name\":\"getReceiptQueueSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"getRelayerRewardAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"latestMessageIDs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"messageReceived\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"delivered\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"outstandingReceipts\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"first\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"last\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"name\":\"receiveCrossChainMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"receivedFailedMessageHashes\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"feeAsset\",\"type\":\"address\"}],\"name\":\"redeemRelayerRewards\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"relayerRewardAddresses\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"relayerRewardAmounts\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"retryMessageExecution\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256[]\",\"name\":\"messageIDs\",\"type\":\"uint256[]\"},{\"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\":\"retryReceipts\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"retrySendCrossChainMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"internalType\":\"structTeleporterMessageInput\",\"name\":\"messageInput\",\"type\":\"tuple\"}],\"name\":\"sendCrossChainMessage\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"sentMessageInfo\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"messageHash\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", ->>>>>>> origin/main + ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"updatedFeeInfo\",\"type\":\"tuple\"}],\"name\":\"AddFeeAmount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"indexed\":false,\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"FailedMessageExecution\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"MessageExecutionRetried\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"deliverer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"rewardRedeemer\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"indexed\":false,\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"ReceiveCrossChainMessage\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"redeemer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RelayerRewardsRedeemed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"indexed\":false,\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"}],\"name\":\"SendCrossChainMessage\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MINIMUM_REQUIRED_CALL_DATA_LENGTH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REQUIRED_ORIGIN_CHAIN_ID_START_INDEX\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WARP_MESSENGER\",\"outputs\":[{\"internalType\":\"contractWarpMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"additionalFeeAmount\",\"type\":\"uint256\"}],\"name\":\"addFeeAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"blockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"delivererAddress\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayers\",\"type\":\"address[]\"}],\"name\":\"checkIsAllowedRelayer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeAsset\",\"type\":\"address\"}],\"name\":\"checkRelayerRewardAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"getFeeInfo\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"feeAsset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"getMessageHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"messageHash\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"chainID\",\"type\":\"bytes32\"}],\"name\":\"getNextMessageID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"chainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getReceiptAtIndex\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"chainID\",\"type\":\"bytes32\"}],\"name\":\"getReceiptQueueSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"getRelayerRewardAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"latestMessageIDs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"messageReceived\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"delivered\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"outstandingReceipts\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"first\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"last\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"name\":\"receiveCrossChainMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"receivedFailedMessageHashes\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"feeAsset\",\"type\":\"address\"}],\"name\":\"redeemRelayerRewards\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"relayerRewardAddresses\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"relayerRewardAmounts\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"retryMessageExecution\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256[]\",\"name\":\"messageIDs\",\"type\":\"uint256[]\"},{\"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\":\"retryReceipts\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"retrySendCrossChainMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"internalType\":\"structTeleporterMessageInput\",\"name\":\"messageInput\",\"type\":\"tuple\"}],\"name\":\"sendCrossChainMessage\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"sentMessageInfo\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"messageHash\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", } // TeleporterMessengerABI 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 87ef78b3d..21d1d7e84 100644 --- a/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol +++ b/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol @@ -74,7 +74,7 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { constructor(address teleporterMessengerAddress) { require( teleporterMessengerAddress != address(0), - "ERC20Bridge: invalid teleporter messenger address" + "ERC20Bridge: zero teleporter messenger address" ); teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); diff --git a/contracts/src/Teleporter/tests/ReceiptsQueueTests.t.sol b/contracts/src/Teleporter/tests/ReceiptsQueueTests.t.sol index 0457bfb83..35c01de8e 100644 --- a/contracts/src/Teleporter/tests/ReceiptsQueueTests.t.sol +++ b/contracts/src/Teleporter/tests/ReceiptsQueueTests.t.sol @@ -15,19 +15,22 @@ contract ReceiptQueueTest is Test { // each time after deployment. ReceiptQueue.TeleporterMessageReceiptQueue private _queue; - // Add 3 elements to the queue. - TeleporterMessageReceipt private _receipt1 = TeleporterMessageReceipt({ - receivedMessageID: 543, - relayerRewardAddress: 0x10eB43ef5982628728E3E4bb9F78834f67Fbb40b - }); - TeleporterMessageReceipt private _receipt2 = TeleporterMessageReceipt({ - receivedMessageID: 684384, - relayerRewardAddress: 0x10eB43ef5982628728E3E4bb9F78834f67Fbb40b - }); - TeleporterMessageReceipt private _receipt3 = TeleporterMessageReceipt({ - receivedMessageID: 654351, - relayerRewardAddress: 0xcC8E718045817AebA89592C72Ae1C9917f5D0894 - }); + // Add 3 elements to the queue. + TeleporterMessageReceipt private _receipt1 = + TeleporterMessageReceipt({ + receivedMessageID: 543, + relayerRewardAddress: 0x10eB43ef5982628728E3E4bb9F78834f67Fbb40b + }); + TeleporterMessageReceipt private _receipt2 = + TeleporterMessageReceipt({ + receivedMessageID: 684384, + relayerRewardAddress: 0x10eB43ef5982628728E3E4bb9F78834f67Fbb40b + }); + TeleporterMessageReceipt private _receipt3 = + TeleporterMessageReceipt({ + receivedMessageID: 654351, + relayerRewardAddress: 0xcC8E718045817AebA89592C72Ae1C9917f5D0894 + }); function testEnqueueDequeueSuccess() public { // Check the initial size is zero. @@ -80,7 +83,7 @@ contract ReceiptQueueTest is Test { function testDequeueRevertIfEmptyQueue() public { // Check that you can't dequeue from empty queue. - vm.expectRevert(ReceiptQueue.EmptyQueue.selector); + vm.expectRevert(_formatErrorMessage("empty queue")); TeleporterMessageReceipt memory result = _queue.dequeue(); assertEq(result.receivedMessageID, 0); assertEq(result.relayerRewardAddress, address(0)); @@ -101,15 +104,21 @@ contract ReceiptQueueTest is Test { assertEq(result.relayerRewardAddress, _receipt2.relayerRewardAddress); // Check can't get an out of index element. - vm.expectRevert(ReceiptQueue.OutofIndex.selector); + vm.expectRevert(_formatErrorMessage("index out of bounds")); result = _queue.getReceiptAtIndex(4); } function testGetReceiptAtIndexWithEmptyQueue() public { // Check that you can't get receipts from empty queue. - vm.expectRevert(ReceiptQueue.OutofIndex.selector); + vm.expectRevert(_formatErrorMessage("index out of bounds")); TeleporterMessageReceipt memory result = _queue.getReceiptAtIndex(0); assertEq(result.receivedMessageID, 0); assertEq(result.relayerRewardAddress, address(0)); } + + function _formatErrorMessage( + string memory errorMessage + ) private pure returns (bytes memory) { + return bytes(string.concat("ReceiptQueue: ", errorMessage)); + } } diff --git a/contracts/src/Teleporter/tests/ReentrancyGuardsTests.t.sol b/contracts/src/Teleporter/tests/ReentrancyGuardsTests.t.sol index 5508dedf8..5b54140b3 100644 --- a/contracts/src/Teleporter/tests/ReentrancyGuardsTests.t.sol +++ b/contracts/src/Teleporter/tests/ReentrancyGuardsTests.t.sol @@ -8,10 +8,6 @@ pragma solidity 0.8.18; import "forge-std/Test.sol"; import "../ReentrancyGuards.sol"; -// Errors -error ReceiveFailed(); -error SendFailed(); - contract ReentrancyGuardsTests is Test { SampleMessenger internal _sampleMessenger; @@ -36,7 +32,7 @@ contract ReentrancyGuardsTests is Test { function testRecursiveSendFails() public { // First we check when a send function calls another send function, which should fail. bytes memory sendMsg = abi.encodeCall(SampleMessenger.sendMessage, ()); - vm.expectRevert(SendFailed.selector); + vm.expectRevert("send failed"); _sampleMessenger.sendAndCall(sendMsg); // We also need to check that we fail if a send function calls a receive function, @@ -45,7 +41,7 @@ contract ReentrancyGuardsTests is Test { SampleMessenger.receiveAndCall, (sendMsg) ); - vm.expectRevert(SendFailed.selector); + vm.expectRevert("send failed"); _sampleMessenger.sendAndCall(receiveMsg); } @@ -55,7 +51,7 @@ contract ReentrancyGuardsTests is Test { SampleMessenger.receiveMessage, () ); - vm.expectRevert(ReceiveFailed.selector); + vm.expectRevert("receive failed"); _sampleMessenger.receiveAndCall(receiveMsg); // We also need to check that we fail if a receive function calls a send function, @@ -64,7 +60,7 @@ contract ReentrancyGuardsTests is Test { SampleMessenger.sendAndCall, (receiveMsg) ); - vm.expectRevert(ReceiveFailed.selector); + vm.expectRevert("receive failed"); _sampleMessenger.receiveAndCall(sendMsg); } @@ -85,7 +81,7 @@ contract ReentrancyGuardsTests is Test { function testRecursiveDirectSendFails() public { // We want to check sending recursively by directly making a function call and not low level call also fails. - vm.expectRevert(ReentrancyGuards.SenderReentrancy.selector); + vm.expectRevert("ReentrancyGuards: sender reentrancy"); _sampleMessenger.sendRecursive(); assertEq(_sampleMessenger.nonce(), 0); @@ -93,7 +89,7 @@ contract ReentrancyGuardsTests is Test { function testRecursiveDirectReceiveFails() public { // We want to check receiving recursively by directly making a function call and not low level call also fails. - vm.expectRevert(ReentrancyGuards.ReceiverReentrancy.selector); + vm.expectRevert("ReentrancyGuards: receiver reentrancy"); _sampleMessenger.receiveRecursive(); assertEq(_sampleMessenger.nonce(), 0); @@ -112,9 +108,7 @@ contract SampleMessenger is ReentrancyGuards { if (message.length > 0) { // solhint-disable-next-line avoid-low-level-calls (bool success, ) = address(this).call(message); - if (!success) { - revert SendFailed(); - } + require(success, "send failed"); } } @@ -132,9 +126,7 @@ contract SampleMessenger is ReentrancyGuards { if (message.length > 0) { // solhint-disable-next-line avoid-low-level-calls (bool success, ) = address(this).call(message); - if (!success) { - revert ReceiveFailed(); - } + require(success, "receive failed"); } } diff --git a/contracts/src/Teleporter/tests/RetryMessageExecutionTests.t.sol b/contracts/src/Teleporter/tests/RetryMessageExecutionTests.t.sol index 7a0d87221..fc0068a9a 100644 --- a/contracts/src/Teleporter/tests/RetryMessageExecutionTests.t.sol +++ b/contracts/src/Teleporter/tests/RetryMessageExecutionTests.t.sol @@ -22,11 +22,6 @@ contract FlakyMessageReceiver is ITeleporterReceiver { bytes32 public latestMessageSenderSubnetID; address public latestMessageSenderAddress; - // Errors - error EvenBlockNumber(); - error InvalidAction(); - error Unauthorized(); - constructor(address teleporterContractAddress) { teleporterContract = teleporterContractAddress; } @@ -36,9 +31,7 @@ contract FlakyMessageReceiver is ITeleporterReceiver { address originSenderAddress, bytes calldata messageBytes ) external { - if (msg.sender != teleporterContract) { - revert Unauthorized(); - } + require(msg.sender == teleporterContract, "unauthorized"); // Decode the payload to recover the action and corresponding function parameters (FlakyMessageReceiverAction action, bytes memory actionData) = abi .decode(messageBytes, (FlakyMessageReceiverAction, bytes)); @@ -49,7 +42,7 @@ contract FlakyMessageReceiver is ITeleporterReceiver { string memory message = abi.decode(actionData, (string)); _retryReceive(originChainID, originSenderAddress, message); } else { - revert InvalidAction(); + revert("invalid action"); } } @@ -59,12 +52,8 @@ contract FlakyMessageReceiver is ITeleporterReceiver { address originSenderAddress, string memory message ) internal { - if (msg.sender != teleporterContract) { - revert Unauthorized(); - } - if (block.number % 2 == 0) { - revert EvenBlockNumber(); - } + require(msg.sender == teleporterContract, "unauthorized"); + require(block.number % 2 != 0, "even block number"); latestMessage = message; latestMessageSenderSubnetID = originChainID; latestMessageSenderAddress = originSenderAddress; @@ -76,12 +65,8 @@ contract FlakyMessageReceiver is ITeleporterReceiver { address originSenderAddress, string memory message ) internal { - if (msg.sender != teleporterContract) { - revert Unauthorized(); - } - if (block.number % 2 == 0) { - revert EvenBlockNumber(); - } + require(msg.sender == teleporterContract, "unauthorized"); + require(block.number % 2 != 0, "even block number"); ITeleporterMessenger messenger = ITeleporterMessenger( teleporterContract diff --git a/contracts/src/Teleporter/tests/TeleporterMessengerTest.t.sol b/contracts/src/Teleporter/tests/TeleporterMessengerTest.t.sol index 0ec92b263..6d7f2967e 100644 --- a/contracts/src/Teleporter/tests/TeleporterMessengerTest.t.sol +++ b/contracts/src/Teleporter/tests/TeleporterMessengerTest.t.sol @@ -103,7 +103,7 @@ contract TeleporterMessengerTest is Test { 0 ); - vm.expectRevert(ReceiptQueue.OutofIndex.selector); + vm.expectRevert("ReceiptQueue: index out of bounds"); TeleporterMessageReceipt memory receipt = teleporterMessenger .getReceiptAtIndex(DEFAULT_ORIGIN_CHAIN_ID, 0); assertEq(receipt.receivedMessageID, 0); From 07e380e6dba9ffc153164caa17ee5bf3846f881c Mon Sep 17 00:00:00 2001 From: Matthew Lam Date: Wed, 18 Oct 2023 19:57:22 +0000 Subject: [PATCH 11/20] change to >= check --- .../src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol b/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol index 21d1d7e84..ba5f06a60 100644 --- a/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol +++ b/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol @@ -124,7 +124,7 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { // is not a "fee/burn on transfer" token, since it was deployed by this // contract itself. require( - totalAmount > primaryFeeAmount + secondaryFeeAmount, + totalAmount >= primaryFeeAmount + secondaryFeeAmount, "ERC20Bridge: insufficient total fee amount" ); @@ -162,7 +162,7 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { // 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. require( - adjustedAmount > primaryFeeAmount, + adjustedAmount >= primaryFeeAmount, "ERC20Bridge: insufficient adjusted amount" ); From 491900d07e125327220d7f2a9606ca32d4df8370 Mon Sep 17 00:00:00 2001 From: Matthew Lam Date: Wed, 18 Oct 2023 20:07:01 +0000 Subject: [PATCH 12/20] change check to use > 0 --- contracts/src/Teleporter/TeleporterMessenger.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/src/Teleporter/TeleporterMessenger.sol b/contracts/src/Teleporter/TeleporterMessenger.sol index 1802e3041..a4b308268 100644 --- a/contracts/src/Teleporter/TeleporterMessenger.sol +++ b/contracts/src/Teleporter/TeleporterMessenger.sol @@ -473,7 +473,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { */ function redeemRelayerRewards(address feeAsset) external { uint256 rewardAmount = relayerRewardAmounts[msg.sender][feeAsset]; - require(rewardAmount != 0, "TeleporterMessenger: no reward to redeem"); + require(rewardAmount > 0, "TeleporterMessenger: no reward to redeem"); // Zero the reward balance before calling the external ERC20 to transfer the // reward to prevent any possible re-entrancy. From 51f3da97b642226af448b85c5f222fe149d6088a Mon Sep 17 00:00:00 2001 From: minghinmatthewlam Date: Wed, 18 Oct 2023 13:55:15 -0700 Subject: [PATCH 13/20] Update contracts/src/Teleporter/TeleporterMessenger.sol Co-authored-by: Michael Kaplan <55204436+michaelkaplan13@users.noreply.github.com> Signed-off-by: minghinmatthewlam --- contracts/src/Teleporter/TeleporterMessenger.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/src/Teleporter/TeleporterMessenger.sol b/contracts/src/Teleporter/TeleporterMessenger.sol index a4b308268..01620bbb4 100644 --- a/contracts/src/Teleporter/TeleporterMessenger.sol +++ b/contracts/src/Teleporter/TeleporterMessenger.sol @@ -180,7 +180,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { // The additional fee amount must be non-zero. require( additionalFeeAmount > 0, - "TeleporterMessenger: zero fee amount" + "TeleporterMessenger: zero additional fee amount" ); // Do not allow adding a fee asset with contract address zero. From b7c17abd23ba5ae970971782cb6d049b00d81f6c Mon Sep 17 00:00:00 2001 From: minghinmatthewlam Date: Wed, 18 Oct 2023 13:55:22 -0700 Subject: [PATCH 14/20] Update contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol Co-authored-by: Michael Kaplan <55204436+michaelkaplan13@users.noreply.github.com> Signed-off-by: minghinmatthewlam --- .../src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol b/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol index ba5f06a60..2509a3bf5 100644 --- a/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol +++ b/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol @@ -571,7 +571,7 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { // so this check is redundant but left in for clarity. require( destinationChainID != currentChainID, - "ERC20Bridge: bridging to same chain" + "ERC20Bridge: cannot bridge to same chain" ); // Allow the Teleporter messenger to spend the fee amount. From 5ba1868d59b299a6acbea7cc59a4b3934c1a61cc Mon Sep 17 00:00:00 2001 From: minghinmatthewlam Date: Wed, 18 Oct 2023 13:55:29 -0700 Subject: [PATCH 15/20] Update contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol Co-authored-by: Michael Kaplan <55204436+michaelkaplan13@users.noreply.github.com> Signed-off-by: minghinmatthewlam --- .../src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol b/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol index 2509a3bf5..597cce84e 100644 --- a/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol +++ b/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol @@ -125,7 +125,7 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { // contract itself. require( totalAmount >= primaryFeeAmount + secondaryFeeAmount, - "ERC20Bridge: insufficient total fee amount" + "ERC20Bridge: insufficient total amount" ); return From faa2837bacb66cea65ba4e2c9a998064ad31e11b Mon Sep 17 00:00:00 2001 From: minghinmatthewlam Date: Wed, 18 Oct 2023 13:55:37 -0700 Subject: [PATCH 16/20] Update contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol Co-authored-by: Michael Kaplan <55204436+michaelkaplan13@users.noreply.github.com> Signed-off-by: minghinmatthewlam --- .../src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol b/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol index 597cce84e..bcdfc4a62 100644 --- a/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol +++ b/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol @@ -103,7 +103,7 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { // Bridging tokens within a single chain is not allowed. require( destinationChainID != currentChainID, - "ERC20Bridge: bridging to same chain" + "ERC20Bridge: cannot bridge to same chain" ); // Neither the recipient nor the destination bridge can be the zero address. From e2b68a1ce8818a3c33c0d32aee54755b88ff1afe Mon Sep 17 00:00:00 2001 From: Matthew Lam Date: Wed, 18 Oct 2023 21:02:41 +0000 Subject: [PATCH 17/20] update lint command to match ci --- scripts/local/lint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/local/lint.sh b/scripts/local/lint.sh index 889daf1e1..92f38c272 100755 --- a/scripts/local/lint.sh +++ b/scripts/local/lint.sh @@ -10,5 +10,5 @@ TELEPORTER_PATH=$( ) cd $TELEPORTER_PATH/contracts/src -solhint '**/*.sol' +solhint '**/*.sol' --config ./.solhint.json --ignore-path ./.solhintignore exit 0 \ No newline at end of file From 7855a5be42cc635fadeebda4d5bc9fd94605b114 Mon Sep 17 00:00:00 2001 From: Matthew Lam Date: Wed, 18 Oct 2023 21:21:04 +0000 Subject: [PATCH 18/20] revert change for >= check to prevent bridging with no amount --- .../src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol | 4 ++-- .../ERC20Bridge/tests/ERC20BridgeTests.t.sol | 4 ++-- contracts/src/Teleporter/tests/AddFeeAmountTests.t.sol | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol b/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol index bcdfc4a62..dc81c237a 100644 --- a/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol +++ b/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol @@ -124,7 +124,7 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { // is not a "fee/burn on transfer" token, since it was deployed by this // contract itself. require( - totalAmount >= primaryFeeAmount + secondaryFeeAmount, + totalAmount > primaryFeeAmount + secondaryFeeAmount, "ERC20Bridge: insufficient total amount" ); @@ -162,7 +162,7 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { // 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. require( - adjustedAmount >= primaryFeeAmount, + adjustedAmount > primaryFeeAmount, "ERC20Bridge: insufficient adjusted amount" ); diff --git a/contracts/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol b/contracts/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol index 219cff66d..857ee4305 100644 --- a/contracts/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol +++ b/contracts/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol @@ -71,7 +71,7 @@ contract ERC20BridgeTest is Test { } function testSameChainID() public { - vm.expectRevert(_formatErrorMessage("bridging to same chain")); + vm.expectRevert(_formatErrorMessage("cannot bridge to same chain")); erc20Bridge.bridgeTokens({ destinationChainID: _MOCK_BLOCKCHAIN_ID, destinationBridgeAddress: _DEFAULT_OTHER_BRIDGE_ADDRESS, @@ -113,7 +113,7 @@ contract ERC20BridgeTest is Test { contractNonce: 1 }); - vm.expectRevert(_formatErrorMessage("insufficient total fee amount")); + vm.expectRevert(_formatErrorMessage("insufficient total amount")); erc20Bridge.bridgeTokens({ destinationChainID: _DEFAULT_OTHER_CHAIN_ID, destinationBridgeAddress: _DEFAULT_OTHER_BRIDGE_ADDRESS, diff --git a/contracts/src/Teleporter/tests/AddFeeAmountTests.t.sol b/contracts/src/Teleporter/tests/AddFeeAmountTests.t.sol index 5c417f4dc..0152c8724 100644 --- a/contracts/src/Teleporter/tests/AddFeeAmountTests.t.sol +++ b/contracts/src/Teleporter/tests/AddFeeAmountTests.t.sol @@ -118,7 +118,7 @@ contract AddFeeAmountTest is TeleporterMessengerTest { // Expect revert when adding 0 additional amount. uint256 additionalFeeAmount = 0; - vm.expectRevert(_formatErrorMessage("zero fee amount")); + vm.expectRevert(_formatErrorMessage("zero additional fee amount")); teleporterMessenger.addFeeAmount( DEFAULT_DESTINATION_CHAIN_ID, messageID, From c87cc97e8cbbb4ad9776c33168a404f6fd7ebf0a Mon Sep 17 00:00:00 2001 From: Matthew Lam Date: Thu, 19 Oct 2023 21:44:09 +0000 Subject: [PATCH 19/20] rename format error message functions and use lint script for ci --- .github/workflows/linter.yml | 3 +-- .../ERC20Bridge/tests/ERC20BridgeTests.t.sol | 18 +++++++++---- .../Teleporter/tests/AddFeeAmountTests.t.sol | 14 ++++++---- .../HandleInitialMessageExecutionTests.t.sol | 10 ++++--- .../Teleporter/tests/ReceiptsQueueTests.t.sol | 8 +++--- .../tests/ReceiveCrossChainMessageTests.t.sol | 26 +++++++++++++------ .../tests/RedeemRelayerRewardsTests.t.sol | 2 +- .../tests/RetryMessageExecutionTests.t.sol | 14 ++++++---- .../Teleporter/tests/RetryReceiptTests.t.sol | 2 +- .../RetrySendCrossChainMessageTests.t.sol | 4 +-- .../tests/SendCrossChainMessageTests.t.sol | 4 ++- .../tests/TeleporterMessengerTest.t.sol | 2 +- 12 files changed, 69 insertions(+), 38 deletions(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index dc036f96b..db5a4c1ab 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -24,5 +24,4 @@ jobs: # in subdirectories. The former only checks sol files in the current directory and directories one level down. - name: Run Lint run: | - cd contracts/src - npx solhint '**/*.sol' --config ./.solhint.json --ignore-path ./.solhintignore --max-warnings 0 + ./scripts/local/lint.sh diff --git a/contracts/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol b/contracts/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol index 857ee4305..ae9758eb2 100644 --- a/contracts/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol +++ b/contracts/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol @@ -71,7 +71,9 @@ contract ERC20BridgeTest is Test { } function testSameChainID() public { - vm.expectRevert(_formatErrorMessage("cannot bridge to same chain")); + vm.expectRevert( + _formatERC20BridgeErrorMessage("cannot bridge to same chain") + ); erc20Bridge.bridgeTokens({ destinationChainID: _MOCK_BLOCKCHAIN_ID, destinationBridgeAddress: _DEFAULT_OTHER_BRIDGE_ADDRESS, @@ -90,7 +92,9 @@ contract ERC20BridgeTest is Test { _DEFAULT_OTHER_BRIDGE_ADDRESS, address(mockERC20) ); - vm.expectRevert(_formatErrorMessage("insufficient adjusted amount")); + vm.expectRevert( + _formatERC20BridgeErrorMessage("insufficient adjusted amount") + ); erc20Bridge.bridgeTokens({ destinationChainID: _DEFAULT_OTHER_CHAIN_ID, destinationBridgeAddress: _DEFAULT_OTHER_BRIDGE_ADDRESS, @@ -113,7 +117,9 @@ contract ERC20BridgeTest is Test { contractNonce: 1 }); - vm.expectRevert(_formatErrorMessage("insufficient total amount")); + vm.expectRevert( + _formatERC20BridgeErrorMessage("insufficient total amount") + ); erc20Bridge.bridgeTokens({ destinationChainID: _DEFAULT_OTHER_CHAIN_ID, destinationBridgeAddress: _DEFAULT_OTHER_BRIDGE_ADDRESS, @@ -490,7 +496,9 @@ contract ERC20BridgeTest is Test { address(mockERC20) ); - vm.expectRevert(_formatErrorMessage("insufficient adjusted amount")); + vm.expectRevert( + _formatERC20BridgeErrorMessage("insufficient adjusted amount") + ); erc20Bridge.bridgeTokens({ destinationChainID: _DEFAULT_OTHER_CHAIN_ID, destinationBridgeAddress: _DEFAULT_OTHER_BRIDGE_ADDRESS, @@ -757,7 +765,7 @@ contract ERC20BridgeTest is Test { ); } - function _formatErrorMessage( + function _formatERC20BridgeErrorMessage( string memory errorMessage ) private pure returns (bytes memory) { return bytes(string.concat("ERC20Bridge: ", errorMessage)); diff --git a/contracts/src/Teleporter/tests/AddFeeAmountTests.t.sol b/contracts/src/Teleporter/tests/AddFeeAmountTests.t.sol index 0152c8724..559567268 100644 --- a/contracts/src/Teleporter/tests/AddFeeAmountTests.t.sol +++ b/contracts/src/Teleporter/tests/AddFeeAmountTests.t.sol @@ -64,7 +64,7 @@ contract AddFeeAmountTest is TeleporterMessengerTest { // Add to the fee amount of a message that doesn't exist. Expect revert. uint256 additionalFeeAmount = 131313; uint256 fakeMessageID = 13; - vm.expectRevert(_formatErrorMessage("message not found")); + vm.expectRevert(_formatTeleporterErrorMessage("message not found")); teleporterMessenger.addFeeAmount( DEFAULT_DESTINATION_CHAIN_ID, fakeMessageID, @@ -99,7 +99,7 @@ contract AddFeeAmountTest is TeleporterMessengerTest { // Now try to add to the fee of the message. Should revert since the message receipt was received already. uint256 additionalFeeAmount = 131313; - vm.expectRevert(_formatErrorMessage("message not found")); + vm.expectRevert(_formatTeleporterErrorMessage("message not found")); teleporterMessenger.addFeeAmount( DEFAULT_DESTINATION_CHAIN_ID, messageID, @@ -118,7 +118,9 @@ contract AddFeeAmountTest is TeleporterMessengerTest { // Expect revert when adding 0 additional amount. uint256 additionalFeeAmount = 0; - vm.expectRevert(_formatErrorMessage("zero additional fee amount")); + vm.expectRevert( + _formatTeleporterErrorMessage("zero additional fee amount") + ); teleporterMessenger.addFeeAmount( DEFAULT_DESTINATION_CHAIN_ID, messageID, @@ -139,7 +141,7 @@ contract AddFeeAmountTest is TeleporterMessengerTest { uint256 additionalFeeAmount = 131313; address differentFeeAsset = 0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664; vm.expectRevert( - _formatErrorMessage("invalid fee asset contract address") + _formatTeleporterErrorMessage("invalid fee asset contract address") ); teleporterMessenger.addFeeAmount( DEFAULT_DESTINATION_CHAIN_ID, @@ -160,7 +162,9 @@ contract AddFeeAmountTest is TeleporterMessengerTest { // Expect revert when using an invalid fee asset. uint256 additionalFeeAmount = 131313; address invalidFeeAsset = address(0); - vm.expectRevert(_formatErrorMessage("zero fee asset contract address")); + vm.expectRevert( + _formatTeleporterErrorMessage("zero fee asset contract address") + ); teleporterMessenger.addFeeAmount( DEFAULT_DESTINATION_CHAIN_ID, messageID, diff --git a/contracts/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol b/contracts/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol index 5c9d87b11..e93b9b7e3 100644 --- a/contracts/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol +++ b/contracts/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol @@ -183,7 +183,7 @@ contract HandleInitialMessageExecutionTest is TeleporterMessengerTest { _setUpSuccessGetVerifiedWarpMessageMock(0, warpMessage); // Receive the message. - vm.expectRevert(_formatErrorMessage("insufficient gas")); + vm.expectRevert(_formatTeleporterErrorMessage("insufficient gas")); teleporterMessenger.receiveCrossChainMessage( 0, DEFAULT_RELAYER_REWARD_ADDRESS @@ -246,7 +246,9 @@ contract HandleInitialMessageExecutionTest is TeleporterMessengerTest { ), DEFAULT_RELAYER_REWARD_ADDRESS ); - vm.expectRevert(_formatErrorMessage("retry execution failed")); + vm.expectRevert( + _formatTeleporterErrorMessage("retry execution failed") + ); teleporterMessenger.retryMessageExecution( DEFAULT_ORIGIN_CHAIN_ID, messageToReceive @@ -307,7 +309,9 @@ contract HandleInitialMessageExecutionTest is TeleporterMessengerTest { ), DEFAULT_RELAYER_REWARD_ADDRESS ); - vm.expectRevert(_formatErrorMessage("retry execution failed")); + vm.expectRevert( + _formatTeleporterErrorMessage("retry execution failed") + ); teleporterMessenger.retryMessageExecution( DEFAULT_ORIGIN_CHAIN_ID, messageToReceive diff --git a/contracts/src/Teleporter/tests/ReceiptsQueueTests.t.sol b/contracts/src/Teleporter/tests/ReceiptsQueueTests.t.sol index 35c01de8e..50d9d26dd 100644 --- a/contracts/src/Teleporter/tests/ReceiptsQueueTests.t.sol +++ b/contracts/src/Teleporter/tests/ReceiptsQueueTests.t.sol @@ -83,7 +83,7 @@ contract ReceiptQueueTest is Test { function testDequeueRevertIfEmptyQueue() public { // Check that you can't dequeue from empty queue. - vm.expectRevert(_formatErrorMessage("empty queue")); + vm.expectRevert(_formatReceiptQueueErrorMessage("empty queue")); TeleporterMessageReceipt memory result = _queue.dequeue(); assertEq(result.receivedMessageID, 0); assertEq(result.relayerRewardAddress, address(0)); @@ -104,19 +104,19 @@ contract ReceiptQueueTest is Test { assertEq(result.relayerRewardAddress, _receipt2.relayerRewardAddress); // Check can't get an out of index element. - vm.expectRevert(_formatErrorMessage("index out of bounds")); + vm.expectRevert(_formatReceiptQueueErrorMessage("index out of bounds")); result = _queue.getReceiptAtIndex(4); } function testGetReceiptAtIndexWithEmptyQueue() public { // Check that you can't get receipts from empty queue. - vm.expectRevert(_formatErrorMessage("index out of bounds")); + vm.expectRevert(_formatReceiptQueueErrorMessage("index out of bounds")); TeleporterMessageReceipt memory result = _queue.getReceiptAtIndex(0); assertEq(result.receivedMessageID, 0); assertEq(result.relayerRewardAddress, address(0)); } - function _formatErrorMessage( + function _formatReceiptQueueErrorMessage( string memory errorMessage ) private pure returns (bytes memory) { return bytes(string.concat("ReceiptQueue: ", errorMessage)); diff --git a/contracts/src/Teleporter/tests/ReceiveCrossChainMessageTests.t.sol b/contracts/src/Teleporter/tests/ReceiveCrossChainMessageTests.t.sol index 72a4fcc58..bd9be25e5 100644 --- a/contracts/src/Teleporter/tests/ReceiveCrossChainMessageTests.t.sol +++ b/contracts/src/Teleporter/tests/ReceiveCrossChainMessageTests.t.sol @@ -135,7 +135,7 @@ contract ReceiveCrossChainMessagedTest is TeleporterMessengerTest { abi.encodeCall(WarpMessenger.getVerifiedWarpMessage, (0)) ); - vm.expectRevert(_formatErrorMessage("invalid warp message")); + vm.expectRevert(_formatTeleporterErrorMessage("invalid warp message")); teleporterMessenger.receiveCrossChainMessage(0, address(1)); // Receive invalid message at index 3 @@ -149,7 +149,7 @@ contract ReceiveCrossChainMessagedTest is TeleporterMessengerTest { abi.encodeCall(WarpMessenger.getVerifiedWarpMessage, (3)) ); - vm.expectRevert(_formatErrorMessage("invalid warp message")); + vm.expectRevert(_formatTeleporterErrorMessage("invalid warp message")); teleporterMessenger.receiveCrossChainMessage(3, address(1)); } @@ -171,7 +171,9 @@ contract ReceiveCrossChainMessagedTest is TeleporterMessengerTest { // Mock the call to the warp precompile to get the message. _setUpSuccessGetVerifiedWarpMessageMock(0, warpMessage); - vm.expectRevert(_formatErrorMessage("invalid origin sender address")); + vm.expectRevert( + _formatTeleporterErrorMessage("invalid origin sender address") + ); teleporterMessenger.receiveCrossChainMessage( 0, DEFAULT_RELAYER_REWARD_ADDRESS @@ -198,7 +200,9 @@ contract ReceiveCrossChainMessagedTest is TeleporterMessengerTest { // Mock the call to the warp precompile to get the message. _setUpSuccessGetVerifiedWarpMessageMock(0, warpMessage); - vm.expectRevert(_formatErrorMessage("invalid destination chain ID")); + vm.expectRevert( + _formatTeleporterErrorMessage("invalid destination chain ID") + ); teleporterMessenger.receiveCrossChainMessage( 0, DEFAULT_RELAYER_REWARD_ADDRESS @@ -223,7 +227,9 @@ contract ReceiveCrossChainMessagedTest is TeleporterMessengerTest { // Mock the call to the warp precompile to get the message. _setUpSuccessGetVerifiedWarpMessageMock(0, warpMessage); - vm.expectRevert(_formatErrorMessage("invalid destination address")); + vm.expectRevert( + _formatTeleporterErrorMessage("invalid destination address") + ); teleporterMessenger.receiveCrossChainMessage( 0, DEFAULT_RELAYER_REWARD_ADDRESS @@ -231,7 +237,9 @@ contract ReceiveCrossChainMessagedTest is TeleporterMessengerTest { } function testInvalidRelayerAddress() public { - vm.expectRevert(_formatErrorMessage("zero relayer reward address")); + vm.expectRevert( + _formatTeleporterErrorMessage("zero relayer reward address") + ); teleporterMessenger.receiveCrossChainMessage(0, address(0)); } @@ -240,7 +248,9 @@ contract ReceiveCrossChainMessagedTest is TeleporterMessengerTest { testSuccess(); // Check you can't deliver it again. - vm.expectRevert(_formatErrorMessage("message already delivered")); + vm.expectRevert( + _formatTeleporterErrorMessage("message already delivered") + ); teleporterMessenger.receiveCrossChainMessage( 0, DEFAULT_RELAYER_REWARD_ADDRESS @@ -272,7 +282,7 @@ contract ReceiveCrossChainMessagedTest is TeleporterMessengerTest { _setUpSuccessGetVerifiedWarpMessageMock(0, warpMessage); // Receive the message. - vm.expectRevert(_formatErrorMessage("unauthorized relayer")); + vm.expectRevert(_formatTeleporterErrorMessage("unauthorized relayer")); teleporterMessenger.receiveCrossChainMessage( 0, DEFAULT_RELAYER_REWARD_ADDRESS diff --git a/contracts/src/Teleporter/tests/RedeemRelayerRewardsTests.t.sol b/contracts/src/Teleporter/tests/RedeemRelayerRewardsTests.t.sol index b9c9b969b..6aab1a332 100644 --- a/contracts/src/Teleporter/tests/RedeemRelayerRewardsTests.t.sol +++ b/contracts/src/Teleporter/tests/RedeemRelayerRewardsTests.t.sol @@ -22,7 +22,7 @@ contract RedeemRelayerRewardsTest is TeleporterMessengerTest { } function testZeroRewardBalance() public { - vm.expectRevert(_formatErrorMessage("no reward to redeem")); + vm.expectRevert(_formatTeleporterErrorMessage("no reward to redeem")); teleporterMessenger.redeemRelayerRewards(address(_mockFeeAsset)); } diff --git a/contracts/src/Teleporter/tests/RetryMessageExecutionTests.t.sol b/contracts/src/Teleporter/tests/RetryMessageExecutionTests.t.sol index fc0068a9a..596e58764 100644 --- a/contracts/src/Teleporter/tests/RetryMessageExecutionTests.t.sol +++ b/contracts/src/Teleporter/tests/RetryMessageExecutionTests.t.sol @@ -104,7 +104,9 @@ contract RetryMessageExecutionTest is TeleporterMessengerTest { ) = _receiveFailedMessage(false); // Now retry it in another block with an even timestamp so that it fails again. - vm.expectRevert(_formatErrorMessage("retry execution failed")); + vm.expectRevert( + _formatTeleporterErrorMessage("retry execution failed") + ); teleporterMessenger.retryMessageExecution(originChainID, message); } @@ -120,7 +122,7 @@ contract RetryMessageExecutionTest is TeleporterMessengerTest { message: new bytes(0) }); - vm.expectRevert(_formatErrorMessage("message not found")); + vm.expectRevert(_formatTeleporterErrorMessage("message not found")); teleporterMessenger.retryMessageExecution( DEFAULT_ORIGIN_CHAIN_ID, fakeMessage @@ -137,7 +139,7 @@ contract RetryMessageExecutionTest is TeleporterMessengerTest { // Alter the message before retrying it. message.message = "altered message"; - vm.expectRevert(_formatErrorMessage("invalid message hash")); + vm.expectRevert(_formatTeleporterErrorMessage("invalid message hash")); teleporterMessenger.retryMessageExecution(originChainID, message); } @@ -149,7 +151,7 @@ contract RetryMessageExecutionTest is TeleporterMessengerTest { ) = _successfullyRetryMessage(); // Now try again and make sure it's been cleared from state - vm.expectRevert(_formatErrorMessage("message not found")); + vm.expectRevert(_formatTeleporterErrorMessage("message not found")); teleporterMessenger.retryMessageExecution(originChainID, message); } @@ -191,7 +193,9 @@ contract RetryMessageExecutionTest is TeleporterMessengerTest { // Retrying the message execution should revert since there is still no contract deployed // to the destination address. - vm.expectRevert(_formatErrorMessage("destination address has no code")); + vm.expectRevert( + _formatTeleporterErrorMessage("destination address has no code") + ); teleporterMessenger.retryMessageExecution(originChainID, message); } diff --git a/contracts/src/Teleporter/tests/RetryReceiptTests.t.sol b/contracts/src/Teleporter/tests/RetryReceiptTests.t.sol index cd99d55af..ec7df805b 100644 --- a/contracts/src/Teleporter/tests/RetryReceiptTests.t.sol +++ b/contracts/src/Teleporter/tests/RetryReceiptTests.t.sol @@ -172,7 +172,7 @@ contract RetryReceiptTest is TeleporterMessengerTest { missingIDs[0] = 21; // Try to retry a receipt for an unreceived message from that chain - should fail. - vm.expectRevert(_formatErrorMessage("receipt not found")); + vm.expectRevert(_formatTeleporterErrorMessage("receipt not found")); _retryTestReceiptsWithNoFee(DEFAULT_DESTINATION_CHAIN_ID, missingIDs); } diff --git a/contracts/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol b/contracts/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol index d23a81fcb..67c4c7953 100644 --- a/contracts/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol +++ b/contracts/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol @@ -48,7 +48,7 @@ contract RetrySendCrossChainMessageTest is TeleporterMessengerTest { receipts: new TeleporterMessageReceipt[](0), message: new bytes(0) }); - vm.expectRevert(_formatErrorMessage("message not found")); + vm.expectRevert(_formatTeleporterErrorMessage("message not found")); teleporterMessenger.retrySendCrossChainMessage( DEFAULT_DESTINATION_CHAIN_ID, fakeMessage @@ -72,7 +72,7 @@ contract RetrySendCrossChainMessageTest is TeleporterMessengerTest { }); // Retry it - should fail. - vm.expectRevert(_formatErrorMessage("invalid message hash")); + vm.expectRevert(_formatTeleporterErrorMessage("invalid message hash")); teleporterMessenger.retrySendCrossChainMessage( DEFAULT_DESTINATION_CHAIN_ID, alteredMessage diff --git a/contracts/src/Teleporter/tests/SendCrossChainMessageTests.t.sol b/contracts/src/Teleporter/tests/SendCrossChainMessageTests.t.sol index 68fad83ac..39b72d267 100644 --- a/contracts/src/Teleporter/tests/SendCrossChainMessageTests.t.sol +++ b/contracts/src/Teleporter/tests/SendCrossChainMessageTests.t.sol @@ -210,7 +210,9 @@ contract SendCrossChainMessageTest is TeleporterMessengerTest { message: new bytes(0) }); - vm.expectRevert(_formatErrorMessage("zero fee asset contract address")); + vm.expectRevert( + _formatTeleporterErrorMessage("zero fee asset contract address") + ); teleporterMessenger.sendCrossChainMessage(messageInput); } } diff --git a/contracts/src/Teleporter/tests/TeleporterMessengerTest.t.sol b/contracts/src/Teleporter/tests/TeleporterMessengerTest.t.sol index 6d7f2967e..afd190a1d 100644 --- a/contracts/src/Teleporter/tests/TeleporterMessengerTest.t.sol +++ b/contracts/src/Teleporter/tests/TeleporterMessengerTest.t.sol @@ -300,7 +300,7 @@ contract TeleporterMessengerTest is Test { }); } - function _formatErrorMessage( + function _formatTeleporterErrorMessage( string memory errorMessage ) internal pure returns (bytes memory) { return bytes(string.concat("TeleporterMessenger: ", errorMessage)); From 661e4085875c6e9766da4d660c1cdbf5dd783c4d Mon Sep 17 00:00:00 2001 From: Matthew Lam Date: Thu, 19 Oct 2023 21:52:47 +0000 Subject: [PATCH 20/20] install global instead of local because using as command line --- .github/workflows/linter.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index db5a4c1ab..3b4ecdbce 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -17,8 +17,8 @@ jobs: - name: Install solhint run: | - npm install solhint - npx solhint --version + npm install solhint -g + solhint --version # "solhint **/*.sol" runs differently than "solhint '**/*.sol'", where the latter checks sol files # in subdirectories. The former only checks sol files in the current directory and directories one level down.