From 23b6eaef83823864fa2f25499cc723749648d896 Mon Sep 17 00:00:00 2001 From: Gwen Date: Tue, 26 Sep 2023 15:29:09 -0400 Subject: [PATCH] create abi go binding --- .github/workflows/abibinding.yml | 42 ++ abis/TeleporterMessenger.json | 1053 ++++++++++++++++++++++++++++++ 2 files changed, 1095 insertions(+) create mode 100644 .github/workflows/abibinding.yml create mode 100644 abis/TeleporterMessenger.json diff --git a/.github/workflows/abibinding.yml b/.github/workflows/abibinding.yml new file mode 100644 index 000000000..e194e299f --- /dev/null +++ b/.github/workflows/abibinding.yml @@ -0,0 +1,42 @@ +# Copyright (C) 2023, Ava Labs, Inc. All rights reserved. +# See the file LICENSE for licensing terms. + +name: ABI Go Binding + +on: + push: + branches: + - main + pull_request: + branches: + - "*" + +env: + GO_VERSION: "1.20.7" + +jobs: + abi_binding: + name: abi_binding + runs-on: ubuntu-20.04 + + steps: + - name: Checkout go-ethereum repository + uses: actions/checkout@v4 + with: + repository: ethereum/go-ethereum + ref: v1.13.1 + + - name: Setup Go + uses: actions/setup-go@v4 + with: + go-version: ${{ env.GO_VERSION }} + + - name: Install abigen tool + run: | + make + make devtools + + - name: Create ABI Go bindings + run: | + mkdir -p abis/go/teleport-messenger + abigen --abi abis/TeleporterMessenger.json --pkg teleport_messenger --out abis/go/teleport-messenger/teleport_messenger.go diff --git a/abis/TeleporterMessenger.json b/abis/TeleporterMessenger.json new file mode 100644 index 000000000..27895ece7 --- /dev/null +++ b/abis/TeleporterMessenger.json @@ -0,0 +1,1053 @@ +[ + { + "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": "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": "struct TeleporterFeeInfo", + "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": "struct TeleporterMessageReceipt[]", + "name": "receipts", + "type": "tuple[]" + }, + { + "internalType": "bytes", + "name": "message", + "type": "bytes" + } + ], + "indexed": false, + "internalType": "struct TeleporterMessage", + "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": "struct TeleporterMessageReceipt[]", + "name": "receipts", + "type": "tuple[]" + }, + { + "internalType": "bytes", + "name": "message", + "type": "bytes" + } + ], + "indexed": false, + "internalType": "struct TeleporterMessage", + "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": "struct TeleporterMessageReceipt[]", + "name": "receipts", + "type": "tuple[]" + }, + { + "internalType": "bytes", + "name": "message", + "type": "bytes" + } + ], + "indexed": false, + "internalType": "struct TeleporterMessage", + "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": "contract WarpMessenger", + "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": "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": "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": "struct TeleporterMessageReceipt[]", + "name": "receipts", + "type": "tuple[]" + }, + { + "internalType": "bytes", + "name": "message", + "type": "bytes" + } + ], + "internalType": "struct TeleporterMessage", + "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": "struct TeleporterFeeInfo", + "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": "struct TeleporterMessageReceipt[]", + "name": "receipts", + "type": "tuple[]" + }, + { + "internalType": "bytes", + "name": "message", + "type": "bytes" + } + ], + "internalType": "struct TeleporterMessage", + "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": "struct TeleporterFeeInfo", + "name": "feeInfo", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "requiredGasLimit", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "allowedRelayerAddresses", + "type": "address[]" + }, + { + "internalType": "bytes", + "name": "message", + "type": "bytes" + } + ], + "internalType": "struct TeleporterMessageInput", + "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": "struct TeleporterFeeInfo", + "name": "feeInfo", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file