diff --git a/.gas-snapshot b/.gas-snapshot index b1e7bb03..bc7d9087 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -1,53 +1,53 @@ -IBCMockAppTest:testHandshake() (gas: 3436712) -IBCMockAppTest:testHandshakeBetweenDifferentPorts() (gas: 2543821) -IBCMockAppTest:testPacketRelay() (gas: 9628786) -IBCMockAppTest:testPacketTimeout() (gas: 2924924) -IBCTest:testBenchmarkCreateMockClient() (gas: 209341) -IBCTest:testBenchmarkLCUpdateMockClient() (gas: 39935) -IBCTest:testBenchmarkRecvPacket() (gas: 137264) -IBCTest:testBenchmarkSendPacket() (gas: 85111) -IBCTest:testBenchmarkUpdateMockClient() (gas: 137315) +IBCMockAppTest:testHandshake() (gas: 3435974) +IBCMockAppTest:testHandshakeBetweenDifferentPorts() (gas: 2542936) +IBCMockAppTest:testPacketRelay() (gas: 9616141) +IBCMockAppTest:testPacketTimeout() (gas: 2924777) +IBCTest:testBenchmarkCreateMockClient() (gas: 209339) +IBCTest:testBenchmarkLCUpdateMockClient() (gas: 39945) +IBCTest:testBenchmarkRecvPacket() (gas: 134536) +IBCTest:testBenchmarkSendPacket() (gas: 85126) +IBCTest:testBenchmarkUpdateMockClient() (gas: 137373) IBCTest:testToUint128((uint64,uint64)) (runs: 256, μ: 947, ~: 947) -TestICS02:testCreateClient() (gas: 24730617) -TestICS02:testInvalidCreateClient() (gas: 24578266) -TestICS02:testInvalidUpdateClient() (gas: 24581452) -TestICS02:testRegisterClient() (gas: 24325238) -TestICS02:testRegisterClientDuplicatedClientType() (gas: 24307288) -TestICS02:testRegisterClientInvalidClientType() (gas: 24292160) -TestICS02:testUpdateClient() (gas: 24747541) -TestICS03Handshake:testConnOpenAck() (gas: 1631286) -TestICS03Handshake:testConnOpenConfirm() (gas: 1765699) -TestICS03Handshake:testConnOpenInit() (gas: 1279049) -TestICS03Handshake:testConnOpenTry() (gas: 2160427) -TestICS03Handshake:testInvalidConnOpenAck() (gas: 1943429) -TestICS03Handshake:testInvalidConnOpenConfirm() (gas: 2007619) -TestICS03Handshake:testInvalidConnOpenInit() (gas: 666461) -TestICS03Handshake:testInvalidConnOpenTry() (gas: 2073805) +TestICS02:testCreateClient() (gas: 23647978) +TestICS02:testInvalidCreateClient() (gas: 23497549) +TestICS02:testInvalidUpdateClient() (gas: 23499468) +TestICS02:testRegisterClient() (gas: 23242497) +TestICS02:testRegisterClientDuplicatedClientType() (gas: 23225722) +TestICS02:testRegisterClientInvalidClientType() (gas: 23209851) +TestICS02:testUpdateClient() (gas: 23665020) +TestICS03Handshake:testConnOpenAck() (gas: 1631316) +TestICS03Handshake:testConnOpenConfirm() (gas: 1765734) +TestICS03Handshake:testConnOpenInit() (gas: 1279055) +TestICS03Handshake:testConnOpenTry() (gas: 2160463) +TestICS03Handshake:testInvalidConnOpenAck() (gas: 2031008) +TestICS03Handshake:testInvalidConnOpenConfirm() (gas: 2095567) +TestICS03Handshake:testInvalidConnOpenInit() (gas: 666816) +TestICS03Handshake:testInvalidConnOpenTry() (gas: 2101014) TestICS03Version:testCopyVersions() (gas: 558658) TestICS03Version:testFindSupportedVersion() (gas: 19400) TestICS03Version:testIsSupportedVersion() (gas: 7864) -TestICS03Version:testPickVersion() (gas: 25399) +TestICS03Version:testPickVersion() (gas: 25327) TestICS03Version:testVerifyProposedVersion() (gas: 11777) TestICS03Version:testVerifySupportedFeature() (gas: 4153) -TestICS04Handshake:testBindPort() (gas: 40333) -TestICS04Handshake:testChanClose() (gas: 8475602) -TestICS04Handshake:testChanOpenAck() (gas: 2882165) -TestICS04Handshake:testChanOpenConfirm() (gas: 3062397) -TestICS04Handshake:testChanOpenInit() (gas: 2197364) -TestICS04Handshake:testChanOpenTry() (gas: 2655756) -TestICS04Handshake:testInvalidChanOpenAck() (gas: 2059642) -TestICS04Handshake:testInvalidChanOpenConfirm() (gas: 2117621) -TestICS04Handshake:testInvalidChanOpenInit() (gas: 1272924) -TestICS04Handshake:testInvalidChanOpenTry() (gas: 1348072) -TestICS04Packet:testAcknowledgementPacket() (gas: 2283020) -TestICS04Packet:testInvalidSendPacket() (gas: 2294517) -TestICS04Packet:testRecvPacket() (gas: 7604920) -TestICS04Packet:testRecvPacketTimeoutHeight() (gas: 2320237) -TestICS04Packet:testRecvPacketTimeoutTimestamp() (gas: 2318872) -TestICS04Packet:testSendPacket() (gas: 5093797) -TestICS04Packet:testTimeoutOnClose() (gas: 2507647) -TestICS20:testAddressToHex(address) (runs: 256, μ: 22713, ~: 22824) +TestICS04Handshake:testBindPort() (gas: 38248) +TestICS04Handshake:testChanClose() (gas: 8477010) +TestICS04Handshake:testChanOpenAck() (gas: 2881785) +TestICS04Handshake:testChanOpenConfirm() (gas: 3061565) +TestICS04Handshake:testChanOpenInit() (gas: 2197331) +TestICS04Handshake:testChanOpenTry() (gas: 2655828) +TestICS04Handshake:testInvalidChanOpenAck() (gas: 2061616) +TestICS04Handshake:testInvalidChanOpenConfirm() (gas: 2117572) +TestICS04Handshake:testInvalidChanOpenInit() (gas: 1275175) +TestICS04Handshake:testInvalidChanOpenTry() (gas: 1351818) +TestICS04Packet:testAcknowledgementPacket() (gas: 2283754) +TestICS04Packet:testInvalidSendPacket() (gas: 2288863) +TestICS04Packet:testRecvPacket() (gas: 7612057) +TestICS04Packet:testRecvPacketTimeoutHeight() (gas: 2316335) +TestICS04Packet:testRecvPacketTimeoutTimestamp() (gas: 2315328) +TestICS04Packet:testSendPacket() (gas: 5091415) +TestICS04Packet:testTimeoutOnClose() (gas: 2539103) +TestICS20:testAddressToHex(address) (runs: 256, μ: 22676, ~: 22804) TestICS20:testHexToAddress(string) (runs: 256, μ: 4776, ~: 4734) TestICS20:testIsEscapedString() (gas: 48979) -TestICS20:testMarshaling() (gas: 148145) -TestICS20:testParseAmount(uint256) (runs: 256, μ: 27316, ~: 23633) \ No newline at end of file +TestICS20:testMarshaling() (gas: 148517) +TestICS20:testParseAmount(uint256) (runs: 256, μ: 27026, ~: 21930) \ No newline at end of file diff --git a/contracts/apps/20-transfer/ICS20Bank.sol b/contracts/apps/20-transfer/ICS20Bank.sol index d1db88a8..432862ac 100644 --- a/contracts/apps/20-transfer/ICS20Bank.sol +++ b/contracts/apps/20-transfer/ICS20Bank.sol @@ -7,76 +7,95 @@ import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {Address} from "@openzeppelin/contracts/utils/Address.sol"; import {ICS20Lib} from "./ICS20Lib.sol"; import {IICS20Bank} from "./IICS20Bank.sol"; +import {IICS20Errors} from "./IICS20Errors.sol"; -contract ICS20Bank is Context, AccessControl, IICS20Bank { +contract ICS20Bank is Context, AccessControl, IICS20Bank, IICS20Errors { using Address for address; bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE"); bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR_ROLE"); // Mapping from token ID to account balances - mapping(string => mapping(address => uint256)) private _balances; + mapping(string => mapping(address => uint256)) internal _balances; constructor() { - _setupRole(ADMIN_ROLE, _msgSender()); + _grantRole(ADMIN_ROLE, _msgSender()); } function setOperator(address operator) public virtual { - require(hasRole(ADMIN_ROLE, _msgSender()), "must have admin role to set new operator"); - _setupRole(OPERATOR_ROLE, operator); + if (!hasRole(ADMIN_ROLE, _msgSender())) { + revert ICS20BankNotAdminRole(_msgSender()); + } + _grantRole(OPERATOR_ROLE, operator); } - function balanceOf(address account, string calldata denom) external view virtual returns (uint256) { - require(account != address(0), "ICS20Bank: balance query for the zero address"); + function balanceOf(address account, string calldata denom) public view virtual returns (uint256) { return _balances[denom][account]; } - function transferFrom(address from, address to, string calldata denom, uint256 amount) external virtual override { - require(to != address(0), "ICS20Bank: transfer to the zero address"); - require( - from == _msgSender() || hasRole(OPERATOR_ROLE, _msgSender()), "ICS20Bank: caller is not owner nor approved" - ); + function transferFrom(address from, address to, string calldata denom, uint256 amount) public virtual override { + if (to == address(0)) { + revert ICS20InvalidReceiver(to); + } else if (from != _msgSender() && !hasRole(OPERATOR_ROLE, _msgSender())) { + revert ICS20InvalidSender(from); + } uint256 fromBalance = _balances[denom][from]; - require(fromBalance >= amount, "ICS20Bank: insufficient balance for transfer"); + if (fromBalance < amount) { + revert ICS20InsufficientBalance(from, fromBalance, amount); + } unchecked { _balances[denom][from] = fromBalance - amount; } _balances[denom][to] += amount; } - function mint(address account, string calldata denom, uint256 amount) external virtual override { - require(hasRole(OPERATOR_ROLE, _msgSender()), "ICS20Bank: must have minter role to mint"); + function mint(address account, string calldata denom, uint256 amount) public virtual override { + if (!hasRole(OPERATOR_ROLE, _msgSender())) { + revert ICS20BankNotMintRole(_msgSender()); + } _mint(account, denom, amount); } - function burn(address account, string calldata denom, uint256 amount) external virtual override { - require(hasRole(OPERATOR_ROLE, _msgSender()), "ICS20Bank: must have minter role to mint"); + function burn(address account, string calldata denom, uint256 amount) public virtual override { + if (!hasRole(OPERATOR_ROLE, _msgSender())) { + revert ICS20BankNotBurnRole(_msgSender()); + } _burn(account, denom, amount); } - function addressToDenom(address tokenContract) public pure virtual override returns (string memory) { - return ICS20Lib.addressToHexString(tokenContract); - } - - function deposit(address tokenContract, uint256 amount, address receiver) external virtual override { - require(tokenContract.isContract()); - require(IERC20(tokenContract).transferFrom(_msgSender(), address(this), amount)); + function deposit(address tokenContract, uint256 amount, address receiver) public virtual override { + if (tokenContract == address(0)) { + revert ICS20InvalidTokenContract(tokenContract); + } + if (!IERC20(tokenContract).transferFrom(_msgSender(), address(this), amount)) { + revert ICS20FailedERC20Transfer(tokenContract, _msgSender(), address(this), amount); + } _mint(receiver, addressToDenom(tokenContract), amount); } - function withdraw(address tokenContract, uint256 amount, address receiver) external virtual override { - require(tokenContract.isContract()); + function withdraw(address tokenContract, uint256 amount, address receiver) public virtual override { + if (tokenContract == address(0)) { + revert ICS20InvalidTokenContract(tokenContract); + } _burn(_msgSender(), addressToDenom(tokenContract), amount); - require(IERC20(tokenContract).transfer(receiver, amount)); + if (!IERC20(tokenContract).transfer(receiver, amount)) { + revert ICS20FailedERC20TransferFrom(tokenContract, _msgSender(), address(this), receiver, amount); + } } - function _mint(address account, string memory denom, uint256 amount) internal virtual { + function addressToDenom(address tokenContract) public pure virtual override returns (string memory) { + return ICS20Lib.addressToHexString(tokenContract); + } + + function _mint(address account, string memory denom, uint256 amount) internal { _balances[denom][account] += amount; } - function _burn(address account, string memory denom, uint256 amount) internal virtual { + function _burn(address account, string memory denom, uint256 amount) internal { uint256 accountBalance = _balances[denom][account]; - require(accountBalance >= amount, "ICS20Bank: burn amount exceeds balance"); + if (accountBalance < amount) { + revert ICS20InsufficientBalance(account, accountBalance, amount); + } unchecked { _balances[denom][account] = accountBalance - amount; } diff --git a/contracts/apps/20-transfer/ICS20Lib.sol b/contracts/apps/20-transfer/ICS20Lib.sol index c6f108f7..b24cc2a9 100644 --- a/contracts/apps/20-transfer/ICS20Lib.sol +++ b/contracts/apps/20-transfer/ICS20Lib.sol @@ -2,6 +2,7 @@ pragma solidity ^0.8.20; import {Strings} from "@openzeppelin/contracts/utils/Strings.sol"; +import {IICS20Errors} from "./IICS20Errors.sol"; library ICS20Lib { /** @@ -15,9 +16,9 @@ library ICS20Lib { string memo; } - bytes public constant SUCCESSFUL_ACKNOWLEDGEMENT_JSON = bytes('{"result":"AQ=="}'); - bytes public constant FAILED_ACKNOWLEDGEMENT_JSON = bytes('{"error":"failed"}'); - bytes32 public constant KECCAK256_SUCCESSFUL_ACKNOWLEDGEMENT_JSON = keccak256(SUCCESSFUL_ACKNOWLEDGEMENT_JSON); + bytes internal constant SUCCESSFUL_ACKNOWLEDGEMENT_JSON = bytes('{"result":"AQ=="}'); + bytes internal constant FAILED_ACKNOWLEDGEMENT_JSON = bytes('{"error":"failed"}'); + bytes32 internal constant KECCAK256_SUCCESSFUL_ACKNOWLEDGEMENT_JSON = keccak256(SUCCESSFUL_ACKNOWLEDGEMENT_JSON); uint256 private constant CHAR_DOUBLE_QUOTE = 0x22; uint256 private constant CHAR_SLASH = 0x2f; @@ -99,24 +100,35 @@ library ICS20Lib { uint256 pos = 0; unchecked { - require(bytes32(bz[pos:pos + 11]) == bytes32('{"amount":"'), "amount"); + if (bytes32(bz[pos:pos + 11]) != bytes32('{"amount":"')) { + revert IICS20Errors.ICS20JSONUnexpectedBytes(pos, bytes32('{"amount":"'), bytes32(bz[pos:pos + 11])); + } (pd.amount, pos) = parseUint256String(bz, pos + 11); - - require(bytes32(bz[pos:pos + 10]) == bytes32(',"denom":"'), "denom"); + if (bytes32(bz[pos:pos + 10]) != bytes32(',"denom":"')) { + revert IICS20Errors.ICS20JSONUnexpectedBytes(pos, bytes32(',"denom":"'), bytes32(bz[pos:pos + 10])); + } (pd.denom, pos) = parseString(bz, pos + 10); if (uint256(uint8(bz[pos + 2])) == CHAR_M) { - require(bytes32(bz[pos:pos + 9]) == bytes32(',"memo":"'), "memo"); + if (bytes32(bz[pos:pos + 9]) != bytes32(',"memo":"')) { + revert IICS20Errors.ICS20JSONUnexpectedBytes(pos, bytes32(',"memo":"'), bytes32(bz[pos:pos + 9])); + } (pd.memo, pos) = parseString(bz, pos + 9); } - require(bytes32(bz[pos:pos + 13]) == bytes32(',"receiver":"'), "receiver"); + if (bytes32(bz[pos:pos + 13]) != bytes32(',"receiver":"')) { + revert IICS20Errors.ICS20JSONUnexpectedBytes(pos, bytes32(',"receiver":"'), bytes32(bz[pos:pos + 13])); + } (pd.receiver, pos) = parseString(bz, pos + 13); - require(bytes32(bz[pos:pos + 11]) == bytes32(',"sender":"'), "sender"); + if (bytes32(bz[pos:pos + 11]) != bytes32(',"sender":"')) { + revert IICS20Errors.ICS20JSONUnexpectedBytes(pos, bytes32(',"sender":"'), bytes32(bz[pos:pos + 11])); + } (pd.sender, pos) = parseString(bz, pos + 11); - require(pos == bz.length - 1 && uint256(uint8(bz[pos])) == CHAR_CLOSING_BRACE, "closing brace"); + if (pos != bz.length - 1 || uint256(uint8(bz[pos])) != CHAR_CLOSING_BRACE) { + revert IICS20Errors.ICS20JSONClosingBraceNotFound(pos, bz[pos]); + } } return pd; @@ -135,7 +147,9 @@ library ICS20Lib { } ret = ret * 10 + (c - 48); } - require(pos < bz.length && uint256(uint8(bz[pos])) == CHAR_DOUBLE_QUOTE, "unterminated string"); + if (pos >= bz.length || uint256(uint8(bz[pos])) != CHAR_DOUBLE_QUOTE) { + revert IICS20Errors.ICS20JSONStringClosingDoubleQuoteNotFound(pos, bz[pos]); + } return (ret, pos + 1); } } @@ -152,15 +166,16 @@ library ICS20Lib { } else if (c == CHAR_BACKSLASH && i + 1 < bz.length) { i++; c = uint256(uint8(bz[i])); - require( - c == CHAR_DOUBLE_QUOTE || c == CHAR_SLASH || c == CHAR_BACKSLASH || c == CHAR_F || c == CHAR_R - || c == CHAR_N || c == CHAR_B || c == CHAR_T, - "invalid escape" - ); + if ( + c != CHAR_DOUBLE_QUOTE && c != CHAR_SLASH && c != CHAR_BACKSLASH && c != CHAR_F && c != CHAR_R + && c != CHAR_N && c != CHAR_B && c != CHAR_T + ) { + revert IICS20Errors.ICS20JSONInvalidEscape(i, bz[i]); + } } } } - revert("unterminated string"); + revert IICS20Errors.ICS20JSONStringUnclosed(bz, pos); } function isEscapedJSONString(string calldata s) internal pure returns (bool) { @@ -211,9 +226,6 @@ library ICS20Lib { localValue >>= 4; } } - if (localValue != 0) { - revert("insufficient hex length"); - } return string(buffer); } @@ -250,8 +262,11 @@ library ICS20Lib { * This is a copy from https://github.com/GNSPS/solidity-bytes-utils/blob/v0.8.0/contracts/BytesLib.sol */ function slice(bytes memory _bytes, uint256 _start, uint256 _length) internal pure returns (bytes memory) { - require(_length + 31 >= _length, "slice_overflow"); - require(_bytes.length >= _start + _length, "slice_outOfBounds"); + if (_length + 31 < _length) { + revert IICS20Errors.ICS20BytesSliceOverflow(_length); + } else if (_start + _length > _bytes.length) { + revert IICS20Errors.ICS20BytesSliceOutOfBounds(_bytes.length, _start, _start + _length); + } bytes memory tempBytes; diff --git a/contracts/apps/20-transfer/ICS20Transfer.sol b/contracts/apps/20-transfer/ICS20Transfer.sol index b026486e..190ff736 100644 --- a/contracts/apps/20-transfer/ICS20Transfer.sol +++ b/contracts/apps/20-transfer/ICS20Transfer.sol @@ -5,8 +5,9 @@ import {IBCAppBase} from "../commons/IBCAppBase.sol"; import {IIBCModule} from "../../core/26-router/IIBCModule.sol"; import {Channel, Packet} from "../../proto/Channel.sol"; import {ICS20Lib} from "./ICS20Lib.sol"; +import {IICS20Errors} from "./IICS20Errors.sol"; -abstract contract ICS20Transfer is IBCAppBase { +abstract contract ICS20Transfer is IBCAppBase, IICS20Errors { string public constant ICS20_VERSION = "ics20-1"; mapping(string => address) channelEscrowAddresses; @@ -34,7 +35,7 @@ abstract contract ICS20Transfer is IBCAppBase { ) { // sender chain is not the source, unescrow tokens bytes memory unprefixedDenom = ICS20Lib.slice(denom, denomPrefix.length, denom.length - denomPrefix.length); - success = _transferFrom( + success = _tryTransferFrom( _getEscrowAddress(packet.destination_channel), receiver, string(unprefixedDenom), data.amount ); } else { @@ -44,7 +45,7 @@ abstract contract ICS20Transfer is IBCAppBase { if (ICS20Lib.isEscapeNeededString(denom)) { success = false; } else { - success = _mint( + success = _tryMint( receiver, string( abi.encodePacked(_getDenomPrefix(packet.destination_port, packet.destination_channel), denom) @@ -78,9 +79,13 @@ abstract contract ICS20Transfer is IBCAppBase { onlyIBC returns (string memory) { - require(msg_.order == Channel.Order.ORDER_UNORDERED, "must be unordered"); + if (msg_.order != Channel.Order.ORDER_UNORDERED) { + revert IBCModuleChannelOrderNotAllowed(msg_.portId, msg_.channelId, msg_.order); + } bytes memory versionBytes = bytes(msg_.version); - require(versionBytes.length == 0 || keccak256(versionBytes) == keccak256(bytes(ICS20_VERSION))); + if (versionBytes.length != 0 && keccak256(versionBytes) != keccak256(bytes(ICS20_VERSION))) { + revert ICS20UnexpectedVersion(msg_.version); + } channelEscrowAddresses[msg_.channelId] = address(this); return ICS20_VERSION; } @@ -92,18 +97,24 @@ abstract contract ICS20Transfer is IBCAppBase { onlyIBC returns (string memory) { - require(msg_.order == Channel.Order.ORDER_UNORDERED, "must be unordered"); - require(keccak256(bytes(msg_.counterpartyVersion)) == keccak256(bytes(ICS20_VERSION))); + if (msg_.order != Channel.Order.ORDER_UNORDERED) { + revert IBCModuleChannelOrderNotAllowed(msg_.portId, msg_.channelId, msg_.order); + } + if (keccak256(bytes(msg_.counterpartyVersion)) != keccak256(bytes(ICS20_VERSION))) { + revert ICS20UnexpectedVersion(msg_.counterpartyVersion); + } channelEscrowAddresses[msg_.channelId] = address(this); return ICS20_VERSION; } function onChanOpenAck(IIBCModule.MsgOnChanOpenAck calldata msg_) external virtual override onlyIBC { - require(keccak256(bytes(msg_.counterpartyVersion)) == keccak256(bytes(ICS20_VERSION))); + if (keccak256(bytes(msg_.counterpartyVersion)) != keccak256(bytes(ICS20_VERSION))) { + revert ICS20UnexpectedVersion(msg_.counterpartyVersion); + } } - function onChanCloseInit(IIBCModule.MsgOnChanCloseInit calldata) external virtual override onlyIBC { - revert("not allowed"); + function onChanCloseInit(IIBCModule.MsgOnChanCloseInit calldata msg_) external virtual override onlyIBC { + revert IBCModuleChannelCloseNotAllowed(msg_.portId, msg_.channelId); } function onTimeoutPacket(Packet.Data calldata packet, address) external virtual override onlyIBC { @@ -112,7 +123,9 @@ abstract contract ICS20Transfer is IBCAppBase { function _getEscrowAddress(string memory sourceChannel) internal view virtual returns (address) { address escrow = channelEscrowAddresses[sourceChannel]; - require(escrow != address(0)); + if (escrow == address(0)) { + revert ICS20EscrowAddressNotFound(sourceChannel); + } return escrow; } @@ -126,12 +139,10 @@ abstract contract ICS20Transfer is IBCAppBase { denom.length >= denomPrefix.length && ICS20Lib.equal(ICS20Lib.slice(denom, 0, denomPrefix.length), denomPrefix) ) { - require(_mint(_decodeSender(data.sender), data.denom, data.amount)); + _mint(_decodeSender(data.sender), data.denom, data.amount); } else { // sender was source chain - require( - _transferFrom(_getEscrowAddress(sourceChannel), _decodeSender(data.sender), data.denom, data.amount) - ); + _transferFrom(_getEscrowAddress(sourceChannel), _decodeSender(data.sender), data.denom, data.amount); } } @@ -142,20 +153,38 @@ abstract contract ICS20Transfer is IBCAppBase { /** * @dev _transferFrom transfers tokens from `sender` to `receiver` in the bank. */ - function _transferFrom(address sender, address receiver, string memory denom, uint256 amount) + function _transferFrom(address sender, address receiver, string memory denom, uint256 amount) internal virtual; + + /** + * @dev _burn burns tokens from `account` in the bank. + */ + function _burn(address account, string memory denom, uint256 amount) internal virtual; + + /** + * @dev _mint mints tokens to `account` in the bank. + */ + function _mint(address account, string memory denom, uint256 amount) internal virtual; + + /** + * @dev _tryTransferFrom transfers tokens from `sender` to `receiver` in the bank. + * If the transfer fails, it returns false and does not revert. + */ + function _tryTransferFrom(address sender, address receiver, string memory denom, uint256 amount) internal virtual returns (bool); /** - * @dev _mint mints tokens to `account` in the bank. + * @dev _tryMint mints tokens to `account` in the bank. + * If the mint fails, it returns false and does not revert. */ - function _mint(address account, string memory denom, uint256 amount) internal virtual returns (bool); + function _tryMint(address account, string memory denom, uint256 amount) internal virtual returns (bool); /** - * @dev _burn burns tokens from `account` in the bank. + * @dev _tryBurn burns tokens from `account` in the bank. + * If the burn fails, it returns false and does not revert. */ - function _burn(address account, string memory denom, uint256 amount) internal virtual returns (bool); + function _tryBurn(address account, string memory denom, uint256 amount) internal virtual returns (bool); /** * @dev _encodeSender encodes an address to a hex string. @@ -171,7 +200,9 @@ abstract contract ICS20Transfer is IBCAppBase { */ function _decodeSender(string memory sender) internal pure virtual returns (address) { (address addr, bool ok) = ICS20Lib.hexStringToAddress(sender); - require(ok, "invalid address"); + if (!ok) { + revert ICS20InvalidSenderAddress(sender); + } return addr; } diff --git a/contracts/apps/20-transfer/ICS20TransferBank.sol b/contracts/apps/20-transfer/ICS20TransferBank.sol index ac4e9401..7b625e8a 100644 --- a/contracts/apps/20-transfer/ICS20TransferBank.sol +++ b/contracts/apps/20-transfer/ICS20TransferBank.sol @@ -33,7 +33,9 @@ contract ICS20TransferBank is ICS20Transfer { string calldata sourceChannel, uint64 timeoutHeight ) external { - require(ICS20Lib.isEscapedJSONString(receiver), "unescaped receiver"); + if (!ICS20Lib.isEscapedJSONString(receiver)) { + revert ICS20InvalidReceiverAddress(receiver); + } bytes memory denomPrefix = _getDenomPrefix(sourcePort, sourceChannel); bytes memory denomBytes = bytes(denom); if ( @@ -41,9 +43,9 @@ contract ICS20TransferBank is ICS20Transfer { || !ICS20Lib.equal(ICS20Lib.slice(denomBytes, 0, denomPrefix.length), denomPrefix) ) { // sender is source chain - require(_transferFrom(_msgSender(), _getEscrowAddress(sourceChannel), denom, amount)); + _transferFrom(_msgSender(), _getEscrowAddress(sourceChannel), denom, amount); } else { - require(_burn(_msgSender(), denom, amount)); + _burn(_msgSender(), denom, amount); } bytes memory packetData = ICS20Lib.marshalJSON(denom, amount, _encodeSender(_msgSender()), receiver); IIBCHandler(ibcAddress()).sendPacket( @@ -51,7 +53,11 @@ contract ICS20TransferBank is ICS20Transfer { ); } - function _transferFrom(address sender, address receiver, string memory denom, uint256 amount) + function _transferFrom(address sender, address receiver, string memory denom, uint256 amount) internal override { + bank.transferFrom(sender, receiver, denom, amount); + } + + function _tryTransferFrom(address sender, address receiver, string memory denom, uint256 amount) internal override returns (bool) @@ -63,7 +69,11 @@ contract ICS20TransferBank is ICS20Transfer { } } - function _mint(address account, string memory denom, uint256 amount) internal override returns (bool) { + function _mint(address account, string memory denom, uint256 amount) internal override { + bank.mint(account, denom, amount); + } + + function _tryMint(address account, string memory denom, uint256 amount) internal override returns (bool) { try bank.mint(account, denom, amount) { return true; } catch (bytes memory) { @@ -71,7 +81,11 @@ contract ICS20TransferBank is ICS20Transfer { } } - function _burn(address account, string memory denom, uint256 amount) internal override returns (bool) { + function _burn(address account, string memory denom, uint256 amount) internal override { + bank.burn(account, denom, amount); + } + + function _tryBurn(address account, string memory denom, uint256 amount) internal override returns (bool) { try bank.burn(account, denom, amount) { return true; } catch (bytes memory) { diff --git a/contracts/apps/20-transfer/IICS20Errors.sol b/contracts/apps/20-transfer/IICS20Errors.sol new file mode 100644 index 00000000..2ef576b6 --- /dev/null +++ b/contracts/apps/20-transfer/IICS20Errors.sol @@ -0,0 +1,62 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity ^0.8.20; + +interface IICS20Errors { + /// @param channelId Channel identifier + error ICS20EscrowAddressNotFound(string channelId); + /// @param version Version string + error ICS20UnexpectedVersion(string version); + /// @param sender Address of the sender + error ICS20BankNotAdminRole(address sender); + /// @param sender Address of the sender + error ICS20BankNotMintRole(address sender); + /// @param sender Address of the sender + error ICS20BankNotBurnRole(address sender); + /// @param tokenContract Address of the token contract + error ICS20InvalidTokenContract(address tokenContract); + /// @param tokenContract Address of the token contract + /// @param from Address from which tokens are being transferred + /// @param to Address to which tokens are being transferred + /// @param amount Amount of tokens being transferred + error ICS20FailedERC20Transfer(address tokenContract, address from, address to, uint256 amount); + /// @param tokenContract Address of the token contract + /// @param sender Address whose tokens are being transferred + /// @param from Address from which tokens are being transferred + /// @param to Address to which tokens are being transferred + /// @param amount Amount of tokens being transferred + error ICS20FailedERC20TransferFrom(address tokenContract, address sender, address from, address to, uint256 amount); + /// @param sender Address whose tokens are being transferred + /// @param balance Current balance for the interacting account + /// @param needed Minimum amount required to perform a transfer + error ICS20InsufficientBalance(address sender, uint256 balance, uint256 needed); + /// @param sender Address whose tokens are being transferred + error ICS20InvalidSender(address sender); + /// @param receiver Address to which tokens are being transferred + error ICS20InvalidReceiver(address receiver); + /// @param sender Address of the sender + error ICS20InvalidSenderAddress(string sender); + /// @param receiver Address of the receiver + error ICS20InvalidReceiverAddress(string receiver); + /// @param position position in packet data bytes + /// @param expected expected bytes + /// @param actual actual bytes + error ICS20JSONUnexpectedBytes(uint256 position, bytes32 expected, bytes32 actual); + /// @param position position in packet data bytes + /// @param actual actual value + error ICS20JSONClosingBraceNotFound(uint256 position, bytes1 actual); + /// @param position position in packet data bytes + /// @param actual actual value + error ICS20JSONStringClosingDoubleQuoteNotFound(uint256 position, bytes1 actual); + /// @param bz json string value + /// @param position position in packet data bytes + error ICS20JSONStringUnclosed(bytes bz, uint256 position); + /// @param position position in packet data bytes + /// @param actual actual value + error ICS20JSONInvalidEscape(uint256 position, bytes1 actual); + /// @param length length of the slice + error ICS20BytesSliceOverflow(uint256 length); + /// @param length length of the bytes + /// @param start start index + /// @param end end index + error ICS20BytesSliceOutOfBounds(uint256 length, uint256 start, uint256 end); +} diff --git a/contracts/apps/commons/IBCAppBase.sol b/contracts/apps/commons/IBCAppBase.sol index 32be412f..d03a9574 100644 --- a/contracts/apps/commons/IBCAppBase.sol +++ b/contracts/apps/commons/IBCAppBase.sol @@ -4,11 +4,12 @@ pragma solidity ^0.8.20; import {Context} from "@openzeppelin/contracts/utils/Context.sol"; import {Packet} from "../../proto/Channel.sol"; import {IIBCModule} from "../../core/26-router/IIBCModule.sol"; +import {IIBCModuleErrors} from "../../core/26-router/IIBCModuleErrors.sol"; /** * @dev Base contract of the IBC App protocol */ -abstract contract IBCAppBase is Context, IIBCModule { +abstract contract IBCAppBase is Context, IIBCModule, IIBCModuleErrors { /** * @dev Throws if called by any account other than the IBC contract. */ @@ -26,7 +27,9 @@ abstract contract IBCAppBase is Context, IIBCModule { * @dev Throws if the sender is not the IBC contract. */ function _checkIBC() internal view virtual { - require(ibcAddress() == _msgSender(), "IBCAppBase: caller is not the IBC contract"); + if (ibcAddress() != _msgSender()) { + revert IBCModuleInvalidSender(_msgSender()); + } } /** diff --git a/contracts/apps/mock/IBCMockApp.sol b/contracts/apps/mock/IBCMockApp.sol index 82cd62b9..e952f0bf 100644 --- a/contracts/apps/mock/IBCMockApp.sol +++ b/contracts/apps/mock/IBCMockApp.sol @@ -8,15 +8,16 @@ import {IBCAppBase} from "../commons/IBCAppBase.sol"; import {IIBCModule} from "../../core/26-router/IIBCModule.sol"; import {IIBCHandler} from "../../core/25-handler/IIBCHandler.sol"; import {IBCMockLib} from "./IBCMockLib.sol"; +import {IIBCMockErrors} from "./IIBCMockErrors.sol"; -contract IBCMockApp is IBCAppBase, Ownable { +contract IBCMockApp is IBCAppBase, IIBCMockErrors, Ownable { string public constant MOCKAPP_VERSION = "mockapp-1"; IIBCHandler immutable ibcHandler; bool public closeChannelAllowed = true; - constructor(IIBCHandler ibcHandler_) { + constructor(IIBCHandler ibcHandler_) Ownable(msg.sender) { ibcHandler = ibcHandler_; } @@ -69,13 +70,21 @@ contract IBCMockApp is IBCAppBase, Ownable { onlyIBC { if (equals(packet.data, IBCMockLib.MOCK_PACKET_DATA)) { - require(equals(acknowledgement, IBCMockLib.SUCCESSFUL_ACKNOWLEDGEMENT_JSON), "invalid ack"); + if (!equals(acknowledgement, IBCMockLib.SUCCESSFUL_ACKNOWLEDGEMENT_JSON)) { + revert IBCMockUnexpectedAcknowledgement(acknowledgement, IBCMockLib.SUCCESSFUL_ACKNOWLEDGEMENT_JSON); + } } else if (equals(packet.data, IBCMockLib.MOCK_ASYNC_PACKET_DATA)) { - require(equals(acknowledgement, IBCMockLib.SUCCESSFUL_ASYNC_ACKNOWLEDGEMENT_JSON), "invalid async ack"); + if (!equals(acknowledgement, IBCMockLib.SUCCESSFUL_ASYNC_ACKNOWLEDGEMENT_JSON)) { + revert IBCMockUnexpectedAcknowledgement( + acknowledgement, IBCMockLib.SUCCESSFUL_ASYNC_ACKNOWLEDGEMENT_JSON + ); + } } else if (equals(packet.data, IBCMockLib.MOCK_FAIL_PACKET_DATA)) { - require(equals(acknowledgement, IBCMockLib.FAILED_ACKNOWLEDGEMENT_JSON), "invalid failed ack"); + if (!equals(acknowledgement, IBCMockLib.FAILED_ACKNOWLEDGEMENT_JSON)) { + revert IBCMockUnexpectedAcknowledgement(acknowledgement, IBCMockLib.FAILED_ACKNOWLEDGEMENT_JSON); + } } else { - revert("invalid packet data"); + revert IBCMockUnexpectedPacket(packet.data); } } @@ -86,10 +95,9 @@ contract IBCMockApp is IBCAppBase, Ownable { onlyIBC returns (string memory) { - require( - bytes(msg_.version).length == 0 || keccak256(bytes(msg_.version)) == keccak256(bytes(MOCKAPP_VERSION)), - "version mismatch" - ); + if (bytes(msg_.version).length != 0 && keccak256(bytes(msg_.version)) != keccak256(bytes(MOCKAPP_VERSION))) { + revert IBCMockUnexpectedVersion(msg_.version, MOCKAPP_VERSION); + } return MOCKAPP_VERSION; } @@ -100,20 +108,28 @@ contract IBCMockApp is IBCAppBase, Ownable { onlyIBC returns (string memory) { - require(keccak256(bytes(msg_.counterpartyVersion)) == keccak256(bytes(MOCKAPP_VERSION)), "version mismatch"); + if (keccak256(bytes(msg_.counterpartyVersion)) != keccak256(bytes(MOCKAPP_VERSION))) { + revert IBCMockUnexpectedVersion(msg_.counterpartyVersion, MOCKAPP_VERSION); + } return MOCKAPP_VERSION; } - function onChanCloseInit(IIBCModule.MsgOnChanCloseInit calldata) external virtual override onlyIBC { - require(closeChannelAllowed, "close not allowed"); + function onChanCloseInit(IIBCModule.MsgOnChanCloseInit calldata msg_) external virtual override onlyIBC { + if (!closeChannelAllowed) { + revert IBCModuleChannelCloseNotAllowed(msg_.portId, msg_.channelId); + } } - function onChanCloseConfirm(IIBCModule.MsgOnChanCloseConfirm calldata) external virtual override onlyIBC { - require(closeChannelAllowed, "close not allowed"); + function onChanCloseConfirm(IIBCModule.MsgOnChanCloseConfirm calldata msg_) external virtual override onlyIBC { + if (!closeChannelAllowed) { + revert IBCModuleChannelCloseNotAllowed(msg_.portId, msg_.channelId); + } } - function onTimeoutPacket(Packet.Data calldata, address) external view override onlyIBC { - require(closeChannelAllowed, "timeout not allowed"); + function onTimeoutPacket(Packet.Data calldata packet, address) external view override onlyIBC { + if (!closeChannelAllowed) { + revert IBCModuleChannelCloseNotAllowed(packet.source_port, packet.source_channel); + } } function equals(bytes calldata a, bytes memory b) private pure returns (bool) { diff --git a/contracts/apps/mock/IIBCMockErrors.sol b/contracts/apps/mock/IIBCMockErrors.sol new file mode 100644 index 00000000..0a6b2977 --- /dev/null +++ b/contracts/apps/mock/IIBCMockErrors.sol @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity ^0.8.20; + +interface IIBCMockErrors { + /// @dev An error indicating that the version is unexpected + /// @param actual Actual version + /// @param expected Expected version + error IBCMockUnexpectedVersion(string actual, string expected); + + /// @dev An error indicating that the packet acknowledgement is unexpected + error IBCMockUnexpectedAcknowledgement(bytes actual, bytes expected); + + /// @dev An error indicating that the packet is unexpected + error IBCMockUnexpectedPacket(bytes actual); +} diff --git a/contracts/clients/IBFT2Client.sol b/contracts/clients/IBFT2Client.sol index 463e9dce..24483c8d 100644 --- a/contracts/clients/IBFT2Client.sol +++ b/contracts/clients/IBFT2Client.sol @@ -2,6 +2,7 @@ pragma solidity ^0.8.20; import {ILightClient} from "../core/02-client/ILightClient.sol"; +import {ILightClientErrors} from "../core/02-client/ILightClientErrors.sol"; import {IBCHeight} from "../core/02-client/IBCHeight.sol"; import {IIBCHandler} from "../core/25-handler/IIBCHandler.sol"; import {Height} from "../proto/Client.sol"; @@ -15,31 +16,13 @@ import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import {RLPReader} from "solidity-rlp/contracts/RLPReader.sol"; import {MPTProof} from "solidity-mpt/src/MPTProof.sol"; -// please see docs/ibft2-light-client.md for client spec -contract IBFT2Client is ILightClient { +/// @notice please see docs/ibft2-light-client.md for client spec +contract IBFT2Client is ILightClient, ILightClientErrors { using MPTProof for bytes; using RLPReader for RLPReader.RLPItem; using RLPReader for bytes; using IBCHeight for Height.Data; - string private constant HEADER_TYPE_URL = "/ibc.lightclients.ibft2.v1.Header"; - string private constant CLIENT_STATE_TYPE_URL = "/ibc.lightclients.ibft2.v1.ClientState"; - string private constant CONSENSUS_STATE_TYPE_URL = "/ibc.lightclients.ibft2.v1.ConsensusState"; - - bytes32 private constant HEADER_TYPE_URL_HASH = keccak256(abi.encodePacked(HEADER_TYPE_URL)); - bytes32 private constant CLIENT_STATE_TYPE_URL_HASH = keccak256(abi.encodePacked(CLIENT_STATE_TYPE_URL)); - bytes32 private constant CONSENSUS_STATE_TYPE_URL_HASH = keccak256(abi.encodePacked(CONSENSUS_STATE_TYPE_URL)); - - uint256 private constant COMMITMENT_SLOT = 0; - uint8 private constant ACCOUNT_STORAGE_ROOT_INDEX = 2; - - address internal immutable ibcHandler; - - mapping(string => ClientState.Data) internal clientStates; - mapping(string => mapping(uint128 => ConsensusState.Data)) internal consensusStates; - mapping(string => mapping(uint128 => uint256)) internal processedTimes; - mapping(string => mapping(uint128 => uint256)) internal processedHeights; - struct ParsedBesuHeader { Header.Data base; Height.Data height; @@ -48,10 +31,44 @@ contract IBFT2Client is ILightClient { RLPReader.RLPItem[] validators; } - struct Fraction { - uint64 numerator; - uint64 denominator; - } + /// @dev An error indicating that the IBC address of the initial client state is invalid + error InvalidIBCAddressLength(); + /// @dev An error indicating that the initial consensus state root length is invalid + error InvalidConsensusStateRootLength(); + /// @dev An error indicating that the validator set is empty + error EmptyValidators(); + /// @dev An error indicating that a validator address length is invalid + error InvalidValidatorAddressLength(); + /// @param itemsLength length of items in the header + error UnexpectedEthereumHeaderFormat(uint256 itemsLength); + /// @param itemsLength length of items in the extra data + error UnexpectedExtraDataFormat(uint256 itemsLength); + /// @param actual actual number of valid seals + /// @param threshold threshold of seals + error InsufficientTrustedValidatorsSeals(uint256 actual, uint256 threshold); + /// @param actual actual number of valid seals + /// @param threshold threshold of seals + error InsuffientUntrustedValidatorsSeals(uint256 actual, uint256 threshold); + /// @param length length of the signature + error InvalidECDSASignatureLength(uint256 length); + + string internal constant HEADER_TYPE_URL = "/ibc.lightclients.ibft2.v1.Header"; + string internal constant CLIENT_STATE_TYPE_URL = "/ibc.lightclients.ibft2.v1.ClientState"; + string internal constant CONSENSUS_STATE_TYPE_URL = "/ibc.lightclients.ibft2.v1.ConsensusState"; + + bytes32 internal constant HEADER_TYPE_URL_HASH = keccak256(abi.encodePacked(HEADER_TYPE_URL)); + bytes32 internal constant CLIENT_STATE_TYPE_URL_HASH = keccak256(abi.encodePacked(CLIENT_STATE_TYPE_URL)); + bytes32 internal constant CONSENSUS_STATE_TYPE_URL_HASH = keccak256(abi.encodePacked(CONSENSUS_STATE_TYPE_URL)); + + uint256 internal constant COMMITMENT_SLOT = 0; + uint8 internal constant ACCOUNT_STORAGE_ROOT_INDEX = 2; + + address internal immutable ibcHandler; + + mapping(string => ClientState.Data) internal clientStates; + mapping(string => mapping(uint128 => ConsensusState.Data)) internal consensusStates; + mapping(string => mapping(uint128 => uint256)) internal processedTimes; + mapping(string => mapping(uint128 => uint256)) internal processedHeights; constructor(address ibcHandler_) { ibcHandler = ibcHandler_; @@ -67,8 +84,15 @@ contract IBFT2Client is ILightClient { ) external override onlyIBC returns (Height.Data memory height) { ClientState.Data memory clientState = unmarshalClientState(protoClientState); ConsensusState.Data memory consensusState = unmarshalConsensusState(protoConsensusState); - require(clientState.ibc_store_address.length == 20, "invalid address length"); - require(consensusState.root.length == 32, "invalid root length"); + if (clientState.ibc_store_address.length != 20) { + revert InvalidIBCAddressLength(); + } + if (consensusState.root.length != 32) { + revert InvalidConsensusStateRootLength(); + } + if (consensusState.validators.length == 0) { + revert EmptyValidators(); + } clientStates[clientId] = clientState; consensusStates[clientId][clientState.latest_height.toUint128()] = consensusState; return clientState.latest_height; @@ -100,7 +124,9 @@ contract IBFT2Client is ILightClient { returns (uint64) { ConsensusState.Data storage consensusState = consensusStates[clientId][height.toUint128()]; - require(consensusState.timestamp != 0, "consensus state not found"); + if (consensusState.timestamp == 0) { + revert ConsensusStateNotFound(clientId, height); + } // ConsensState.timestamp is seconds since unix epoch, so need to convert it to nanoseconds return consensusState.timestamp * 1e9; } @@ -110,7 +136,9 @@ contract IBFT2Client is ILightClient { */ function getLatestHeight(string calldata clientId) external view override returns (Height.Data memory) { ClientState.Data storage clientState = clientStates[clientId]; - require(clientState.latest_height.revision_height != 0, "client not found"); + if (clientState.latest_height.revision_height == 0) { + revert ClientStateNotFound(clientId); + } return clientState.latest_height; } @@ -121,6 +149,9 @@ contract IBFT2Client is ILightClient { return ILightClient.ClientStatus.Active; } + /** + * @dev updateClient updates the client with the given header + */ function updateClient(string calldata clientId, Header.Data calldata header) public returns (Height.Data[] memory heights) @@ -129,15 +160,17 @@ contract IBFT2Client is ILightClient { assert(clientState.ibc_store_address.length != 0); ParsedBesuHeader memory parsedHeader = parseBesuHeader(header); - require(parsedHeader.height.gt(clientState.latest_height), "header height <= consensus state height"); uint128 newHeight = parsedHeader.height.toUint128(); ConsensusState.Data storage trustedConsensusState = consensusStates[clientId][header.trusted_height.toUint128()]; - require(trustedConsensusState.timestamp != 0); - - (bytes[] memory validators, bool ok) = verify(trustedConsensusState.validators, parsedHeader); - require(ok, "failed to verify the header"); + if (trustedConsensusState.timestamp == 0) { + revert ConsensusStateNotFound(clientId, header.trusted_height); + } + bytes[] memory validators = verify(trustedConsensusState.validators, parsedHeader); + if (validators.length == 0) { + revert EmptyValidators(); + } if (parsedHeader.height.gt(clientState.latest_height)) { clientState.latest_height = parsedHeader.height; } @@ -176,7 +209,9 @@ contract IBFT2Client is ILightClient { return false; } ConsensusState.Data storage consensusState = consensusStates[clientId][height.toUint128()]; - require(consensusState.timestamp != 0); + if (consensusState.timestamp == 0) { + revert ConsensusStateNotFound(clientId, height); + } return verifyMembership( proof, bytes32(consensusState.root), @@ -202,7 +237,9 @@ contract IBFT2Client is ILightClient { return false; } ConsensusState.Data storage consensusState = consensusStates[clientId][height.toUint128()]; - require(consensusState.timestamp != 0); + if (consensusState.timestamp == 0) { + revert ConsensusStateNotFound(clientId, height); + } return verifyNonMembership( proof, bytes32(consensusState.root), keccak256(abi.encodePacked(keccak256(path), COMMITMENT_SLOT)) ); @@ -224,13 +261,17 @@ contract IBFT2Client is ILightClient { function unmarshalHeader(bytes calldata bz) internal pure returns (Header.Data memory header) { Any.Data memory anyHeader = Any.decode(bz); - require(keccak256(abi.encodePacked(anyHeader.type_url)) == HEADER_TYPE_URL_HASH, "invalid header type url"); + if (keccak256(abi.encodePacked(anyHeader.type_url)) != HEADER_TYPE_URL_HASH) { + revert UnexpectedProtoAnyTypeURL(anyHeader.type_url); + } return Header.decode(anyHeader.value); } function unmarshalClientState(bytes calldata bz) internal pure returns (ClientState.Data memory clientState) { Any.Data memory anyClientState = Any.decode(bz); - require(keccak256(abi.encodePacked(anyClientState.type_url)) == CLIENT_STATE_TYPE_URL_HASH); + if (keccak256(abi.encodePacked(anyClientState.type_url)) != CLIENT_STATE_TYPE_URL_HASH) { + revert UnexpectedProtoAnyTypeURL(anyClientState.type_url); + } return ClientState.decode(anyClientState.value); } @@ -240,7 +281,9 @@ contract IBFT2Client is ILightClient { returns (ConsensusState.Data memory consensusState) { Any.Data memory anyConsensusState = Any.decode(bz); - require(keccak256(abi.encodePacked(anyConsensusState.type_url)) == CONSENSUS_STATE_TYPE_URL_HASH); + if (keccak256(abi.encodePacked(anyConsensusState.type_url)) != CONSENSUS_STATE_TYPE_URL_HASH) { + revert UnexpectedProtoAnyTypeURL(anyConsensusState.type_url); + } return ConsensusState.decode(anyConsensusState.value); } @@ -254,18 +297,10 @@ contract IBFT2Client is ILightClient { function verify(bytes[] memory trustedVals, ParsedBesuHeader memory untrustedHeader) internal pure - returns (bytes[] memory validators, bool ok) + returns (bytes[] memory) { bytes32 blkHash = keccak256(untrustedHeader.base.besu_header_rlp); - - if ( - !verifyCommitSealsTrusting( - trustedVals, untrustedHeader.base.seals, blkHash, Fraction({numerator: 1, denominator: 3}) - ) - ) { - return (validators, false); - } - + verifyCommitSealsTrusting(trustedVals, untrustedHeader.base.seals, blkHash); return verifyCommitSeals(untrustedHeader.validators, untrustedHeader.base.seals, blkHash); } @@ -274,14 +309,11 @@ contract IBFT2Client is ILightClient { * @param trustedVals trusted validators * @param seals commit seals for untrusted block header * @param blkHash the hash of untrusted block - * @param trustLevel new header can be trusted if at least one correct validator signed it */ - function verifyCommitSealsTrusting( - bytes[] memory trustedVals, - bytes[] memory seals, - bytes32 blkHash, - Fraction memory trustLevel - ) internal pure returns (bool) { + function verifyCommitSealsTrusting(bytes[] memory trustedVals, bytes[] memory seals, bytes32 blkHash) + internal + pure + { uint8 success = 0; bool[] memory marked = new bool[](trustedVals.length); for (uint256 i = 0; i < seals.length; i++) { @@ -290,14 +322,18 @@ contract IBFT2Client is ILightClient { } address signer = ecdsaRecover(blkHash, seals[i]); for (uint256 j = 0; j < trustedVals.length; j++) { - require(trustedVals[j].length == 20, "invalid address length"); + if (trustedVals[j].length != 20) { + revert InvalidValidatorAddressLength(); + } if (!marked[j] && address(bytes20(trustedVals[j])) == signer) { success++; marked[j] = true; } } } - return success >= trustedVals.length * trustLevel.numerator / trustLevel.denominator; + if (success < trustedVals.length / 3) { + revert InsufficientTrustedValidatorsSeals(success, trustedVals.length / 3); + } } /** @@ -309,20 +345,25 @@ contract IBFT2Client is ILightClient { function verifyCommitSeals(RLPReader.RLPItem[] memory untrustedVals, bytes[] memory seals, bytes32 blkHash) internal pure - returns (bytes[] memory, bool) + returns (bytes[] memory) { bytes[] memory validators = new bytes[](untrustedVals.length); uint8 success = 0; for (uint256 i = 0; i < seals.length; i++) { validators[i] = untrustedVals[i].toBytes(); - require(validators[i].length == 20, "invalid address length"); + if (validators[i].length != 20) { + revert InvalidValidatorAddressLength(); + } if (seals[i].length == 0) { continue; } else if (address(bytes20(validators[i])) == ecdsaRecover(blkHash, seals[i])) { success++; } } - return (validators, success > untrustedVals.length * 2 / 3); + if (success < untrustedVals.length * 2 / 3) { + revert InsuffientUntrustedValidatorsSeals(success, untrustedVals.length * 2 / 3); + } + return validators; } /// helper functions /// @@ -411,11 +452,14 @@ contract IBFT2Client is ILightClient { parsedHeader.stateRoot = bytes32(items[3].toUint()); parsedHeader.height = Height.Data({revision_number: 0, revision_height: uint64(items[8].toUint())}); - require(items.length == 15, "items length must be 15"); + if (items.length != 15) { + revert UnexpectedEthereumHeaderFormat(items.length); + } parsedHeader.time = uint64(items[11].toUint()); items = items[12].toBytes().toRlpItem().toList(); - require(items.length == 4, "extra length must be 4"); - + if (items.length != 4) { + revert UnexpectedExtraDataFormat(items.length); + } parsedHeader.validators = items[1].toList(); return parsedHeader; } @@ -431,12 +475,13 @@ contract IBFT2Client is ILightClient { } function ecdsaRecover(bytes32 hash, bytes memory sig) private pure returns (address) { - require(sig.length == 65, "sig length must be 65"); - if (uint8(sig[64]) < 27) { + if (sig.length != 65) { + revert InvalidECDSASignatureLength(sig.length); + } else if (uint8(sig[64]) < 27) { sig[64] = bytes1(uint8(sig[64]) + 27); } - (address signer, ECDSA.RecoverError error) = ECDSA.tryRecover(hash, sig); - if (error != ECDSA.RecoverError.NoError) { + (address signer, ECDSA.RecoverError e,) = ECDSA.tryRecover(hash, sig); + if (e != ECDSA.RecoverError.NoError) { return address(0); } return signer; @@ -476,7 +521,9 @@ contract IBFT2Client is ILightClient { } modifier onlyIBC() { - require(msg.sender == ibcHandler); + if (msg.sender != ibcHandler) { + revert InvalidCaller(msg.sender); + } _; } } diff --git a/contracts/clients/LocalhostClient.sol b/contracts/clients/LocalhostClient.sol index 24b0db1c..b0d1ac56 100644 --- a/contracts/clients/LocalhostClient.sol +++ b/contracts/clients/LocalhostClient.sol @@ -2,6 +2,7 @@ pragma solidity ^0.8.20; import {ILightClient} from "../core/02-client/ILightClient.sol"; +import {ILightClientErrors} from "../core/02-client/ILightClientErrors.sol"; import {IBCHeight} from "../core/02-client/IBCHeight.sol"; import {IIBCHandler} from "../core/25-handler/IIBCHandler.sol"; import {Height} from "../proto/Client.sol"; @@ -16,9 +17,16 @@ import {GoogleProtobufAny as Any} from "../proto/GoogleProtobufAny.sol"; * - `getLatestHeight` always returns the current block number * - `verifyMembership` checks the proof height is not greater than the current block height */ -contract LocalhostClient is ILightClient { +contract LocalhostClient is ILightClient, ILightClientErrors { using IBCHeight for Height.Data; + error InvalidClientID(); + error InvalidConsensusState(); + error InvalidHeightRevisionNumber(); + error InvalidHeightRevisionHeight(); + error InvalidProof(); + error InvalidPrefix(); + address public immutable ibcHandler; constructor(address ibcHandler_) { @@ -36,17 +44,18 @@ contract LocalhostClient is ILightClient { bytes calldata protoClientState, bytes calldata protoConsensusState ) public virtual override onlyIBC returns (Height.Data memory height) { - require( - keccak256(abi.encodePacked(clientId)) == keccak256(abi.encodePacked(LocalhostClientLib.CLIENT_ID)), - "invalid client id" - ); - require( - keccak256(protoConsensusState) == keccak256(LocalhostClientLib.sentinelConsensusState()), - "invalid consensus state" - ); + if (keccak256(abi.encodePacked(clientId)) != keccak256(abi.encodePacked(LocalhostClientLib.CLIENT_ID))) { + revert InvalidClientID(); + } + if (keccak256(protoConsensusState) != keccak256(LocalhostClientLib.sentinelConsensusState())) { + revert InvalidConsensusState(); + } ClientState.Data memory clientState = LocalhostClientLib.unmarshalClientState(protoClientState); - require(clientState.latest_height.revision_number == 0, "invalid revision number"); - require(clientState.latest_height.revision_height == uint64(block.number), "invalid revision height"); + if (clientState.latest_height.revision_number != 0) { + revert InvalidHeightRevisionNumber(); + } else if (clientState.latest_height.revision_height != uint64(block.number)) { + revert InvalidHeightRevisionHeight(); + } return Height.Data({revision_number: 0, revision_height: uint64(block.number)}); } @@ -69,10 +78,9 @@ contract LocalhostClient is ILightClient { * @param clientId the client identifier must be match with `LocalhostClientLib.CLIENT_ID` */ function updateClient(string calldata clientId) public returns (Height.Data[] memory heights) { - require( - keccak256(abi.encodePacked(clientId)) == keccak256(abi.encodePacked(LocalhostClientLib.CLIENT_ID)), - "invalid client id" - ); + if (keccak256(abi.encodePacked(clientId)) != keccak256(abi.encodePacked(LocalhostClientLib.CLIENT_ID))) { + revert InvalidClientID(); + } IIBCHandler(ibcHandler).updateClientCommitments(clientId, new Height.Data[](0)); return heights; } @@ -81,8 +89,11 @@ contract LocalhostClient is ILightClient { * @dev getTimestampAtHeight always returns the current block timestamp. */ function getTimestampAtHeight(string calldata, Height.Data calldata height) public view returns (uint64) { - require(height.revision_number == 0, "invalid revision number"); - require(height.revision_height <= block.number, "invalid revision height"); + if (height.revision_number != 0) { + revert InvalidHeightRevisionNumber(); + } else if (height.revision_height > block.number) { + revert InvalidHeightRevisionHeight(); + } return uint64(block.timestamp); } @@ -97,10 +108,9 @@ contract LocalhostClient is ILightClient { * @dev getStatus returns the status of the client corresponding to `clientId`. */ function getStatus(string calldata clientId) public view virtual override returns (ClientStatus) { - require( - keccak256(abi.encodePacked(clientId)) == keccak256(abi.encodePacked(LocalhostClientLib.CLIENT_ID)), - "invalid client id" - ); + if (keccak256(abi.encodePacked(clientId)) != keccak256(abi.encodePacked(LocalhostClientLib.CLIENT_ID))) { + revert InvalidClientID(); + } return ClientStatus.Active; } @@ -118,14 +128,21 @@ contract LocalhostClient is ILightClient { bytes memory path, bytes memory value ) public view virtual override returns (bool) { - require( - keccak256(abi.encodePacked(clientId)) == keccak256(abi.encodePacked(LocalhostClientLib.CLIENT_ID)), - "invalid client id" - ); - require(proofHeight.revision_number == 0, "invalid revision number"); - require(proofHeight.revision_height <= block.number, "invalid revision height"); - require(keccak256(proof) == keccak256(LocalhostClientLib.sentinelProof()), "invalid proof"); - require(keccak256(IIBCHandler(ibcHandler).getCommitmentPrefix()) == keccak256(prefix), "invalid prefix"); + if (keccak256(abi.encodePacked(clientId)) != keccak256(abi.encodePacked(LocalhostClientLib.CLIENT_ID))) { + revert InvalidClientID(); + } + if (proofHeight.revision_number != 0) { + revert InvalidHeightRevisionNumber(); + } + if (proofHeight.revision_height > block.number) { + revert InvalidHeightRevisionHeight(); + } + if (keccak256(proof) != keccak256(LocalhostClientLib.sentinelProof())) { + revert InvalidProof(); + } + if (keccak256(IIBCHandler(ibcHandler).getCommitmentPrefix()) != keccak256(prefix)) { + revert InvalidPrefix(); + } return IIBCHandler(ibcHandler).getCommitment(keccak256(path)) == keccak256(value); } @@ -142,14 +159,21 @@ contract LocalhostClient is ILightClient { bytes memory prefix, bytes memory path ) public view returns (bool) { - require( - keccak256(abi.encodePacked(clientId)) == keccak256(abi.encodePacked(LocalhostClientLib.CLIENT_ID)), - "invalid client id" - ); - require(proofHeight.revision_number == 0, "invalid revision number"); - require(proofHeight.revision_height <= block.number, "invalid revision height"); - require(keccak256(proof) == keccak256(LocalhostClientLib.sentinelProof()), "invalid proof"); - require(keccak256(IIBCHandler(ibcHandler).getCommitmentPrefix()) == keccak256(prefix), "invalid prefix"); + if (keccak256(abi.encodePacked(clientId)) != keccak256(abi.encodePacked(LocalhostClientLib.CLIENT_ID))) { + revert InvalidClientID(); + } + if (proofHeight.revision_number != 0) { + revert InvalidHeightRevisionNumber(); + } + if (proofHeight.revision_height > block.number) { + revert InvalidHeightRevisionHeight(); + } + if (keccak256(proof) != keccak256(LocalhostClientLib.sentinelProof())) { + revert InvalidProof(); + } + if (keccak256(IIBCHandler(ibcHandler).getCommitmentPrefix()) != keccak256(prefix)) { + revert InvalidPrefix(); + } return IIBCHandler(ibcHandler).getCommitment(keccak256(path)) == bytes32(0); } @@ -180,15 +204,16 @@ contract LocalhostClient is ILightClient { pure returns (bytes memory, bool) { - require( - keccak256(abi.encodePacked(clientId)) == keccak256(abi.encodePacked(LocalhostClientLib.CLIENT_ID)), - "invalid client id" - ); + if (keccak256(abi.encodePacked(clientId)) != keccak256(abi.encodePacked(LocalhostClientLib.CLIENT_ID))) { + revert InvalidClientID(); + } return (LocalhostClientLib.sentinelConsensusState(), true); } modifier onlyIBC() { - require(msg.sender == ibcHandler); + if (msg.sender != ibcHandler) { + revert InvalidCaller(msg.sender); + } _; } } @@ -198,6 +223,9 @@ contract LocalhostClient is ILightClient { * @notice LocalhostClientLib is a library that provides the client type, client identifier, client state type URL, consensus state type URL, and helper functions for the localhost client. */ library LocalhostClientLib { + /// @param url the unexpected type URL + error UnexpectedProtoAnyTypeURL(string url); + string internal constant CLIENT_TYPE = "09-localhost"; string internal constant CLIENT_ID = string(abi.encodePacked(CLIENT_TYPE, "-0")); string internal constant CLIENT_STATE_TYPE_URL = "/ibc.lightclients.localhost.v2.ClientState"; @@ -210,7 +238,9 @@ library LocalhostClientLib { function unmarshalClientState(bytes calldata protoClientState) internal pure returns (ClientState.Data memory) { Any.Data memory any = Any.decode(protoClientState); - require(keccak256(abi.encodePacked(any.type_url)) == CLIENT_STATE_TYPE_URL_HASH, "invalid client state type"); + if (keccak256(abi.encodePacked(any.type_url)) != CLIENT_STATE_TYPE_URL_HASH) { + revert UnexpectedProtoAnyTypeURL(any.type_url); + } return ClientState.decode(any.value); } diff --git a/contracts/clients/MockClient.sol b/contracts/clients/MockClient.sol index 29a24333..5932ef8a 100644 --- a/contracts/clients/MockClient.sol +++ b/contracts/clients/MockClient.sol @@ -3,6 +3,7 @@ pragma solidity ^0.8.20; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {ILightClient} from "../core/02-client/ILightClient.sol"; +import {ILightClientErrors} from "../core/02-client/ILightClientErrors.sol"; import {IBCHeight} from "../core/02-client/IBCHeight.sol"; import {IIBCHandler} from "../core/25-handler/IIBCHandler.sol"; import {Height} from "../proto/Client.sol"; @@ -13,25 +14,32 @@ import { } from "../proto/MockClient.sol"; import {GoogleProtobufAny as Any} from "../proto/GoogleProtobufAny.sol"; -// MockClient implements https://github.com/datachainlab/ibc-mock-client -// WARNING: This client is intended to be used for testing purpose. Therefore, it is not generally available in a production, except in a fully trusted environment. -contract MockClient is Ownable, ILightClient { +/// @notice MockClient implements https://github.com/datachainlab/ibc-mock-client +/// WARNING: This client is intended to be used for testing purpose. +contract MockClient is Ownable, ILightClient, ILightClientErrors { using IBCHeight for Height.Data; - string private constant HEADER_TYPE_URL = "/ibc.lightclients.mock.v1.Header"; - string private constant CLIENT_STATE_TYPE_URL = "/ibc.lightclients.mock.v1.ClientState"; - string private constant CONSENSUS_STATE_TYPE_URL = "/ibc.lightclients.mock.v1.ConsensusState"; + error InvalidClientState(); + error InvalidConsensusState(); + error InvalidHeader(); + error InvalidProof(); + error InvalidPrefix(); - bytes32 private constant HEADER_TYPE_URL_HASH = keccak256(abi.encodePacked(HEADER_TYPE_URL)); - bytes32 private constant CLIENT_STATE_TYPE_URL_HASH = keccak256(abi.encodePacked(CLIENT_STATE_TYPE_URL)); - bytes32 private constant CONSENSUS_STATE_TYPE_URL_HASH = keccak256(abi.encodePacked(CONSENSUS_STATE_TYPE_URL)); + string internal constant HEADER_TYPE_URL = "/ibc.lightclients.mock.v1.Header"; + string internal constant CLIENT_STATE_TYPE_URL = "/ibc.lightclients.mock.v1.ClientState"; + string internal constant CONSENSUS_STATE_TYPE_URL = "/ibc.lightclients.mock.v1.ConsensusState"; + + bytes32 internal constant HEADER_TYPE_URL_HASH = keccak256(abi.encodePacked(HEADER_TYPE_URL)); + bytes32 internal constant CLIENT_STATE_TYPE_URL_HASH = keccak256(abi.encodePacked(CLIENT_STATE_TYPE_URL)); + bytes32 internal constant CONSENSUS_STATE_TYPE_URL_HASH = keccak256(abi.encodePacked(CONSENSUS_STATE_TYPE_URL)); address internal immutable ibcHandler; + mapping(string => ClientState.Data) internal clientStates; mapping(string => mapping(uint128 => ConsensusState.Data)) internal consensusStates; mapping(string => ClientStatus) internal statuses; - constructor(address ibcHandler_) { + constructor(address ibcHandler_) Ownable(msg.sender) { ibcHandler = ibcHandler_; } @@ -45,11 +53,11 @@ contract MockClient is Ownable, ILightClient { ) external virtual override onlyIBC returns (Height.Data memory height) { ClientState.Data memory clientState = unmarshalClientState(protoClientState); ConsensusState.Data memory consensusState = unmarshalConsensusState(protoConsensusState); - if ( - clientState.latest_height.revision_number != 0 || clientState.latest_height.revision_height == 0 - || consensusState.timestamp == 0 - ) { - revert("invalid client state"); + if (clientState.latest_height.revision_number != 0 || clientState.latest_height.revision_height == 0) { + revert InvalidClientState(); + } + if (consensusState.timestamp == 0) { + revert InvalidConsensusState(); } clientStates[clientId] = clientState; consensusStates[clientId][clientState.latest_height.toUint128()] = consensusState; @@ -69,12 +77,13 @@ contract MockClient is Ownable, ILightClient { returns (bytes4, bytes memory) { Any.Data memory any = Any.decode(protoClientMessage); - require(keccak256(abi.encodePacked(any.type_url)) == HEADER_TYPE_URL_HASH, "invalid header type"); + if (keccak256(abi.encodePacked(any.type_url)) != HEADER_TYPE_URL_HASH) { + revert UnexpectedProtoAnyTypeURL(any.type_url); + } Header.Data memory header = Header.decode(any.value); - require( - header.height.revision_number == 0 && header.height.revision_height != 0 && header.timestamp != 0, - "invalid header" - ); + if (header.height.revision_number != 0 || header.height.revision_height == 0 || header.timestamp == 0) { + revert InvalidHeader(); + } return (this.updateClient.selector, abi.encode(clientId, header)); } @@ -90,7 +99,9 @@ contract MockClient is Ownable, ILightClient { returns (uint64) { ConsensusState.Data storage consensusState = consensusStates[clientId][height.toUint128()]; - require(consensusState.timestamp != 0, "consensus state not found"); + if (consensusState.timestamp == 0) { + revert ConsensusStateNotFound(clientId, height); + } return consensusState.timestamp; } @@ -99,7 +110,9 @@ contract MockClient is Ownable, ILightClient { */ function getLatestHeight(string calldata clientId) external view virtual override returns (Height.Data memory) { ClientState.Data storage clientState = clientStates[clientId]; - require(clientState.latest_height.revision_height != 0, "client not found"); + if (clientState.latest_height.revision_height == 0) { + revert ClientStateNotFound(clientId); + } return clientState.latest_height; } @@ -124,10 +137,12 @@ contract MockClient is Ownable, ILightClient { public returns (Height.Data[] memory heights) { - require(statuses[clientId] == ClientStatus.Active, "client not active"); - require(header.height.revision_number == 0, "invalid revision number"); - require(header.height.revision_height != 0, "invalid revision height"); - require(header.timestamp != 0, "invalid timestamp"); + if (statuses[clientId] != ClientStatus.Active) { + revert NotActiveClient(clientId); + } + if (header.height.revision_number != 0 || header.height.revision_height == 0 || header.timestamp == 0) { + revert InvalidHeader(); + } if (header.height.gt(clientStates[clientId].latest_height)) { clientStates[clientId].latest_height = header.height; } @@ -151,9 +166,15 @@ contract MockClient is Ownable, ILightClient { bytes memory path, bytes calldata value ) external view virtual override returns (bool) { - require(consensusStates[clientId][height.toUint128()].timestamp != 0, "consensus state not found"); - require(keccak256(IIBCHandler(ibcHandler).getCommitmentPrefix()) == keccak256(prefix), "invalid prefix"); - require(proof.length == 32, "invalid proof length"); + if (consensusStates[clientId][height.toUint128()].timestamp == 0) { + revert ConsensusStateNotFound(clientId, height); + } + if (keccak256(IIBCHandler(ibcHandler).getCommitmentPrefix()) != keccak256(prefix)) { + revert InvalidPrefix(); + } + if (proof.length != 32) { + revert InvalidProof(); + } return sha256(abi.encodePacked(height.toUint128(), sha256(prefix), sha256(path), sha256(value))) == bytes32(proof); } @@ -171,8 +192,12 @@ contract MockClient is Ownable, ILightClient { bytes memory prefix, bytes memory path ) external view virtual override returns (bool) { - require(consensusStates[clientId][height.toUint128()].timestamp != 0, "consensus state not found"); - require(keccak256(IIBCHandler(ibcHandler).getCommitmentPrefix()) == keccak256(prefix), "invalid prefix"); + if (consensusStates[clientId][height.toUint128()].timestamp == 0) { + revert ConsensusStateNotFound(clientId, height); + } + if (keccak256(IIBCHandler(ibcHandler).getCommitmentPrefix()) != keccak256(prefix)) { + revert InvalidPrefix(); + } return sha256(abi.encodePacked(height.toUint128(), sha256(prefix), sha256(path), sha256(""))) == bytes32(proof); } @@ -219,9 +244,9 @@ contract MockClient is Ownable, ILightClient { function unmarshalClientState(bytes calldata bz) internal pure returns (ClientState.Data memory clientState) { Any.Data memory anyClientState = Any.decode(bz); - require( - keccak256(abi.encodePacked(anyClientState.type_url)) == CLIENT_STATE_TYPE_URL_HASH, "invalid client state" - ); + if (keccak256(abi.encodePacked(anyClientState.type_url)) != CLIENT_STATE_TYPE_URL_HASH) { + revert UnexpectedProtoAnyTypeURL(anyClientState.type_url); + } return ClientState.decode(anyClientState.value); } @@ -231,15 +256,16 @@ contract MockClient is Ownable, ILightClient { returns (ConsensusState.Data memory consensusState) { Any.Data memory anyConsensusState = Any.decode(bz); - require( - keccak256(abi.encodePacked(anyConsensusState.type_url)) == CONSENSUS_STATE_TYPE_URL_HASH, - "invalid consensus state" - ); + if (keccak256(abi.encodePacked(anyConsensusState.type_url)) != CONSENSUS_STATE_TYPE_URL_HASH) { + revert UnexpectedProtoAnyTypeURL(anyConsensusState.type_url); + } return ConsensusState.decode(anyConsensusState.value); } modifier onlyIBC() { - require(msg.sender == ibcHandler); + if (msg.sender != ibcHandler) { + revert InvalidCaller(msg.sender); + } _; } } diff --git a/contracts/core/02-client/IBCClient.sol b/contracts/core/02-client/IBCClient.sol index 51ac0bbf..2d908d7d 100644 --- a/contracts/core/02-client/IBCClient.sol +++ b/contracts/core/02-client/IBCClient.sol @@ -7,17 +7,20 @@ import {Height} from "../../proto/Client.sol"; import {IBCHost} from "../24-host/IBCHost.sol"; import {IBCCommitment} from "../24-host/IBCCommitment.sol"; import {IIBCClient} from "../02-client/IIBCClient.sol"; +import {IIBCClientErrors} from "../02-client/IIBCClientErrors.sol"; /** * @dev IBCClient is a contract that implements [ICS-2](https://github.com/cosmos/ibc/tree/main/spec/core/ics-002-client-semantics). */ -contract IBCClient is IBCHost, IIBCClient { +contract IBCClient is IBCHost, IIBCClient, IIBCClientErrors { /** * @dev createClient creates a new client state and populates it with a given consensus state */ function createClient(MsgCreateClient calldata msg_) external override returns (string memory clientId) { address clientImpl = clientRegistry[msg_.clientType]; - require(clientImpl != address(0), "unregistered client type"); + if (clientImpl == address(0)) { + revert IBCClientUnregisteredClientType(msg_.clientType); + } clientId = generateClientIdentifier(msg_.clientType); clientTypes[clientId] = msg_.clientType; clientImpls[clientId] = clientImpl; @@ -44,7 +47,7 @@ contract IBCClient is IBCHost, IIBCClient { revert(add(32, returndata), returndata_size) } } else { - revert("update client failed"); + revert IBCClientFailedUpdateClient(selector, args); } } Height.Data[] memory heights = abi.decode(returndata, (Height.Data[])); @@ -77,15 +80,21 @@ contract IBCClient is IBCHost, IIBCClient { bytes memory consensusState; bool found; (clientState, found) = lc.getClientState(clientId); - require(found, "client not found"); + if (!found) { + revert IBCClientClientNotFound(clientId); + } commitments[IBCCommitment.clientStateCommitmentKey(clientId)] = keccak256(clientState); for (uint256 i = 0; i < heights.length; i++) { (consensusState, found) = lc.getConsensusState(clientId, heights[i]); - require(found, "consensus state not found"); + if (!found) { + revert IBCClientConsensusStateNotFound(clientId, heights[i]); + } bytes32 key = IBCCommitment.consensusStateCommitmentKey( clientId, heights[i].revision_number, heights[i].revision_height ); - require(commitments[key] == bytes32(0), "consensus state already exists"); + if (commitments[key] != bytes32(0)) { + continue; + } commitments[key] = keccak256(consensusState); } } diff --git a/contracts/core/02-client/IIBCClient.sol b/contracts/core/02-client/IIBCClient.sol index 996049d8..856b7b57 100644 --- a/contracts/core/02-client/IIBCClient.sol +++ b/contracts/core/02-client/IIBCClient.sol @@ -4,6 +4,8 @@ pragma solidity ^0.8.20; import {Height} from "../../proto/Client.sol"; interface IIBCClient { + // --------------------- Data Structure --------------------- // + struct MsgCreateClient { string clientType; bytes protoClientState; @@ -15,7 +17,11 @@ interface IIBCClient { bytes protoClientMessage; } - event GeneratedClientIdentifier(string); + // --------------------- Events --------------------- // + + /// @notice Emitted when a client identifier is generated + /// @param clientId client identifier + event GeneratedClientIdentifier(string clientId); /** * @dev createClient creates a new client state and populates it with a given consensus state diff --git a/contracts/core/02-client/IIBCClientErrors.sol b/contracts/core/02-client/IIBCClientErrors.sol new file mode 100644 index 00000000..1e641bad --- /dev/null +++ b/contracts/core/02-client/IIBCClientErrors.sol @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity ^0.8.20; + +import {Height} from "../../proto/Client.sol"; + +interface IIBCClientErrors { + /// @param clientType the client type + error IBCClientUnregisteredClientType(string clientType); + + /// @param clientId the client identifier + error IBCClientClientNotFound(string clientId); + + /// @param clientId the client identifier + /// @param consensusHeight the consensus height + error IBCClientConsensusStateNotFound(string clientId, Height.Data consensusHeight); + + /// @param clientId the client identifier + error IBCClientNotActiveClient(string clientId); + + /// @param selector the function selector + /// @param args the calldata + error IBCClientFailedUpdateClient(bytes4 selector, bytes args); +} diff --git a/contracts/core/02-client/ILightClientErrors.sol b/contracts/core/02-client/ILightClientErrors.sol new file mode 100644 index 00000000..32cc4395 --- /dev/null +++ b/contracts/core/02-client/ILightClientErrors.sol @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity ^0.8.20; + +import {Height} from "../../proto/Client.sol"; + +interface ILightClientErrors { + /// @param caller the caller of the function + error InvalidCaller(address caller); + error NotActiveClient(string clientId); + /// @param clientId client identifier + error ClientStateNotFound(string clientId); + /// @param clientId client identifier + /// @param height consensus height + error ConsensusStateNotFound(string clientId, Height.Data height); + /// @param url type url of the any + error UnexpectedProtoAnyTypeURL(string url); +} diff --git a/contracts/core/03-connection/IBCConnection.sol b/contracts/core/03-connection/IBCConnection.sol index b69ddbbb..c209fbfd 100644 --- a/contracts/core/03-connection/IBCConnection.sol +++ b/contracts/core/03-connection/IBCConnection.sol @@ -6,6 +6,7 @@ import {Height} from "../../proto/Client.sol"; import {ConnectionEnd, Version, Counterparty} from "../../proto/Connection.sol"; import {MerklePrefix} from "../../proto/Commitment.sol"; import {IIBCConnection} from "../03-connection/IIBCConnection.sol"; +import {IIBCConnectionErrors} from "../03-connection/IIBCConnectionErrors.sol"; import {IBCHost} from "../24-host/IBCHost.sol"; import {IBCSelfStateValidator} from "../24-host/IBCSelfStateValidator.sol"; import {IBCCommitment} from "../24-host/IBCCommitment.sol"; @@ -14,7 +15,7 @@ import {IBCConnectionLib} from "./IBCConnectionLib.sol"; /** * @dev IBCConnection is a contract that implements [ICS-3](https://github.com/cosmos/ibc/tree/main/spec/core/ics-003-connection-semantics). */ -abstract contract IBCConnection is IBCHost, IBCSelfStateValidator, IIBCConnection { +abstract contract IBCConnection is IBCHost, IBCSelfStateValidator, IIBCConnection, IIBCConnectionErrors { /** * @dev connectionOpenInit initialises a connection attempt on chain A. The generated connection identifier * is returned. @@ -26,17 +27,20 @@ abstract contract IBCConnection is IBCHost, IBCSelfStateValidator, IIBCConnectio { string memory connectionId = generateConnectionIdentifier(); ConnectionEnd.Data storage connection = connections[connectionId]; - require(connection.state == ConnectionEnd.State.STATE_UNINITIALIZED_UNSPECIFIED, "connectionId already exists"); + if (connection.state != ConnectionEnd.State.STATE_UNINITIALIZED_UNSPECIFIED) { + revert IBCConnectionAlreadyConnectionExists(); + } // ensure the client exists checkAndGetClient(msg_.clientId); - require(bytes(msg_.counterparty.connection_id).length == 0, "counterparty connectionId must be empty"); + if (bytes(msg_.counterparty.connection_id).length > 0) { + revert IBCConnectionInvalidCounterpartyConnectionIdentifier(msg_.counterparty.connection_id); + } connection.client_id = msg_.clientId; if (msg_.version.features.length > 0) { - require( - IBCConnectionLib.isSupportedVersion(getCompatibleVersions(), msg_.version), - "the selected version is not supported" - ); + if (!IBCConnectionLib.isSupportedVersion(getCompatibleVersions(), msg_.version)) { + revert IBCConnectionIBCVersionNotSupported(); + } connection.versions.push(msg_.version); } else { IBCConnectionLib.setSupportedVersions(getCompatibleVersions(), connection.versions); @@ -59,13 +63,18 @@ abstract contract IBCConnection is IBCHost, IBCSelfStateValidator, IIBCConnectio override returns (string memory) { - require(validateSelfClient(msg_.clientStateBytes), "failed to validate self client state"); - require(msg_.counterpartyVersions.length > 0, "counterpartyVersions length must be greater than 0"); + if (msg_.counterpartyVersions.length == 0) { + revert IBCConnectionEmptyConnectionCounterpartyVersions(); + } else if (!validateSelfClient(msg_.clientStateBytes)) { + revert IBCConnectionInvalidSelfClientState(); + } bytes memory selfConsensusState = getSelfConsensusState(msg_.consensusHeight, msg_.hostConsensusStateProof); string memory connectionId = generateConnectionIdentifier(); ConnectionEnd.Data storage connection = connections[connectionId]; - require(connection.state == ConnectionEnd.State.STATE_UNINITIALIZED_UNSPECIFIED, "connectionId already exists"); + if (connection.state != ConnectionEnd.State.STATE_UNINITIALIZED_UNSPECIFIED) { + revert IBCConnectionAlreadyConnectionExists(); + } // ensure the client exists checkAndGetClient(msg_.clientId); @@ -87,27 +96,18 @@ abstract contract IBCConnection is IBCHost, IBCSelfStateValidator, IIBCConnectio }) }); - require( - verifyConnectionState( - connection, msg_.proofHeight, msg_.proofInit, msg_.counterparty.connection_id, expectedConnection - ), - "failed to verify connection state" + verifyConnectionState( + connection, msg_.proofHeight, msg_.proofInit, msg_.counterparty.connection_id, expectedConnection ); - require( - verifyClientState( - connection, - msg_.proofHeight, - IBCCommitment.clientStatePath(connection.counterparty.client_id), - msg_.proofClient, - msg_.clientStateBytes - ), - "failed to verify clientState" + verifyClientState( + connection, + msg_.proofHeight, + IBCCommitment.clientStatePath(connection.counterparty.client_id), + msg_.proofClient, + msg_.clientStateBytes ); - require( - verifyClientConsensusState( - connection, msg_.proofHeight, msg_.consensusHeight, msg_.proofConsensus, selfConsensusState - ), - "failed to verify clientConsensusState" + verifyClientConsensusState( + connection, msg_.proofHeight, msg_.consensusHeight, msg_.proofConsensus, selfConsensusState ); updateConnectionCommitment(connectionId); @@ -121,12 +121,15 @@ abstract contract IBCConnection is IBCHost, IBCSelfStateValidator, IIBCConnectio */ function connectionOpenAck(IIBCConnection.MsgConnectionOpenAck calldata msg_) external override { ConnectionEnd.Data storage connection = connections[msg_.connectionId]; - require(connection.state == ConnectionEnd.State.STATE_INIT, "connection state is not INIT"); - require( - IBCConnectionLib.isSupportedVersion(connection.versions, msg_.version), - "the counterparty selected version is not supported by versions selected on INIT" - ); - require(validateSelfClient(msg_.clientStateBytes), "failed to validate self client state"); + if (connection.state != ConnectionEnd.State.STATE_INIT) { + revert IBCConnectionUnexpectedConnectionState(connection.state); + } + if (!IBCConnectionLib.isSupportedVersion(connection.versions, msg_.version)) { + revert IBCConnectionIBCVersionNotSupported(); + } + if (!validateSelfClient(msg_.clientStateBytes)) { + revert IBCConnectionInvalidSelfClientState(); + } bytes memory selfConsensusState = getSelfConsensusState(msg_.consensusHeight, msg_.hostConsensusStateProof); ConnectionEnd.Data memory expectedConnection = ConnectionEnd.Data({ @@ -141,27 +144,18 @@ abstract contract IBCConnection is IBCHost, IBCSelfStateValidator, IIBCConnectio }) }); - require( - verifyConnectionState( - connection, msg_.proofHeight, msg_.proofTry, msg_.counterpartyConnectionId, expectedConnection - ), - "failed to verify connection state" + verifyConnectionState( + connection, msg_.proofHeight, msg_.proofTry, msg_.counterpartyConnectionId, expectedConnection ); - require( - verifyClientState( - connection, - msg_.proofHeight, - IBCCommitment.clientStatePath(connection.counterparty.client_id), - msg_.proofClient, - msg_.clientStateBytes - ), - "failed to verify clientState" + verifyClientState( + connection, + msg_.proofHeight, + IBCCommitment.clientStatePath(connection.counterparty.client_id), + msg_.proofClient, + msg_.clientStateBytes ); - require( - verifyClientConsensusState( - connection, msg_.proofHeight, msg_.consensusHeight, msg_.proofConsensus, selfConsensusState - ), - "failed to verify clientConsensusState" + verifyClientConsensusState( + connection, msg_.proofHeight, msg_.consensusHeight, msg_.proofConsensus, selfConsensusState ); connection.state = ConnectionEnd.State.STATE_OPEN; @@ -176,7 +170,9 @@ abstract contract IBCConnection is IBCHost, IBCSelfStateValidator, IIBCConnectio */ function connectionOpenConfirm(IIBCConnection.MsgConnectionOpenConfirm calldata msg_) external override { ConnectionEnd.Data storage connection = connections[msg_.connectionId]; - require(connection.state == ConnectionEnd.State.STATE_TRYOPEN, "connection state is not TRYOPEN"); + if (connection.state != ConnectionEnd.State.STATE_TRYOPEN) { + revert IBCConnectionUnexpectedConnectionState(connection.state); + } ConnectionEnd.Data memory expectedConnection = ConnectionEnd.Data({ client_id: connection.counterparty.client_id, @@ -190,11 +186,8 @@ abstract contract IBCConnection is IBCHost, IBCSelfStateValidator, IIBCConnectio }) }); - require( - verifyConnectionState( - connection, msg_.proofHeight, msg_.proofAck, connection.counterparty.connection_id, expectedConnection - ), - "failed to verify connection state" + verifyConnectionState( + connection, msg_.proofHeight, msg_.proofAck, connection.counterparty.connection_id, expectedConnection ); connection.state = ConnectionEnd.State.STATE_OPEN; @@ -214,10 +207,22 @@ abstract contract IBCConnection is IBCHost, IBCSelfStateValidator, IIBCConnectio bytes memory path, bytes memory proof, bytes memory clientStateBytes - ) private returns (bool) { - return checkAndGetClient(connection.client_id).verifyMembership( - connection.client_id, height, 0, 0, proof, connection.counterparty.prefix.key_prefix, path, clientStateBytes - ); + ) private { + if ( + checkAndGetClient(connection.client_id).verifyMembership( + connection.client_id, + height, + 0, + 0, + proof, + connection.counterparty.prefix.key_prefix, + path, + clientStateBytes + ) + ) { + return; + } + revert IBCConnectionFailedVerifyClientState(connection.client_id, path, clientStateBytes, proof, height); } function verifyClientConsensusState( @@ -226,18 +231,31 @@ abstract contract IBCConnection is IBCHost, IBCSelfStateValidator, IIBCConnectio Height.Data memory consensusHeight, bytes memory proof, bytes memory consensusStateBytes - ) private returns (bool) { - return checkAndGetClient(connection.client_id).verifyMembership( + ) private { + if ( + checkAndGetClient(connection.client_id).verifyMembership( + connection.client_id, + height, + 0, + 0, + proof, + connection.counterparty.prefix.key_prefix, + IBCCommitment.consensusStatePath( + connection.counterparty.client_id, consensusHeight.revision_number, consensusHeight.revision_height + ), + consensusStateBytes + ) + ) { + return; + } + revert IBCConnectionFailedVerifyClientConsensusState( connection.client_id, - height, - 0, - 0, - proof, - connection.counterparty.prefix.key_prefix, IBCCommitment.consensusStatePath( connection.counterparty.client_id, consensusHeight.revision_number, consensusHeight.revision_height ), - consensusStateBytes + consensusStateBytes, + proof, + height ); } @@ -245,18 +263,29 @@ abstract contract IBCConnection is IBCHost, IBCSelfStateValidator, IIBCConnectio ConnectionEnd.Data storage connection, Height.Data memory height, bytes memory proof, - string memory connectionId, + string memory counterpartyConnectionId, ConnectionEnd.Data memory counterpartyConnection - ) private returns (bool) { - return checkAndGetClient(connection.client_id).verifyMembership( + ) private { + if ( + checkAndGetClient(connection.client_id).verifyMembership( + connection.client_id, + height, + 0, + 0, + proof, + connection.counterparty.prefix.key_prefix, + IBCCommitment.connectionPath(counterpartyConnectionId), + ConnectionEnd.encode(counterpartyConnection) + ) + ) { + return; + } + revert IBCConnectionFailedVerifyConnectionState( connection.client_id, - height, - 0, - 0, + IBCCommitment.connectionPath(counterpartyConnectionId), + ConnectionEnd.encode(counterpartyConnection), proof, - connection.counterparty.prefix.key_prefix, - IBCCommitment.connectionPath(connectionId), - ConnectionEnd.encode(counterpartyConnection) + height ); } diff --git a/contracts/core/03-connection/IBCConnectionLib.sol b/contracts/core/03-connection/IBCConnectionLib.sol index 412e11d4..49cefa3e 100644 --- a/contracts/core/03-connection/IBCConnectionLib.sol +++ b/contracts/core/03-connection/IBCConnectionLib.sol @@ -2,11 +2,12 @@ pragma solidity ^0.8.20; import {Version} from "../../proto/Connection.sol"; +import {IIBCConnectionErrors} from "./IIBCConnectionErrors.sol"; library IBCConnectionLib { - string public constant IBC_VERSION_IDENTIFIER = "1"; - string public constant ORDER_ORDERED = "ORDER_ORDERED"; - string public constant ORDER_UNORDERED = "ORDER_UNORDERED"; + string internal constant IBC_VERSION_IDENTIFIER = "1"; + string internal constant ORDER_ORDERED = "ORDER_ORDERED"; + string internal constant ORDER_UNORDERED = "ORDER_UNORDERED"; /** * @dev defaultIBCVersion returns the latest supported version of IBC used in connection version negotiation @@ -21,10 +22,12 @@ library IBCConnectionLib { /** * @dev setSupportedVersions sets the supported versions to a given array. * - * NOTE: `versions` must be an empty array + * NOTE: `dst` must be an empty array */ function setSupportedVersions(Version.Data[] memory supportedVersions, Version.Data[] storage dst) internal { - require(dst.length == 0, "versions must be empty"); + if (dst.length != 0) { + revert IIBCConnectionErrors.IBCConnectionVersionsAlreadySet(); + } for (uint256 i = 0; i < supportedVersions.length; i++) { dst.push(supportedVersions[i]); } @@ -128,7 +131,7 @@ library IBCConnectionLib { return Version.Data({identifier: supportedVersion.identifier, features: featureSet}); } } - revert("matching counterparty version not found"); + revert IIBCConnectionErrors.IBCConnectionNoMatchingVersionFound(); } /** diff --git a/contracts/core/03-connection/IBCConnectionSelfStateNoValidation.sol b/contracts/core/03-connection/IBCConnectionSelfStateNoValidation.sol index 3cf3bd62..f8d1b515 100644 --- a/contracts/core/03-connection/IBCConnectionSelfStateNoValidation.sol +++ b/contracts/core/03-connection/IBCConnectionSelfStateNoValidation.sol @@ -26,7 +26,9 @@ contract IBCConnectionSelfStateNoValidation is IBCConnection { override returns (bytes memory) { - require(hostConsensusStateProof.length != 0, "hostConsensusStateProof cannot be empty"); + if (hostConsensusStateProof.length == 0) { + revert IBCConnectionInvalidHostConsensusStateProof(); + } return hostConsensusStateProof; } } diff --git a/contracts/core/03-connection/IIBCConnection.sol b/contracts/core/03-connection/IIBCConnection.sol index 1532d614..1c5c45e3 100644 --- a/contracts/core/03-connection/IIBCConnection.sol +++ b/contracts/core/03-connection/IIBCConnection.sol @@ -5,6 +5,8 @@ import {Height} from "../../proto/Client.sol"; import {Version, Counterparty} from "../../proto/Connection.sol"; interface IIBCConnection { + // --------------------- Data Structure --------------------- // + struct MsgConnectionOpenInit { string clientId; Counterparty.Data counterparty; @@ -45,7 +47,11 @@ interface IIBCConnection { Height.Data proofHeight; } - event GeneratedConnectionIdentifier(string); + // --------------------- Events --------------------- // + + /// @notice Emitted when a connection identifier is generated + /// @param connectionId connection identifier + event GeneratedConnectionIdentifier(string connectionId); /** * @dev connectionOpenInit initialises a connection attempt on chain A. The generated connection identifier diff --git a/contracts/core/03-connection/IIBCConnectionErrors.sol b/contracts/core/03-connection/IIBCConnectionErrors.sol new file mode 100644 index 00000000..2cd91356 --- /dev/null +++ b/contracts/core/03-connection/IIBCConnectionErrors.sol @@ -0,0 +1,54 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity ^0.8.20; + +import {Height} from "../../proto/Client.sol"; +import {ConnectionEnd} from "../../proto/Connection.sol"; + +interface IIBCConnectionErrors { + error IBCConnectionAlreadyConnectionExists(); + + /// @param counterpartyConnectionId counterparty connection identifier + error IBCConnectionInvalidCounterpartyConnectionIdentifier(string counterpartyConnectionId); + + error IBCConnectionEmptyConnectionCounterpartyVersions(); + + error IBCConnectionNoMatchingVersionFound(); + + error IBCConnectionVersionsAlreadySet(); + + error IBCConnectionIBCVersionNotSupported(); + + error IBCConnectionInvalidSelfClientState(); + + error IBCConnectionInvalidHostConsensusStateProof(); + + /// @param state connection state + error IBCConnectionUnexpectedConnectionState(ConnectionEnd.State state); + + /// @param clientId client identifier + /// @param path commitment path + /// @param value value + /// @param proof proof + /// @param height proof height + error IBCConnectionFailedVerifyConnectionState( + string clientId, bytes path, bytes value, bytes proof, Height.Data height + ); + + /// @param clientId client identifier + /// @param path commitment path + /// @param value value + /// @param proof proof + /// @param height proof height + error IBCConnectionFailedVerifyClientState( + string clientId, bytes path, bytes value, bytes proof, Height.Data height + ); + + /// @param clientId client identifier + /// @param path commitment path + /// @param value value + /// @param proof proof + /// @param height proof height + error IBCConnectionFailedVerifyClientConsensusState( + string clientId, bytes path, bytes value, bytes proof, Height.Data height + ); +} diff --git a/contracts/core/04-channel/IBCChannelHandshake.sol b/contracts/core/04-channel/IBCChannelHandshake.sol index 52c631bf..4835fa17 100644 --- a/contracts/core/04-channel/IBCChannelHandshake.sol +++ b/contracts/core/04-channel/IBCChannelHandshake.sol @@ -8,6 +8,7 @@ import {Channel, ChannelCounterparty} from "../../proto/Channel.sol"; import {IBCHeight} from "../02-client/IBCHeight.sol"; import {IBCConnectionLib} from "../03-connection/IBCConnectionLib.sol"; import {IIBCChannelHandshake} from "../04-channel/IIBCChannel.sol"; +import {IIBCChannelErrors} from "../04-channel/IIBCChannelErrors.sol"; import {IBCCommitment} from "../24-host/IBCCommitment.sol"; import {IIBCModule} from "../26-router/IIBCModule.sol"; import {IBCModuleManager} from "../26-router/IBCModuleManager.sol"; @@ -16,7 +17,7 @@ import {IBCChannelLib} from "./IBCChannelLib.sol"; /** * @dev IBCChannelHandshake is a contract that implements [ICS-4](https://github.com/cosmos/ibc/tree/main/spec/core/ics-004-channel-and-packet-semantics). */ -contract IBCChannelHandshake is IBCModuleManager, IIBCChannelHandshake { +contract IBCChannelHandshake is IBCModuleManager, IIBCChannelHandshake, IIBCChannelErrors { using IBCHeight for Height.Data; /** @@ -26,19 +27,28 @@ contract IBCChannelHandshake is IBCModuleManager, IIBCChannelHandshake { external returns (string memory, string memory) { - require(msg_.channel.connection_hops.length == 1, "connection_hops length must be 1"); + if (msg_.channel.connection_hops.length != 1) { + revert IBCChannelInvalidConnectionHopsLength(msg_.channel.connection_hops.length); + } ConnectionEnd.Data storage connection = connections[msg_.channel.connection_hops[0]]; - require( - connection.versions.length == 1, "single version must be negotiated on connection before opening channel" - ); - require( - IBCConnectionLib.verifySupportedFeature( + if (connection.versions.length != 1) { + revert IBCChannelConnectionMultipleVersionsFound( + msg_.channel.connection_hops[0], connection.versions.length + ); + } + if ( + !IBCConnectionLib.verifySupportedFeature( connection.versions[0], IBCChannelLib.toString(msg_.channel.ordering) - ), - "feature not supported" - ); - require(msg_.channel.state == Channel.State.STATE_INIT, "channel state must STATE_INIT"); - require(bytes(msg_.channel.counterparty.channel_id).length == 0, "counterparty channel_id must be empty"); + ) + ) { + revert IBCChannelConnectionFeatureNotSupported(msg_.channel.ordering); + } + if (msg_.channel.state != Channel.State.STATE_INIT) { + revert IBCChannelUnexpectedChannelState(msg_.channel.state); + } + if (bytes(msg_.channel.counterparty.channel_id).length != 0) { + revert IBCChannelCounterpartyChannelIdNotEmpty(msg_.channel.counterparty.channel_id); + } string memory channelId = generateChannelIdentifier(); initializeSequences(msg_.portId, channelId); @@ -75,19 +85,28 @@ contract IBCChannelHandshake is IBCModuleManager, IIBCChannelHandshake { external returns (string memory, string memory) { - require(msg_.channel.connection_hops.length == 1, "connection_hops length must be 1"); + if (msg_.channel.connection_hops.length != 1) { + revert IBCChannelInvalidConnectionHopsLength(msg_.channel.connection_hops.length); + } ConnectionEnd.Data storage connection = connections[msg_.channel.connection_hops[0]]; - require(connection.state == ConnectionEnd.State.STATE_OPEN, "connection state must be STATE_OPEN"); - require( - connection.versions.length == 1, "single version must be negotiated on connection before opening channel" - ); - require( - IBCConnectionLib.verifySupportedFeature( + if (connection.state != ConnectionEnd.State.STATE_OPEN) { + revert IBCChannelConnectionNotOpened(msg_.channel.connection_hops[0]); + } + if (connection.versions.length != 1) { + revert IBCChannelConnectionMultipleVersionsFound( + msg_.channel.connection_hops[0], connection.versions.length + ); + } + if ( + !IBCConnectionLib.verifySupportedFeature( connection.versions[0], IBCChannelLib.toString(msg_.channel.ordering) - ), - "feature not supported" - ); - require(msg_.channel.state == Channel.State.STATE_TRYOPEN, "channel state must be STATE_TRYOPEN"); + ) + ) { + revert IBCChannelConnectionFeatureNotSupported(msg_.channel.ordering); + } + if (msg_.channel.state != Channel.State.STATE_TRYOPEN) { + revert IBCChannelUnexpectedChannelState(msg_.channel.state); + } Channel.Data memory expectedChannel = Channel.Data({ state: Channel.State.STATE_INIT, @@ -96,16 +115,13 @@ contract IBCChannelHandshake is IBCModuleManager, IIBCChannelHandshake { connection_hops: getCounterpartyHops(msg_.channel.connection_hops[0]), version: msg_.counterpartyVersion }); - require( - verifyChannelState( - connection, - msg_.proofHeight, - msg_.proofInit, - msg_.channel.counterparty.port_id, - msg_.channel.counterparty.channel_id, - Channel.encode(expectedChannel) - ), - "failed to verify channel state" + verifyChannelState( + connection, + msg_.proofHeight, + msg_.proofInit, + msg_.channel.counterparty.port_id, + msg_.channel.counterparty.channel_id, + Channel.encode(expectedChannel) ); string memory channelId = generateChannelIdentifier(); @@ -141,12 +157,10 @@ contract IBCChannelHandshake is IBCModuleManager, IIBCChannelHandshake { */ function channelOpenAck(IIBCChannelHandshake.MsgChannelOpenAck calldata msg_) external { Channel.Data storage channel = channels[msg_.portId][msg_.channelId]; - require(channel.state == Channel.State.STATE_INIT, "channel state should be INIT"); - + if (channel.state != Channel.State.STATE_INIT) { + revert IBCChannelUnexpectedChannelState(channel.state); + } ConnectionEnd.Data storage connection = connections[channel.connection_hops[0]]; - require(connection.state == ConnectionEnd.State.STATE_OPEN, "connection state is not OPEN"); - require(channel.connection_hops.length == 1); - Channel.Data memory expectedChannel = Channel.Data({ state: Channel.State.STATE_TRYOPEN, ordering: channel.ordering, @@ -154,16 +168,14 @@ contract IBCChannelHandshake is IBCModuleManager, IIBCChannelHandshake { connection_hops: getCounterpartyHops(channel.connection_hops[0]), version: msg_.counterpartyVersion }); - require( - verifyChannelState( - connection, - msg_.proofHeight, - msg_.proofTry, - channel.counterparty.port_id, - msg_.counterpartyChannelId, - Channel.encode(expectedChannel) - ), - "failed to verify channel state" + + verifyChannelState( + connection, + msg_.proofHeight, + msg_.proofTry, + channel.counterparty.port_id, + msg_.counterpartyChannelId, + Channel.encode(expectedChannel) ); channel.state = Channel.State.STATE_OPEN; channel.version = msg_.counterpartyVersion; @@ -183,12 +195,10 @@ contract IBCChannelHandshake is IBCModuleManager, IIBCChannelHandshake { */ function channelOpenConfirm(IIBCChannelHandshake.MsgChannelOpenConfirm calldata msg_) external { Channel.Data storage channel = channels[msg_.portId][msg_.channelId]; - require(channel.state == Channel.State.STATE_TRYOPEN, "channel state is not TRYOPEN"); - + if (channel.state != Channel.State.STATE_TRYOPEN) { + revert IBCChannelUnexpectedChannelState(channel.state); + } ConnectionEnd.Data storage connection = connections[channel.connection_hops[0]]; - require(connection.state == ConnectionEnd.State.STATE_OPEN, "connection state is not OPEN"); - require(channel.connection_hops.length == 1); - Channel.Data memory expectedChannel = Channel.Data({ state: Channel.State.STATE_OPEN, ordering: channel.ordering, @@ -196,16 +206,13 @@ contract IBCChannelHandshake is IBCModuleManager, IIBCChannelHandshake { connection_hops: getCounterpartyHops(channel.connection_hops[0]), version: channel.version }); - require( - verifyChannelState( - connection, - msg_.proofHeight, - msg_.proofAck, - channel.counterparty.port_id, - channel.counterparty.channel_id, - Channel.encode(expectedChannel) - ), - "failed to verify channel state" + verifyChannelState( + connection, + msg_.proofHeight, + msg_.proofAck, + channel.counterparty.port_id, + channel.counterparty.channel_id, + Channel.encode(expectedChannel) ); channel.state = Channel.State.STATE_OPEN; updateChannelCommitment(msg_.portId, msg_.channelId); @@ -219,11 +226,15 @@ contract IBCChannelHandshake is IBCModuleManager, IIBCChannelHandshake { */ function channelCloseInit(IIBCChannelHandshake.MsgChannelCloseInit calldata msg_) external { Channel.Data storage channel = channels[msg_.portId][msg_.channelId]; - require(channel.state != Channel.State.STATE_CLOSED, "channel state is already CLOSED"); - + if (channel.state == Channel.State.STATE_UNINITIALIZED_UNSPECIFIED) { + revert IBCChannelChannelNotFound(msg_.portId, msg_.channelId); + } else if (channel.state == Channel.State.STATE_CLOSED) { + revert IBCChannelUnexpectedChannelState(channel.state); + } ConnectionEnd.Data storage connection = connections[channel.connection_hops[0]]; - require(connection.state == ConnectionEnd.State.STATE_OPEN, "connection state is not OPEN"); - + if (connection.state != ConnectionEnd.State.STATE_OPEN) { + revert IBCChannelConnectionNotOpened(channel.connection_hops[0]); + } channel.state = Channel.State.STATE_CLOSED; updateChannelCommitment(msg_.portId, msg_.channelId); lookupModuleByPort(msg_.portId).onChanCloseInit( @@ -237,11 +248,16 @@ contract IBCChannelHandshake is IBCModuleManager, IIBCChannelHandshake { */ function channelCloseConfirm(IIBCChannelHandshake.MsgChannelCloseConfirm calldata msg_) external { Channel.Data storage channel = channels[msg_.portId][msg_.channelId]; - require(channel.state != Channel.State.STATE_CLOSED, "channel state is already CLOSED"); + if (channel.state == Channel.State.STATE_UNINITIALIZED_UNSPECIFIED) { + revert IBCChannelChannelNotFound(msg_.portId, msg_.channelId); + } else if (channel.state == Channel.State.STATE_CLOSED) { + revert IBCChannelUnexpectedChannelState(channel.state); + } - require(channel.connection_hops.length == 1); ConnectionEnd.Data storage connection = connections[channel.connection_hops[0]]; - require(connection.state == ConnectionEnd.State.STATE_OPEN, "connection state is not OPEN"); + if (connection.state != ConnectionEnd.State.STATE_OPEN) { + revert IBCChannelConnectionNotOpened(channel.connection_hops[0]); + } Channel.Data memory expectedChannel = Channel.Data({ state: Channel.State.STATE_CLOSED, @@ -250,16 +266,13 @@ contract IBCChannelHandshake is IBCModuleManager, IIBCChannelHandshake { connection_hops: getCounterpartyHops(channel.connection_hops[0]), version: channel.version }); - require( - verifyChannelState( - connection, - msg_.proofHeight, - msg_.proofInit, - channel.counterparty.port_id, - channel.counterparty.channel_id, - Channel.encode(expectedChannel) - ), - "failed to verify channel state" + verifyChannelState( + connection, + msg_.proofHeight, + msg_.proofInit, + channel.counterparty.port_id, + channel.counterparty.channel_id, + Channel.encode(expectedChannel) ); channel.state = Channel.State.STATE_CLOSED; updateChannelCommitment(msg_.portId, msg_.channelId); @@ -305,16 +318,23 @@ contract IBCChannelHandshake is IBCModuleManager, IIBCChannelHandshake { string memory portId, string memory channelId, bytes memory channelBytes - ) private returns (bool) { - return checkAndGetClient(connection.client_id).verifyMembership( - connection.client_id, - height, - 0, - 0, - proof, - connection.counterparty.prefix.key_prefix, - IBCCommitment.channelPath(portId, channelId), - channelBytes + ) private { + if ( + checkAndGetClient(connection.client_id).verifyMembership( + connection.client_id, + height, + 0, + 0, + proof, + connection.counterparty.prefix.key_prefix, + IBCCommitment.channelPath(portId, channelId), + channelBytes + ) + ) { + return; + } + revert IBCChannelFailedVerifyChannelState( + connection.client_id, IBCCommitment.channelPath(portId, channelId), channelBytes, proof, height ); } diff --git a/contracts/core/04-channel/IBCChannelLib.sol b/contracts/core/04-channel/IBCChannelLib.sol index b7fc55a9..b52ed40b 100644 --- a/contracts/core/04-channel/IBCChannelLib.sol +++ b/contracts/core/04-channel/IBCChannelLib.sol @@ -2,6 +2,7 @@ pragma solidity ^0.8.20; import {Channel} from "../../proto/Channel.sol"; +import {IIBCChannelErrors} from "./IIBCChannelErrors.sol"; library IBCChannelLib { enum PacketReceipt { @@ -9,8 +10,8 @@ library IBCChannelLib { SUCCESSFUL } - string public constant ORDER_UNORDERED = "ORDER_UNORDERED"; - string public constant ORDER_ORDERED = "ORDER_ORDERED"; + string internal constant ORDER_UNORDERED = "ORDER_UNORDERED"; + string internal constant ORDER_ORDERED = "ORDER_ORDERED"; bytes32 internal constant PACKET_RECEIPT_SUCCESSFUL_KECCAK256 = keccak256(abi.encodePacked(PacketReceipt.SUCCESSFUL)); @@ -21,7 +22,7 @@ library IBCChannelLib { } else if (commitment == PACKET_RECEIPT_SUCCESSFUL_KECCAK256) { return PacketReceipt.SUCCESSFUL; } else { - revert("unknown receipt"); + revert IIBCChannelErrors.IBCChannelUnknownPacketReceiptCommitment(commitment); } } @@ -31,7 +32,7 @@ library IBCChannelLib { } else if (order == Channel.Order.ORDER_ORDERED) { return ORDER_ORDERED; } else { - revert("unknown order"); + revert IIBCChannelErrors.IBCChannelUnknownChannelOrder(order); } } } diff --git a/contracts/core/04-channel/IBCChannelPacketSendRecv.sol b/contracts/core/04-channel/IBCChannelPacketSendRecv.sol index 040359ee..4d4cac4b 100644 --- a/contracts/core/04-channel/IBCChannelPacketSendRecv.sol +++ b/contracts/core/04-channel/IBCChannelPacketSendRecv.sol @@ -5,21 +5,25 @@ import {Height} from "../../proto/Client.sol"; import {ConnectionEnd} from "../../proto/Connection.sol"; import {Channel} from "../../proto/Channel.sol"; import {ILightClient} from "../02-client/ILightClient.sol"; +import {IIBCClientErrors} from "../02-client/IIBCClientErrors.sol"; import {IBCHeight} from "../02-client/IBCHeight.sol"; import {IBCCommitment} from "../24-host/IBCCommitment.sol"; import {IBCModuleManager} from "../26-router/IBCModuleManager.sol"; import {IBCChannelLib} from "./IBCChannelLib.sol"; import {IIBCChannelPacketSendRecv} from "./IIBCChannel.sol"; +import {IIBCChannelErrors} from "./IIBCChannelErrors.sol"; /** * @dev IBCChannelPacketSendRecv is a contract that implements [ICS-4](https://github.com/cosmos/ibc/tree/main/spec/core/ics-004-channel-and-packet-semantics). */ -contract IBCChannelPacketSendRecv is IBCModuleManager, IIBCChannelPacketSendRecv { +contract IBCChannelPacketSendRecv is + IBCModuleManager, + IIBCChannelPacketSendRecv, + IIBCChannelErrors, + IIBCClientErrors +{ using IBCHeight for Height.Data; - bytes32 internal constant SUCCESSFUL_RECEIPT_COMMITMENT = - keccak256(abi.encodePacked(IBCChannelLib.PacketReceipt.SUCCESSFUL)); - /** * @dev sendPacket is called by a module in order to send an IBC packet on a channel. * The packet sequence generated for the packet to be sent is returned. An error @@ -32,30 +36,35 @@ contract IBCChannelPacketSendRecv is IBCModuleManager, IIBCChannelPacketSendRecv uint64 timeoutTimestamp, bytes calldata data ) external returns (uint64) { - require(authenticateCapability(channelCapabilityPath(sourcePort, sourceChannel)), "unauthorized"); + authenticateCapability(channelCapabilityPath(sourcePort, sourceChannel)); Channel.Data storage channel = channels[sourcePort][sourceChannel]; - require(channel.state == Channel.State.STATE_OPEN, "channel state must be OPEN"); + if (channel.state != Channel.State.STATE_OPEN) { + revert IBCChannelUnexpectedChannelState(channel.state); + } + if (timeoutHeight.isZero() && timeoutTimestamp == 0) { + revert IBCChannelZeroPacketTimeout(); + } { + // NOTE: We can assume here that the connection state is OPEN because the channel state is OPEN ConnectionEnd.Data storage connection = connections[channel.connection_hops[0]]; ILightClient client = ILightClient(clientImpls[connection.client_id]); - require(address(client) != address(0), "client not found"); - require( - client.getStatus(connection.client_id) == ILightClient.ClientStatus.Active, "client state is not active" - ); + if (address(client) == address(0)) { + revert IBCHostClientNotFound(connection.client_id); + } + if (client.getStatus(connection.client_id) != ILightClient.ClientStatus.Active) { + revert IBCClientNotActiveClient(connection.client_id); + } - require(!timeoutHeight.isZero() || timeoutTimestamp != 0, "timeout height and timestamp cannot both be 0"); Height.Data memory latestHeight = client.getLatestHeight(connection.client_id); - require( - timeoutHeight.isZero() || latestHeight.lt(timeoutHeight), - "receiving chain block height >= packet timeout height" - ); + if (!timeoutHeight.isZero() && latestHeight.gte(timeoutHeight)) { + revert IBCChannelPastPacketTimeoutHeight(timeoutHeight, latestHeight); + } uint64 latestTimestamp = client.getTimestampAtHeight(connection.client_id, latestHeight); - require( - timeoutTimestamp == 0 || latestTimestamp < timeoutTimestamp, - "receiving chain block timestamp >= packet timeout timestamp" - ); + if (timeoutTimestamp != 0 && latestTimestamp >= timeoutTimestamp) { + revert IBCChannelPastPacketTimeoutTimestamp(timeoutTimestamp, latestTimestamp); + } } uint64 packetSequence = nextSequenceSends[sourcePort][sourceChannel]; @@ -81,9 +90,16 @@ contract IBCChannelPacketSendRecv is IBCModuleManager, IIBCChannelPacketSendRecv string calldata destinationPortId, string calldata destinationChannel, uint64 sequence, - bytes memory acknowledgement + bytes calldata acknowledgement ) public { - require(authenticateCapability(channelCapabilityPath(destinationPortId, destinationChannel)), "unauthorized"); + authenticateCapability(channelCapabilityPath(destinationPortId, destinationChannel)); + Channel.Data storage channel = channels[destinationPortId][destinationChannel]; + if (channel.state != Channel.State.STATE_OPEN) { + revert IBCChannelUnexpectedChannelState(channel.state); + } + if (acknowledgement.length == 0) { + revert IBCChannelEmptyAcknowledgement(); + } _writeAcknowledgement(destinationPortId, destinationChannel, sequence, acknowledgement); } @@ -93,15 +109,11 @@ contract IBCChannelPacketSendRecv is IBCModuleManager, IIBCChannelPacketSendRecv uint64 sequence, bytes memory acknowledgement ) internal { - require(acknowledgement.length > 0, "acknowledgement cannot be empty"); - - Channel.Data storage channel = channels[destinationPortId][destinationChannel]; - require(channel.state == Channel.State.STATE_OPEN, "channel state must be OPEN"); - bytes32 ackCommitmentKey = IBCCommitment.packetAcknowledgementCommitmentKey(destinationPortId, destinationChannel, sequence); - bytes32 ackCommitment = commitments[ackCommitmentKey]; - require(ackCommitment == bytes32(0), "acknowledgement for packet already exists"); + if (commitments[ackCommitmentKey] != bytes32(0)) { + revert IBCChannelAcknowledgementAlreadyWritten(destinationPortId, destinationChannel, sequence); + } commitments[ackCommitmentKey] = keccak256(abi.encodePacked(sha256(acknowledgement))); emit WriteAcknowledgement(destinationPortId, destinationChannel, sequence, acknowledgement); } @@ -112,60 +124,61 @@ contract IBCChannelPacketSendRecv is IBCModuleManager, IIBCChannelPacketSendRecv */ function recvPacket(MsgPacketRecv calldata msg_) external { Channel.Data storage channel = channels[msg_.packet.destination_port][msg_.packet.destination_channel]; - require(channel.state == Channel.State.STATE_OPEN, "channel state must be OPEN"); - - require( - keccak256(bytes(msg_.packet.source_port)) == keccak256(bytes(channel.counterparty.port_id)), - "packet source port doesn't match the counterparty's port" - ); - require( - keccak256(bytes(msg_.packet.source_channel)) == keccak256(bytes(channel.counterparty.channel_id)), - "packet source channel doesn't match the counterparty's channel" - ); + if (channel.state != Channel.State.STATE_OPEN) { + revert IBCChannelUnexpectedChannelState(channel.state); + } - ConnectionEnd.Data storage connection = connections[channel.connection_hops[0]]; - require(connection.state == ConnectionEnd.State.STATE_OPEN, "connection state is not OPEN"); + if (keccak256(bytes(msg_.packet.source_port)) != keccak256(bytes(channel.counterparty.port_id))) { + revert IBCChannelUnexpectedPacketSource(msg_.packet.source_port, msg_.packet.source_channel); + } else if (keccak256(bytes(msg_.packet.source_channel)) != keccak256(bytes(channel.counterparty.channel_id))) { + revert IBCChannelUnexpectedPacketSource(msg_.packet.source_port, msg_.packet.source_channel); + } - require( - msg_.packet.timeout_height.revision_height == 0 || block.number < msg_.packet.timeout_height.revision_height, - "block height >= packet timeout height" - ); - require( - msg_.packet.timeout_timestamp == 0 || block.timestamp * 1e9 < msg_.packet.timeout_timestamp, - "block timestamp >= packet timeout timestamp" - ); + if ( + msg_.packet.timeout_height.revision_height != 0 + && block.number >= msg_.packet.timeout_height.revision_height + ) { + revert IBCChannelTimeoutPacketHeight(block.number, msg_.packet.timeout_height.revision_height); + } + if (msg_.packet.timeout_timestamp != 0 && block.timestamp * 1e9 >= msg_.packet.timeout_timestamp) { + revert IBCChannelTimeoutPacketTimestamp(block.timestamp * 1e9, msg_.packet.timeout_timestamp); + } - require( - verifyPacketCommitment( - connection, - msg_.proofHeight, - msg_.proof, - IBCCommitment.packetCommitmentPath( - msg_.packet.source_port, msg_.packet.source_channel, msg_.packet.sequence - ), - sha256( - abi.encodePacked( - msg_.packet.timeout_timestamp, - msg_.packet.timeout_height.revision_number, - msg_.packet.timeout_height.revision_height, - sha256(msg_.packet.data) - ) - ) + verifyPacketCommitment( + connections[channel.connection_hops[0]], + msg_.proofHeight, + msg_.proof, + IBCCommitment.packetCommitmentPath( + msg_.packet.source_port, msg_.packet.source_channel, msg_.packet.sequence ), - "failed to verify packet commitment" + sha256( + abi.encodePacked( + msg_.packet.timeout_timestamp, + msg_.packet.timeout_height.revision_number, + msg_.packet.timeout_height.revision_height, + sha256(msg_.packet.data) + ) + ) ); if (channel.ordering == Channel.Order.ORDER_UNORDERED) { bytes32 commitmentKey = IBCCommitment.packetReceiptCommitmentKey( msg_.packet.destination_port, msg_.packet.destination_channel, msg_.packet.sequence ); - require(commitments[commitmentKey] == bytes32(0), "packet receipt already exists"); - commitments[commitmentKey] = SUCCESSFUL_RECEIPT_COMMITMENT; + if (commitments[commitmentKey] != bytes32(0)) { + revert IBCChannelPacketReceiptAlreadyExists( + msg_.packet.destination_port, msg_.packet.destination_channel, msg_.packet.sequence + ); + } + commitments[commitmentKey] = IBCChannelLib.PACKET_RECEIPT_SUCCESSFUL_KECCAK256; } else if (channel.ordering == Channel.Order.ORDER_ORDERED) { - require( - nextSequenceRecvs[msg_.packet.destination_port][msg_.packet.destination_channel] == msg_.packet.sequence, - "packet sequence != next receive sequence" - ); + if ( + nextSequenceRecvs[msg_.packet.destination_port][msg_.packet.destination_channel] != msg_.packet.sequence + ) { + revert IBCChannelUnexpectedNextSequenceRecv( + nextSequenceRecvs[msg_.packet.destination_port][msg_.packet.destination_channel] + ); + } nextSequenceRecvs[msg_.packet.destination_port][msg_.packet.destination_channel]++; commitments[IBCCommitment.nextSequenceRecvCommitmentKey( msg_.packet.destination_port, msg_.packet.destination_channel @@ -173,7 +186,7 @@ contract IBCChannelPacketSendRecv is IBCModuleManager, IIBCChannelPacketSendRecv uint64ToBigEndianBytes(nextSequenceRecvs[msg_.packet.destination_port][msg_.packet.destination_channel]) ); } else { - revert("unknown ordering type"); + revert IBCChannelUnknownChannelOrder(channel.ordering); } bytes memory acknowledgement = lookupModuleByChannel( msg_.packet.destination_port, msg_.packet.destination_channel @@ -196,59 +209,61 @@ contract IBCChannelPacketSendRecv is IBCModuleManager, IIBCChannelPacketSendRecv */ function acknowledgePacket(MsgPacketAcknowledgement calldata msg_) external { Channel.Data storage channel = channels[msg_.packet.source_port][msg_.packet.source_channel]; - require(channel.state == Channel.State.STATE_OPEN, "channel state must be OPEN"); + if (channel.state != Channel.State.STATE_OPEN) { + revert IBCChannelUnexpectedChannelState(channel.state); + } - require( - keccak256(bytes(msg_.packet.destination_port)) == keccak256(bytes(channel.counterparty.port_id)), - "packet destination port doesn't match the counterparty's port" - ); - require( - keccak256(bytes(msg_.packet.destination_channel)) == keccak256(bytes(channel.counterparty.channel_id)), - "packet destination channel doesn't match the counterparty's channel" - ); + if (keccak256(bytes(msg_.packet.destination_port)) != keccak256(bytes(channel.counterparty.port_id))) { + revert IBCChannelUnexpectedPacketDestination(msg_.packet.destination_port, msg_.packet.destination_channel); + } else if ( + keccak256(bytes(msg_.packet.destination_channel)) != keccak256(bytes(channel.counterparty.channel_id)) + ) { + revert IBCChannelUnexpectedPacketDestination(msg_.packet.destination_port, msg_.packet.destination_channel); + } + // NOTE: We can assume here that the connection state is OPEN because the channel state is OPEN ConnectionEnd.Data storage connection = connections[channel.connection_hops[0]]; - require(connection.state == ConnectionEnd.State.STATE_OPEN, "connection state is not OPEN"); bytes32 packetCommitmentKey = IBCCommitment.packetCommitmentKey(msg_.packet.source_port, msg_.packet.source_channel, msg_.packet.sequence); bytes32 packetCommitment = commitments[packetCommitmentKey]; - require(packetCommitment != bytes32(0), "packet commitment not found"); - require( - packetCommitment - == keccak256( + if (packetCommitment == bytes32(0)) { + revert IBCChannelPacketCommitmentNotFound( + msg_.packet.source_port, msg_.packet.source_channel, msg_.packet.sequence + ); + } + bytes32 commitment = keccak256( + abi.encodePacked( + sha256( abi.encodePacked( - sha256( - abi.encodePacked( - msg_.packet.timeout_timestamp, - msg_.packet.timeout_height.revision_number, - msg_.packet.timeout_height.revision_height, - sha256(msg_.packet.data) - ) - ) + msg_.packet.timeout_timestamp, + msg_.packet.timeout_height.revision_number, + msg_.packet.timeout_height.revision_height, + sha256(msg_.packet.data) ) - ), - "commitment bytes are not equal" + ) + ) ); + if (packetCommitment != commitment) { + revert IBCChannelPacketCommitmentMismatch(packetCommitment, commitment); + } - require( - verifyPacketAcknowledgement( - connection, - msg_.proofHeight, - msg_.proof, - IBCCommitment.packetAcknowledgementCommitmentPath( - msg_.packet.destination_port, msg_.packet.destination_channel, msg_.packet.sequence - ), - sha256(msg_.acknowledgement) + verifyPacketAcknowledgement( + connection, + msg_.proofHeight, + msg_.proof, + IBCCommitment.packetAcknowledgementCommitmentPath( + msg_.packet.destination_port, msg_.packet.destination_channel, msg_.packet.sequence ), - "failed to verify packet acknowledgement commitment" + sha256(msg_.acknowledgement) ); if (channel.ordering == Channel.Order.ORDER_ORDERED) { - require( - msg_.packet.sequence == nextSequenceAcks[msg_.packet.source_port][msg_.packet.source_channel], - "packet sequence != next ack sequence" - ); + if (msg_.packet.sequence != nextSequenceAcks[msg_.packet.source_port][msg_.packet.source_channel]) { + revert IBCChannelUnexpectedNextSequenceAck( + nextSequenceAcks[msg_.packet.source_port][msg_.packet.source_channel] + ); + } nextSequenceAcks[msg_.packet.source_port][msg_.packet.source_channel]++; } @@ -266,18 +281,23 @@ contract IBCChannelPacketSendRecv is IBCModuleManager, IIBCChannelPacketSendRecv Height.Data calldata height, bytes calldata proof, bytes memory path, - bytes32 commitmentBytes - ) private returns (bool) { - return checkAndGetClient(connection.client_id).verifyMembership( - connection.client_id, - height, - connection.delay_period, - calcBlockDelay(connection.delay_period), - proof, - connection.counterparty.prefix.key_prefix, - path, - abi.encodePacked(commitmentBytes) - ); + bytes32 commitment + ) private { + if ( + checkAndGetClient(connection.client_id).verifyMembership( + connection.client_id, + height, + connection.delay_period, + calcBlockDelay(connection.delay_period), + proof, + connection.counterparty.prefix.key_prefix, + path, + abi.encodePacked(commitment) + ) + ) { + return; + } + revert IBCChannelFailedVerifyPacketCommitment(connection.client_id, path, commitment, proof, height); } function verifyPacketAcknowledgement( @@ -285,17 +305,24 @@ contract IBCChannelPacketSendRecv is IBCModuleManager, IIBCChannelPacketSendRecv Height.Data calldata height, bytes calldata proof, bytes memory path, - bytes32 acknowledgementCommitmentBytes - ) private returns (bool) { - return checkAndGetClient(connection.client_id).verifyMembership( - connection.client_id, - height, - connection.delay_period, - calcBlockDelay(connection.delay_period), - proof, - connection.counterparty.prefix.key_prefix, - path, - abi.encodePacked(acknowledgementCommitmentBytes) + bytes32 acknowledgementCommitment + ) private { + if ( + checkAndGetClient(connection.client_id).verifyMembership( + connection.client_id, + height, + connection.delay_period, + calcBlockDelay(connection.delay_period), + proof, + connection.counterparty.prefix.key_prefix, + path, + abi.encodePacked(acknowledgementCommitment) + ) + ) { + return; + } + revert IBCChannelFailedVerifyPacketAcknowledgement( + connection.client_id, path, acknowledgementCommitment, proof, height ); } diff --git a/contracts/core/04-channel/IBCChannelPacketTimeout.sol b/contracts/core/04-channel/IBCChannelPacketTimeout.sol index e03fa089..8d79de74 100644 --- a/contracts/core/04-channel/IBCChannelPacketTimeout.sol +++ b/contracts/core/04-channel/IBCChannelPacketTimeout.sol @@ -9,27 +9,28 @@ import {IBCHeight} from "../02-client/IBCHeight.sol"; import {IBCCommitment} from "../24-host/IBCCommitment.sol"; import {IBCModuleManager} from "../26-router/IBCModuleManager.sol"; import {IIBCChannelPacketTimeout} from "./IIBCChannel.sol"; +import {IIBCChannelErrors} from "./IIBCChannelErrors.sol"; -contract IBCChannelPacketTimeout is IBCModuleManager, IIBCChannelPacketTimeout { +contract IBCChannelPacketTimeout is IBCModuleManager, IIBCChannelPacketTimeout, IIBCChannelErrors { using IBCHeight for Height.Data; function timeoutPacket(MsgTimeoutPacket calldata msg_) external { Channel.Data storage channel = channels[msg_.packet.source_port][msg_.packet.source_channel]; - require(channel.state == Channel.State.STATE_OPEN, "channel state must be OPEN"); + if (channel.state != Channel.State.STATE_OPEN) { + revert IBCChannelUnexpectedChannelState(channel.state); + } - require( - keccak256(bytes(msg_.packet.destination_port)) == keccak256(bytes(channel.counterparty.port_id)), - "packet destination port doesn't match the counterparty's port" - ); - require( - keccak256(bytes(msg_.packet.destination_channel)) == keccak256(bytes(channel.counterparty.channel_id)), - "packet destination channel doesn't match the counterparty's channel" - ); + if (keccak256(bytes(msg_.packet.destination_port)) != keccak256(bytes(channel.counterparty.port_id))) { + revert IBCChannelUnexpectedPacketDestination(msg_.packet.destination_port, msg_.packet.destination_channel); + } else if ( + keccak256(bytes(msg_.packet.destination_channel)) != keccak256(bytes(channel.counterparty.channel_id)) + ) { + revert IBCChannelUnexpectedPacketDestination(msg_.packet.destination_port, msg_.packet.destination_channel); + } + // NOTE: we can assume here that the connection exists because the channel is open ConnectionEnd.Data storage connection = connections[channel.connection_hops[0]]; - require(bytes(connection.client_id).length != 0, "connection not found"); ILightClient client = ILightClient(clientImpls[connection.client_id]); - require(address(client) != address(0), "client not found"); { Height.Data memory latestHeight = client.getLatestHeight(connection.client_id); uint64 proofTimestamp = client.getTimestampAtHeight(connection.client_id, latestHeight); @@ -46,30 +47,35 @@ contract IBCChannelPacketTimeout is IBCModuleManager, IIBCChannelPacketTimeout { msg_.packet.source_port, msg_.packet.source_channel, msg_.packet.sequence )]; // NOTE: if false, this indicates that the timeoutPacket already been executed - require(commitment != bytes32(0), "packet commitment not found"); - require( - commitment - == keccak256( + if (commitment == bytes32(0)) { + revert IBCChannelPacketCommitmentNotFound( + msg_.packet.source_port, msg_.packet.source_channel, msg_.packet.sequence + ); + } + bytes32 packetCommitment = keccak256( + abi.encodePacked( + sha256( abi.encodePacked( - sha256( - abi.encodePacked( - msg_.packet.timeout_timestamp, - msg_.packet.timeout_height.revision_number, - msg_.packet.timeout_height.revision_height, - sha256(msg_.packet.data) - ) - ) + msg_.packet.timeout_timestamp, + msg_.packet.timeout_height.revision_number, + msg_.packet.timeout_height.revision_height, + sha256(msg_.packet.data) ) - ), - "commitment bytes are not equal" + ) + ) ); + if (commitment != packetCommitment) { + revert IBCChannelPacketCommitmentMismatch(commitment, packetCommitment); + } } if (channel.ordering == Channel.Order.ORDER_ORDERED) { // check that packet has not been received - require(msg_.nextSequenceRecv <= msg_.packet.sequence, "packet sequence > next receive sequence"); - require( - client.verifyMembership( + if (msg_.packet.sequence < msg_.nextSequenceRecv) { + revert IBCChannelPacketMaybeAlreadyReceived(msg_.packet.sequence, msg_.nextSequenceRecv); + } + if ( + !client.verifyMembership( connection.client_id, msg_.proofHeight, connection.delay_period, @@ -80,13 +86,22 @@ contract IBCChannelPacketTimeout is IBCModuleManager, IIBCChannelPacketTimeout { msg_.packet.destination_port, msg_.packet.destination_channel ), uint64ToBigEndianBytes(msg_.nextSequenceRecv) - ), - "failed to verify next sequence receive" - ); + ) + ) { + revert IBCChannelFailedVerifyNextSequenceRecv( + connection.client_id, + IBCCommitment.nextSequenceRecvCommitmentPath( + msg_.packet.destination_port, msg_.packet.destination_channel + ), + msg_.nextSequenceRecv, + msg_.proof, + msg_.proofHeight + ); + } channel.state = Channel.State.STATE_CLOSED; } else if (channel.ordering == Channel.Order.ORDER_UNORDERED) { - require( - client.verifyNonMembership( + if ( + !client.verifyNonMembership( connection.client_id, msg_.proofHeight, connection.delay_period, @@ -96,11 +111,19 @@ contract IBCChannelPacketTimeout is IBCModuleManager, IIBCChannelPacketTimeout { IBCCommitment.packetReceiptCommitmentPath( msg_.packet.destination_port, msg_.packet.destination_channel, msg_.packet.sequence ) - ), - "failed to verify packet receipt absense" - ); + ) + ) { + revert IBCChannelFailedVerifyPacketReceiptAbsence( + connection.client_id, + IBCCommitment.packetReceiptCommitmentPath( + msg_.packet.destination_port, msg_.packet.destination_channel, msg_.packet.sequence + ), + msg_.proof, + msg_.proofHeight + ); + } } else { - revert("unknown ordering type"); + revert IBCChannelUnknownChannelOrder(channel.ordering); } delete commitments[IBCCommitment.packetCommitmentKey( @@ -115,44 +138,45 @@ contract IBCChannelPacketTimeout is IBCModuleManager, IIBCChannelPacketTimeout { function timeoutOnClose(MsgTimeoutOnClose calldata msg_) external { Channel.Data storage channel = channels[msg_.packet.source_port][msg_.packet.source_channel]; - require(channel.state == Channel.State.STATE_OPEN, "channel state must be OPEN"); + if (channel.state != Channel.State.STATE_OPEN) { + revert IBCChannelUnexpectedChannelState(channel.state); + } - require( - keccak256(bytes(msg_.packet.destination_port)) == keccak256(bytes(channel.counterparty.port_id)), - "packet destination port doesn't match the counterparty's port" - ); - require( - keccak256(bytes(msg_.packet.destination_channel)) == keccak256(bytes(channel.counterparty.channel_id)), - "packet destination channel doesn't match the counterparty's channel" - ); + if (keccak256(bytes(msg_.packet.destination_port)) != keccak256(bytes(channel.counterparty.port_id))) { + revert IBCChannelUnexpectedPacketDestination(msg_.packet.destination_port, msg_.packet.destination_channel); + } else if ( + keccak256(bytes(msg_.packet.destination_channel)) != keccak256(bytes(channel.counterparty.channel_id)) + ) { + revert IBCChannelUnexpectedPacketDestination(msg_.packet.destination_port, msg_.packet.destination_channel); + } ConnectionEnd.Data storage connection = connections[channel.connection_hops[0]]; - require(bytes(connection.client_id).length != 0, "connection not found"); ILightClient client = ILightClient(clientImpls[connection.client_id]); - require(address(client) != address(0), "client not found"); - { bytes32 commitment = commitments[IBCCommitment.packetCommitmentKey( msg_.packet.source_port, msg_.packet.source_channel, msg_.packet.sequence )]; // NOTE: if false, this indicates that the timeoutPacket already been executed - require(commitment != bytes32(0), "packet commitment not found"); - require( - commitment - == keccak256( + if (commitment == bytes32(0)) { + revert IBCChannelPacketCommitmentNotFound( + msg_.packet.source_port, msg_.packet.source_channel, msg_.packet.sequence + ); + } + bytes32 packetCommitment = keccak256( + abi.encodePacked( + sha256( abi.encodePacked( - sha256( - abi.encodePacked( - msg_.packet.timeout_timestamp, - msg_.packet.timeout_height.revision_number, - msg_.packet.timeout_height.revision_height, - sha256(msg_.packet.data) - ) - ) + msg_.packet.timeout_timestamp, + msg_.packet.timeout_height.revision_number, + msg_.packet.timeout_height.revision_height, + sha256(msg_.packet.data) ) - ), - "commitment bytes are not equal" + ) + ) ); + if (commitment != packetCommitment) { + revert IBCChannelPacketCommitmentMismatch(commitment, packetCommitment); + } } { @@ -166,8 +190,8 @@ contract IBCChannelPacketTimeout is IBCModuleManager, IIBCChannelPacketTimeout { connection_hops: buildConnectionHops(connection.counterparty.connection_id), version: channel.version }); - require( - client.verifyMembership( + if ( + !client.verifyMembership( connection.client_id, msg_.proofHeight, connection.delay_period, @@ -176,16 +200,25 @@ contract IBCChannelPacketTimeout is IBCModuleManager, IIBCChannelPacketTimeout { connection.counterparty.prefix.key_prefix, IBCCommitment.channelPath(msg_.packet.destination_port, msg_.packet.destination_channel), Channel.encode(expectedChannel) - ), - "failed to verify channel state" - ); + ) + ) { + revert IBCChannelFailedVerifyChannelState( + connection.client_id, + IBCCommitment.channelPath(msg_.packet.destination_port, msg_.packet.destination_channel), + Channel.encode(expectedChannel), + msg_.proofClose, + msg_.proofHeight + ); + } } if (channel.ordering == Channel.Order.ORDER_ORDERED) { // check that packet has not been received - require(msg_.nextSequenceRecv <= msg_.packet.sequence, "packet sequence > next receive sequence"); - require( - client.verifyMembership( + if (msg_.packet.sequence < msg_.nextSequenceRecv) { + revert IBCChannelPacketMaybeAlreadyReceived(msg_.packet.sequence, msg_.nextSequenceRecv); + } + if ( + !client.verifyMembership( connection.client_id, msg_.proofHeight, connection.delay_period, @@ -196,12 +229,21 @@ contract IBCChannelPacketTimeout is IBCModuleManager, IIBCChannelPacketTimeout { msg_.packet.destination_port, msg_.packet.destination_channel ), uint64ToBigEndianBytes(msg_.nextSequenceRecv) - ), - "failed to verify next sequence receive" - ); + ) + ) { + revert IBCChannelFailedVerifyNextSequenceRecv( + connection.client_id, + IBCCommitment.nextSequenceRecvCommitmentPath( + msg_.packet.destination_port, msg_.packet.destination_channel + ), + msg_.nextSequenceRecv, + msg_.proofUnreceived, + msg_.proofHeight + ); + } } else if (channel.ordering == Channel.Order.ORDER_UNORDERED) { - require( - client.verifyNonMembership( + if ( + !client.verifyNonMembership( connection.client_id, msg_.proofHeight, connection.delay_period, @@ -211,11 +253,19 @@ contract IBCChannelPacketTimeout is IBCModuleManager, IIBCChannelPacketTimeout { IBCCommitment.packetReceiptCommitmentPath( msg_.packet.destination_port, msg_.packet.destination_channel, msg_.packet.sequence ) - ), - "failed to verify packet receipt absense" - ); + ) + ) { + revert IBCChannelFailedVerifyPacketReceiptAbsence( + connection.client_id, + IBCCommitment.packetReceiptCommitmentPath( + msg_.packet.destination_port, msg_.packet.destination_channel, msg_.packet.sequence + ), + msg_.proofUnreceived, + msg_.proofHeight + ); + } } else { - revert("unknown ordering type"); + revert IBCChannelUnknownChannelOrder(channel.ordering); } lookupModuleByChannel(msg_.packet.source_port, msg_.packet.source_channel).onTimeoutPacket( msg_.packet, _msgSender() diff --git a/contracts/core/04-channel/IIBCChannel.sol b/contracts/core/04-channel/IIBCChannel.sol index 4746dd88..e64dc881 100644 --- a/contracts/core/04-channel/IIBCChannel.sol +++ b/contracts/core/04-channel/IIBCChannel.sol @@ -5,6 +5,8 @@ import {Height} from "../../proto/Client.sol"; import {Channel, Packet} from "../../proto/Channel.sol"; interface IIBCChannelHandshake { + // --------------------- Data Structure --------------------- // + struct MsgChannelOpenInit { string portId; Channel.Data channel; @@ -46,7 +48,12 @@ interface IIBCChannelHandshake { Height.Data proofHeight; } - event GeneratedChannelIdentifier(string); + // --------------------- Events --------------------- // + + /// @param channelId channel identifier + event GeneratedChannelIdentifier(string channelId); + + // --------------------- Functions --------------------- // /** * @dev channelOpenInit is called by a module to initiate a channel opening handshake with a module on another chain. @@ -85,6 +92,9 @@ interface IIBCChannelHandshake { } interface IICS04SendPacket { + // --------------------- Events --------------------- // + + /// @notice event emitted upon sending a packet event SendPacket( uint64 sequence, string sourcePort, @@ -94,6 +104,8 @@ interface IICS04SendPacket { bytes data ); + // --------------------- Functions --------------------- // + /** * @dev sendPacket is called by a module in order to send an IBC packet on a channel. * The packet sequence generated for the packet to be sent is returned. An error @@ -109,10 +121,19 @@ interface IICS04SendPacket { } interface IICS04WriteAcknowledgement { + // --------------------- Events --------------------- // + + /// @notice event emitted upon writing an acknowledgement + /// @param destinationPortId destination port + /// @param destinationChannel destination channel + /// @param sequence packet sequence + /// @param acknowledgement acknowledgement event WriteAcknowledgement( string destinationPortId, string destinationChannel, uint64 sequence, bytes acknowledgement ); + // --------------------- Functions --------------------- // + /** * @dev writeAcknowledgement writes the packet execution acknowledgement to the state, * which will be verified by the counterparty chain using AcknowledgePacket. @@ -126,14 +147,21 @@ interface IICS04WriteAcknowledgement { } interface IIBCChannelRecvPacket { + // --------------------- Data Structure --------------------- // + struct MsgPacketRecv { Packet.Data packet; bytes proof; Height.Data proofHeight; } + // --------------------- Events --------------------- // + + /// @notice event emitted upon receiving a packet event RecvPacket(Packet.Data packet); + // --------------------- Functions --------------------- // + /** * @dev recvPacket is called by a module in order to receive & process an IBC packet * sent on the corresponding channel end on the counterparty chain. @@ -142,6 +170,8 @@ interface IIBCChannelRecvPacket { } interface IIBCChannelAcknowledgePacket { + // --------------------- Data Structure --------------------- // + struct MsgPacketAcknowledgement { Packet.Data packet; bytes acknowledgement; @@ -149,8 +179,13 @@ interface IIBCChannelAcknowledgePacket { Height.Data proofHeight; } + // --------------------- Events --------------------- // + + /// @notice event emitted upon acknowledging a packet event AcknowledgePacket(Packet.Data packet, bytes acknowledgement); + // --------------------- Functions --------------------- // + /** * @dev AcknowledgePacket is called by a module to process the acknowledgement of a * packet previously sent by the calling module on a channel to a counterparty @@ -163,6 +198,8 @@ interface IIBCChannelAcknowledgePacket { } interface IIBCChannelPacketTimeout { + // --------------------- Data Structure --------------------- // + struct MsgTimeoutPacket { Packet.Data packet; bytes proof; @@ -178,8 +215,13 @@ interface IIBCChannelPacketTimeout { uint64 nextSequenceRecv; } + // --------------------- Events --------------------- // + + /// @notice event emitted upon timeout of a packet event TimeoutPacket(Packet.Data packet); + // --------------------- Functions --------------------- // + /** * @dev TimeoutPacket is called by a module which originally attempted to send a * packet to a counterparty module, where the timeout height has passed on the diff --git a/contracts/core/04-channel/IIBCChannelErrors.sol b/contracts/core/04-channel/IIBCChannelErrors.sol new file mode 100644 index 00000000..64b96c40 --- /dev/null +++ b/contracts/core/04-channel/IIBCChannelErrors.sol @@ -0,0 +1,137 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity ^0.8.20; + +import {Height} from "../../proto/Client.sol"; +import {Channel} from "../../proto/Channel.sol"; + +interface IIBCChannelErrors { + /// @param state channel state + error IBCChannelUnexpectedChannelState(Channel.State state); + + /// @param portId port identifier + /// @param channelId channel identifier + error IBCChannelChannelNotFound(string portId, string channelId); + + /// @param ordering channel ordering + error IBCChannelUnknownChannelOrder(Channel.Order ordering); + + /// @param clientId client identifier + /// @param path commitment path + /// @param value value + /// @param proof proof + /// @param height proof height + error IBCChannelFailedVerifyChannelState(string clientId, bytes path, bytes value, bytes proof, Height.Data height); + + /// @param connectionId connection identifier + error IBCChannelConnectionNotOpened(string connectionId); + + /// @param counterpartyChannelId counterparty channel identifier + error IBCChannelCounterpartyChannelIdNotEmpty(string counterpartyChannelId); + + /// @param length length of the connection hops + error IBCChannelInvalidConnectionHopsLength(uint256 length); + + /// @param connectionId connection identifier + /// @param length length of the connection hops + error IBCChannelConnectionMultipleVersionsFound(string connectionId, uint256 length); + + /// @param ordering channel ordering + error IBCChannelConnectionFeatureNotSupported(Channel.Order ordering); + + /// @notice timeout height and timestamp are both zero + error IBCChannelZeroPacketTimeout(); + + /// @notice receiving chain block height >= packet timeout height + /// @param timeoutHeight packet timeout height + /// @param latestHeight latest height of the receiving chain + error IBCChannelPastPacketTimeoutHeight(Height.Data timeoutHeight, Height.Data latestHeight); + + /// @notice receiving chain block timestamp >= packet timeout timestamp + /// @param timeoutTimestamp packet timeout timestamp + /// @param latestTimestamp latest timestamp of the receiving chain + error IBCChannelPastPacketTimeoutTimestamp(uint64 timeoutTimestamp, uint64 latestTimestamp); + + /// @param commitment packet receipt commitment + error IBCChannelUnknownPacketReceiptCommitment(bytes32 commitment); + + /// @param sourcePort source port + /// @param sourceChannel source channel + error IBCChannelUnexpectedPacketSource(string sourcePort, string sourceChannel); + + /// @param destinationPort destination port + /// @param destinationChannel destination channel + error IBCChannelUnexpectedPacketDestination(string destinationPort, string destinationChannel); + + /// @param currentBlockNumber current block number + /// @param timeoutHeight packet timeout height + error IBCChannelTimeoutPacketHeight(uint256 currentBlockNumber, uint64 timeoutHeight); + + /// @param currentTimestamp current timestamp + /// @param timeoutTimestamp packet timeout timestamp + error IBCChannelTimeoutPacketTimestamp(uint256 currentTimestamp, uint64 timeoutTimestamp); + + /// @param destinationPort destination port + /// @param destinationChannel destination channel + /// @param sequence packet sequence + error IBCChannelPacketReceiptAlreadyExists(string destinationPort, string destinationChannel, uint64 sequence); + + /// @param expected expected sequence + error IBCChannelUnexpectedNextSequenceRecv(uint64 expected); + + /// @param portId port identifier + /// @param channelId channel identifier + /// @param sequence packet sequence + error IBCChannelPacketCommitmentNotFound(string portId, string channelId, uint64 sequence); + + /// @param expected expected sequence + error IBCChannelUnexpectedNextSequenceAck(uint64 expected); + + /// @param expected expected commitment + /// @param actual actual commitment + error IBCChannelPacketCommitmentMismatch(bytes32 expected, bytes32 actual); + + /// @param sequence packet sequence + /// @param nextSequenceRecv next sequence received + error IBCChannelPacketMaybeAlreadyReceived(uint64 sequence, uint64 nextSequenceRecv); + + /// @param clientId client identifier + /// @param path commitment path + /// @param commitment packet commitment + /// @param proof proof + /// @param height proof height + error IBCChannelFailedVerifyPacketCommitment( + string clientId, bytes path, bytes32 commitment, bytes proof, Height.Data height + ); + + /// @param clientId client identifier + /// @param path commitment path + /// @param commitment acknowledgement commitment + /// @param proof proof + /// @param height proof height + error IBCChannelFailedVerifyPacketAcknowledgement( + string clientId, bytes path, bytes32 commitment, bytes proof, Height.Data height + ); + + /// @param clientId client identifier + /// @param path commitment path + /// @param nextSequenceRecv next sequence received + /// @param proof proof + /// @param height proof height + error IBCChannelFailedVerifyNextSequenceRecv( + string clientId, bytes path, uint64 nextSequenceRecv, bytes proof, Height.Data height + ); + + /// @param clientId client identifier + /// @param path commitment path + /// @param proof proof + /// @param height proof height + error IBCChannelFailedVerifyPacketReceiptAbsence(string clientId, bytes path, bytes proof, Height.Data height); + + /// @notice acknowledgement cannot be empty + error IBCChannelEmptyAcknowledgement(); + + /// @param destinationPort destination port + /// @param destinationChannel destination channel + /// @param sequence packet sequence + error IBCChannelAcknowledgementAlreadyWritten(string destinationPort, string destinationChannel, uint64 sequence); +} diff --git a/contracts/core/24-host/IBCHost.sol b/contracts/core/24-host/IBCHost.sol index c1dc9f48..6e47ba83 100644 --- a/contracts/core/24-host/IBCHost.sol +++ b/contracts/core/24-host/IBCHost.sol @@ -3,8 +3,9 @@ pragma solidity ^0.8.20; import {ILightClient} from "../02-client/ILightClient.sol"; import {IBCStore} from "../24-host/IBCStore.sol"; +import {IIBCHostErrors} from "./IIBCHostErrors.sol"; -contract IBCHost is IBCStore { +contract IBCHost is IIBCHostErrors, IBCStore { // It represents the prefix of the commitment proof(https://github.com/cosmos/ibc/tree/main/spec/core/ics-023-vector-commitments#prefix). // In ibc-solidity, the prefix is not required, but for compatibility with ibc-go this must be a non-empty value. bytes internal constant DEFAULT_COMMITMENT_PREFIX = bytes("ibc"); @@ -21,7 +22,9 @@ contract IBCHost is IBCStore { */ function checkAndGetClient(string memory clientId) internal view returns (ILightClient) { address clientImpl = clientImpls[clientId]; - require(clientImpl != address(0)); + if (clientImpl == address(0)) { + revert IBCHostClientNotFound(clientId); + } return ILightClient(clientImpl); } } diff --git a/contracts/core/24-host/IBCHostConfigurator.sol b/contracts/core/24-host/IBCHostConfigurator.sol index 33153a5f..ebe30c11 100644 --- a/contracts/core/24-host/IBCHostConfigurator.sol +++ b/contracts/core/24-host/IBCHostConfigurator.sol @@ -1,7 +1,6 @@ // SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.20; -import {Address} from "@openzeppelin/contracts/utils/Address.sol"; import {IBCClientLib} from "../02-client/IBCClientLib.sol"; import {ILightClient} from "../02-client/ILightClient.sol"; import {IBCModuleManager} from "../26-router/IBCModuleManager.sol"; @@ -11,24 +10,30 @@ import {IIBCHostConfigurator} from "./IIBCHostConfigurator.sol"; /** * @dev IBCHostConfigurator is a contract that provides the host configuration. */ -abstract contract IBCHostConfigurator is IBCModuleManager, IIBCHostConfigurator { +abstract contract IBCHostConfigurator is IIBCHostConfigurator, IBCModuleManager { function _setExpectedTimePerBlock(uint64 expectedTimePerBlock_) internal virtual { expectedTimePerBlock = expectedTimePerBlock_; } function _registerClient(string calldata clientType, ILightClient client) internal virtual { - require(IBCClientLib.validateClientType(bytes(clientType)), "invalid clientType"); - require(address(clientRegistry[clientType]) == address(0), "clientType already exists"); - require(address(client) != address(this) && Address.isContract(address(client)), "invalid client address"); + if (!IBCClientLib.validateClientType(bytes(clientType))) { + revert IBCHostInvalidClientType(clientType); + } else if (address(clientRegistry[clientType]) != address(0)) { + revert IBCHostClientTypeAlreadyExists(clientType); + } + if (address(client) == address(0) || address(client) == address(this)) { + revert IBCHostInvalidLightClientAddress(address(client)); + } clientRegistry[clientType] = address(client); } function _bindPort(string calldata portId, IIBCModule moduleAddress) internal virtual { - require(validatePortIdentifier(bytes(portId)), "invalid portId"); - require( - address(moduleAddress) != address(this) && Address.isContract(address(moduleAddress)), - "invalid moduleAddress" - ); + if (!validatePortIdentifier(bytes(portId))) { + revert IBCHostInvalidPortIdentifier(portId); + } + if (address(moduleAddress) == address(0) || address(moduleAddress) == address(this)) { + revert IBCHostInvalidModuleAddress(address(moduleAddress)); + } claimCapability(portCapabilityPath(portId), address(moduleAddress)); } } diff --git a/contracts/core/24-host/IIBCHostErrors.sol b/contracts/core/24-host/IIBCHostErrors.sol new file mode 100644 index 00000000..395d220e --- /dev/null +++ b/contracts/core/24-host/IIBCHostErrors.sol @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity ^0.8.20; + +interface IIBCHostErrors { + /// @param clientType client type + error IBCHostInvalidClientType(string clientType); + + /// @param clientType client type + error IBCHostClientTypeAlreadyExists(string clientType); + + /// @param clientId the client identifier + error IBCHostClientNotFound(string clientId); + + /// @param portId port identifier + error IBCHostInvalidPortIdentifier(string portId); + + /// @param lcAddress light client contract address + error IBCHostInvalidLightClientAddress(address lcAddress); + + /// @param moduleAddress module contract address + error IBCHostInvalidModuleAddress(address moduleAddress); + + /// @param name module name + error IBCHostModuleNotFound(string name); + + /// @param name capability name + error IBCHostCapabilityAlreadyClaimed(string name); + + /// @param name capability name + /// @param caller caller address + error IBCHostFailedAuthenticateCapability(string name, address caller); +} diff --git a/contracts/core/25-handler/IBCClientConnectionChannelHandler.sol b/contracts/core/25-handler/IBCClientConnectionChannelHandler.sol index 94fadb7d..f908b719 100644 --- a/contracts/core/25-handler/IBCClientConnectionChannelHandler.sol +++ b/contracts/core/25-handler/IBCClientConnectionChannelHandler.sol @@ -70,7 +70,6 @@ abstract contract IBCClientConnectionChannelHandler is } function wrappedRouteUpdateClient(MsgUpdateClient calldata msg_) public returns (address, bytes4, bytes memory) { - require(msg.sender == address(this), "only this contract can call routeUpdateClient"); (bool success, bytes memory returndata) = address(ibcClient).delegatecall(abi.encodeWithSelector(IIBCClient.routeUpdateClient.selector, msg_)); if (!success) { diff --git a/contracts/core/25-handler/IIBCHandler.sol b/contracts/core/25-handler/IIBCHandler.sol index 2bae59df..c6df2401 100644 --- a/contracts/core/25-handler/IIBCHandler.sol +++ b/contracts/core/25-handler/IIBCHandler.sol @@ -2,9 +2,13 @@ pragma solidity ^0.8.20; import {IIBCClient} from "../02-client/IIBCClient.sol"; +import {IIBCClientErrors} from "../02-client/IIBCClientErrors.sol"; import {IIBCConnection} from "../03-connection/IIBCConnection.sol"; +import {IIBCConnectionErrors} from "../03-connection/IIBCConnectionErrors.sol"; import {IIBCChannelHandshake, IIBCChannelPacket} from "../04-channel/IIBCChannel.sol"; +import {IIBCChannelErrors} from "../04-channel/IIBCChannelErrors.sol"; import {IIBCHostConfigurator} from "../24-host/IIBCHostConfigurator.sol"; +import {IIBCHostErrors} from "../24-host/IIBCHostErrors.sol"; import {IIBCQuerier} from "./IIBCQuerier.sol"; /** @@ -12,9 +16,13 @@ import {IIBCQuerier} from "./IIBCQuerier.sol"; */ interface IIBCHandler is IIBCClient, + IIBCClientErrors, IIBCConnection, + IIBCConnectionErrors, IIBCChannelHandshake, IIBCChannelPacket, - IIBCQuerier, - IIBCHostConfigurator + IIBCChannelErrors, + IIBCHostConfigurator, + IIBCHostErrors, + IIBCQuerier {} diff --git a/contracts/core/25-handler/OwnableIBCHandler.sol b/contracts/core/25-handler/OwnableIBCHandler.sol index 9266bb1d..5da1d6b8 100644 --- a/contracts/core/25-handler/OwnableIBCHandler.sol +++ b/contracts/core/25-handler/OwnableIBCHandler.sol @@ -31,6 +31,7 @@ contract OwnableIBCHandler is IBCHandler, Ownable { IIBCChannelPacketTimeout ibcChannelPacketTimeout_ ) IBCHandler(ibcClient_, ibcConnection_, ibcChannelHandshake_, ibcChannelPacketSendRecv_, ibcChannelPacketTimeout_) + Ownable(msg.sender) {} function registerClient(string calldata clientType, ILightClient client) public onlyOwner { diff --git a/contracts/core/26-router/IBCModuleManager.sol b/contracts/core/26-router/IBCModuleManager.sol index 2ca8ae08..fea768ea 100644 --- a/contracts/core/26-router/IBCModuleManager.sol +++ b/contracts/core/26-router/IBCModuleManager.sol @@ -14,7 +14,9 @@ contract IBCModuleManager is IBCHost, Context { */ function lookupModuleByPort(string memory portId) internal view virtual returns (IIBCModule) { address module = lookupModule(portCapabilityPath(portId)); - require(module != address(0), "module not found"); + if (module == address(0)) { + revert IBCHostModuleNotFound(portCapabilityPath(portId)); + } return IIBCModule(module); } @@ -28,7 +30,9 @@ contract IBCModuleManager is IBCHost, Context { returns (IIBCModule) { address module = lookupModule(channelCapabilityPath(portId, channelId)); - require(module != address(0), "module not found"); + if (module == address(0)) { + revert IBCHostModuleNotFound(channelCapabilityPath(portId, channelId)); + } return IIBCModule(module); } @@ -36,7 +40,9 @@ contract IBCModuleManager is IBCHost, Context { * @dev claimCapability allows the IBC app module to claim a capability that core IBC passes to it */ function claimCapability(string memory name, address addr) internal { - require(capabilities[name] == address(0), "capability already claimed"); + if (capabilities[name] != address(0)) { + revert IBCHostCapabilityAlreadyClaimed(name); + } capabilities[name] = addr; } @@ -44,8 +50,10 @@ contract IBCModuleManager is IBCHost, Context { * @dev authenticateCapability attempts to authenticate a given name from a caller. * It allows for a caller to check that a capability does in fact correspond to a particular name. */ - function authenticateCapability(string memory name) internal view returns (bool) { - return _msgSender() == capabilities[name]; + function authenticateCapability(string memory name) internal view { + if (capabilities[name] != _msgSender()) { + revert IBCHostFailedAuthenticateCapability(name, _msgSender()); + } } /** diff --git a/contracts/core/26-router/IIBCModuleErrors.sol b/contracts/core/26-router/IIBCModuleErrors.sol new file mode 100644 index 00000000..b24a430c --- /dev/null +++ b/contracts/core/26-router/IIBCModuleErrors.sol @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity ^0.8.20; + +import {Channel} from "../../proto/Channel.sol"; + +interface IIBCModuleErrors { + /// @dev An error indicating that the sender is not the IBC contract + /// @param sender Address of the sender + error IBCModuleInvalidSender(address sender); + + /// @dev An error indicating that the channel ordering is not allowed + /// @param portId Port identifier + /// @param channelId Channel identifier + /// @param order Channel ordering type + error IBCModuleChannelOrderNotAllowed(string portId, string channelId, Channel.Order order); + + /// @dev An error indicating that the channel close is not allowed + error IBCModuleChannelCloseNotAllowed(string portId, string channelId); +} diff --git a/contracts/helpers/LocalhostHelper.sol b/contracts/helpers/LocalhostHelper.sol index 5b0cdf41..9e7a3caa 100644 --- a/contracts/helpers/LocalhostHelper.sol +++ b/contracts/helpers/LocalhostHelper.sol @@ -6,6 +6,7 @@ import {LocalhostClient, LocalhostClientLib} from "../clients/LocalhostClient.so import {Version, Counterparty, MerklePrefix} from "../proto/Connection.sol"; import {IBCConnectionLib} from "../core/03-connection/IBCConnectionLib.sol"; import {IIBCClient} from "../core/02-client/IIBCClient.sol"; +import {IIBCClientErrors} from "../core/02-client/IIBCClientErrors.sol"; import {IIBCConnection} from "../core/03-connection/IIBCConnection.sol"; import {Height} from "../proto/Client.sol"; import {Channel, ChannelCounterparty} from "../proto/Channel.sol"; @@ -39,7 +40,9 @@ library LocalhostHelper { */ function getLocalhostClient(IIBCHandler ibcHandler) internal view returns (LocalhostClient) { address localhost = ibcHandler.getClientByType(LocalhostClientLib.CLIENT_TYPE); - require(localhost != address(0), "client not found"); + if (localhost == address(0)) { + revert IIBCClientErrors.IBCClientUnregisteredClientType(LocalhostClientLib.CLIENT_TYPE); + } return LocalhostClient(localhost); } diff --git a/package-lock.json b/package-lock.json index 13c683c6..e71f8774 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "0.1.0", "license": "Apache-2.0", "dependencies": { - "@openzeppelin/contracts": "^4.8.3", + "@openzeppelin/contracts": "^5.0.1", "solidity-mpt": "^0.1.0", "solidity-rlp": "^2.0.8" }, @@ -178,9 +178,9 @@ } }, "node_modules/@openzeppelin/contracts": { - "version": "4.9.3", - "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-4.9.3.tgz", - "integrity": "sha512-He3LieZ1pP2TNt5JbkPA4PNT9WC3gOTOlDcFGJW4Le4QKqwmiNJCRt44APfxMxvq7OugU/cqYuPcSBzOw38DAg==" + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-5.0.1.tgz", + "integrity": "sha512-yQJaT5HDp9hYOOp4jTYxMsR02gdFZFXhewX5HW9Jo4fsqSVqqyIO/xTHdWDaKX5a3pv1txmf076Lziz+sO7L1w==" }, "node_modules/@pnpm/config.env-replace": { "version": "1.1.0", @@ -655,9 +655,9 @@ } }, "node_modules/ignore": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.0.tgz", - "integrity": "sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg==", + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", + "integrity": "sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==", "dev": true, "engines": { "node": ">= 4" @@ -1072,9 +1072,9 @@ } }, "node_modules/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" @@ -1104,9 +1104,9 @@ } }, "node_modules/solhint": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/solhint/-/solhint-4.0.0.tgz", - "integrity": "sha512-bFViMcFvhqVd/HK3Roo7xZXX5nbujS7Bxeg5vnZc9QvH0yCWCrQ38Yrn1pbAY9tlKROc6wFr+rK1mxYgYrjZgA==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/solhint/-/solhint-4.1.1.tgz", + "integrity": "sha512-7G4iF8H5hKHc0tR+/uyZesSKtfppFIMvPSW+Ku6MSL25oVRuyFeqNhOsXHfkex64wYJyXs4fe+pvhB069I19Tw==", "dev": true, "dependencies": { "@solidity-parser/parser": "^0.16.0", @@ -1394,9 +1394,9 @@ } }, "@openzeppelin/contracts": { - "version": "4.9.3", - "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-4.9.3.tgz", - "integrity": "sha512-He3LieZ1pP2TNt5JbkPA4PNT9WC3gOTOlDcFGJW4Le4QKqwmiNJCRt44APfxMxvq7OugU/cqYuPcSBzOw38DAg==" + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-5.0.1.tgz", + "integrity": "sha512-yQJaT5HDp9hYOOp4jTYxMsR02gdFZFXhewX5HW9Jo4fsqSVqqyIO/xTHdWDaKX5a3pv1txmf076Lziz+sO7L1w==" }, "@pnpm/config.env-replace": { "version": "1.1.0", @@ -1753,9 +1753,9 @@ } }, "ignore": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.0.tgz", - "integrity": "sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg==", + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", + "integrity": "sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==", "dev": true }, "import-fresh": { @@ -2056,9 +2056,9 @@ } }, "semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", "dev": true, "requires": { "lru-cache": "^6.0.0" @@ -2076,9 +2076,9 @@ } }, "solhint": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/solhint/-/solhint-4.0.0.tgz", - "integrity": "sha512-bFViMcFvhqVd/HK3Roo7xZXX5nbujS7Bxeg5vnZc9QvH0yCWCrQ38Yrn1pbAY9tlKROc6wFr+rK1mxYgYrjZgA==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/solhint/-/solhint-4.1.1.tgz", + "integrity": "sha512-7G4iF8H5hKHc0tR+/uyZesSKtfppFIMvPSW+Ku6MSL25oVRuyFeqNhOsXHfkex64wYJyXs4fe+pvhB069I19Tw==", "dev": true, "requires": { "@solidity-parser/parser": "^0.16.0", diff --git a/package.json b/package.json index 6ad12b1c..abf90dab 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "description": "IBC in Solidity", "dependencies": { - "@openzeppelin/contracts": "^4.8.3", + "@openzeppelin/contracts": "^5.0.1", "solidity-rlp": "^2.0.8", "solidity-mpt": "^0.1.0" }, diff --git a/pkg/client/client.go b/pkg/client/client.go index 6eee8fa0..53967ea9 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -7,6 +7,7 @@ import ( "github.com/avast/retry-go" "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" gethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethclient" @@ -16,6 +17,7 @@ import ( type ETHClient struct { *ethclient.Client rpcClient *rpc.Client + erepo ErrorsRepository option option } @@ -40,7 +42,7 @@ func WithRetryOption(rops ...retry.Option) Option { } } -func NewETHClient(endpoint string, opts ...Option) (*ETHClient, error) { +func NewETHClient(endpoint string, erepo ErrorsRepository, opts ...Option) (*ETHClient, error) { rpcClient, err := rpc.DialHTTP(endpoint) if err != nil { return nil, err @@ -52,6 +54,7 @@ func NewETHClient(endpoint string, opts ...Option) (*ETHClient, error) { return ÐClient{ rpcClient: rpcClient, Client: ethclient.NewClient(rpcClient), + erepo: erepo, option: *opt, }, nil } @@ -66,8 +69,12 @@ func (cl *ETHClient) GetTransactionReceipt(ctx context.Context, txHash common.Ha } else if r.Status == gethtypes.ReceiptStatusSuccessful { return r.GetGethReceipt(), false, nil } else if r.HasRevertReason() { - reason, err := r.GetRevertReason() - return r.GetGethReceipt(), false, fmt.Errorf("revert-reason=%v parse-err=%v", reason, err) + e, args, err := cl.erepo.ParseError(r.RevertReason) + if err == nil { + return r.GetGethReceipt(), false, fmt.Errorf("revert-reason=\"%v\" args=\"%v\"", e.String(), args) + } else { + return r.GetGethReceipt(), false, fmt.Errorf("raw-revert-reason=\"%x\" parse-err=\"%v\"", []byte(r.RevertReason), err) + } } else { return r.GetGethReceipt(), false, fmt.Errorf("failed to execute a transaction: %v", r) } @@ -95,3 +102,70 @@ func (cl *ETHClient) WaitForReceiptAndGet(ctx context.Context, tx *gethtypes.Tra } return receipt, nil } + +type ErrorsRepository struct { + errs map[[4]byte]abi.Error +} + +func NewErrorsRepository() ErrorsRepository { + er := ErrorsRepository{ + errs: make(map[[4]byte]abi.Error), + } + for _, e := range builtInErrors() { + if err := er.Add(e); err != nil { + panic(err) + } + } + return er +} + +func (r *ErrorsRepository) Add(e0 abi.Error) error { + var sel [4]byte + copy(sel[:], e0.ID[:4]) + if e1, ok := r.errs[sel]; ok { + if e1.Sig == e0.Sig { + return nil + } + return fmt.Errorf("error selector collision: sel=%x e0=%v e1=%v", sel, e0, e1) + } + r.errs[sel] = e0 + return nil +} + +func (r *ErrorsRepository) GetError(sel [4]byte) (abi.Error, bool) { + e, ok := r.errs[sel] + return e, ok +} + +func (r *ErrorsRepository) ParseError(bz []byte) (abi.Error, interface{}, error) { + if len(bz) < 4 { + return abi.Error{}, nil, fmt.Errorf("invalid error data: %v", bz) + } + var sel [4]byte + copy(sel[:], bz[:4]) + e, ok := r.GetError(sel) + if !ok { + return abi.Error{}, nil, fmt.Errorf("unknown error: sel=%x", sel) + } + v, err := e.Unpack(bz) + return e, v, err +} + +// builtInErrors returns a list of solidity built-in errors. +// The list includes "Error(string)" and "Panic(uint256)" errors. +func builtInErrors() []abi.Error { + var errors []abi.Error + strT, err := abi.NewType("string", "", nil) + if err != nil { + panic(err) + } + errors = append(errors, abi.NewError("Error", abi.Arguments{{Type: strT}})) + + uint256T, err := abi.NewType("uint256", "", nil) + if err != nil { + panic(err) + } + errors = append(errors, abi.NewError("Panic", abi.Arguments{{Type: uint256T}})) + + return errors +} diff --git a/pkg/client/client_test.go b/pkg/client/client_test.go index a385aa2a..b15b6295 100644 --- a/pkg/client/client_test.go +++ b/pkg/client/client_test.go @@ -9,21 +9,13 @@ import ( ) func TestRevertReasonParser(t *testing.T) { - // 1. Valid format - s, err := parseRevertReason( + erepo := NewErrorsRepository() + s, args, err := erepo.ParseError( hexToBytes("0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001a4e6f7420656e6f7567682045746865722070726f76696465642e000000000000"), ) require.NoError(t, err) - require.Equal(t, "Not enough Ether provided.", s) - - // 2. Empty bytes - s, err = parseRevertReason(nil) - require.NoError(t, err) - require.Equal(t, "", s) - - // 3. Invalid format - _, err = parseRevertReason([]byte{0}) - require.Error(t, err) + require.Equal(t, "Error(string)", s.Sig) + require.Equal(t, []interface{}{"Not enough Ether provided."}, args) } func hexToBytes(s string) []byte { diff --git a/pkg/client/receipt.go b/pkg/client/receipt.go index e4ef28a7..e0fd02db 100644 --- a/pkg/client/receipt.go +++ b/pkg/client/receipt.go @@ -3,7 +3,6 @@ package client import ( "encoding/json" "errors" - "fmt" "math/big" "github.com/ethereum/go-ethereum/common" @@ -131,24 +130,3 @@ func (rc Receipt) GetGethReceipt() *gethtypes.Receipt { func (rc Receipt) HasRevertReason() bool { return len(rc.RevertReason) > 0 } - -func (rc Receipt) GetRevertReason() (string, error) { - return parseRevertReason(rc.RevertReason) -} - -// A format of revertReason is: -// 4byte: Function selector for Error(string) -// 32byte: Data offset -// 32byte: String length -// Remains: String Data -func parseRevertReason(bz []byte) (string, error) { - if l := len(bz); l == 0 { - return "", nil - } else if l < 68 { - return "", fmt.Errorf("invalid length") - } - - size := &big.Int{} - size.SetBytes(bz[36:68]) - return string(bz[68 : 68+size.Int64()]), nil -} diff --git a/pkg/contract/erc20/erc20.go b/pkg/contract/erc20/erc20.go index 0edb390c..e83448b9 100644 --- a/pkg/contract/erc20/erc20.go +++ b/pkg/contract/erc20/erc20.go @@ -31,7 +31,7 @@ var ( // Erc20MetaData contains all meta data concerning the Erc20 contract. var Erc20MetaData = &bind.MetaData{ - ABI: "[{\"type\":\"constructor\",\"inputs\":[{\"name\":\"name_\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"symbol_\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"allowance\",\"inputs\":[{\"name\":\"owner\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"spender\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"approve\",\"inputs\":[{\"name\":\"spender\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"balanceOf\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"decimals\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint8\",\"internalType\":\"uint8\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"decreaseAllowance\",\"inputs\":[{\"name\":\"spender\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"subtractedValue\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"increaseAllowance\",\"inputs\":[{\"name\":\"spender\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"addedValue\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"name\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"symbol\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"totalSupply\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"transfer\",\"inputs\":[{\"name\":\"to\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"transferFrom\",\"inputs\":[{\"name\":\"from\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"to\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"event\",\"name\":\"Approval\",\"inputs\":[{\"name\":\"owner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"spender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Transfer\",\"inputs\":[{\"name\":\"from\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"to\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false}]", + ABI: "[{\"type\":\"function\",\"name\":\"allowance\",\"inputs\":[{\"name\":\"owner\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"spender\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"approve\",\"inputs\":[{\"name\":\"spender\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"balanceOf\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"decimals\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint8\",\"internalType\":\"uint8\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"name\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"symbol\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"totalSupply\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"transfer\",\"inputs\":[{\"name\":\"to\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"transferFrom\",\"inputs\":[{\"name\":\"from\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"to\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"event\",\"name\":\"Approval\",\"inputs\":[{\"name\":\"owner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"spender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Transfer\",\"inputs\":[{\"name\":\"from\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"to\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"ERC20InsufficientAllowance\",\"inputs\":[{\"name\":\"spender\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"allowance\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"needed\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"ERC20InsufficientBalance\",\"inputs\":[{\"name\":\"sender\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"balance\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"needed\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"ERC20InvalidApprover\",\"inputs\":[{\"name\":\"approver\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"ERC20InvalidReceiver\",\"inputs\":[{\"name\":\"receiver\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"ERC20InvalidSender\",\"inputs\":[{\"name\":\"sender\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"ERC20InvalidSpender\",\"inputs\":[{\"name\":\"spender\",\"type\":\"address\",\"internalType\":\"address\"}]}]", } // Erc20ABI is the input ABI used to generate the binding from. @@ -368,107 +368,65 @@ func (_Erc20 *Erc20CallerSession) TotalSupply() (*big.Int, error) { // Approve is a paid mutator transaction binding the contract method 0x095ea7b3. // -// Solidity: function approve(address spender, uint256 amount) returns(bool) -func (_Erc20 *Erc20Transactor) Approve(opts *bind.TransactOpts, spender common.Address, amount *big.Int) (*types.Transaction, error) { - return _Erc20.contract.Transact(opts, "approve", spender, amount) +// Solidity: function approve(address spender, uint256 value) returns(bool) +func (_Erc20 *Erc20Transactor) Approve(opts *bind.TransactOpts, spender common.Address, value *big.Int) (*types.Transaction, error) { + return _Erc20.contract.Transact(opts, "approve", spender, value) } // Approve is a paid mutator transaction binding the contract method 0x095ea7b3. // -// Solidity: function approve(address spender, uint256 amount) returns(bool) -func (_Erc20 *Erc20Session) Approve(spender common.Address, amount *big.Int) (*types.Transaction, error) { - return _Erc20.Contract.Approve(&_Erc20.TransactOpts, spender, amount) +// Solidity: function approve(address spender, uint256 value) returns(bool) +func (_Erc20 *Erc20Session) Approve(spender common.Address, value *big.Int) (*types.Transaction, error) { + return _Erc20.Contract.Approve(&_Erc20.TransactOpts, spender, value) } // Approve is a paid mutator transaction binding the contract method 0x095ea7b3. // -// Solidity: function approve(address spender, uint256 amount) returns(bool) -func (_Erc20 *Erc20TransactorSession) Approve(spender common.Address, amount *big.Int) (*types.Transaction, error) { - return _Erc20.Contract.Approve(&_Erc20.TransactOpts, spender, amount) -} - -// DecreaseAllowance is a paid mutator transaction binding the contract method 0xa457c2d7. -// -// Solidity: function decreaseAllowance(address spender, uint256 subtractedValue) returns(bool) -func (_Erc20 *Erc20Transactor) DecreaseAllowance(opts *bind.TransactOpts, spender common.Address, subtractedValue *big.Int) (*types.Transaction, error) { - return _Erc20.contract.Transact(opts, "decreaseAllowance", spender, subtractedValue) -} - -// DecreaseAllowance is a paid mutator transaction binding the contract method 0xa457c2d7. -// -// Solidity: function decreaseAllowance(address spender, uint256 subtractedValue) returns(bool) -func (_Erc20 *Erc20Session) DecreaseAllowance(spender common.Address, subtractedValue *big.Int) (*types.Transaction, error) { - return _Erc20.Contract.DecreaseAllowance(&_Erc20.TransactOpts, spender, subtractedValue) -} - -// DecreaseAllowance is a paid mutator transaction binding the contract method 0xa457c2d7. -// -// Solidity: function decreaseAllowance(address spender, uint256 subtractedValue) returns(bool) -func (_Erc20 *Erc20TransactorSession) DecreaseAllowance(spender common.Address, subtractedValue *big.Int) (*types.Transaction, error) { - return _Erc20.Contract.DecreaseAllowance(&_Erc20.TransactOpts, spender, subtractedValue) -} - -// IncreaseAllowance is a paid mutator transaction binding the contract method 0x39509351. -// -// Solidity: function increaseAllowance(address spender, uint256 addedValue) returns(bool) -func (_Erc20 *Erc20Transactor) IncreaseAllowance(opts *bind.TransactOpts, spender common.Address, addedValue *big.Int) (*types.Transaction, error) { - return _Erc20.contract.Transact(opts, "increaseAllowance", spender, addedValue) -} - -// IncreaseAllowance is a paid mutator transaction binding the contract method 0x39509351. -// -// Solidity: function increaseAllowance(address spender, uint256 addedValue) returns(bool) -func (_Erc20 *Erc20Session) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error) { - return _Erc20.Contract.IncreaseAllowance(&_Erc20.TransactOpts, spender, addedValue) -} - -// IncreaseAllowance is a paid mutator transaction binding the contract method 0x39509351. -// -// Solidity: function increaseAllowance(address spender, uint256 addedValue) returns(bool) -func (_Erc20 *Erc20TransactorSession) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error) { - return _Erc20.Contract.IncreaseAllowance(&_Erc20.TransactOpts, spender, addedValue) +// Solidity: function approve(address spender, uint256 value) returns(bool) +func (_Erc20 *Erc20TransactorSession) Approve(spender common.Address, value *big.Int) (*types.Transaction, error) { + return _Erc20.Contract.Approve(&_Erc20.TransactOpts, spender, value) } // Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. // -// Solidity: function transfer(address to, uint256 amount) returns(bool) -func (_Erc20 *Erc20Transactor) Transfer(opts *bind.TransactOpts, to common.Address, amount *big.Int) (*types.Transaction, error) { - return _Erc20.contract.Transact(opts, "transfer", to, amount) +// Solidity: function transfer(address to, uint256 value) returns(bool) +func (_Erc20 *Erc20Transactor) Transfer(opts *bind.TransactOpts, to common.Address, value *big.Int) (*types.Transaction, error) { + return _Erc20.contract.Transact(opts, "transfer", to, value) } // Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. // -// Solidity: function transfer(address to, uint256 amount) returns(bool) -func (_Erc20 *Erc20Session) Transfer(to common.Address, amount *big.Int) (*types.Transaction, error) { - return _Erc20.Contract.Transfer(&_Erc20.TransactOpts, to, amount) +// Solidity: function transfer(address to, uint256 value) returns(bool) +func (_Erc20 *Erc20Session) Transfer(to common.Address, value *big.Int) (*types.Transaction, error) { + return _Erc20.Contract.Transfer(&_Erc20.TransactOpts, to, value) } // Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. // -// Solidity: function transfer(address to, uint256 amount) returns(bool) -func (_Erc20 *Erc20TransactorSession) Transfer(to common.Address, amount *big.Int) (*types.Transaction, error) { - return _Erc20.Contract.Transfer(&_Erc20.TransactOpts, to, amount) +// Solidity: function transfer(address to, uint256 value) returns(bool) +func (_Erc20 *Erc20TransactorSession) Transfer(to common.Address, value *big.Int) (*types.Transaction, error) { + return _Erc20.Contract.Transfer(&_Erc20.TransactOpts, to, value) } // TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. // -// Solidity: function transferFrom(address from, address to, uint256 amount) returns(bool) -func (_Erc20 *Erc20Transactor) TransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, amount *big.Int) (*types.Transaction, error) { - return _Erc20.contract.Transact(opts, "transferFrom", from, to, amount) +// Solidity: function transferFrom(address from, address to, uint256 value) returns(bool) +func (_Erc20 *Erc20Transactor) TransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, value *big.Int) (*types.Transaction, error) { + return _Erc20.contract.Transact(opts, "transferFrom", from, to, value) } // TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. // -// Solidity: function transferFrom(address from, address to, uint256 amount) returns(bool) -func (_Erc20 *Erc20Session) TransferFrom(from common.Address, to common.Address, amount *big.Int) (*types.Transaction, error) { - return _Erc20.Contract.TransferFrom(&_Erc20.TransactOpts, from, to, amount) +// Solidity: function transferFrom(address from, address to, uint256 value) returns(bool) +func (_Erc20 *Erc20Session) TransferFrom(from common.Address, to common.Address, value *big.Int) (*types.Transaction, error) { + return _Erc20.Contract.TransferFrom(&_Erc20.TransactOpts, from, to, value) } // TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. // -// Solidity: function transferFrom(address from, address to, uint256 amount) returns(bool) -func (_Erc20 *Erc20TransactorSession) TransferFrom(from common.Address, to common.Address, amount *big.Int) (*types.Transaction, error) { - return _Erc20.Contract.TransferFrom(&_Erc20.TransactOpts, from, to, amount) +// Solidity: function transferFrom(address from, address to, uint256 value) returns(bool) +func (_Erc20 *Erc20TransactorSession) TransferFrom(from common.Address, to common.Address, value *big.Int) (*types.Transaction, error) { + return _Erc20.Contract.TransferFrom(&_Erc20.TransactOpts, from, to, value) } // Erc20ApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the Erc20 contract. diff --git a/pkg/contract/ibchandler/ibchandler.go b/pkg/contract/ibchandler/ibchandler.go index abcb69b8..9e54965a 100644 --- a/pkg/contract/ibchandler/ibchandler.go +++ b/pkg/contract/ibchandler/ibchandler.go @@ -227,7 +227,7 @@ type VersionData struct { // IbchandlerMetaData contains all meta data concerning the Ibchandler contract. var IbchandlerMetaData = &bind.MetaData{ - ABI: "[{\"type\":\"function\",\"name\":\"acknowledgePacket\",\"inputs\":[{\"name\":\"msg_\",\"type\":\"tuple\",\"internalType\":\"structIIBCChannelAcknowledgePacket.MsgPacketAcknowledgement\",\"components\":[{\"name\":\"packet\",\"type\":\"tuple\",\"internalType\":\"structPacket.Data\",\"components\":[{\"name\":\"sequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"source_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"source_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"timeout_height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"timeout_timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"acknowledgement\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proof\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proofHeight\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"bindPort\",\"inputs\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"moduleAddress\",\"type\":\"address\",\"internalType\":\"contractIIBCModule\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"channelCloseConfirm\",\"inputs\":[{\"name\":\"msg_\",\"type\":\"tuple\",\"internalType\":\"structIIBCChannelHandshake.MsgChannelCloseConfirm\",\"components\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"proofInit\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proofHeight\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"channelCloseInit\",\"inputs\":[{\"name\":\"msg_\",\"type\":\"tuple\",\"internalType\":\"structIIBCChannelHandshake.MsgChannelCloseInit\",\"components\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"channelOpenAck\",\"inputs\":[{\"name\":\"msg_\",\"type\":\"tuple\",\"internalType\":\"structIIBCChannelHandshake.MsgChannelOpenAck\",\"components\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"counterpartyVersion\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"counterpartyChannelId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"proofTry\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proofHeight\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"channelOpenConfirm\",\"inputs\":[{\"name\":\"msg_\",\"type\":\"tuple\",\"internalType\":\"structIIBCChannelHandshake.MsgChannelOpenConfirm\",\"components\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"proofAck\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proofHeight\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"channelOpenInit\",\"inputs\":[{\"name\":\"msg_\",\"type\":\"tuple\",\"internalType\":\"structIIBCChannelHandshake.MsgChannelOpenInit\",\"components\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channel\",\"type\":\"tuple\",\"internalType\":\"structChannel.Data\",\"components\":[{\"name\":\"state\",\"type\":\"uint8\",\"internalType\":\"enumChannel.State\"},{\"name\":\"ordering\",\"type\":\"uint8\",\"internalType\":\"enumChannel.Order\"},{\"name\":\"counterparty\",\"type\":\"tuple\",\"internalType\":\"structChannelCounterparty.Data\",\"components\":[{\"name\":\"port_id\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channel_id\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"name\":\"connection_hops\",\"type\":\"string[]\",\"internalType\":\"string[]\"},{\"name\":\"version\",\"type\":\"string\",\"internalType\":\"string\"}]}]}],\"outputs\":[{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"version\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"channelOpenTry\",\"inputs\":[{\"name\":\"msg_\",\"type\":\"tuple\",\"internalType\":\"structIIBCChannelHandshake.MsgChannelOpenTry\",\"components\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channel\",\"type\":\"tuple\",\"internalType\":\"structChannel.Data\",\"components\":[{\"name\":\"state\",\"type\":\"uint8\",\"internalType\":\"enumChannel.State\"},{\"name\":\"ordering\",\"type\":\"uint8\",\"internalType\":\"enumChannel.Order\"},{\"name\":\"counterparty\",\"type\":\"tuple\",\"internalType\":\"structChannelCounterparty.Data\",\"components\":[{\"name\":\"port_id\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channel_id\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"name\":\"connection_hops\",\"type\":\"string[]\",\"internalType\":\"string[]\"},{\"name\":\"version\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"name\":\"counterpartyVersion\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"proofInit\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proofHeight\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}]}],\"outputs\":[{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"version\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"connectionOpenAck\",\"inputs\":[{\"name\":\"msg_\",\"type\":\"tuple\",\"internalType\":\"structIIBCConnection.MsgConnectionOpenAck\",\"components\":[{\"name\":\"connectionId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"clientStateBytes\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"version\",\"type\":\"tuple\",\"internalType\":\"structVersion.Data\",\"components\":[{\"name\":\"identifier\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"features\",\"type\":\"string[]\",\"internalType\":\"string[]\"}]},{\"name\":\"counterpartyConnectionId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"proofTry\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proofClient\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proofConsensus\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proofHeight\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"consensusHeight\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"hostConsensusStateProof\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"connectionOpenConfirm\",\"inputs\":[{\"name\":\"msg_\",\"type\":\"tuple\",\"internalType\":\"structIIBCConnection.MsgConnectionOpenConfirm\",\"components\":[{\"name\":\"connectionId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"proofAck\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proofHeight\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"connectionOpenInit\",\"inputs\":[{\"name\":\"msg_\",\"type\":\"tuple\",\"internalType\":\"structIIBCConnection.MsgConnectionOpenInit\",\"components\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"counterparty\",\"type\":\"tuple\",\"internalType\":\"structCounterparty.Data\",\"components\":[{\"name\":\"client_id\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"connection_id\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"prefix\",\"type\":\"tuple\",\"internalType\":\"structMerklePrefix.Data\",\"components\":[{\"name\":\"key_prefix\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]}]},{\"name\":\"version\",\"type\":\"tuple\",\"internalType\":\"structVersion.Data\",\"components\":[{\"name\":\"identifier\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"features\",\"type\":\"string[]\",\"internalType\":\"string[]\"}]},{\"name\":\"delayPeriod\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"outputs\":[{\"name\":\"connectionId\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"connectionOpenTry\",\"inputs\":[{\"name\":\"msg_\",\"type\":\"tuple\",\"internalType\":\"structIIBCConnection.MsgConnectionOpenTry\",\"components\":[{\"name\":\"counterparty\",\"type\":\"tuple\",\"internalType\":\"structCounterparty.Data\",\"components\":[{\"name\":\"client_id\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"connection_id\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"prefix\",\"type\":\"tuple\",\"internalType\":\"structMerklePrefix.Data\",\"components\":[{\"name\":\"key_prefix\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]}]},{\"name\":\"delayPeriod\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"clientStateBytes\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"counterpartyVersions\",\"type\":\"tuple[]\",\"internalType\":\"structVersion.Data[]\",\"components\":[{\"name\":\"identifier\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"features\",\"type\":\"string[]\",\"internalType\":\"string[]\"}]},{\"name\":\"proofInit\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proofClient\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proofConsensus\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proofHeight\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"consensusHeight\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"hostConsensusStateProof\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]}],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"createClient\",\"inputs\":[{\"name\":\"msg_\",\"type\":\"tuple\",\"internalType\":\"structIIBCClient.MsgCreateClient\",\"components\":[{\"name\":\"clientType\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"protoClientState\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"protoConsensusState\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]}],\"outputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"getChannel\",\"inputs\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"}],\"outputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structChannel.Data\",\"components\":[{\"name\":\"state\",\"type\":\"uint8\",\"internalType\":\"enumChannel.State\"},{\"name\":\"ordering\",\"type\":\"uint8\",\"internalType\":\"enumChannel.Order\"},{\"name\":\"counterparty\",\"type\":\"tuple\",\"internalType\":\"structChannelCounterparty.Data\",\"components\":[{\"name\":\"port_id\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channel_id\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"name\":\"connection_hops\",\"type\":\"string[]\",\"internalType\":\"string[]\"},{\"name\":\"version\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getClient\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getClientByType\",\"inputs\":[{\"name\":\"clientType\",\"type\":\"string\",\"internalType\":\"string\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getClientState\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getClientType\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"}],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getCommitment\",\"inputs\":[{\"name\":\"hashedPath\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getCommitmentPrefix\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getConnection\",\"inputs\":[{\"name\":\"connectionId\",\"type\":\"string\",\"internalType\":\"string\"}],\"outputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structConnectionEnd.Data\",\"components\":[{\"name\":\"client_id\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"versions\",\"type\":\"tuple[]\",\"internalType\":\"structVersion.Data[]\",\"components\":[{\"name\":\"identifier\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"features\",\"type\":\"string[]\",\"internalType\":\"string[]\"}]},{\"name\":\"state\",\"type\":\"uint8\",\"internalType\":\"enumConnectionEnd.State\"},{\"name\":\"counterparty\",\"type\":\"tuple\",\"internalType\":\"structCounterparty.Data\",\"components\":[{\"name\":\"client_id\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"connection_id\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"prefix\",\"type\":\"tuple\",\"internalType\":\"structMerklePrefix.Data\",\"components\":[{\"name\":\"key_prefix\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]}]},{\"name\":\"delay_period\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getConsensusState\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"outputs\":[{\"name\":\"\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getExpectedTimePerBlock\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getNextSequenceAck\",\"inputs\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getNextSequenceRecv\",\"inputs\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getNextSequenceSend\",\"inputs\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getPacketReceipt\",\"inputs\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"sequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint8\",\"internalType\":\"enumIBCChannelLib.PacketReceipt\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"recvPacket\",\"inputs\":[{\"name\":\"msg_\",\"type\":\"tuple\",\"internalType\":\"structIIBCChannelRecvPacket.MsgPacketRecv\",\"components\":[{\"name\":\"packet\",\"type\":\"tuple\",\"internalType\":\"structPacket.Data\",\"components\":[{\"name\":\"sequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"source_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"source_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"timeout_height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"timeout_timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"proof\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proofHeight\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"registerClient\",\"inputs\":[{\"name\":\"clientType\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"client\",\"type\":\"address\",\"internalType\":\"contractILightClient\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"routeUpdateClient\",\"inputs\":[{\"name\":\"msg_\",\"type\":\"tuple\",\"internalType\":\"structIIBCClient.MsgUpdateClient\",\"components\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"protoClientMessage\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]}],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"\",\"type\":\"bytes4\",\"internalType\":\"bytes4\"},{\"name\":\"\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"sendPacket\",\"inputs\":[{\"name\":\"sourcePort\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"sourceChannel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"timeoutHeight\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"timeoutTimestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setExpectedTimePerBlock\",\"inputs\":[{\"name\":\"expectedTimePerBlock_\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"timeoutOnClose\",\"inputs\":[{\"name\":\"msg_\",\"type\":\"tuple\",\"internalType\":\"structIIBCChannelPacketTimeout.MsgTimeoutOnClose\",\"components\":[{\"name\":\"packet\",\"type\":\"tuple\",\"internalType\":\"structPacket.Data\",\"components\":[{\"name\":\"sequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"source_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"source_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"timeout_height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"timeout_timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"proofUnreceived\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proofClose\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proofHeight\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"nextSequenceRecv\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"timeoutPacket\",\"inputs\":[{\"name\":\"msg_\",\"type\":\"tuple\",\"internalType\":\"structIIBCChannelPacketTimeout.MsgTimeoutPacket\",\"components\":[{\"name\":\"packet\",\"type\":\"tuple\",\"internalType\":\"structPacket.Data\",\"components\":[{\"name\":\"sequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"source_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"source_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"timeout_height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"timeout_timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"proof\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proofHeight\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"nextSequenceRecv\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"updateClient\",\"inputs\":[{\"name\":\"msg_\",\"type\":\"tuple\",\"internalType\":\"structIIBCClient.MsgUpdateClient\",\"components\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"protoClientMessage\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"updateClientCommitments\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"heights\",\"type\":\"tuple[]\",\"internalType\":\"structHeight.Data[]\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"writeAcknowledgement\",\"inputs\":[{\"name\":\"destinationPortId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destinationChannel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"sequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"acknowledgement\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"event\",\"name\":\"AcknowledgePacket\",\"inputs\":[{\"name\":\"packet\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structPacket.Data\",\"components\":[{\"name\":\"sequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"source_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"source_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"timeout_height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"timeout_timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"acknowledgement\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"GeneratedChannelIdentifier\",\"inputs\":[{\"name\":\"\",\"type\":\"string\",\"indexed\":false,\"internalType\":\"string\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"GeneratedClientIdentifier\",\"inputs\":[{\"name\":\"\",\"type\":\"string\",\"indexed\":false,\"internalType\":\"string\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"GeneratedConnectionIdentifier\",\"inputs\":[{\"name\":\"\",\"type\":\"string\",\"indexed\":false,\"internalType\":\"string\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"RecvPacket\",\"inputs\":[{\"name\":\"packet\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structPacket.Data\",\"components\":[{\"name\":\"sequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"source_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"source_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"timeout_height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"timeout_timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"SendPacket\",\"inputs\":[{\"name\":\"sequence\",\"type\":\"uint64\",\"indexed\":false,\"internalType\":\"uint64\"},{\"name\":\"sourcePort\",\"type\":\"string\",\"indexed\":false,\"internalType\":\"string\"},{\"name\":\"sourceChannel\",\"type\":\"string\",\"indexed\":false,\"internalType\":\"string\"},{\"name\":\"timeoutHeight\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"timeoutTimestamp\",\"type\":\"uint64\",\"indexed\":false,\"internalType\":\"uint64\"},{\"name\":\"data\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"TimeoutPacket\",\"inputs\":[{\"name\":\"packet\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structPacket.Data\",\"components\":[{\"name\":\"sequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"source_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"source_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"timeout_height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"timeout_timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"WriteAcknowledgement\",\"inputs\":[{\"name\":\"destinationPortId\",\"type\":\"string\",\"indexed\":false,\"internalType\":\"string\"},{\"name\":\"destinationChannel\",\"type\":\"string\",\"indexed\":false,\"internalType\":\"string\"},{\"name\":\"sequence\",\"type\":\"uint64\",\"indexed\":false,\"internalType\":\"uint64\"},{\"name\":\"acknowledgement\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false}]", + ABI: "[{\"type\":\"function\",\"name\":\"acknowledgePacket\",\"inputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structIIBCChannelAcknowledgePacket.MsgPacketAcknowledgement\",\"components\":[{\"name\":\"packet\",\"type\":\"tuple\",\"internalType\":\"structPacket.Data\",\"components\":[{\"name\":\"sequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"source_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"source_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"timeout_height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"timeout_timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"acknowledgement\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proof\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proofHeight\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"bindPort\",\"inputs\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"moduleAddress\",\"type\":\"address\",\"internalType\":\"contractIIBCModule\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"channelCloseConfirm\",\"inputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structIIBCChannelHandshake.MsgChannelCloseConfirm\",\"components\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"proofInit\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proofHeight\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"channelCloseInit\",\"inputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structIIBCChannelHandshake.MsgChannelCloseInit\",\"components\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"channelOpenAck\",\"inputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structIIBCChannelHandshake.MsgChannelOpenAck\",\"components\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"counterpartyVersion\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"counterpartyChannelId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"proofTry\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proofHeight\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"channelOpenConfirm\",\"inputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structIIBCChannelHandshake.MsgChannelOpenConfirm\",\"components\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"proofAck\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proofHeight\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"channelOpenInit\",\"inputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structIIBCChannelHandshake.MsgChannelOpenInit\",\"components\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channel\",\"type\":\"tuple\",\"internalType\":\"structChannel.Data\",\"components\":[{\"name\":\"state\",\"type\":\"uint8\",\"internalType\":\"enumChannel.State\"},{\"name\":\"ordering\",\"type\":\"uint8\",\"internalType\":\"enumChannel.Order\"},{\"name\":\"counterparty\",\"type\":\"tuple\",\"internalType\":\"structChannelCounterparty.Data\",\"components\":[{\"name\":\"port_id\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channel_id\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"name\":\"connection_hops\",\"type\":\"string[]\",\"internalType\":\"string[]\"},{\"name\":\"version\",\"type\":\"string\",\"internalType\":\"string\"}]}]}],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"channelOpenTry\",\"inputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structIIBCChannelHandshake.MsgChannelOpenTry\",\"components\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channel\",\"type\":\"tuple\",\"internalType\":\"structChannel.Data\",\"components\":[{\"name\":\"state\",\"type\":\"uint8\",\"internalType\":\"enumChannel.State\"},{\"name\":\"ordering\",\"type\":\"uint8\",\"internalType\":\"enumChannel.Order\"},{\"name\":\"counterparty\",\"type\":\"tuple\",\"internalType\":\"structChannelCounterparty.Data\",\"components\":[{\"name\":\"port_id\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channel_id\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"name\":\"connection_hops\",\"type\":\"string[]\",\"internalType\":\"string[]\"},{\"name\":\"version\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"name\":\"counterpartyVersion\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"proofInit\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proofHeight\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}]}],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"connectionOpenAck\",\"inputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structIIBCConnection.MsgConnectionOpenAck\",\"components\":[{\"name\":\"connectionId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"clientStateBytes\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"version\",\"type\":\"tuple\",\"internalType\":\"structVersion.Data\",\"components\":[{\"name\":\"identifier\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"features\",\"type\":\"string[]\",\"internalType\":\"string[]\"}]},{\"name\":\"counterpartyConnectionId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"proofTry\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proofClient\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proofConsensus\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proofHeight\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"consensusHeight\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"hostConsensusStateProof\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"connectionOpenConfirm\",\"inputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structIIBCConnection.MsgConnectionOpenConfirm\",\"components\":[{\"name\":\"connectionId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"proofAck\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proofHeight\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"connectionOpenInit\",\"inputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structIIBCConnection.MsgConnectionOpenInit\",\"components\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"counterparty\",\"type\":\"tuple\",\"internalType\":\"structCounterparty.Data\",\"components\":[{\"name\":\"client_id\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"connection_id\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"prefix\",\"type\":\"tuple\",\"internalType\":\"structMerklePrefix.Data\",\"components\":[{\"name\":\"key_prefix\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]}]},{\"name\":\"version\",\"type\":\"tuple\",\"internalType\":\"structVersion.Data\",\"components\":[{\"name\":\"identifier\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"features\",\"type\":\"string[]\",\"internalType\":\"string[]\"}]},{\"name\":\"delayPeriod\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"connectionOpenTry\",\"inputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structIIBCConnection.MsgConnectionOpenTry\",\"components\":[{\"name\":\"counterparty\",\"type\":\"tuple\",\"internalType\":\"structCounterparty.Data\",\"components\":[{\"name\":\"client_id\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"connection_id\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"prefix\",\"type\":\"tuple\",\"internalType\":\"structMerklePrefix.Data\",\"components\":[{\"name\":\"key_prefix\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]}]},{\"name\":\"delayPeriod\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"clientStateBytes\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"counterpartyVersions\",\"type\":\"tuple[]\",\"internalType\":\"structVersion.Data[]\",\"components\":[{\"name\":\"identifier\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"features\",\"type\":\"string[]\",\"internalType\":\"string[]\"}]},{\"name\":\"proofInit\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proofClient\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proofConsensus\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proofHeight\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"consensusHeight\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"hostConsensusStateProof\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]}],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"createClient\",\"inputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structIIBCClient.MsgCreateClient\",\"components\":[{\"name\":\"clientType\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"protoClientState\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"protoConsensusState\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]}],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"getChannel\",\"inputs\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"}],\"outputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structChannel.Data\",\"components\":[{\"name\":\"state\",\"type\":\"uint8\",\"internalType\":\"enumChannel.State\"},{\"name\":\"ordering\",\"type\":\"uint8\",\"internalType\":\"enumChannel.Order\"},{\"name\":\"counterparty\",\"type\":\"tuple\",\"internalType\":\"structChannelCounterparty.Data\",\"components\":[{\"name\":\"port_id\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channel_id\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"name\":\"connection_hops\",\"type\":\"string[]\",\"internalType\":\"string[]\"},{\"name\":\"version\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getClient\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getClientByType\",\"inputs\":[{\"name\":\"clientType\",\"type\":\"string\",\"internalType\":\"string\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getClientState\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getClientType\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"}],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getCommitment\",\"inputs\":[{\"name\":\"hashedPath\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getCommitmentPrefix\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getConnection\",\"inputs\":[{\"name\":\"connectionId\",\"type\":\"string\",\"internalType\":\"string\"}],\"outputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structConnectionEnd.Data\",\"components\":[{\"name\":\"client_id\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"versions\",\"type\":\"tuple[]\",\"internalType\":\"structVersion.Data[]\",\"components\":[{\"name\":\"identifier\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"features\",\"type\":\"string[]\",\"internalType\":\"string[]\"}]},{\"name\":\"state\",\"type\":\"uint8\",\"internalType\":\"enumConnectionEnd.State\"},{\"name\":\"counterparty\",\"type\":\"tuple\",\"internalType\":\"structCounterparty.Data\",\"components\":[{\"name\":\"client_id\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"connection_id\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"prefix\",\"type\":\"tuple\",\"internalType\":\"structMerklePrefix.Data\",\"components\":[{\"name\":\"key_prefix\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]}]},{\"name\":\"delay_period\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getConsensusState\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"outputs\":[{\"name\":\"consensusStateBytes\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getExpectedTimePerBlock\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getNextSequenceAck\",\"inputs\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getNextSequenceRecv\",\"inputs\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getNextSequenceSend\",\"inputs\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getPacketReceipt\",\"inputs\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"sequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint8\",\"internalType\":\"enumIBCChannelLib.PacketReceipt\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"recvPacket\",\"inputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structIIBCChannelRecvPacket.MsgPacketRecv\",\"components\":[{\"name\":\"packet\",\"type\":\"tuple\",\"internalType\":\"structPacket.Data\",\"components\":[{\"name\":\"sequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"source_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"source_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"timeout_height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"timeout_timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"proof\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proofHeight\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"registerClient\",\"inputs\":[{\"name\":\"clientType\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"client\",\"type\":\"address\",\"internalType\":\"contractILightClient\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"routeUpdateClient\",\"inputs\":[{\"name\":\"msg_\",\"type\":\"tuple\",\"internalType\":\"structIIBCClient.MsgUpdateClient\",\"components\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"protoClientMessage\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]}],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"\",\"type\":\"bytes4\",\"internalType\":\"bytes4\"},{\"name\":\"\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"sendPacket\",\"inputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setExpectedTimePerBlock\",\"inputs\":[{\"name\":\"expectedTimePerBlock_\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"timeoutOnClose\",\"inputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structIIBCChannelPacketTimeout.MsgTimeoutOnClose\",\"components\":[{\"name\":\"packet\",\"type\":\"tuple\",\"internalType\":\"structPacket.Data\",\"components\":[{\"name\":\"sequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"source_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"source_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"timeout_height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"timeout_timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"proofUnreceived\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proofClose\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proofHeight\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"nextSequenceRecv\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"timeoutPacket\",\"inputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structIIBCChannelPacketTimeout.MsgTimeoutPacket\",\"components\":[{\"name\":\"packet\",\"type\":\"tuple\",\"internalType\":\"structPacket.Data\",\"components\":[{\"name\":\"sequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"source_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"source_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"timeout_height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"timeout_timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"proof\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proofHeight\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"nextSequenceRecv\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"updateClient\",\"inputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structIIBCClient.MsgUpdateClient\",\"components\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"protoClientMessage\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"updateClientCommitments\",\"inputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"\",\"type\":\"tuple[]\",\"internalType\":\"structHeight.Data[]\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"wrappedRouteUpdateClient\",\"inputs\":[{\"name\":\"msg_\",\"type\":\"tuple\",\"internalType\":\"structIIBCClient.MsgUpdateClient\",\"components\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"protoClientMessage\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]}],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"\",\"type\":\"bytes4\",\"internalType\":\"bytes4\"},{\"name\":\"\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"writeAcknowledgement\",\"inputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"event\",\"name\":\"AcknowledgePacket\",\"inputs\":[{\"name\":\"packet\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structPacket.Data\",\"components\":[{\"name\":\"sequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"source_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"source_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"timeout_height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"timeout_timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"acknowledgement\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"GeneratedChannelIdentifier\",\"inputs\":[{\"name\":\"channelId\",\"type\":\"string\",\"indexed\":false,\"internalType\":\"string\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"GeneratedClientIdentifier\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"indexed\":false,\"internalType\":\"string\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"GeneratedConnectionIdentifier\",\"inputs\":[{\"name\":\"connectionId\",\"type\":\"string\",\"indexed\":false,\"internalType\":\"string\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"RecvPacket\",\"inputs\":[{\"name\":\"packet\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structPacket.Data\",\"components\":[{\"name\":\"sequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"source_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"source_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"timeout_height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"timeout_timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"SendPacket\",\"inputs\":[{\"name\":\"sequence\",\"type\":\"uint64\",\"indexed\":false,\"internalType\":\"uint64\"},{\"name\":\"sourcePort\",\"type\":\"string\",\"indexed\":false,\"internalType\":\"string\"},{\"name\":\"sourceChannel\",\"type\":\"string\",\"indexed\":false,\"internalType\":\"string\"},{\"name\":\"timeoutHeight\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"timeoutTimestamp\",\"type\":\"uint64\",\"indexed\":false,\"internalType\":\"uint64\"},{\"name\":\"data\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"TimeoutPacket\",\"inputs\":[{\"name\":\"packet\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structPacket.Data\",\"components\":[{\"name\":\"sequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"source_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"source_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"timeout_height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"timeout_timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"WriteAcknowledgement\",\"inputs\":[{\"name\":\"destinationPortId\",\"type\":\"string\",\"indexed\":false,\"internalType\":\"string\"},{\"name\":\"destinationChannel\",\"type\":\"string\",\"indexed\":false,\"internalType\":\"string\"},{\"name\":\"sequence\",\"type\":\"uint64\",\"indexed\":false,\"internalType\":\"uint64\"},{\"name\":\"acknowledgement\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"IBCChannelAcknowledgementAlreadyWritten\",\"inputs\":[{\"name\":\"destinationPort\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destinationChannel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"sequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"type\":\"error\",\"name\":\"IBCChannelChannelNotFound\",\"inputs\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"type\":\"error\",\"name\":\"IBCChannelConnectionFeatureNotSupported\",\"inputs\":[{\"name\":\"ordering\",\"type\":\"uint8\",\"internalType\":\"enumChannel.Order\"}]},{\"type\":\"error\",\"name\":\"IBCChannelConnectionMultipleVersionsFound\",\"inputs\":[{\"name\":\"connectionId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"length\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"IBCChannelConnectionNotOpened\",\"inputs\":[{\"name\":\"connectionId\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"type\":\"error\",\"name\":\"IBCChannelCounterpartyChannelIdNotEmpty\",\"inputs\":[{\"name\":\"counterpartyChannelId\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"type\":\"error\",\"name\":\"IBCChannelEmptyAcknowledgement\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"IBCChannelFailedVerifyChannelState\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"path\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proof\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}]},{\"type\":\"error\",\"name\":\"IBCChannelFailedVerifyNextSequenceRecv\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"path\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"nextSequenceRecv\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"proof\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}]},{\"type\":\"error\",\"name\":\"IBCChannelFailedVerifyPacketAcknowledgement\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"path\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"commitment\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"proof\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}]},{\"type\":\"error\",\"name\":\"IBCChannelFailedVerifyPacketCommitment\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"path\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"commitment\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"proof\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}]},{\"type\":\"error\",\"name\":\"IBCChannelFailedVerifyPacketReceiptAbsence\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"path\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proof\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}]},{\"type\":\"error\",\"name\":\"IBCChannelInvalidConnectionHopsLength\",\"inputs\":[{\"name\":\"length\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"IBCChannelPacketCommitmentMismatch\",\"inputs\":[{\"name\":\"expected\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"actual\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"type\":\"error\",\"name\":\"IBCChannelPacketCommitmentNotFound\",\"inputs\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"sequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"type\":\"error\",\"name\":\"IBCChannelPacketMaybeAlreadyReceived\",\"inputs\":[{\"name\":\"sequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"nextSequenceRecv\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"type\":\"error\",\"name\":\"IBCChannelPacketReceiptAlreadyExists\",\"inputs\":[{\"name\":\"destinationPort\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destinationChannel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"sequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"type\":\"error\",\"name\":\"IBCChannelPastPacketTimeoutHeight\",\"inputs\":[{\"name\":\"timeoutHeight\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"latestHeight\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}]},{\"type\":\"error\",\"name\":\"IBCChannelPastPacketTimeoutTimestamp\",\"inputs\":[{\"name\":\"timeoutTimestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"latestTimestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"type\":\"error\",\"name\":\"IBCChannelTimeoutPacketHeight\",\"inputs\":[{\"name\":\"currentBlockNumber\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"timeoutHeight\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"type\":\"error\",\"name\":\"IBCChannelTimeoutPacketTimestamp\",\"inputs\":[{\"name\":\"currentTimestamp\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"timeoutTimestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"type\":\"error\",\"name\":\"IBCChannelUnexpectedChannelState\",\"inputs\":[{\"name\":\"state\",\"type\":\"uint8\",\"internalType\":\"enumChannel.State\"}]},{\"type\":\"error\",\"name\":\"IBCChannelUnexpectedNextSequenceAck\",\"inputs\":[{\"name\":\"expected\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"type\":\"error\",\"name\":\"IBCChannelUnexpectedNextSequenceRecv\",\"inputs\":[{\"name\":\"expected\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"type\":\"error\",\"name\":\"IBCChannelUnexpectedPacketDestination\",\"inputs\":[{\"name\":\"destinationPort\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destinationChannel\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"type\":\"error\",\"name\":\"IBCChannelUnexpectedPacketSource\",\"inputs\":[{\"name\":\"sourcePort\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"sourceChannel\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"type\":\"error\",\"name\":\"IBCChannelUnknownChannelOrder\",\"inputs\":[{\"name\":\"ordering\",\"type\":\"uint8\",\"internalType\":\"enumChannel.Order\"}]},{\"type\":\"error\",\"name\":\"IBCChannelUnknownPacketReceiptCommitment\",\"inputs\":[{\"name\":\"commitment\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"type\":\"error\",\"name\":\"IBCChannelZeroPacketTimeout\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"IBCClientClientNotFound\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"type\":\"error\",\"name\":\"IBCClientConsensusStateNotFound\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"consensusHeight\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}]},{\"type\":\"error\",\"name\":\"IBCClientFailedUpdateClient\",\"inputs\":[{\"name\":\"selector\",\"type\":\"bytes4\",\"internalType\":\"bytes4\"},{\"name\":\"args\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]},{\"type\":\"error\",\"name\":\"IBCClientNotActiveClient\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"type\":\"error\",\"name\":\"IBCClientUnregisteredClientType\",\"inputs\":[{\"name\":\"clientType\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"type\":\"error\",\"name\":\"IBCConnectionAlreadyConnectionExists\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"IBCConnectionEmptyConnectionCounterpartyVersions\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"IBCConnectionFailedVerifyClientConsensusState\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"path\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proof\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}]},{\"type\":\"error\",\"name\":\"IBCConnectionFailedVerifyClientState\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"path\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proof\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}]},{\"type\":\"error\",\"name\":\"IBCConnectionFailedVerifyConnectionState\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"path\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"proof\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}]},{\"type\":\"error\",\"name\":\"IBCConnectionIBCVersionNotSupported\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"IBCConnectionInvalidCounterpartyConnectionIdentifier\",\"inputs\":[{\"name\":\"counterpartyConnectionId\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"type\":\"error\",\"name\":\"IBCConnectionInvalidHostConsensusStateProof\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"IBCConnectionInvalidSelfClientState\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"IBCConnectionNoMatchingVersionFound\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"IBCConnectionUnexpectedConnectionState\",\"inputs\":[{\"name\":\"state\",\"type\":\"uint8\",\"internalType\":\"enumConnectionEnd.State\"}]},{\"type\":\"error\",\"name\":\"IBCConnectionVersionsAlreadySet\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"IBCHostCapabilityAlreadyClaimed\",\"inputs\":[{\"name\":\"name\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"type\":\"error\",\"name\":\"IBCHostClientNotFound\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"type\":\"error\",\"name\":\"IBCHostClientTypeAlreadyExists\",\"inputs\":[{\"name\":\"clientType\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"type\":\"error\",\"name\":\"IBCHostFailedAuthenticateCapability\",\"inputs\":[{\"name\":\"name\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"caller\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"IBCHostInvalidClientType\",\"inputs\":[{\"name\":\"clientType\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"type\":\"error\",\"name\":\"IBCHostInvalidLightClientAddress\",\"inputs\":[{\"name\":\"lcAddress\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"IBCHostInvalidModuleAddress\",\"inputs\":[{\"name\":\"moduleAddress\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"IBCHostInvalidPortIdentifier\",\"inputs\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"type\":\"error\",\"name\":\"IBCHostModuleNotFound\",\"inputs\":[{\"name\":\"name\",\"type\":\"string\",\"internalType\":\"string\"}]}]", } // IbchandlerABI is the input ABI used to generate the binding from. @@ -629,7 +629,7 @@ func (_Ibchandler *IbchandlerCallerSession) GetConnection(connectionId string) ( // GetConsensusState is a free data retrieval call binding the contract method 0x6cf44bf4. // -// Solidity: function getConsensusState(string clientId, (uint64,uint64) height) view returns(bytes, bool) +// Solidity: function getConsensusState(string clientId, (uint64,uint64) height) view returns(bytes consensusStateBytes, bool) func (_Ibchandler *IbchandlerCaller) GetConsensusState(opts *bind.CallOpts, clientId string, height HeightData) ([]byte, bool, error) { var out []interface{} err := _Ibchandler.contract.Call(opts, &out, "getConsensusState", clientId, height) @@ -647,14 +647,14 @@ func (_Ibchandler *IbchandlerCaller) GetConsensusState(opts *bind.CallOpts, clie // GetConsensusState is a free data retrieval call binding the contract method 0x6cf44bf4. // -// Solidity: function getConsensusState(string clientId, (uint64,uint64) height) view returns(bytes, bool) +// Solidity: function getConsensusState(string clientId, (uint64,uint64) height) view returns(bytes consensusStateBytes, bool) func (_Ibchandler *IbchandlerSession) GetConsensusState(clientId string, height HeightData) ([]byte, bool, error) { return _Ibchandler.Contract.GetConsensusState(&_Ibchandler.CallOpts, clientId, height) } // GetConsensusState is a free data retrieval call binding the contract method 0x6cf44bf4. // -// Solidity: function getConsensusState(string clientId, (uint64,uint64) height) view returns(bytes, bool) +// Solidity: function getConsensusState(string clientId, (uint64,uint64) height) view returns(bytes consensusStateBytes, bool) func (_Ibchandler *IbchandlerCallerSession) GetConsensusState(clientId string, height HeightData) ([]byte, bool, error) { return _Ibchandler.Contract.GetConsensusState(&_Ibchandler.CallOpts, clientId, height) } @@ -849,23 +849,23 @@ func (_Ibchandler *IbchandlerCallerSession) RouteUpdateClient(msg_ IIBCClientMsg // AcknowledgePacket is a paid mutator transaction binding the contract method 0x59f37976. // -// Solidity: function acknowledgePacket(((uint64,string,string,string,string,bytes,(uint64,uint64),uint64),bytes,bytes,(uint64,uint64)) msg_) returns() -func (_Ibchandler *IbchandlerTransactor) AcknowledgePacket(opts *bind.TransactOpts, msg_ IIBCChannelAcknowledgePacketMsgPacketAcknowledgement) (*types.Transaction, error) { - return _Ibchandler.contract.Transact(opts, "acknowledgePacket", msg_) +// Solidity: function acknowledgePacket(((uint64,string,string,string,string,bytes,(uint64,uint64),uint64),bytes,bytes,(uint64,uint64)) ) returns() +func (_Ibchandler *IbchandlerTransactor) AcknowledgePacket(opts *bind.TransactOpts, arg0 IIBCChannelAcknowledgePacketMsgPacketAcknowledgement) (*types.Transaction, error) { + return _Ibchandler.contract.Transact(opts, "acknowledgePacket", arg0) } // AcknowledgePacket is a paid mutator transaction binding the contract method 0x59f37976. // -// Solidity: function acknowledgePacket(((uint64,string,string,string,string,bytes,(uint64,uint64),uint64),bytes,bytes,(uint64,uint64)) msg_) returns() -func (_Ibchandler *IbchandlerSession) AcknowledgePacket(msg_ IIBCChannelAcknowledgePacketMsgPacketAcknowledgement) (*types.Transaction, error) { - return _Ibchandler.Contract.AcknowledgePacket(&_Ibchandler.TransactOpts, msg_) +// Solidity: function acknowledgePacket(((uint64,string,string,string,string,bytes,(uint64,uint64),uint64),bytes,bytes,(uint64,uint64)) ) returns() +func (_Ibchandler *IbchandlerSession) AcknowledgePacket(arg0 IIBCChannelAcknowledgePacketMsgPacketAcknowledgement) (*types.Transaction, error) { + return _Ibchandler.Contract.AcknowledgePacket(&_Ibchandler.TransactOpts, arg0) } // AcknowledgePacket is a paid mutator transaction binding the contract method 0x59f37976. // -// Solidity: function acknowledgePacket(((uint64,string,string,string,string,bytes,(uint64,uint64),uint64),bytes,bytes,(uint64,uint64)) msg_) returns() -func (_Ibchandler *IbchandlerTransactorSession) AcknowledgePacket(msg_ IIBCChannelAcknowledgePacketMsgPacketAcknowledgement) (*types.Transaction, error) { - return _Ibchandler.Contract.AcknowledgePacket(&_Ibchandler.TransactOpts, msg_) +// Solidity: function acknowledgePacket(((uint64,string,string,string,string,bytes,(uint64,uint64),uint64),bytes,bytes,(uint64,uint64)) ) returns() +func (_Ibchandler *IbchandlerTransactorSession) AcknowledgePacket(arg0 IIBCChannelAcknowledgePacketMsgPacketAcknowledgement) (*types.Transaction, error) { + return _Ibchandler.Contract.AcknowledgePacket(&_Ibchandler.TransactOpts, arg0) } // BindPort is a paid mutator transaction binding the contract method 0x117e886a. @@ -891,254 +891,254 @@ func (_Ibchandler *IbchandlerTransactorSession) BindPort(portId string, moduleAd // ChannelCloseConfirm is a paid mutator transaction binding the contract method 0x25cbc3a6. // -// Solidity: function channelCloseConfirm((string,string,bytes,(uint64,uint64)) msg_) returns() -func (_Ibchandler *IbchandlerTransactor) ChannelCloseConfirm(opts *bind.TransactOpts, msg_ IIBCChannelHandshakeMsgChannelCloseConfirm) (*types.Transaction, error) { - return _Ibchandler.contract.Transact(opts, "channelCloseConfirm", msg_) +// Solidity: function channelCloseConfirm((string,string,bytes,(uint64,uint64)) ) returns() +func (_Ibchandler *IbchandlerTransactor) ChannelCloseConfirm(opts *bind.TransactOpts, arg0 IIBCChannelHandshakeMsgChannelCloseConfirm) (*types.Transaction, error) { + return _Ibchandler.contract.Transact(opts, "channelCloseConfirm", arg0) } // ChannelCloseConfirm is a paid mutator transaction binding the contract method 0x25cbc3a6. // -// Solidity: function channelCloseConfirm((string,string,bytes,(uint64,uint64)) msg_) returns() -func (_Ibchandler *IbchandlerSession) ChannelCloseConfirm(msg_ IIBCChannelHandshakeMsgChannelCloseConfirm) (*types.Transaction, error) { - return _Ibchandler.Contract.ChannelCloseConfirm(&_Ibchandler.TransactOpts, msg_) +// Solidity: function channelCloseConfirm((string,string,bytes,(uint64,uint64)) ) returns() +func (_Ibchandler *IbchandlerSession) ChannelCloseConfirm(arg0 IIBCChannelHandshakeMsgChannelCloseConfirm) (*types.Transaction, error) { + return _Ibchandler.Contract.ChannelCloseConfirm(&_Ibchandler.TransactOpts, arg0) } // ChannelCloseConfirm is a paid mutator transaction binding the contract method 0x25cbc3a6. // -// Solidity: function channelCloseConfirm((string,string,bytes,(uint64,uint64)) msg_) returns() -func (_Ibchandler *IbchandlerTransactorSession) ChannelCloseConfirm(msg_ IIBCChannelHandshakeMsgChannelCloseConfirm) (*types.Transaction, error) { - return _Ibchandler.Contract.ChannelCloseConfirm(&_Ibchandler.TransactOpts, msg_) +// Solidity: function channelCloseConfirm((string,string,bytes,(uint64,uint64)) ) returns() +func (_Ibchandler *IbchandlerTransactorSession) ChannelCloseConfirm(arg0 IIBCChannelHandshakeMsgChannelCloseConfirm) (*types.Transaction, error) { + return _Ibchandler.Contract.ChannelCloseConfirm(&_Ibchandler.TransactOpts, arg0) } // ChannelCloseInit is a paid mutator transaction binding the contract method 0xa06cb3a2. // -// Solidity: function channelCloseInit((string,string) msg_) returns() -func (_Ibchandler *IbchandlerTransactor) ChannelCloseInit(opts *bind.TransactOpts, msg_ IIBCChannelHandshakeMsgChannelCloseInit) (*types.Transaction, error) { - return _Ibchandler.contract.Transact(opts, "channelCloseInit", msg_) +// Solidity: function channelCloseInit((string,string) ) returns() +func (_Ibchandler *IbchandlerTransactor) ChannelCloseInit(opts *bind.TransactOpts, arg0 IIBCChannelHandshakeMsgChannelCloseInit) (*types.Transaction, error) { + return _Ibchandler.contract.Transact(opts, "channelCloseInit", arg0) } // ChannelCloseInit is a paid mutator transaction binding the contract method 0xa06cb3a2. // -// Solidity: function channelCloseInit((string,string) msg_) returns() -func (_Ibchandler *IbchandlerSession) ChannelCloseInit(msg_ IIBCChannelHandshakeMsgChannelCloseInit) (*types.Transaction, error) { - return _Ibchandler.Contract.ChannelCloseInit(&_Ibchandler.TransactOpts, msg_) +// Solidity: function channelCloseInit((string,string) ) returns() +func (_Ibchandler *IbchandlerSession) ChannelCloseInit(arg0 IIBCChannelHandshakeMsgChannelCloseInit) (*types.Transaction, error) { + return _Ibchandler.Contract.ChannelCloseInit(&_Ibchandler.TransactOpts, arg0) } // ChannelCloseInit is a paid mutator transaction binding the contract method 0xa06cb3a2. // -// Solidity: function channelCloseInit((string,string) msg_) returns() -func (_Ibchandler *IbchandlerTransactorSession) ChannelCloseInit(msg_ IIBCChannelHandshakeMsgChannelCloseInit) (*types.Transaction, error) { - return _Ibchandler.Contract.ChannelCloseInit(&_Ibchandler.TransactOpts, msg_) +// Solidity: function channelCloseInit((string,string) ) returns() +func (_Ibchandler *IbchandlerTransactorSession) ChannelCloseInit(arg0 IIBCChannelHandshakeMsgChannelCloseInit) (*types.Transaction, error) { + return _Ibchandler.Contract.ChannelCloseInit(&_Ibchandler.TransactOpts, arg0) } // ChannelOpenAck is a paid mutator transaction binding the contract method 0x256c4199. // -// Solidity: function channelOpenAck((string,string,string,string,bytes,(uint64,uint64)) msg_) returns() -func (_Ibchandler *IbchandlerTransactor) ChannelOpenAck(opts *bind.TransactOpts, msg_ IIBCChannelHandshakeMsgChannelOpenAck) (*types.Transaction, error) { - return _Ibchandler.contract.Transact(opts, "channelOpenAck", msg_) +// Solidity: function channelOpenAck((string,string,string,string,bytes,(uint64,uint64)) ) returns() +func (_Ibchandler *IbchandlerTransactor) ChannelOpenAck(opts *bind.TransactOpts, arg0 IIBCChannelHandshakeMsgChannelOpenAck) (*types.Transaction, error) { + return _Ibchandler.contract.Transact(opts, "channelOpenAck", arg0) } // ChannelOpenAck is a paid mutator transaction binding the contract method 0x256c4199. // -// Solidity: function channelOpenAck((string,string,string,string,bytes,(uint64,uint64)) msg_) returns() -func (_Ibchandler *IbchandlerSession) ChannelOpenAck(msg_ IIBCChannelHandshakeMsgChannelOpenAck) (*types.Transaction, error) { - return _Ibchandler.Contract.ChannelOpenAck(&_Ibchandler.TransactOpts, msg_) +// Solidity: function channelOpenAck((string,string,string,string,bytes,(uint64,uint64)) ) returns() +func (_Ibchandler *IbchandlerSession) ChannelOpenAck(arg0 IIBCChannelHandshakeMsgChannelOpenAck) (*types.Transaction, error) { + return _Ibchandler.Contract.ChannelOpenAck(&_Ibchandler.TransactOpts, arg0) } // ChannelOpenAck is a paid mutator transaction binding the contract method 0x256c4199. // -// Solidity: function channelOpenAck((string,string,string,string,bytes,(uint64,uint64)) msg_) returns() -func (_Ibchandler *IbchandlerTransactorSession) ChannelOpenAck(msg_ IIBCChannelHandshakeMsgChannelOpenAck) (*types.Transaction, error) { - return _Ibchandler.Contract.ChannelOpenAck(&_Ibchandler.TransactOpts, msg_) +// Solidity: function channelOpenAck((string,string,string,string,bytes,(uint64,uint64)) ) returns() +func (_Ibchandler *IbchandlerTransactorSession) ChannelOpenAck(arg0 IIBCChannelHandshakeMsgChannelOpenAck) (*types.Transaction, error) { + return _Ibchandler.Contract.ChannelOpenAck(&_Ibchandler.TransactOpts, arg0) } // ChannelOpenConfirm is a paid mutator transaction binding the contract method 0x5bd51b62. // -// Solidity: function channelOpenConfirm((string,string,bytes,(uint64,uint64)) msg_) returns() -func (_Ibchandler *IbchandlerTransactor) ChannelOpenConfirm(opts *bind.TransactOpts, msg_ IIBCChannelHandshakeMsgChannelOpenConfirm) (*types.Transaction, error) { - return _Ibchandler.contract.Transact(opts, "channelOpenConfirm", msg_) +// Solidity: function channelOpenConfirm((string,string,bytes,(uint64,uint64)) ) returns() +func (_Ibchandler *IbchandlerTransactor) ChannelOpenConfirm(opts *bind.TransactOpts, arg0 IIBCChannelHandshakeMsgChannelOpenConfirm) (*types.Transaction, error) { + return _Ibchandler.contract.Transact(opts, "channelOpenConfirm", arg0) } // ChannelOpenConfirm is a paid mutator transaction binding the contract method 0x5bd51b62. // -// Solidity: function channelOpenConfirm((string,string,bytes,(uint64,uint64)) msg_) returns() -func (_Ibchandler *IbchandlerSession) ChannelOpenConfirm(msg_ IIBCChannelHandshakeMsgChannelOpenConfirm) (*types.Transaction, error) { - return _Ibchandler.Contract.ChannelOpenConfirm(&_Ibchandler.TransactOpts, msg_) +// Solidity: function channelOpenConfirm((string,string,bytes,(uint64,uint64)) ) returns() +func (_Ibchandler *IbchandlerSession) ChannelOpenConfirm(arg0 IIBCChannelHandshakeMsgChannelOpenConfirm) (*types.Transaction, error) { + return _Ibchandler.Contract.ChannelOpenConfirm(&_Ibchandler.TransactOpts, arg0) } // ChannelOpenConfirm is a paid mutator transaction binding the contract method 0x5bd51b62. // -// Solidity: function channelOpenConfirm((string,string,bytes,(uint64,uint64)) msg_) returns() -func (_Ibchandler *IbchandlerTransactorSession) ChannelOpenConfirm(msg_ IIBCChannelHandshakeMsgChannelOpenConfirm) (*types.Transaction, error) { - return _Ibchandler.Contract.ChannelOpenConfirm(&_Ibchandler.TransactOpts, msg_) +// Solidity: function channelOpenConfirm((string,string,bytes,(uint64,uint64)) ) returns() +func (_Ibchandler *IbchandlerTransactorSession) ChannelOpenConfirm(arg0 IIBCChannelHandshakeMsgChannelOpenConfirm) (*types.Transaction, error) { + return _Ibchandler.Contract.ChannelOpenConfirm(&_Ibchandler.TransactOpts, arg0) } // ChannelOpenInit is a paid mutator transaction binding the contract method 0xdd3469fc. // -// Solidity: function channelOpenInit((string,(uint8,uint8,(string,string),string[],string)) msg_) returns(string channelId, string version) -func (_Ibchandler *IbchandlerTransactor) ChannelOpenInit(opts *bind.TransactOpts, msg_ IIBCChannelHandshakeMsgChannelOpenInit) (*types.Transaction, error) { - return _Ibchandler.contract.Transact(opts, "channelOpenInit", msg_) +// Solidity: function channelOpenInit((string,(uint8,uint8,(string,string),string[],string)) ) returns(string, string) +func (_Ibchandler *IbchandlerTransactor) ChannelOpenInit(opts *bind.TransactOpts, arg0 IIBCChannelHandshakeMsgChannelOpenInit) (*types.Transaction, error) { + return _Ibchandler.contract.Transact(opts, "channelOpenInit", arg0) } // ChannelOpenInit is a paid mutator transaction binding the contract method 0xdd3469fc. // -// Solidity: function channelOpenInit((string,(uint8,uint8,(string,string),string[],string)) msg_) returns(string channelId, string version) -func (_Ibchandler *IbchandlerSession) ChannelOpenInit(msg_ IIBCChannelHandshakeMsgChannelOpenInit) (*types.Transaction, error) { - return _Ibchandler.Contract.ChannelOpenInit(&_Ibchandler.TransactOpts, msg_) +// Solidity: function channelOpenInit((string,(uint8,uint8,(string,string),string[],string)) ) returns(string, string) +func (_Ibchandler *IbchandlerSession) ChannelOpenInit(arg0 IIBCChannelHandshakeMsgChannelOpenInit) (*types.Transaction, error) { + return _Ibchandler.Contract.ChannelOpenInit(&_Ibchandler.TransactOpts, arg0) } // ChannelOpenInit is a paid mutator transaction binding the contract method 0xdd3469fc. // -// Solidity: function channelOpenInit((string,(uint8,uint8,(string,string),string[],string)) msg_) returns(string channelId, string version) -func (_Ibchandler *IbchandlerTransactorSession) ChannelOpenInit(msg_ IIBCChannelHandshakeMsgChannelOpenInit) (*types.Transaction, error) { - return _Ibchandler.Contract.ChannelOpenInit(&_Ibchandler.TransactOpts, msg_) +// Solidity: function channelOpenInit((string,(uint8,uint8,(string,string),string[],string)) ) returns(string, string) +func (_Ibchandler *IbchandlerTransactorSession) ChannelOpenInit(arg0 IIBCChannelHandshakeMsgChannelOpenInit) (*types.Transaction, error) { + return _Ibchandler.Contract.ChannelOpenInit(&_Ibchandler.TransactOpts, arg0) } // ChannelOpenTry is a paid mutator transaction binding the contract method 0x11b88a15. // -// Solidity: function channelOpenTry((string,(uint8,uint8,(string,string),string[],string),string,bytes,(uint64,uint64)) msg_) returns(string channelId, string version) -func (_Ibchandler *IbchandlerTransactor) ChannelOpenTry(opts *bind.TransactOpts, msg_ IIBCChannelHandshakeMsgChannelOpenTry) (*types.Transaction, error) { - return _Ibchandler.contract.Transact(opts, "channelOpenTry", msg_) +// Solidity: function channelOpenTry((string,(uint8,uint8,(string,string),string[],string),string,bytes,(uint64,uint64)) ) returns(string, string) +func (_Ibchandler *IbchandlerTransactor) ChannelOpenTry(opts *bind.TransactOpts, arg0 IIBCChannelHandshakeMsgChannelOpenTry) (*types.Transaction, error) { + return _Ibchandler.contract.Transact(opts, "channelOpenTry", arg0) } // ChannelOpenTry is a paid mutator transaction binding the contract method 0x11b88a15. // -// Solidity: function channelOpenTry((string,(uint8,uint8,(string,string),string[],string),string,bytes,(uint64,uint64)) msg_) returns(string channelId, string version) -func (_Ibchandler *IbchandlerSession) ChannelOpenTry(msg_ IIBCChannelHandshakeMsgChannelOpenTry) (*types.Transaction, error) { - return _Ibchandler.Contract.ChannelOpenTry(&_Ibchandler.TransactOpts, msg_) +// Solidity: function channelOpenTry((string,(uint8,uint8,(string,string),string[],string),string,bytes,(uint64,uint64)) ) returns(string, string) +func (_Ibchandler *IbchandlerSession) ChannelOpenTry(arg0 IIBCChannelHandshakeMsgChannelOpenTry) (*types.Transaction, error) { + return _Ibchandler.Contract.ChannelOpenTry(&_Ibchandler.TransactOpts, arg0) } // ChannelOpenTry is a paid mutator transaction binding the contract method 0x11b88a15. // -// Solidity: function channelOpenTry((string,(uint8,uint8,(string,string),string[],string),string,bytes,(uint64,uint64)) msg_) returns(string channelId, string version) -func (_Ibchandler *IbchandlerTransactorSession) ChannelOpenTry(msg_ IIBCChannelHandshakeMsgChannelOpenTry) (*types.Transaction, error) { - return _Ibchandler.Contract.ChannelOpenTry(&_Ibchandler.TransactOpts, msg_) +// Solidity: function channelOpenTry((string,(uint8,uint8,(string,string),string[],string),string,bytes,(uint64,uint64)) ) returns(string, string) +func (_Ibchandler *IbchandlerTransactorSession) ChannelOpenTry(arg0 IIBCChannelHandshakeMsgChannelOpenTry) (*types.Transaction, error) { + return _Ibchandler.Contract.ChannelOpenTry(&_Ibchandler.TransactOpts, arg0) } // ConnectionOpenAck is a paid mutator transaction binding the contract method 0x8c145a93. // -// Solidity: function connectionOpenAck((string,bytes,(string,string[]),string,bytes,bytes,bytes,(uint64,uint64),(uint64,uint64),bytes) msg_) returns() -func (_Ibchandler *IbchandlerTransactor) ConnectionOpenAck(opts *bind.TransactOpts, msg_ IIBCConnectionMsgConnectionOpenAck) (*types.Transaction, error) { - return _Ibchandler.contract.Transact(opts, "connectionOpenAck", msg_) +// Solidity: function connectionOpenAck((string,bytes,(string,string[]),string,bytes,bytes,bytes,(uint64,uint64),(uint64,uint64),bytes) ) returns() +func (_Ibchandler *IbchandlerTransactor) ConnectionOpenAck(opts *bind.TransactOpts, arg0 IIBCConnectionMsgConnectionOpenAck) (*types.Transaction, error) { + return _Ibchandler.contract.Transact(opts, "connectionOpenAck", arg0) } // ConnectionOpenAck is a paid mutator transaction binding the contract method 0x8c145a93. // -// Solidity: function connectionOpenAck((string,bytes,(string,string[]),string,bytes,bytes,bytes,(uint64,uint64),(uint64,uint64),bytes) msg_) returns() -func (_Ibchandler *IbchandlerSession) ConnectionOpenAck(msg_ IIBCConnectionMsgConnectionOpenAck) (*types.Transaction, error) { - return _Ibchandler.Contract.ConnectionOpenAck(&_Ibchandler.TransactOpts, msg_) +// Solidity: function connectionOpenAck((string,bytes,(string,string[]),string,bytes,bytes,bytes,(uint64,uint64),(uint64,uint64),bytes) ) returns() +func (_Ibchandler *IbchandlerSession) ConnectionOpenAck(arg0 IIBCConnectionMsgConnectionOpenAck) (*types.Transaction, error) { + return _Ibchandler.Contract.ConnectionOpenAck(&_Ibchandler.TransactOpts, arg0) } // ConnectionOpenAck is a paid mutator transaction binding the contract method 0x8c145a93. // -// Solidity: function connectionOpenAck((string,bytes,(string,string[]),string,bytes,bytes,bytes,(uint64,uint64),(uint64,uint64),bytes) msg_) returns() -func (_Ibchandler *IbchandlerTransactorSession) ConnectionOpenAck(msg_ IIBCConnectionMsgConnectionOpenAck) (*types.Transaction, error) { - return _Ibchandler.Contract.ConnectionOpenAck(&_Ibchandler.TransactOpts, msg_) +// Solidity: function connectionOpenAck((string,bytes,(string,string[]),string,bytes,bytes,bytes,(uint64,uint64),(uint64,uint64),bytes) ) returns() +func (_Ibchandler *IbchandlerTransactorSession) ConnectionOpenAck(arg0 IIBCConnectionMsgConnectionOpenAck) (*types.Transaction, error) { + return _Ibchandler.Contract.ConnectionOpenAck(&_Ibchandler.TransactOpts, arg0) } // ConnectionOpenConfirm is a paid mutator transaction binding the contract method 0x6a728f2c. // -// Solidity: function connectionOpenConfirm((string,bytes,(uint64,uint64)) msg_) returns() -func (_Ibchandler *IbchandlerTransactor) ConnectionOpenConfirm(opts *bind.TransactOpts, msg_ IIBCConnectionMsgConnectionOpenConfirm) (*types.Transaction, error) { - return _Ibchandler.contract.Transact(opts, "connectionOpenConfirm", msg_) +// Solidity: function connectionOpenConfirm((string,bytes,(uint64,uint64)) ) returns() +func (_Ibchandler *IbchandlerTransactor) ConnectionOpenConfirm(opts *bind.TransactOpts, arg0 IIBCConnectionMsgConnectionOpenConfirm) (*types.Transaction, error) { + return _Ibchandler.contract.Transact(opts, "connectionOpenConfirm", arg0) } // ConnectionOpenConfirm is a paid mutator transaction binding the contract method 0x6a728f2c. // -// Solidity: function connectionOpenConfirm((string,bytes,(uint64,uint64)) msg_) returns() -func (_Ibchandler *IbchandlerSession) ConnectionOpenConfirm(msg_ IIBCConnectionMsgConnectionOpenConfirm) (*types.Transaction, error) { - return _Ibchandler.Contract.ConnectionOpenConfirm(&_Ibchandler.TransactOpts, msg_) +// Solidity: function connectionOpenConfirm((string,bytes,(uint64,uint64)) ) returns() +func (_Ibchandler *IbchandlerSession) ConnectionOpenConfirm(arg0 IIBCConnectionMsgConnectionOpenConfirm) (*types.Transaction, error) { + return _Ibchandler.Contract.ConnectionOpenConfirm(&_Ibchandler.TransactOpts, arg0) } // ConnectionOpenConfirm is a paid mutator transaction binding the contract method 0x6a728f2c. // -// Solidity: function connectionOpenConfirm((string,bytes,(uint64,uint64)) msg_) returns() -func (_Ibchandler *IbchandlerTransactorSession) ConnectionOpenConfirm(msg_ IIBCConnectionMsgConnectionOpenConfirm) (*types.Transaction, error) { - return _Ibchandler.Contract.ConnectionOpenConfirm(&_Ibchandler.TransactOpts, msg_) +// Solidity: function connectionOpenConfirm((string,bytes,(uint64,uint64)) ) returns() +func (_Ibchandler *IbchandlerTransactorSession) ConnectionOpenConfirm(arg0 IIBCConnectionMsgConnectionOpenConfirm) (*types.Transaction, error) { + return _Ibchandler.Contract.ConnectionOpenConfirm(&_Ibchandler.TransactOpts, arg0) } // ConnectionOpenInit is a paid mutator transaction binding the contract method 0xd3c68ba0. // -// Solidity: function connectionOpenInit((string,(string,string,(bytes)),(string,string[]),uint64) msg_) returns(string connectionId) -func (_Ibchandler *IbchandlerTransactor) ConnectionOpenInit(opts *bind.TransactOpts, msg_ IIBCConnectionMsgConnectionOpenInit) (*types.Transaction, error) { - return _Ibchandler.contract.Transact(opts, "connectionOpenInit", msg_) +// Solidity: function connectionOpenInit((string,(string,string,(bytes)),(string,string[]),uint64) ) returns(string) +func (_Ibchandler *IbchandlerTransactor) ConnectionOpenInit(opts *bind.TransactOpts, arg0 IIBCConnectionMsgConnectionOpenInit) (*types.Transaction, error) { + return _Ibchandler.contract.Transact(opts, "connectionOpenInit", arg0) } // ConnectionOpenInit is a paid mutator transaction binding the contract method 0xd3c68ba0. // -// Solidity: function connectionOpenInit((string,(string,string,(bytes)),(string,string[]),uint64) msg_) returns(string connectionId) -func (_Ibchandler *IbchandlerSession) ConnectionOpenInit(msg_ IIBCConnectionMsgConnectionOpenInit) (*types.Transaction, error) { - return _Ibchandler.Contract.ConnectionOpenInit(&_Ibchandler.TransactOpts, msg_) +// Solidity: function connectionOpenInit((string,(string,string,(bytes)),(string,string[]),uint64) ) returns(string) +func (_Ibchandler *IbchandlerSession) ConnectionOpenInit(arg0 IIBCConnectionMsgConnectionOpenInit) (*types.Transaction, error) { + return _Ibchandler.Contract.ConnectionOpenInit(&_Ibchandler.TransactOpts, arg0) } // ConnectionOpenInit is a paid mutator transaction binding the contract method 0xd3c68ba0. // -// Solidity: function connectionOpenInit((string,(string,string,(bytes)),(string,string[]),uint64) msg_) returns(string connectionId) -func (_Ibchandler *IbchandlerTransactorSession) ConnectionOpenInit(msg_ IIBCConnectionMsgConnectionOpenInit) (*types.Transaction, error) { - return _Ibchandler.Contract.ConnectionOpenInit(&_Ibchandler.TransactOpts, msg_) +// Solidity: function connectionOpenInit((string,(string,string,(bytes)),(string,string[]),uint64) ) returns(string) +func (_Ibchandler *IbchandlerTransactorSession) ConnectionOpenInit(arg0 IIBCConnectionMsgConnectionOpenInit) (*types.Transaction, error) { + return _Ibchandler.Contract.ConnectionOpenInit(&_Ibchandler.TransactOpts, arg0) } // ConnectionOpenTry is a paid mutator transaction binding the contract method 0x314d55c3. // -// Solidity: function connectionOpenTry(((string,string,(bytes)),uint64,string,bytes,(string,string[])[],bytes,bytes,bytes,(uint64,uint64),(uint64,uint64),bytes) msg_) returns(string) -func (_Ibchandler *IbchandlerTransactor) ConnectionOpenTry(opts *bind.TransactOpts, msg_ IIBCConnectionMsgConnectionOpenTry) (*types.Transaction, error) { - return _Ibchandler.contract.Transact(opts, "connectionOpenTry", msg_) +// Solidity: function connectionOpenTry(((string,string,(bytes)),uint64,string,bytes,(string,string[])[],bytes,bytes,bytes,(uint64,uint64),(uint64,uint64),bytes) ) returns(string) +func (_Ibchandler *IbchandlerTransactor) ConnectionOpenTry(opts *bind.TransactOpts, arg0 IIBCConnectionMsgConnectionOpenTry) (*types.Transaction, error) { + return _Ibchandler.contract.Transact(opts, "connectionOpenTry", arg0) } // ConnectionOpenTry is a paid mutator transaction binding the contract method 0x314d55c3. // -// Solidity: function connectionOpenTry(((string,string,(bytes)),uint64,string,bytes,(string,string[])[],bytes,bytes,bytes,(uint64,uint64),(uint64,uint64),bytes) msg_) returns(string) -func (_Ibchandler *IbchandlerSession) ConnectionOpenTry(msg_ IIBCConnectionMsgConnectionOpenTry) (*types.Transaction, error) { - return _Ibchandler.Contract.ConnectionOpenTry(&_Ibchandler.TransactOpts, msg_) +// Solidity: function connectionOpenTry(((string,string,(bytes)),uint64,string,bytes,(string,string[])[],bytes,bytes,bytes,(uint64,uint64),(uint64,uint64),bytes) ) returns(string) +func (_Ibchandler *IbchandlerSession) ConnectionOpenTry(arg0 IIBCConnectionMsgConnectionOpenTry) (*types.Transaction, error) { + return _Ibchandler.Contract.ConnectionOpenTry(&_Ibchandler.TransactOpts, arg0) } // ConnectionOpenTry is a paid mutator transaction binding the contract method 0x314d55c3. // -// Solidity: function connectionOpenTry(((string,string,(bytes)),uint64,string,bytes,(string,string[])[],bytes,bytes,bytes,(uint64,uint64),(uint64,uint64),bytes) msg_) returns(string) -func (_Ibchandler *IbchandlerTransactorSession) ConnectionOpenTry(msg_ IIBCConnectionMsgConnectionOpenTry) (*types.Transaction, error) { - return _Ibchandler.Contract.ConnectionOpenTry(&_Ibchandler.TransactOpts, msg_) +// Solidity: function connectionOpenTry(((string,string,(bytes)),uint64,string,bytes,(string,string[])[],bytes,bytes,bytes,(uint64,uint64),(uint64,uint64),bytes) ) returns(string) +func (_Ibchandler *IbchandlerTransactorSession) ConnectionOpenTry(arg0 IIBCConnectionMsgConnectionOpenTry) (*types.Transaction, error) { + return _Ibchandler.Contract.ConnectionOpenTry(&_Ibchandler.TransactOpts, arg0) } // CreateClient is a paid mutator transaction binding the contract method 0xd5a24481. // -// Solidity: function createClient((string,bytes,bytes) msg_) returns(string clientId) -func (_Ibchandler *IbchandlerTransactor) CreateClient(opts *bind.TransactOpts, msg_ IIBCClientMsgCreateClient) (*types.Transaction, error) { - return _Ibchandler.contract.Transact(opts, "createClient", msg_) +// Solidity: function createClient((string,bytes,bytes) ) returns(string) +func (_Ibchandler *IbchandlerTransactor) CreateClient(opts *bind.TransactOpts, arg0 IIBCClientMsgCreateClient) (*types.Transaction, error) { + return _Ibchandler.contract.Transact(opts, "createClient", arg0) } // CreateClient is a paid mutator transaction binding the contract method 0xd5a24481. // -// Solidity: function createClient((string,bytes,bytes) msg_) returns(string clientId) -func (_Ibchandler *IbchandlerSession) CreateClient(msg_ IIBCClientMsgCreateClient) (*types.Transaction, error) { - return _Ibchandler.Contract.CreateClient(&_Ibchandler.TransactOpts, msg_) +// Solidity: function createClient((string,bytes,bytes) ) returns(string) +func (_Ibchandler *IbchandlerSession) CreateClient(arg0 IIBCClientMsgCreateClient) (*types.Transaction, error) { + return _Ibchandler.Contract.CreateClient(&_Ibchandler.TransactOpts, arg0) } // CreateClient is a paid mutator transaction binding the contract method 0xd5a24481. // -// Solidity: function createClient((string,bytes,bytes) msg_) returns(string clientId) -func (_Ibchandler *IbchandlerTransactorSession) CreateClient(msg_ IIBCClientMsgCreateClient) (*types.Transaction, error) { - return _Ibchandler.Contract.CreateClient(&_Ibchandler.TransactOpts, msg_) +// Solidity: function createClient((string,bytes,bytes) ) returns(string) +func (_Ibchandler *IbchandlerTransactorSession) CreateClient(arg0 IIBCClientMsgCreateClient) (*types.Transaction, error) { + return _Ibchandler.Contract.CreateClient(&_Ibchandler.TransactOpts, arg0) } // RecvPacket is a paid mutator transaction binding the contract method 0x236ebd70. // -// Solidity: function recvPacket(((uint64,string,string,string,string,bytes,(uint64,uint64),uint64),bytes,(uint64,uint64)) msg_) returns() -func (_Ibchandler *IbchandlerTransactor) RecvPacket(opts *bind.TransactOpts, msg_ IIBCChannelRecvPacketMsgPacketRecv) (*types.Transaction, error) { - return _Ibchandler.contract.Transact(opts, "recvPacket", msg_) +// Solidity: function recvPacket(((uint64,string,string,string,string,bytes,(uint64,uint64),uint64),bytes,(uint64,uint64)) ) returns() +func (_Ibchandler *IbchandlerTransactor) RecvPacket(opts *bind.TransactOpts, arg0 IIBCChannelRecvPacketMsgPacketRecv) (*types.Transaction, error) { + return _Ibchandler.contract.Transact(opts, "recvPacket", arg0) } // RecvPacket is a paid mutator transaction binding the contract method 0x236ebd70. // -// Solidity: function recvPacket(((uint64,string,string,string,string,bytes,(uint64,uint64),uint64),bytes,(uint64,uint64)) msg_) returns() -func (_Ibchandler *IbchandlerSession) RecvPacket(msg_ IIBCChannelRecvPacketMsgPacketRecv) (*types.Transaction, error) { - return _Ibchandler.Contract.RecvPacket(&_Ibchandler.TransactOpts, msg_) +// Solidity: function recvPacket(((uint64,string,string,string,string,bytes,(uint64,uint64),uint64),bytes,(uint64,uint64)) ) returns() +func (_Ibchandler *IbchandlerSession) RecvPacket(arg0 IIBCChannelRecvPacketMsgPacketRecv) (*types.Transaction, error) { + return _Ibchandler.Contract.RecvPacket(&_Ibchandler.TransactOpts, arg0) } // RecvPacket is a paid mutator transaction binding the contract method 0x236ebd70. // -// Solidity: function recvPacket(((uint64,string,string,string,string,bytes,(uint64,uint64),uint64),bytes,(uint64,uint64)) msg_) returns() -func (_Ibchandler *IbchandlerTransactorSession) RecvPacket(msg_ IIBCChannelRecvPacketMsgPacketRecv) (*types.Transaction, error) { - return _Ibchandler.Contract.RecvPacket(&_Ibchandler.TransactOpts, msg_) +// Solidity: function recvPacket(((uint64,string,string,string,string,bytes,(uint64,uint64),uint64),bytes,(uint64,uint64)) ) returns() +func (_Ibchandler *IbchandlerTransactorSession) RecvPacket(arg0 IIBCChannelRecvPacketMsgPacketRecv) (*types.Transaction, error) { + return _Ibchandler.Contract.RecvPacket(&_Ibchandler.TransactOpts, arg0) } // RegisterClient is a paid mutator transaction binding the contract method 0x18c19870. @@ -1164,23 +1164,23 @@ func (_Ibchandler *IbchandlerTransactorSession) RegisterClient(clientType string // SendPacket is a paid mutator transaction binding the contract method 0xae4cd201. // -// Solidity: function sendPacket(string sourcePort, string sourceChannel, (uint64,uint64) timeoutHeight, uint64 timeoutTimestamp, bytes data) returns(uint64) -func (_Ibchandler *IbchandlerTransactor) SendPacket(opts *bind.TransactOpts, sourcePort string, sourceChannel string, timeoutHeight HeightData, timeoutTimestamp uint64, data []byte) (*types.Transaction, error) { - return _Ibchandler.contract.Transact(opts, "sendPacket", sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, data) +// Solidity: function sendPacket(string , string , (uint64,uint64) , uint64 , bytes ) returns(uint64) +func (_Ibchandler *IbchandlerTransactor) SendPacket(opts *bind.TransactOpts, arg0 string, arg1 string, arg2 HeightData, arg3 uint64, arg4 []byte) (*types.Transaction, error) { + return _Ibchandler.contract.Transact(opts, "sendPacket", arg0, arg1, arg2, arg3, arg4) } // SendPacket is a paid mutator transaction binding the contract method 0xae4cd201. // -// Solidity: function sendPacket(string sourcePort, string sourceChannel, (uint64,uint64) timeoutHeight, uint64 timeoutTimestamp, bytes data) returns(uint64) -func (_Ibchandler *IbchandlerSession) SendPacket(sourcePort string, sourceChannel string, timeoutHeight HeightData, timeoutTimestamp uint64, data []byte) (*types.Transaction, error) { - return _Ibchandler.Contract.SendPacket(&_Ibchandler.TransactOpts, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, data) +// Solidity: function sendPacket(string , string , (uint64,uint64) , uint64 , bytes ) returns(uint64) +func (_Ibchandler *IbchandlerSession) SendPacket(arg0 string, arg1 string, arg2 HeightData, arg3 uint64, arg4 []byte) (*types.Transaction, error) { + return _Ibchandler.Contract.SendPacket(&_Ibchandler.TransactOpts, arg0, arg1, arg2, arg3, arg4) } // SendPacket is a paid mutator transaction binding the contract method 0xae4cd201. // -// Solidity: function sendPacket(string sourcePort, string sourceChannel, (uint64,uint64) timeoutHeight, uint64 timeoutTimestamp, bytes data) returns(uint64) -func (_Ibchandler *IbchandlerTransactorSession) SendPacket(sourcePort string, sourceChannel string, timeoutHeight HeightData, timeoutTimestamp uint64, data []byte) (*types.Transaction, error) { - return _Ibchandler.Contract.SendPacket(&_Ibchandler.TransactOpts, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, data) +// Solidity: function sendPacket(string , string , (uint64,uint64) , uint64 , bytes ) returns(uint64) +func (_Ibchandler *IbchandlerTransactorSession) SendPacket(arg0 string, arg1 string, arg2 HeightData, arg3 uint64, arg4 []byte) (*types.Transaction, error) { + return _Ibchandler.Contract.SendPacket(&_Ibchandler.TransactOpts, arg0, arg1, arg2, arg3, arg4) } // SetExpectedTimePerBlock is a paid mutator transaction binding the contract method 0x27184c13. @@ -1206,107 +1206,128 @@ func (_Ibchandler *IbchandlerTransactorSession) SetExpectedTimePerBlock(expected // TimeoutOnClose is a paid mutator transaction binding the contract method 0x9ebb2107. // -// Solidity: function timeoutOnClose(((uint64,string,string,string,string,bytes,(uint64,uint64),uint64),bytes,bytes,(uint64,uint64),uint64) msg_) returns() -func (_Ibchandler *IbchandlerTransactor) TimeoutOnClose(opts *bind.TransactOpts, msg_ IIBCChannelPacketTimeoutMsgTimeoutOnClose) (*types.Transaction, error) { - return _Ibchandler.contract.Transact(opts, "timeoutOnClose", msg_) +// Solidity: function timeoutOnClose(((uint64,string,string,string,string,bytes,(uint64,uint64),uint64),bytes,bytes,(uint64,uint64),uint64) ) returns() +func (_Ibchandler *IbchandlerTransactor) TimeoutOnClose(opts *bind.TransactOpts, arg0 IIBCChannelPacketTimeoutMsgTimeoutOnClose) (*types.Transaction, error) { + return _Ibchandler.contract.Transact(opts, "timeoutOnClose", arg0) } // TimeoutOnClose is a paid mutator transaction binding the contract method 0x9ebb2107. // -// Solidity: function timeoutOnClose(((uint64,string,string,string,string,bytes,(uint64,uint64),uint64),bytes,bytes,(uint64,uint64),uint64) msg_) returns() -func (_Ibchandler *IbchandlerSession) TimeoutOnClose(msg_ IIBCChannelPacketTimeoutMsgTimeoutOnClose) (*types.Transaction, error) { - return _Ibchandler.Contract.TimeoutOnClose(&_Ibchandler.TransactOpts, msg_) +// Solidity: function timeoutOnClose(((uint64,string,string,string,string,bytes,(uint64,uint64),uint64),bytes,bytes,(uint64,uint64),uint64) ) returns() +func (_Ibchandler *IbchandlerSession) TimeoutOnClose(arg0 IIBCChannelPacketTimeoutMsgTimeoutOnClose) (*types.Transaction, error) { + return _Ibchandler.Contract.TimeoutOnClose(&_Ibchandler.TransactOpts, arg0) } // TimeoutOnClose is a paid mutator transaction binding the contract method 0x9ebb2107. // -// Solidity: function timeoutOnClose(((uint64,string,string,string,string,bytes,(uint64,uint64),uint64),bytes,bytes,(uint64,uint64),uint64) msg_) returns() -func (_Ibchandler *IbchandlerTransactorSession) TimeoutOnClose(msg_ IIBCChannelPacketTimeoutMsgTimeoutOnClose) (*types.Transaction, error) { - return _Ibchandler.Contract.TimeoutOnClose(&_Ibchandler.TransactOpts, msg_) +// Solidity: function timeoutOnClose(((uint64,string,string,string,string,bytes,(uint64,uint64),uint64),bytes,bytes,(uint64,uint64),uint64) ) returns() +func (_Ibchandler *IbchandlerTransactorSession) TimeoutOnClose(arg0 IIBCChannelPacketTimeoutMsgTimeoutOnClose) (*types.Transaction, error) { + return _Ibchandler.Contract.TimeoutOnClose(&_Ibchandler.TransactOpts, arg0) } // TimeoutPacket is a paid mutator transaction binding the contract method 0xaa18c8b1. // -// Solidity: function timeoutPacket(((uint64,string,string,string,string,bytes,(uint64,uint64),uint64),bytes,(uint64,uint64),uint64) msg_) returns() -func (_Ibchandler *IbchandlerTransactor) TimeoutPacket(opts *bind.TransactOpts, msg_ IIBCChannelPacketTimeoutMsgTimeoutPacket) (*types.Transaction, error) { - return _Ibchandler.contract.Transact(opts, "timeoutPacket", msg_) +// Solidity: function timeoutPacket(((uint64,string,string,string,string,bytes,(uint64,uint64),uint64),bytes,(uint64,uint64),uint64) ) returns() +func (_Ibchandler *IbchandlerTransactor) TimeoutPacket(opts *bind.TransactOpts, arg0 IIBCChannelPacketTimeoutMsgTimeoutPacket) (*types.Transaction, error) { + return _Ibchandler.contract.Transact(opts, "timeoutPacket", arg0) } // TimeoutPacket is a paid mutator transaction binding the contract method 0xaa18c8b1. // -// Solidity: function timeoutPacket(((uint64,string,string,string,string,bytes,(uint64,uint64),uint64),bytes,(uint64,uint64),uint64) msg_) returns() -func (_Ibchandler *IbchandlerSession) TimeoutPacket(msg_ IIBCChannelPacketTimeoutMsgTimeoutPacket) (*types.Transaction, error) { - return _Ibchandler.Contract.TimeoutPacket(&_Ibchandler.TransactOpts, msg_) +// Solidity: function timeoutPacket(((uint64,string,string,string,string,bytes,(uint64,uint64),uint64),bytes,(uint64,uint64),uint64) ) returns() +func (_Ibchandler *IbchandlerSession) TimeoutPacket(arg0 IIBCChannelPacketTimeoutMsgTimeoutPacket) (*types.Transaction, error) { + return _Ibchandler.Contract.TimeoutPacket(&_Ibchandler.TransactOpts, arg0) } // TimeoutPacket is a paid mutator transaction binding the contract method 0xaa18c8b1. // -// Solidity: function timeoutPacket(((uint64,string,string,string,string,bytes,(uint64,uint64),uint64),bytes,(uint64,uint64),uint64) msg_) returns() -func (_Ibchandler *IbchandlerTransactorSession) TimeoutPacket(msg_ IIBCChannelPacketTimeoutMsgTimeoutPacket) (*types.Transaction, error) { - return _Ibchandler.Contract.TimeoutPacket(&_Ibchandler.TransactOpts, msg_) +// Solidity: function timeoutPacket(((uint64,string,string,string,string,bytes,(uint64,uint64),uint64),bytes,(uint64,uint64),uint64) ) returns() +func (_Ibchandler *IbchandlerTransactorSession) TimeoutPacket(arg0 IIBCChannelPacketTimeoutMsgTimeoutPacket) (*types.Transaction, error) { + return _Ibchandler.Contract.TimeoutPacket(&_Ibchandler.TransactOpts, arg0) } // UpdateClient is a paid mutator transaction binding the contract method 0xda6cea55. // -// Solidity: function updateClient((string,bytes) msg_) returns() -func (_Ibchandler *IbchandlerTransactor) UpdateClient(opts *bind.TransactOpts, msg_ IIBCClientMsgUpdateClient) (*types.Transaction, error) { - return _Ibchandler.contract.Transact(opts, "updateClient", msg_) +// Solidity: function updateClient((string,bytes) ) returns() +func (_Ibchandler *IbchandlerTransactor) UpdateClient(opts *bind.TransactOpts, arg0 IIBCClientMsgUpdateClient) (*types.Transaction, error) { + return _Ibchandler.contract.Transact(opts, "updateClient", arg0) } // UpdateClient is a paid mutator transaction binding the contract method 0xda6cea55. // -// Solidity: function updateClient((string,bytes) msg_) returns() -func (_Ibchandler *IbchandlerSession) UpdateClient(msg_ IIBCClientMsgUpdateClient) (*types.Transaction, error) { - return _Ibchandler.Contract.UpdateClient(&_Ibchandler.TransactOpts, msg_) +// Solidity: function updateClient((string,bytes) ) returns() +func (_Ibchandler *IbchandlerSession) UpdateClient(arg0 IIBCClientMsgUpdateClient) (*types.Transaction, error) { + return _Ibchandler.Contract.UpdateClient(&_Ibchandler.TransactOpts, arg0) } // UpdateClient is a paid mutator transaction binding the contract method 0xda6cea55. // -// Solidity: function updateClient((string,bytes) msg_) returns() -func (_Ibchandler *IbchandlerTransactorSession) UpdateClient(msg_ IIBCClientMsgUpdateClient) (*types.Transaction, error) { - return _Ibchandler.Contract.UpdateClient(&_Ibchandler.TransactOpts, msg_) +// Solidity: function updateClient((string,bytes) ) returns() +func (_Ibchandler *IbchandlerTransactorSession) UpdateClient(arg0 IIBCClientMsgUpdateClient) (*types.Transaction, error) { + return _Ibchandler.Contract.UpdateClient(&_Ibchandler.TransactOpts, arg0) } // UpdateClientCommitments is a paid mutator transaction binding the contract method 0x7ad81754. // -// Solidity: function updateClientCommitments(string clientId, (uint64,uint64)[] heights) returns() -func (_Ibchandler *IbchandlerTransactor) UpdateClientCommitments(opts *bind.TransactOpts, clientId string, heights []HeightData) (*types.Transaction, error) { - return _Ibchandler.contract.Transact(opts, "updateClientCommitments", clientId, heights) +// Solidity: function updateClientCommitments(string , (uint64,uint64)[] ) returns() +func (_Ibchandler *IbchandlerTransactor) UpdateClientCommitments(opts *bind.TransactOpts, arg0 string, arg1 []HeightData) (*types.Transaction, error) { + return _Ibchandler.contract.Transact(opts, "updateClientCommitments", arg0, arg1) } // UpdateClientCommitments is a paid mutator transaction binding the contract method 0x7ad81754. // -// Solidity: function updateClientCommitments(string clientId, (uint64,uint64)[] heights) returns() -func (_Ibchandler *IbchandlerSession) UpdateClientCommitments(clientId string, heights []HeightData) (*types.Transaction, error) { - return _Ibchandler.Contract.UpdateClientCommitments(&_Ibchandler.TransactOpts, clientId, heights) +// Solidity: function updateClientCommitments(string , (uint64,uint64)[] ) returns() +func (_Ibchandler *IbchandlerSession) UpdateClientCommitments(arg0 string, arg1 []HeightData) (*types.Transaction, error) { + return _Ibchandler.Contract.UpdateClientCommitments(&_Ibchandler.TransactOpts, arg0, arg1) } // UpdateClientCommitments is a paid mutator transaction binding the contract method 0x7ad81754. // -// Solidity: function updateClientCommitments(string clientId, (uint64,uint64)[] heights) returns() -func (_Ibchandler *IbchandlerTransactorSession) UpdateClientCommitments(clientId string, heights []HeightData) (*types.Transaction, error) { - return _Ibchandler.Contract.UpdateClientCommitments(&_Ibchandler.TransactOpts, clientId, heights) +// Solidity: function updateClientCommitments(string , (uint64,uint64)[] ) returns() +func (_Ibchandler *IbchandlerTransactorSession) UpdateClientCommitments(arg0 string, arg1 []HeightData) (*types.Transaction, error) { + return _Ibchandler.Contract.UpdateClientCommitments(&_Ibchandler.TransactOpts, arg0, arg1) +} + +// WrappedRouteUpdateClient is a paid mutator transaction binding the contract method 0x32b5f86c. +// +// Solidity: function wrappedRouteUpdateClient((string,bytes) msg_) returns(address, bytes4, bytes) +func (_Ibchandler *IbchandlerTransactor) WrappedRouteUpdateClient(opts *bind.TransactOpts, msg_ IIBCClientMsgUpdateClient) (*types.Transaction, error) { + return _Ibchandler.contract.Transact(opts, "wrappedRouteUpdateClient", msg_) +} + +// WrappedRouteUpdateClient is a paid mutator transaction binding the contract method 0x32b5f86c. +// +// Solidity: function wrappedRouteUpdateClient((string,bytes) msg_) returns(address, bytes4, bytes) +func (_Ibchandler *IbchandlerSession) WrappedRouteUpdateClient(msg_ IIBCClientMsgUpdateClient) (*types.Transaction, error) { + return _Ibchandler.Contract.WrappedRouteUpdateClient(&_Ibchandler.TransactOpts, msg_) +} + +// WrappedRouteUpdateClient is a paid mutator transaction binding the contract method 0x32b5f86c. +// +// Solidity: function wrappedRouteUpdateClient((string,bytes) msg_) returns(address, bytes4, bytes) +func (_Ibchandler *IbchandlerTransactorSession) WrappedRouteUpdateClient(msg_ IIBCClientMsgUpdateClient) (*types.Transaction, error) { + return _Ibchandler.Contract.WrappedRouteUpdateClient(&_Ibchandler.TransactOpts, msg_) } // WriteAcknowledgement is a paid mutator transaction binding the contract method 0xb56e79de. // -// Solidity: function writeAcknowledgement(string destinationPortId, string destinationChannel, uint64 sequence, bytes acknowledgement) returns() -func (_Ibchandler *IbchandlerTransactor) WriteAcknowledgement(opts *bind.TransactOpts, destinationPortId string, destinationChannel string, sequence uint64, acknowledgement []byte) (*types.Transaction, error) { - return _Ibchandler.contract.Transact(opts, "writeAcknowledgement", destinationPortId, destinationChannel, sequence, acknowledgement) +// Solidity: function writeAcknowledgement(string , string , uint64 , bytes ) returns() +func (_Ibchandler *IbchandlerTransactor) WriteAcknowledgement(opts *bind.TransactOpts, arg0 string, arg1 string, arg2 uint64, arg3 []byte) (*types.Transaction, error) { + return _Ibchandler.contract.Transact(opts, "writeAcknowledgement", arg0, arg1, arg2, arg3) } // WriteAcknowledgement is a paid mutator transaction binding the contract method 0xb56e79de. // -// Solidity: function writeAcknowledgement(string destinationPortId, string destinationChannel, uint64 sequence, bytes acknowledgement) returns() -func (_Ibchandler *IbchandlerSession) WriteAcknowledgement(destinationPortId string, destinationChannel string, sequence uint64, acknowledgement []byte) (*types.Transaction, error) { - return _Ibchandler.Contract.WriteAcknowledgement(&_Ibchandler.TransactOpts, destinationPortId, destinationChannel, sequence, acknowledgement) +// Solidity: function writeAcknowledgement(string , string , uint64 , bytes ) returns() +func (_Ibchandler *IbchandlerSession) WriteAcknowledgement(arg0 string, arg1 string, arg2 uint64, arg3 []byte) (*types.Transaction, error) { + return _Ibchandler.Contract.WriteAcknowledgement(&_Ibchandler.TransactOpts, arg0, arg1, arg2, arg3) } // WriteAcknowledgement is a paid mutator transaction binding the contract method 0xb56e79de. // -// Solidity: function writeAcknowledgement(string destinationPortId, string destinationChannel, uint64 sequence, bytes acknowledgement) returns() -func (_Ibchandler *IbchandlerTransactorSession) WriteAcknowledgement(destinationPortId string, destinationChannel string, sequence uint64, acknowledgement []byte) (*types.Transaction, error) { - return _Ibchandler.Contract.WriteAcknowledgement(&_Ibchandler.TransactOpts, destinationPortId, destinationChannel, sequence, acknowledgement) +// Solidity: function writeAcknowledgement(string , string , uint64 , bytes ) returns() +func (_Ibchandler *IbchandlerTransactorSession) WriteAcknowledgement(arg0 string, arg1 string, arg2 uint64, arg3 []byte) (*types.Transaction, error) { + return _Ibchandler.Contract.WriteAcknowledgement(&_Ibchandler.TransactOpts, arg0, arg1, arg2, arg3) } // IbchandlerAcknowledgePacketIterator is returned from FilterAcknowledgePacket and is used to iterate over the raw logs and unpacked data for AcknowledgePacket events raised by the Ibchandler contract. @@ -1513,13 +1534,13 @@ func (it *IbchandlerGeneratedChannelIdentifierIterator) Close() error { // IbchandlerGeneratedChannelIdentifier represents a GeneratedChannelIdentifier event raised by the Ibchandler contract. type IbchandlerGeneratedChannelIdentifier struct { - Arg0 string - Raw types.Log // Blockchain specific contextual infos + ChannelId string + Raw types.Log // Blockchain specific contextual infos } // FilterGeneratedChannelIdentifier is a free log retrieval operation binding the contract event 0x01fb9b8778b6fb840b058bb971dea3ba81c167b010a0216afe600826884f9ba7. // -// Solidity: event GeneratedChannelIdentifier(string arg0) +// Solidity: event GeneratedChannelIdentifier(string channelId) func (_Ibchandler *IbchandlerFilterer) FilterGeneratedChannelIdentifier(opts *bind.FilterOpts) (*IbchandlerGeneratedChannelIdentifierIterator, error) { logs, sub, err := _Ibchandler.contract.FilterLogs(opts, "GeneratedChannelIdentifier") @@ -1531,7 +1552,7 @@ func (_Ibchandler *IbchandlerFilterer) FilterGeneratedChannelIdentifier(opts *bi // WatchGeneratedChannelIdentifier is a free log subscription operation binding the contract event 0x01fb9b8778b6fb840b058bb971dea3ba81c167b010a0216afe600826884f9ba7. // -// Solidity: event GeneratedChannelIdentifier(string arg0) +// Solidity: event GeneratedChannelIdentifier(string channelId) func (_Ibchandler *IbchandlerFilterer) WatchGeneratedChannelIdentifier(opts *bind.WatchOpts, sink chan<- *IbchandlerGeneratedChannelIdentifier) (event.Subscription, error) { logs, sub, err := _Ibchandler.contract.WatchLogs(opts, "GeneratedChannelIdentifier") @@ -1568,7 +1589,7 @@ func (_Ibchandler *IbchandlerFilterer) WatchGeneratedChannelIdentifier(opts *bin // ParseGeneratedChannelIdentifier is a log parse operation binding the contract event 0x01fb9b8778b6fb840b058bb971dea3ba81c167b010a0216afe600826884f9ba7. // -// Solidity: event GeneratedChannelIdentifier(string arg0) +// Solidity: event GeneratedChannelIdentifier(string channelId) func (_Ibchandler *IbchandlerFilterer) ParseGeneratedChannelIdentifier(log types.Log) (*IbchandlerGeneratedChannelIdentifier, error) { event := new(IbchandlerGeneratedChannelIdentifier) if err := _Ibchandler.contract.UnpackLog(event, "GeneratedChannelIdentifier", log); err != nil { @@ -1647,13 +1668,13 @@ func (it *IbchandlerGeneratedClientIdentifierIterator) Close() error { // IbchandlerGeneratedClientIdentifier represents a GeneratedClientIdentifier event raised by the Ibchandler contract. type IbchandlerGeneratedClientIdentifier struct { - Arg0 string - Raw types.Log // Blockchain specific contextual infos + ClientId string + Raw types.Log // Blockchain specific contextual infos } // FilterGeneratedClientIdentifier is a free log retrieval operation binding the contract event 0x601bfcc455d5d4d7738f8c6ac232e0d7cc9c31dab811f1d87c100af0b7fc3a20. // -// Solidity: event GeneratedClientIdentifier(string arg0) +// Solidity: event GeneratedClientIdentifier(string clientId) func (_Ibchandler *IbchandlerFilterer) FilterGeneratedClientIdentifier(opts *bind.FilterOpts) (*IbchandlerGeneratedClientIdentifierIterator, error) { logs, sub, err := _Ibchandler.contract.FilterLogs(opts, "GeneratedClientIdentifier") @@ -1665,7 +1686,7 @@ func (_Ibchandler *IbchandlerFilterer) FilterGeneratedClientIdentifier(opts *bin // WatchGeneratedClientIdentifier is a free log subscription operation binding the contract event 0x601bfcc455d5d4d7738f8c6ac232e0d7cc9c31dab811f1d87c100af0b7fc3a20. // -// Solidity: event GeneratedClientIdentifier(string arg0) +// Solidity: event GeneratedClientIdentifier(string clientId) func (_Ibchandler *IbchandlerFilterer) WatchGeneratedClientIdentifier(opts *bind.WatchOpts, sink chan<- *IbchandlerGeneratedClientIdentifier) (event.Subscription, error) { logs, sub, err := _Ibchandler.contract.WatchLogs(opts, "GeneratedClientIdentifier") @@ -1702,7 +1723,7 @@ func (_Ibchandler *IbchandlerFilterer) WatchGeneratedClientIdentifier(opts *bind // ParseGeneratedClientIdentifier is a log parse operation binding the contract event 0x601bfcc455d5d4d7738f8c6ac232e0d7cc9c31dab811f1d87c100af0b7fc3a20. // -// Solidity: event GeneratedClientIdentifier(string arg0) +// Solidity: event GeneratedClientIdentifier(string clientId) func (_Ibchandler *IbchandlerFilterer) ParseGeneratedClientIdentifier(log types.Log) (*IbchandlerGeneratedClientIdentifier, error) { event := new(IbchandlerGeneratedClientIdentifier) if err := _Ibchandler.contract.UnpackLog(event, "GeneratedClientIdentifier", log); err != nil { @@ -1781,13 +1802,13 @@ func (it *IbchandlerGeneratedConnectionIdentifierIterator) Close() error { // IbchandlerGeneratedConnectionIdentifier represents a GeneratedConnectionIdentifier event raised by the Ibchandler contract. type IbchandlerGeneratedConnectionIdentifier struct { - Arg0 string - Raw types.Log // Blockchain specific contextual infos + ConnectionId string + Raw types.Log // Blockchain specific contextual infos } // FilterGeneratedConnectionIdentifier is a free log retrieval operation binding the contract event 0xbcf8ae1e9272e040280c9adfc8033bb831043a9959e37ef4af1f7e8ded16321b. // -// Solidity: event GeneratedConnectionIdentifier(string arg0) +// Solidity: event GeneratedConnectionIdentifier(string connectionId) func (_Ibchandler *IbchandlerFilterer) FilterGeneratedConnectionIdentifier(opts *bind.FilterOpts) (*IbchandlerGeneratedConnectionIdentifierIterator, error) { logs, sub, err := _Ibchandler.contract.FilterLogs(opts, "GeneratedConnectionIdentifier") @@ -1799,7 +1820,7 @@ func (_Ibchandler *IbchandlerFilterer) FilterGeneratedConnectionIdentifier(opts // WatchGeneratedConnectionIdentifier is a free log subscription operation binding the contract event 0xbcf8ae1e9272e040280c9adfc8033bb831043a9959e37ef4af1f7e8ded16321b. // -// Solidity: event GeneratedConnectionIdentifier(string arg0) +// Solidity: event GeneratedConnectionIdentifier(string connectionId) func (_Ibchandler *IbchandlerFilterer) WatchGeneratedConnectionIdentifier(opts *bind.WatchOpts, sink chan<- *IbchandlerGeneratedConnectionIdentifier) (event.Subscription, error) { logs, sub, err := _Ibchandler.contract.WatchLogs(opts, "GeneratedConnectionIdentifier") @@ -1836,7 +1857,7 @@ func (_Ibchandler *IbchandlerFilterer) WatchGeneratedConnectionIdentifier(opts * // ParseGeneratedConnectionIdentifier is a log parse operation binding the contract event 0xbcf8ae1e9272e040280c9adfc8033bb831043a9959e37ef4af1f7e8ded16321b. // -// Solidity: event GeneratedConnectionIdentifier(string arg0) +// Solidity: event GeneratedConnectionIdentifier(string connectionId) func (_Ibchandler *IbchandlerFilterer) ParseGeneratedConnectionIdentifier(log types.Log) (*IbchandlerGeneratedConnectionIdentifier, error) { event := new(IbchandlerGeneratedConnectionIdentifier) if err := _Ibchandler.contract.UnpackLog(event, "GeneratedConnectionIdentifier", log); err != nil { diff --git a/pkg/contract/ibcmockapp/ibcmockapp.go b/pkg/contract/ibcmockapp/ibcmockapp.go index b4694e72..979aca3b 100644 --- a/pkg/contract/ibcmockapp/ibcmockapp.go +++ b/pkg/contract/ibcmockapp/ibcmockapp.go @@ -100,7 +100,7 @@ type PacketData struct { // IbcmockappMetaData contains all meta data concerning the Ibcmockapp contract. var IbcmockappMetaData = &bind.MetaData{ - ABI: "[{\"type\":\"constructor\",\"inputs\":[{\"name\":\"ibcHandler_\",\"type\":\"address\",\"internalType\":\"contractIIBCHandler\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"MOCKAPP_VERSION\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"allowCloseChannel\",\"inputs\":[{\"name\":\"allow\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"closeChannelAllowed\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"ibcAddress\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"onAcknowledgementPacket\",\"inputs\":[{\"name\":\"packet\",\"type\":\"tuple\",\"internalType\":\"structPacket.Data\",\"components\":[{\"name\":\"sequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"source_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"source_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"timeout_height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"timeout_timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"acknowledgement\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"onChanCloseConfirm\",\"inputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structIIBCModule.MsgOnChanCloseConfirm\",\"components\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"onChanCloseInit\",\"inputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structIIBCModule.MsgOnChanCloseInit\",\"components\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"onChanOpenAck\",\"inputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structIIBCModule.MsgOnChanOpenAck\",\"components\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"counterpartyVersion\",\"type\":\"string\",\"internalType\":\"string\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"onChanOpenConfirm\",\"inputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structIIBCModule.MsgOnChanOpenConfirm\",\"components\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"onChanOpenInit\",\"inputs\":[{\"name\":\"msg_\",\"type\":\"tuple\",\"internalType\":\"structIIBCModule.MsgOnChanOpenInit\",\"components\":[{\"name\":\"order\",\"type\":\"uint8\",\"internalType\":\"enumChannel.Order\"},{\"name\":\"connectionHops\",\"type\":\"string[]\",\"internalType\":\"string[]\"},{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"counterparty\",\"type\":\"tuple\",\"internalType\":\"structChannelCounterparty.Data\",\"components\":[{\"name\":\"port_id\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channel_id\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"name\":\"version\",\"type\":\"string\",\"internalType\":\"string\"}]}],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"onChanOpenTry\",\"inputs\":[{\"name\":\"msg_\",\"type\":\"tuple\",\"internalType\":\"structIIBCModule.MsgOnChanOpenTry\",\"components\":[{\"name\":\"order\",\"type\":\"uint8\",\"internalType\":\"enumChannel.Order\"},{\"name\":\"connectionHops\",\"type\":\"string[]\",\"internalType\":\"string[]\"},{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"counterparty\",\"type\":\"tuple\",\"internalType\":\"structChannelCounterparty.Data\",\"components\":[{\"name\":\"port_id\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channel_id\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"name\":\"counterpartyVersion\",\"type\":\"string\",\"internalType\":\"string\"}]}],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"onRecvPacket\",\"inputs\":[{\"name\":\"packet\",\"type\":\"tuple\",\"internalType\":\"structPacket.Data\",\"components\":[{\"name\":\"sequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"source_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"source_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"timeout_height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"timeout_timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"acknowledgement\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"onTimeoutPacket\",\"inputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structPacket.Data\",\"components\":[{\"name\":\"sequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"source_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"source_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"timeout_height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"timeout_timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"owner\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"renounceOwnership\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"sendPacket\",\"inputs\":[{\"name\":\"message\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"sourcePort\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"sourceChannel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"timeoutHeight\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"timeoutTimestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"transferOwnership\",\"inputs\":[{\"name\":\"newOwner\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"writeAcknowledgement\",\"inputs\":[{\"name\":\"destinationPort\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destinationChannel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"sequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"event\",\"name\":\"OwnershipTransferred\",\"inputs\":[{\"name\":\"previousOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false}]", + ABI: "[{\"type\":\"constructor\",\"inputs\":[{\"name\":\"ibcHandler_\",\"type\":\"address\",\"internalType\":\"contractIIBCHandler\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"MOCKAPP_VERSION\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"allowCloseChannel\",\"inputs\":[{\"name\":\"allow\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"closeChannelAllowed\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"ibcAddress\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"onAcknowledgementPacket\",\"inputs\":[{\"name\":\"packet\",\"type\":\"tuple\",\"internalType\":\"structPacket.Data\",\"components\":[{\"name\":\"sequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"source_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"source_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"timeout_height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"timeout_timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"acknowledgement\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"onChanCloseConfirm\",\"inputs\":[{\"name\":\"msg_\",\"type\":\"tuple\",\"internalType\":\"structIIBCModule.MsgOnChanCloseConfirm\",\"components\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"onChanCloseInit\",\"inputs\":[{\"name\":\"msg_\",\"type\":\"tuple\",\"internalType\":\"structIIBCModule.MsgOnChanCloseInit\",\"components\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"onChanOpenAck\",\"inputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structIIBCModule.MsgOnChanOpenAck\",\"components\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"counterpartyVersion\",\"type\":\"string\",\"internalType\":\"string\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"onChanOpenConfirm\",\"inputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structIIBCModule.MsgOnChanOpenConfirm\",\"components\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"onChanOpenInit\",\"inputs\":[{\"name\":\"msg_\",\"type\":\"tuple\",\"internalType\":\"structIIBCModule.MsgOnChanOpenInit\",\"components\":[{\"name\":\"order\",\"type\":\"uint8\",\"internalType\":\"enumChannel.Order\"},{\"name\":\"connectionHops\",\"type\":\"string[]\",\"internalType\":\"string[]\"},{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"counterparty\",\"type\":\"tuple\",\"internalType\":\"structChannelCounterparty.Data\",\"components\":[{\"name\":\"port_id\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channel_id\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"name\":\"version\",\"type\":\"string\",\"internalType\":\"string\"}]}],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"onChanOpenTry\",\"inputs\":[{\"name\":\"msg_\",\"type\":\"tuple\",\"internalType\":\"structIIBCModule.MsgOnChanOpenTry\",\"components\":[{\"name\":\"order\",\"type\":\"uint8\",\"internalType\":\"enumChannel.Order\"},{\"name\":\"connectionHops\",\"type\":\"string[]\",\"internalType\":\"string[]\"},{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"counterparty\",\"type\":\"tuple\",\"internalType\":\"structChannelCounterparty.Data\",\"components\":[{\"name\":\"port_id\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channel_id\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"name\":\"counterpartyVersion\",\"type\":\"string\",\"internalType\":\"string\"}]}],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"onRecvPacket\",\"inputs\":[{\"name\":\"packet\",\"type\":\"tuple\",\"internalType\":\"structPacket.Data\",\"components\":[{\"name\":\"sequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"source_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"source_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"timeout_height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"timeout_timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"acknowledgement\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"onTimeoutPacket\",\"inputs\":[{\"name\":\"packet\",\"type\":\"tuple\",\"internalType\":\"structPacket.Data\",\"components\":[{\"name\":\"sequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"source_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"source_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"timeout_height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"timeout_timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"owner\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"renounceOwnership\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"sendPacket\",\"inputs\":[{\"name\":\"message\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"sourcePort\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"sourceChannel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"timeoutHeight\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"timeoutTimestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"transferOwnership\",\"inputs\":[{\"name\":\"newOwner\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"writeAcknowledgement\",\"inputs\":[{\"name\":\"destinationPort\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destinationChannel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"sequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"event\",\"name\":\"OwnershipTransferred\",\"inputs\":[{\"name\":\"previousOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"IBCMockUnexpectedAcknowledgement\",\"inputs\":[{\"name\":\"actual\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"expected\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]},{\"type\":\"error\",\"name\":\"IBCMockUnexpectedPacket\",\"inputs\":[{\"name\":\"actual\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]},{\"type\":\"error\",\"name\":\"IBCMockUnexpectedVersion\",\"inputs\":[{\"name\":\"actual\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"expected\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"type\":\"error\",\"name\":\"IBCModuleChannelCloseNotAllowed\",\"inputs\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"type\":\"error\",\"name\":\"IBCModuleChannelOrderNotAllowed\",\"inputs\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"order\",\"type\":\"uint8\",\"internalType\":\"enumChannel.Order\"}]},{\"type\":\"error\",\"name\":\"IBCModuleInvalidSender\",\"inputs\":[{\"name\":\"sender\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"OwnableInvalidOwner\",\"inputs\":[{\"name\":\"owner\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"OwnableUnauthorizedAccount\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"internalType\":\"address\"}]}]", } // IbcmockappABI is the input ABI used to generate the binding from. @@ -375,10 +375,10 @@ func (_Ibcmockapp *IbcmockappCallerSession) OnRecvPacket(packet PacketData, arg1 // OnTimeoutPacket is a free data retrieval call binding the contract method 0x52c7157d. // -// Solidity: function onTimeoutPacket((uint64,string,string,string,string,bytes,(uint64,uint64),uint64) , address ) view returns() -func (_Ibcmockapp *IbcmockappCaller) OnTimeoutPacket(opts *bind.CallOpts, arg0 PacketData, arg1 common.Address) error { +// Solidity: function onTimeoutPacket((uint64,string,string,string,string,bytes,(uint64,uint64),uint64) packet, address ) view returns() +func (_Ibcmockapp *IbcmockappCaller) OnTimeoutPacket(opts *bind.CallOpts, packet PacketData, arg1 common.Address) error { var out []interface{} - err := _Ibcmockapp.contract.Call(opts, &out, "onTimeoutPacket", arg0, arg1) + err := _Ibcmockapp.contract.Call(opts, &out, "onTimeoutPacket", packet, arg1) if err != nil { return err @@ -390,16 +390,16 @@ func (_Ibcmockapp *IbcmockappCaller) OnTimeoutPacket(opts *bind.CallOpts, arg0 P // OnTimeoutPacket is a free data retrieval call binding the contract method 0x52c7157d. // -// Solidity: function onTimeoutPacket((uint64,string,string,string,string,bytes,(uint64,uint64),uint64) , address ) view returns() -func (_Ibcmockapp *IbcmockappSession) OnTimeoutPacket(arg0 PacketData, arg1 common.Address) error { - return _Ibcmockapp.Contract.OnTimeoutPacket(&_Ibcmockapp.CallOpts, arg0, arg1) +// Solidity: function onTimeoutPacket((uint64,string,string,string,string,bytes,(uint64,uint64),uint64) packet, address ) view returns() +func (_Ibcmockapp *IbcmockappSession) OnTimeoutPacket(packet PacketData, arg1 common.Address) error { + return _Ibcmockapp.Contract.OnTimeoutPacket(&_Ibcmockapp.CallOpts, packet, arg1) } // OnTimeoutPacket is a free data retrieval call binding the contract method 0x52c7157d. // -// Solidity: function onTimeoutPacket((uint64,string,string,string,string,bytes,(uint64,uint64),uint64) , address ) view returns() -func (_Ibcmockapp *IbcmockappCallerSession) OnTimeoutPacket(arg0 PacketData, arg1 common.Address) error { - return _Ibcmockapp.Contract.OnTimeoutPacket(&_Ibcmockapp.CallOpts, arg0, arg1) +// Solidity: function onTimeoutPacket((uint64,string,string,string,string,bytes,(uint64,uint64),uint64) packet, address ) view returns() +func (_Ibcmockapp *IbcmockappCallerSession) OnTimeoutPacket(packet PacketData, arg1 common.Address) error { + return _Ibcmockapp.Contract.OnTimeoutPacket(&_Ibcmockapp.CallOpts, packet, arg1) } // Owner is a free data retrieval call binding the contract method 0x8da5cb5b. @@ -477,44 +477,44 @@ func (_Ibcmockapp *IbcmockappTransactorSession) OnAcknowledgementPacket(packet P // OnChanCloseConfirm is a paid mutator transaction binding the contract method 0x38c858bc. // -// Solidity: function onChanCloseConfirm((string,string) ) returns() -func (_Ibcmockapp *IbcmockappTransactor) OnChanCloseConfirm(opts *bind.TransactOpts, arg0 IIBCModuleMsgOnChanCloseConfirm) (*types.Transaction, error) { - return _Ibcmockapp.contract.Transact(opts, "onChanCloseConfirm", arg0) +// Solidity: function onChanCloseConfirm((string,string) msg_) returns() +func (_Ibcmockapp *IbcmockappTransactor) OnChanCloseConfirm(opts *bind.TransactOpts, msg_ IIBCModuleMsgOnChanCloseConfirm) (*types.Transaction, error) { + return _Ibcmockapp.contract.Transact(opts, "onChanCloseConfirm", msg_) } // OnChanCloseConfirm is a paid mutator transaction binding the contract method 0x38c858bc. // -// Solidity: function onChanCloseConfirm((string,string) ) returns() -func (_Ibcmockapp *IbcmockappSession) OnChanCloseConfirm(arg0 IIBCModuleMsgOnChanCloseConfirm) (*types.Transaction, error) { - return _Ibcmockapp.Contract.OnChanCloseConfirm(&_Ibcmockapp.TransactOpts, arg0) +// Solidity: function onChanCloseConfirm((string,string) msg_) returns() +func (_Ibcmockapp *IbcmockappSession) OnChanCloseConfirm(msg_ IIBCModuleMsgOnChanCloseConfirm) (*types.Transaction, error) { + return _Ibcmockapp.Contract.OnChanCloseConfirm(&_Ibcmockapp.TransactOpts, msg_) } // OnChanCloseConfirm is a paid mutator transaction binding the contract method 0x38c858bc. // -// Solidity: function onChanCloseConfirm((string,string) ) returns() -func (_Ibcmockapp *IbcmockappTransactorSession) OnChanCloseConfirm(arg0 IIBCModuleMsgOnChanCloseConfirm) (*types.Transaction, error) { - return _Ibcmockapp.Contract.OnChanCloseConfirm(&_Ibcmockapp.TransactOpts, arg0) +// Solidity: function onChanCloseConfirm((string,string) msg_) returns() +func (_Ibcmockapp *IbcmockappTransactorSession) OnChanCloseConfirm(msg_ IIBCModuleMsgOnChanCloseConfirm) (*types.Transaction, error) { + return _Ibcmockapp.Contract.OnChanCloseConfirm(&_Ibcmockapp.TransactOpts, msg_) } // OnChanCloseInit is a paid mutator transaction binding the contract method 0x3c7df3fb. // -// Solidity: function onChanCloseInit((string,string) ) returns() -func (_Ibcmockapp *IbcmockappTransactor) OnChanCloseInit(opts *bind.TransactOpts, arg0 IIBCModuleMsgOnChanCloseInit) (*types.Transaction, error) { - return _Ibcmockapp.contract.Transact(opts, "onChanCloseInit", arg0) +// Solidity: function onChanCloseInit((string,string) msg_) returns() +func (_Ibcmockapp *IbcmockappTransactor) OnChanCloseInit(opts *bind.TransactOpts, msg_ IIBCModuleMsgOnChanCloseInit) (*types.Transaction, error) { + return _Ibcmockapp.contract.Transact(opts, "onChanCloseInit", msg_) } // OnChanCloseInit is a paid mutator transaction binding the contract method 0x3c7df3fb. // -// Solidity: function onChanCloseInit((string,string) ) returns() -func (_Ibcmockapp *IbcmockappSession) OnChanCloseInit(arg0 IIBCModuleMsgOnChanCloseInit) (*types.Transaction, error) { - return _Ibcmockapp.Contract.OnChanCloseInit(&_Ibcmockapp.TransactOpts, arg0) +// Solidity: function onChanCloseInit((string,string) msg_) returns() +func (_Ibcmockapp *IbcmockappSession) OnChanCloseInit(msg_ IIBCModuleMsgOnChanCloseInit) (*types.Transaction, error) { + return _Ibcmockapp.Contract.OnChanCloseInit(&_Ibcmockapp.TransactOpts, msg_) } // OnChanCloseInit is a paid mutator transaction binding the contract method 0x3c7df3fb. // -// Solidity: function onChanCloseInit((string,string) ) returns() -func (_Ibcmockapp *IbcmockappTransactorSession) OnChanCloseInit(arg0 IIBCModuleMsgOnChanCloseInit) (*types.Transaction, error) { - return _Ibcmockapp.Contract.OnChanCloseInit(&_Ibcmockapp.TransactOpts, arg0) +// Solidity: function onChanCloseInit((string,string) msg_) returns() +func (_Ibcmockapp *IbcmockappTransactorSession) OnChanCloseInit(msg_ IIBCModuleMsgOnChanCloseInit) (*types.Transaction, error) { + return _Ibcmockapp.Contract.OnChanCloseInit(&_Ibcmockapp.TransactOpts, msg_) } // OnChanOpenAck is a paid mutator transaction binding the contract method 0x12f6ff6f. diff --git a/pkg/contract/ibft2client/ibft2client.go b/pkg/contract/ibft2client/ibft2client.go new file mode 100644 index 00000000..26464d4f --- /dev/null +++ b/pkg/contract/ibft2client/ibft2client.go @@ -0,0 +1,488 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package ibft2client + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// HeightData is an auto generated low-level Go binding around an user-defined struct. +type HeightData struct { + RevisionNumber uint64 + RevisionHeight uint64 +} + +// IbcLightclientsIbft2V1HeaderData is an auto generated low-level Go binding around an user-defined struct. +type IbcLightclientsIbft2V1HeaderData struct { + BesuHeaderRlp []byte + Seals [][]byte + TrustedHeight HeightData + AccountStateProof []byte +} + +// Ibft2clientMetaData contains all meta data concerning the Ibft2client contract. +var Ibft2clientMetaData = &bind.MetaData{ + ABI: "[{\"type\":\"constructor\",\"inputs\":[{\"name\":\"ibcHandler_\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"getClientState\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"}],\"outputs\":[{\"name\":\"clientStateBytes\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getConsensusState\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"outputs\":[{\"name\":\"consensusStateBytes\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getLatestHeight\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"}],\"outputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getStatus\",\"inputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint8\",\"internalType\":\"enumILightClient.ClientStatus\"}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"getTimestampAtHeight\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"outputs\":[{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"initializeClient\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"protoClientState\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"protoConsensusState\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"routeUpdateClient\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"protoClientMessage\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bytes4\",\"internalType\":\"bytes4\"},{\"name\":\"\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"updateClient\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"header\",\"type\":\"tuple\",\"internalType\":\"structIbcLightclientsIbft2V1Header.Data\",\"components\":[{\"name\":\"besu_header_rlp\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"seals\",\"type\":\"bytes[]\",\"internalType\":\"bytes[]\"},{\"name\":\"trusted_height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"account_state_proof\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]}],\"outputs\":[{\"name\":\"heights\",\"type\":\"tuple[]\",\"internalType\":\"structHeight.Data[]\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"verifyMembership\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"delayTimePeriod\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"delayBlockPeriod\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"proof\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"prefix\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"path\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"verifyNonMembership\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"delayTimePeriod\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"delayBlockPeriod\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"proof\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"prefix\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"path\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"error\",\"name\":\"ClientStateNotFound\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"type\":\"error\",\"name\":\"ConsensusStateNotFound\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}]},{\"type\":\"error\",\"name\":\"EmptyValidators\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InsufficientTrustedValidatorsSeals\",\"inputs\":[{\"name\":\"actual\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"threshold\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"InsuffientUntrustedValidatorsSeals\",\"inputs\":[{\"name\":\"actual\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"threshold\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"InvalidCaller\",\"inputs\":[{\"name\":\"caller\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"InvalidConsensusStateRootLength\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidECDSASignatureLength\",\"inputs\":[{\"name\":\"length\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"InvalidIBCAddressLength\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidValidatorAddressLength\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"NotActiveClient\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"type\":\"error\",\"name\":\"UnexpectedEthereumHeaderFormat\",\"inputs\":[{\"name\":\"itemsLength\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"UnexpectedExtraDataFormat\",\"inputs\":[{\"name\":\"itemsLength\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"UnexpectedProtoAnyTypeURL\",\"inputs\":[{\"name\":\"url\",\"type\":\"string\",\"internalType\":\"string\"}]}]", +} + +// Ibft2clientABI is the input ABI used to generate the binding from. +// Deprecated: Use Ibft2clientMetaData.ABI instead. +var Ibft2clientABI = Ibft2clientMetaData.ABI + +// Ibft2client is an auto generated Go binding around an Ethereum contract. +type Ibft2client struct { + Ibft2clientCaller // Read-only binding to the contract + Ibft2clientTransactor // Write-only binding to the contract + Ibft2clientFilterer // Log filterer for contract events +} + +// Ibft2clientCaller is an auto generated read-only Go binding around an Ethereum contract. +type Ibft2clientCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// Ibft2clientTransactor is an auto generated write-only Go binding around an Ethereum contract. +type Ibft2clientTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// Ibft2clientFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type Ibft2clientFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// Ibft2clientSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type Ibft2clientSession struct { + Contract *Ibft2client // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// Ibft2clientCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type Ibft2clientCallerSession struct { + Contract *Ibft2clientCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// Ibft2clientTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type Ibft2clientTransactorSession struct { + Contract *Ibft2clientTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// Ibft2clientRaw is an auto generated low-level Go binding around an Ethereum contract. +type Ibft2clientRaw struct { + Contract *Ibft2client // Generic contract binding to access the raw methods on +} + +// Ibft2clientCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type Ibft2clientCallerRaw struct { + Contract *Ibft2clientCaller // Generic read-only contract binding to access the raw methods on +} + +// Ibft2clientTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type Ibft2clientTransactorRaw struct { + Contract *Ibft2clientTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewIbft2client creates a new instance of Ibft2client, bound to a specific deployed contract. +func NewIbft2client(address common.Address, backend bind.ContractBackend) (*Ibft2client, error) { + contract, err := bindIbft2client(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &Ibft2client{Ibft2clientCaller: Ibft2clientCaller{contract: contract}, Ibft2clientTransactor: Ibft2clientTransactor{contract: contract}, Ibft2clientFilterer: Ibft2clientFilterer{contract: contract}}, nil +} + +// NewIbft2clientCaller creates a new read-only instance of Ibft2client, bound to a specific deployed contract. +func NewIbft2clientCaller(address common.Address, caller bind.ContractCaller) (*Ibft2clientCaller, error) { + contract, err := bindIbft2client(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &Ibft2clientCaller{contract: contract}, nil +} + +// NewIbft2clientTransactor creates a new write-only instance of Ibft2client, bound to a specific deployed contract. +func NewIbft2clientTransactor(address common.Address, transactor bind.ContractTransactor) (*Ibft2clientTransactor, error) { + contract, err := bindIbft2client(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &Ibft2clientTransactor{contract: contract}, nil +} + +// NewIbft2clientFilterer creates a new log filterer instance of Ibft2client, bound to a specific deployed contract. +func NewIbft2clientFilterer(address common.Address, filterer bind.ContractFilterer) (*Ibft2clientFilterer, error) { + contract, err := bindIbft2client(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &Ibft2clientFilterer{contract: contract}, nil +} + +// bindIbft2client binds a generic wrapper to an already deployed contract. +func bindIbft2client(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := Ibft2clientMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Ibft2client *Ibft2clientRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Ibft2client.Contract.Ibft2clientCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Ibft2client *Ibft2clientRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Ibft2client.Contract.Ibft2clientTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Ibft2client *Ibft2clientRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Ibft2client.Contract.Ibft2clientTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Ibft2client *Ibft2clientCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Ibft2client.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Ibft2client *Ibft2clientTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Ibft2client.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Ibft2client *Ibft2clientTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Ibft2client.Contract.contract.Transact(opts, method, params...) +} + +// GetClientState is a free data retrieval call binding the contract method 0x76c81c42. +// +// Solidity: function getClientState(string clientId) view returns(bytes clientStateBytes, bool) +func (_Ibft2client *Ibft2clientCaller) GetClientState(opts *bind.CallOpts, clientId string) ([]byte, bool, error) { + var out []interface{} + err := _Ibft2client.contract.Call(opts, &out, "getClientState", clientId) + + if err != nil { + return *new([]byte), *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new([]byte)).(*[]byte) + out1 := *abi.ConvertType(out[1], new(bool)).(*bool) + + return out0, out1, err + +} + +// GetClientState is a free data retrieval call binding the contract method 0x76c81c42. +// +// Solidity: function getClientState(string clientId) view returns(bytes clientStateBytes, bool) +func (_Ibft2client *Ibft2clientSession) GetClientState(clientId string) ([]byte, bool, error) { + return _Ibft2client.Contract.GetClientState(&_Ibft2client.CallOpts, clientId) +} + +// GetClientState is a free data retrieval call binding the contract method 0x76c81c42. +// +// Solidity: function getClientState(string clientId) view returns(bytes clientStateBytes, bool) +func (_Ibft2client *Ibft2clientCallerSession) GetClientState(clientId string) ([]byte, bool, error) { + return _Ibft2client.Contract.GetClientState(&_Ibft2client.CallOpts, clientId) +} + +// GetConsensusState is a free data retrieval call binding the contract method 0x6cf44bf4. +// +// Solidity: function getConsensusState(string clientId, (uint64,uint64) height) view returns(bytes consensusStateBytes, bool) +func (_Ibft2client *Ibft2clientCaller) GetConsensusState(opts *bind.CallOpts, clientId string, height HeightData) ([]byte, bool, error) { + var out []interface{} + err := _Ibft2client.contract.Call(opts, &out, "getConsensusState", clientId, height) + + if err != nil { + return *new([]byte), *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new([]byte)).(*[]byte) + out1 := *abi.ConvertType(out[1], new(bool)).(*bool) + + return out0, out1, err + +} + +// GetConsensusState is a free data retrieval call binding the contract method 0x6cf44bf4. +// +// Solidity: function getConsensusState(string clientId, (uint64,uint64) height) view returns(bytes consensusStateBytes, bool) +func (_Ibft2client *Ibft2clientSession) GetConsensusState(clientId string, height HeightData) ([]byte, bool, error) { + return _Ibft2client.Contract.GetConsensusState(&_Ibft2client.CallOpts, clientId, height) +} + +// GetConsensusState is a free data retrieval call binding the contract method 0x6cf44bf4. +// +// Solidity: function getConsensusState(string clientId, (uint64,uint64) height) view returns(bytes consensusStateBytes, bool) +func (_Ibft2client *Ibft2clientCallerSession) GetConsensusState(clientId string, height HeightData) ([]byte, bool, error) { + return _Ibft2client.Contract.GetConsensusState(&_Ibft2client.CallOpts, clientId, height) +} + +// GetLatestHeight is a free data retrieval call binding the contract method 0x329681d0. +// +// Solidity: function getLatestHeight(string clientId) view returns((uint64,uint64)) +func (_Ibft2client *Ibft2clientCaller) GetLatestHeight(opts *bind.CallOpts, clientId string) (HeightData, error) { + var out []interface{} + err := _Ibft2client.contract.Call(opts, &out, "getLatestHeight", clientId) + + if err != nil { + return *new(HeightData), err + } + + out0 := *abi.ConvertType(out[0], new(HeightData)).(*HeightData) + + return out0, err + +} + +// GetLatestHeight is a free data retrieval call binding the contract method 0x329681d0. +// +// Solidity: function getLatestHeight(string clientId) view returns((uint64,uint64)) +func (_Ibft2client *Ibft2clientSession) GetLatestHeight(clientId string) (HeightData, error) { + return _Ibft2client.Contract.GetLatestHeight(&_Ibft2client.CallOpts, clientId) +} + +// GetLatestHeight is a free data retrieval call binding the contract method 0x329681d0. +// +// Solidity: function getLatestHeight(string clientId) view returns((uint64,uint64)) +func (_Ibft2client *Ibft2clientCallerSession) GetLatestHeight(clientId string) (HeightData, error) { + return _Ibft2client.Contract.GetLatestHeight(&_Ibft2client.CallOpts, clientId) +} + +// GetStatus is a free data retrieval call binding the contract method 0x22b05ed2. +// +// Solidity: function getStatus(string ) pure returns(uint8) +func (_Ibft2client *Ibft2clientCaller) GetStatus(opts *bind.CallOpts, arg0 string) (uint8, error) { + var out []interface{} + err := _Ibft2client.contract.Call(opts, &out, "getStatus", arg0) + + if err != nil { + return *new(uint8), err + } + + out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) + + return out0, err + +} + +// GetStatus is a free data retrieval call binding the contract method 0x22b05ed2. +// +// Solidity: function getStatus(string ) pure returns(uint8) +func (_Ibft2client *Ibft2clientSession) GetStatus(arg0 string) (uint8, error) { + return _Ibft2client.Contract.GetStatus(&_Ibft2client.CallOpts, arg0) +} + +// GetStatus is a free data retrieval call binding the contract method 0x22b05ed2. +// +// Solidity: function getStatus(string ) pure returns(uint8) +func (_Ibft2client *Ibft2clientCallerSession) GetStatus(arg0 string) (uint8, error) { + return _Ibft2client.Contract.GetStatus(&_Ibft2client.CallOpts, arg0) +} + +// GetTimestampAtHeight is a free data retrieval call binding the contract method 0x4b0bbdc4. +// +// Solidity: function getTimestampAtHeight(string clientId, (uint64,uint64) height) view returns(uint64) +func (_Ibft2client *Ibft2clientCaller) GetTimestampAtHeight(opts *bind.CallOpts, clientId string, height HeightData) (uint64, error) { + var out []interface{} + err := _Ibft2client.contract.Call(opts, &out, "getTimestampAtHeight", clientId, height) + + if err != nil { + return *new(uint64), err + } + + out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64) + + return out0, err + +} + +// GetTimestampAtHeight is a free data retrieval call binding the contract method 0x4b0bbdc4. +// +// Solidity: function getTimestampAtHeight(string clientId, (uint64,uint64) height) view returns(uint64) +func (_Ibft2client *Ibft2clientSession) GetTimestampAtHeight(clientId string, height HeightData) (uint64, error) { + return _Ibft2client.Contract.GetTimestampAtHeight(&_Ibft2client.CallOpts, clientId, height) +} + +// GetTimestampAtHeight is a free data retrieval call binding the contract method 0x4b0bbdc4. +// +// Solidity: function getTimestampAtHeight(string clientId, (uint64,uint64) height) view returns(uint64) +func (_Ibft2client *Ibft2clientCallerSession) GetTimestampAtHeight(clientId string, height HeightData) (uint64, error) { + return _Ibft2client.Contract.GetTimestampAtHeight(&_Ibft2client.CallOpts, clientId, height) +} + +// RouteUpdateClient is a free data retrieval call binding the contract method 0xf13a62f9. +// +// Solidity: function routeUpdateClient(string clientId, bytes protoClientMessage) pure returns(bytes4, bytes) +func (_Ibft2client *Ibft2clientCaller) RouteUpdateClient(opts *bind.CallOpts, clientId string, protoClientMessage []byte) ([4]byte, []byte, error) { + var out []interface{} + err := _Ibft2client.contract.Call(opts, &out, "routeUpdateClient", clientId, protoClientMessage) + + if err != nil { + return *new([4]byte), *new([]byte), err + } + + out0 := *abi.ConvertType(out[0], new([4]byte)).(*[4]byte) + out1 := *abi.ConvertType(out[1], new([]byte)).(*[]byte) + + return out0, out1, err + +} + +// RouteUpdateClient is a free data retrieval call binding the contract method 0xf13a62f9. +// +// Solidity: function routeUpdateClient(string clientId, bytes protoClientMessage) pure returns(bytes4, bytes) +func (_Ibft2client *Ibft2clientSession) RouteUpdateClient(clientId string, protoClientMessage []byte) ([4]byte, []byte, error) { + return _Ibft2client.Contract.RouteUpdateClient(&_Ibft2client.CallOpts, clientId, protoClientMessage) +} + +// RouteUpdateClient is a free data retrieval call binding the contract method 0xf13a62f9. +// +// Solidity: function routeUpdateClient(string clientId, bytes protoClientMessage) pure returns(bytes4, bytes) +func (_Ibft2client *Ibft2clientCallerSession) RouteUpdateClient(clientId string, protoClientMessage []byte) ([4]byte, []byte, error) { + return _Ibft2client.Contract.RouteUpdateClient(&_Ibft2client.CallOpts, clientId, protoClientMessage) +} + +// VerifyMembership is a free data retrieval call binding the contract method 0xf9bb5a51. +// +// Solidity: function verifyMembership(string clientId, (uint64,uint64) height, uint64 delayTimePeriod, uint64 delayBlockPeriod, bytes proof, bytes prefix, bytes path, bytes value) view returns(bool) +func (_Ibft2client *Ibft2clientCaller) VerifyMembership(opts *bind.CallOpts, clientId string, height HeightData, delayTimePeriod uint64, delayBlockPeriod uint64, proof []byte, prefix []byte, path []byte, value []byte) (bool, error) { + var out []interface{} + err := _Ibft2client.contract.Call(opts, &out, "verifyMembership", clientId, height, delayTimePeriod, delayBlockPeriod, proof, prefix, path, value) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// VerifyMembership is a free data retrieval call binding the contract method 0xf9bb5a51. +// +// Solidity: function verifyMembership(string clientId, (uint64,uint64) height, uint64 delayTimePeriod, uint64 delayBlockPeriod, bytes proof, bytes prefix, bytes path, bytes value) view returns(bool) +func (_Ibft2client *Ibft2clientSession) VerifyMembership(clientId string, height HeightData, delayTimePeriod uint64, delayBlockPeriod uint64, proof []byte, prefix []byte, path []byte, value []byte) (bool, error) { + return _Ibft2client.Contract.VerifyMembership(&_Ibft2client.CallOpts, clientId, height, delayTimePeriod, delayBlockPeriod, proof, prefix, path, value) +} + +// VerifyMembership is a free data retrieval call binding the contract method 0xf9bb5a51. +// +// Solidity: function verifyMembership(string clientId, (uint64,uint64) height, uint64 delayTimePeriod, uint64 delayBlockPeriod, bytes proof, bytes prefix, bytes path, bytes value) view returns(bool) +func (_Ibft2client *Ibft2clientCallerSession) VerifyMembership(clientId string, height HeightData, delayTimePeriod uint64, delayBlockPeriod uint64, proof []byte, prefix []byte, path []byte, value []byte) (bool, error) { + return _Ibft2client.Contract.VerifyMembership(&_Ibft2client.CallOpts, clientId, height, delayTimePeriod, delayBlockPeriod, proof, prefix, path, value) +} + +// VerifyNonMembership is a free data retrieval call binding the contract method 0x999fbbb3. +// +// Solidity: function verifyNonMembership(string clientId, (uint64,uint64) height, uint64 delayTimePeriod, uint64 delayBlockPeriod, bytes proof, bytes prefix, bytes path) view returns(bool) +func (_Ibft2client *Ibft2clientCaller) VerifyNonMembership(opts *bind.CallOpts, clientId string, height HeightData, delayTimePeriod uint64, delayBlockPeriod uint64, proof []byte, prefix []byte, path []byte) (bool, error) { + var out []interface{} + err := _Ibft2client.contract.Call(opts, &out, "verifyNonMembership", clientId, height, delayTimePeriod, delayBlockPeriod, proof, prefix, path) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// VerifyNonMembership is a free data retrieval call binding the contract method 0x999fbbb3. +// +// Solidity: function verifyNonMembership(string clientId, (uint64,uint64) height, uint64 delayTimePeriod, uint64 delayBlockPeriod, bytes proof, bytes prefix, bytes path) view returns(bool) +func (_Ibft2client *Ibft2clientSession) VerifyNonMembership(clientId string, height HeightData, delayTimePeriod uint64, delayBlockPeriod uint64, proof []byte, prefix []byte, path []byte) (bool, error) { + return _Ibft2client.Contract.VerifyNonMembership(&_Ibft2client.CallOpts, clientId, height, delayTimePeriod, delayBlockPeriod, proof, prefix, path) +} + +// VerifyNonMembership is a free data retrieval call binding the contract method 0x999fbbb3. +// +// Solidity: function verifyNonMembership(string clientId, (uint64,uint64) height, uint64 delayTimePeriod, uint64 delayBlockPeriod, bytes proof, bytes prefix, bytes path) view returns(bool) +func (_Ibft2client *Ibft2clientCallerSession) VerifyNonMembership(clientId string, height HeightData, delayTimePeriod uint64, delayBlockPeriod uint64, proof []byte, prefix []byte, path []byte) (bool, error) { + return _Ibft2client.Contract.VerifyNonMembership(&_Ibft2client.CallOpts, clientId, height, delayTimePeriod, delayBlockPeriod, proof, prefix, path) +} + +// InitializeClient is a paid mutator transaction binding the contract method 0xfe66819f. +// +// Solidity: function initializeClient(string clientId, bytes protoClientState, bytes protoConsensusState) returns((uint64,uint64) height) +func (_Ibft2client *Ibft2clientTransactor) InitializeClient(opts *bind.TransactOpts, clientId string, protoClientState []byte, protoConsensusState []byte) (*types.Transaction, error) { + return _Ibft2client.contract.Transact(opts, "initializeClient", clientId, protoClientState, protoConsensusState) +} + +// InitializeClient is a paid mutator transaction binding the contract method 0xfe66819f. +// +// Solidity: function initializeClient(string clientId, bytes protoClientState, bytes protoConsensusState) returns((uint64,uint64) height) +func (_Ibft2client *Ibft2clientSession) InitializeClient(clientId string, protoClientState []byte, protoConsensusState []byte) (*types.Transaction, error) { + return _Ibft2client.Contract.InitializeClient(&_Ibft2client.TransactOpts, clientId, protoClientState, protoConsensusState) +} + +// InitializeClient is a paid mutator transaction binding the contract method 0xfe66819f. +// +// Solidity: function initializeClient(string clientId, bytes protoClientState, bytes protoConsensusState) returns((uint64,uint64) height) +func (_Ibft2client *Ibft2clientTransactorSession) InitializeClient(clientId string, protoClientState []byte, protoConsensusState []byte) (*types.Transaction, error) { + return _Ibft2client.Contract.InitializeClient(&_Ibft2client.TransactOpts, clientId, protoClientState, protoConsensusState) +} + +// UpdateClient is a paid mutator transaction binding the contract method 0xa4f1ec28. +// +// Solidity: function updateClient(string clientId, (bytes,bytes[],(uint64,uint64),bytes) header) returns((uint64,uint64)[] heights) +func (_Ibft2client *Ibft2clientTransactor) UpdateClient(opts *bind.TransactOpts, clientId string, header IbcLightclientsIbft2V1HeaderData) (*types.Transaction, error) { + return _Ibft2client.contract.Transact(opts, "updateClient", clientId, header) +} + +// UpdateClient is a paid mutator transaction binding the contract method 0xa4f1ec28. +// +// Solidity: function updateClient(string clientId, (bytes,bytes[],(uint64,uint64),bytes) header) returns((uint64,uint64)[] heights) +func (_Ibft2client *Ibft2clientSession) UpdateClient(clientId string, header IbcLightclientsIbft2V1HeaderData) (*types.Transaction, error) { + return _Ibft2client.Contract.UpdateClient(&_Ibft2client.TransactOpts, clientId, header) +} + +// UpdateClient is a paid mutator transaction binding the contract method 0xa4f1ec28. +// +// Solidity: function updateClient(string clientId, (bytes,bytes[],(uint64,uint64),bytes) header) returns((uint64,uint64)[] heights) +func (_Ibft2client *Ibft2clientTransactorSession) UpdateClient(clientId string, header IbcLightclientsIbft2V1HeaderData) (*types.Transaction, error) { + return _Ibft2client.Contract.UpdateClient(&_Ibft2client.TransactOpts, clientId, header) +} diff --git a/pkg/contract/ics20bank/ics20bank.go b/pkg/contract/ics20bank/ics20bank.go index 5c530a99..3487b912 100644 --- a/pkg/contract/ics20bank/ics20bank.go +++ b/pkg/contract/ics20bank/ics20bank.go @@ -31,7 +31,7 @@ var ( // Ics20bankMetaData contains all meta data concerning the Ics20bank contract. var Ics20bankMetaData = &bind.MetaData{ - ABI: "[{\"type\":\"constructor\",\"inputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"ADMIN_ROLE\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"DEFAULT_ADMIN_ROLE\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"OPERATOR_ROLE\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"addressToDenom\",\"inputs\":[{\"name\":\"tokenContract\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"balanceOf\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"denom\",\"type\":\"string\",\"internalType\":\"string\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"burn\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"denom\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"deposit\",\"inputs\":[{\"name\":\"tokenContract\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"receiver\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"getRoleAdmin\",\"inputs\":[{\"name\":\"role\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"grantRole\",\"inputs\":[{\"name\":\"role\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"account\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"hasRole\",\"inputs\":[{\"name\":\"role\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"account\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"mint\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"denom\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"renounceRole\",\"inputs\":[{\"name\":\"role\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"account\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"revokeRole\",\"inputs\":[{\"name\":\"role\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"account\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setOperator\",\"inputs\":[{\"name\":\"operator\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"supportsInterface\",\"inputs\":[{\"name\":\"interfaceId\",\"type\":\"bytes4\",\"internalType\":\"bytes4\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"transferFrom\",\"inputs\":[{\"name\":\"from\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"to\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"denom\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"withdraw\",\"inputs\":[{\"name\":\"tokenContract\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"receiver\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"event\",\"name\":\"RoleAdminChanged\",\"inputs\":[{\"name\":\"role\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"previousAdminRole\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"newAdminRole\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"RoleGranted\",\"inputs\":[{\"name\":\"role\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"account\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"sender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"RoleRevoked\",\"inputs\":[{\"name\":\"role\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"account\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"sender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false}]", + ABI: "[{\"type\":\"constructor\",\"inputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"ADMIN_ROLE\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"DEFAULT_ADMIN_ROLE\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"OPERATOR_ROLE\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"addressToDenom\",\"inputs\":[{\"name\":\"tokenContract\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"balanceOf\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"denom\",\"type\":\"string\",\"internalType\":\"string\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"burn\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"denom\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"deposit\",\"inputs\":[{\"name\":\"tokenContract\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"receiver\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"getRoleAdmin\",\"inputs\":[{\"name\":\"role\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"grantRole\",\"inputs\":[{\"name\":\"role\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"account\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"hasRole\",\"inputs\":[{\"name\":\"role\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"account\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"mint\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"denom\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"renounceRole\",\"inputs\":[{\"name\":\"role\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"callerConfirmation\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"revokeRole\",\"inputs\":[{\"name\":\"role\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"account\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setOperator\",\"inputs\":[{\"name\":\"operator\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"supportsInterface\",\"inputs\":[{\"name\":\"interfaceId\",\"type\":\"bytes4\",\"internalType\":\"bytes4\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"transferFrom\",\"inputs\":[{\"name\":\"from\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"to\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"denom\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"withdraw\",\"inputs\":[{\"name\":\"tokenContract\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"receiver\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"event\",\"name\":\"RoleAdminChanged\",\"inputs\":[{\"name\":\"role\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"previousAdminRole\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"newAdminRole\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"RoleGranted\",\"inputs\":[{\"name\":\"role\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"account\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"sender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"RoleRevoked\",\"inputs\":[{\"name\":\"role\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"account\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"sender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"AccessControlBadConfirmation\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"AccessControlUnauthorizedAccount\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"neededRole\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"type\":\"error\",\"name\":\"ICS20BankNotAdminRole\",\"inputs\":[{\"name\":\"sender\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"ICS20BankNotBurnRole\",\"inputs\":[{\"name\":\"sender\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"ICS20BankNotMintRole\",\"inputs\":[{\"name\":\"sender\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"ICS20BytesSliceOutOfBounds\",\"inputs\":[{\"name\":\"length\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"start\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"end\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"ICS20BytesSliceOverflow\",\"inputs\":[{\"name\":\"length\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"ICS20EscrowAddressNotFound\",\"inputs\":[{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"type\":\"error\",\"name\":\"ICS20FailedERC20Transfer\",\"inputs\":[{\"name\":\"tokenContract\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"from\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"to\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"ICS20FailedERC20TransferFrom\",\"inputs\":[{\"name\":\"tokenContract\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"sender\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"from\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"to\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"ICS20InsufficientBalance\",\"inputs\":[{\"name\":\"sender\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"balance\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"needed\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"ICS20InvalidReceiver\",\"inputs\":[{\"name\":\"receiver\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"ICS20InvalidReceiverAddress\",\"inputs\":[{\"name\":\"receiver\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"type\":\"error\",\"name\":\"ICS20InvalidSender\",\"inputs\":[{\"name\":\"sender\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"ICS20InvalidSenderAddress\",\"inputs\":[{\"name\":\"sender\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"type\":\"error\",\"name\":\"ICS20InvalidTokenContract\",\"inputs\":[{\"name\":\"tokenContract\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"ICS20JSONClosingBraceNotFound\",\"inputs\":[{\"name\":\"position\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"actual\",\"type\":\"bytes1\",\"internalType\":\"bytes1\"}]},{\"type\":\"error\",\"name\":\"ICS20JSONInvalidEscape\",\"inputs\":[{\"name\":\"position\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"actual\",\"type\":\"bytes1\",\"internalType\":\"bytes1\"}]},{\"type\":\"error\",\"name\":\"ICS20JSONStringClosingDoubleQuoteNotFound\",\"inputs\":[{\"name\":\"position\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"actual\",\"type\":\"bytes1\",\"internalType\":\"bytes1\"}]},{\"type\":\"error\",\"name\":\"ICS20JSONStringUnclosed\",\"inputs\":[{\"name\":\"bz\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"position\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"ICS20JSONUnexpectedBytes\",\"inputs\":[{\"name\":\"position\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"expected\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"actual\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"type\":\"error\",\"name\":\"ICS20UnexpectedVersion\",\"inputs\":[{\"name\":\"version\",\"type\":\"string\",\"internalType\":\"string\"}]}]", } // Ics20bankABI is the input ABI used to generate the binding from. @@ -514,23 +514,23 @@ func (_Ics20bank *Ics20bankTransactorSession) Mint(account common.Address, denom // RenounceRole is a paid mutator transaction binding the contract method 0x36568abe. // -// Solidity: function renounceRole(bytes32 role, address account) returns() -func (_Ics20bank *Ics20bankTransactor) RenounceRole(opts *bind.TransactOpts, role [32]byte, account common.Address) (*types.Transaction, error) { - return _Ics20bank.contract.Transact(opts, "renounceRole", role, account) +// Solidity: function renounceRole(bytes32 role, address callerConfirmation) returns() +func (_Ics20bank *Ics20bankTransactor) RenounceRole(opts *bind.TransactOpts, role [32]byte, callerConfirmation common.Address) (*types.Transaction, error) { + return _Ics20bank.contract.Transact(opts, "renounceRole", role, callerConfirmation) } // RenounceRole is a paid mutator transaction binding the contract method 0x36568abe. // -// Solidity: function renounceRole(bytes32 role, address account) returns() -func (_Ics20bank *Ics20bankSession) RenounceRole(role [32]byte, account common.Address) (*types.Transaction, error) { - return _Ics20bank.Contract.RenounceRole(&_Ics20bank.TransactOpts, role, account) +// Solidity: function renounceRole(bytes32 role, address callerConfirmation) returns() +func (_Ics20bank *Ics20bankSession) RenounceRole(role [32]byte, callerConfirmation common.Address) (*types.Transaction, error) { + return _Ics20bank.Contract.RenounceRole(&_Ics20bank.TransactOpts, role, callerConfirmation) } // RenounceRole is a paid mutator transaction binding the contract method 0x36568abe. // -// Solidity: function renounceRole(bytes32 role, address account) returns() -func (_Ics20bank *Ics20bankTransactorSession) RenounceRole(role [32]byte, account common.Address) (*types.Transaction, error) { - return _Ics20bank.Contract.RenounceRole(&_Ics20bank.TransactOpts, role, account) +// Solidity: function renounceRole(bytes32 role, address callerConfirmation) returns() +func (_Ics20bank *Ics20bankTransactorSession) RenounceRole(role [32]byte, callerConfirmation common.Address) (*types.Transaction, error) { + return _Ics20bank.Contract.RenounceRole(&_Ics20bank.TransactOpts, role, callerConfirmation) } // RevokeRole is a paid mutator transaction binding the contract method 0xd547741f. diff --git a/pkg/contract/ics20transferbank/ics20transferbank.go b/pkg/contract/ics20transferbank/ics20transferbank.go index 334b46c7..0b16a6c3 100644 --- a/pkg/contract/ics20transferbank/ics20transferbank.go +++ b/pkg/contract/ics20transferbank/ics20transferbank.go @@ -100,7 +100,7 @@ type PacketData struct { // Ics20transferbankMetaData contains all meta data concerning the Ics20transferbank contract. var Ics20transferbankMetaData = &bind.MetaData{ - ABI: "[{\"type\":\"constructor\",\"inputs\":[{\"name\":\"ibcHandler_\",\"type\":\"address\",\"internalType\":\"contractIIBCHandler\"},{\"name\":\"bank_\",\"type\":\"address\",\"internalType\":\"contractIICS20Bank\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"ICS20_VERSION\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"ibcAddress\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"onAcknowledgementPacket\",\"inputs\":[{\"name\":\"packet\",\"type\":\"tuple\",\"internalType\":\"structPacket.Data\",\"components\":[{\"name\":\"sequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"source_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"source_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"timeout_height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"timeout_timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"acknowledgement\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"onChanCloseConfirm\",\"inputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structIIBCModule.MsgOnChanCloseConfirm\",\"components\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"onChanCloseInit\",\"inputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structIIBCModule.MsgOnChanCloseInit\",\"components\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"onChanOpenAck\",\"inputs\":[{\"name\":\"msg_\",\"type\":\"tuple\",\"internalType\":\"structIIBCModule.MsgOnChanOpenAck\",\"components\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"counterpartyVersion\",\"type\":\"string\",\"internalType\":\"string\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"onChanOpenConfirm\",\"inputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structIIBCModule.MsgOnChanOpenConfirm\",\"components\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"onChanOpenInit\",\"inputs\":[{\"name\":\"msg_\",\"type\":\"tuple\",\"internalType\":\"structIIBCModule.MsgOnChanOpenInit\",\"components\":[{\"name\":\"order\",\"type\":\"uint8\",\"internalType\":\"enumChannel.Order\"},{\"name\":\"connectionHops\",\"type\":\"string[]\",\"internalType\":\"string[]\"},{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"counterparty\",\"type\":\"tuple\",\"internalType\":\"structChannelCounterparty.Data\",\"components\":[{\"name\":\"port_id\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channel_id\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"name\":\"version\",\"type\":\"string\",\"internalType\":\"string\"}]}],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"onChanOpenTry\",\"inputs\":[{\"name\":\"msg_\",\"type\":\"tuple\",\"internalType\":\"structIIBCModule.MsgOnChanOpenTry\",\"components\":[{\"name\":\"order\",\"type\":\"uint8\",\"internalType\":\"enumChannel.Order\"},{\"name\":\"connectionHops\",\"type\":\"string[]\",\"internalType\":\"string[]\"},{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"counterparty\",\"type\":\"tuple\",\"internalType\":\"structChannelCounterparty.Data\",\"components\":[{\"name\":\"port_id\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channel_id\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"name\":\"counterpartyVersion\",\"type\":\"string\",\"internalType\":\"string\"}]}],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"onRecvPacket\",\"inputs\":[{\"name\":\"packet\",\"type\":\"tuple\",\"internalType\":\"structPacket.Data\",\"components\":[{\"name\":\"sequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"source_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"source_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"timeout_height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"timeout_timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"acknowledgement\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"onTimeoutPacket\",\"inputs\":[{\"name\":\"packet\",\"type\":\"tuple\",\"internalType\":\"structPacket.Data\",\"components\":[{\"name\":\"sequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"source_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"source_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"timeout_height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"timeout_timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"sendTransfer\",\"inputs\":[{\"name\":\"denom\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"receiver\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"sourcePort\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"sourceChannel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"timeoutHeight\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"}]", + ABI: "[{\"type\":\"constructor\",\"inputs\":[{\"name\":\"ibcHandler_\",\"type\":\"address\",\"internalType\":\"contractIIBCHandler\"},{\"name\":\"bank_\",\"type\":\"address\",\"internalType\":\"contractIICS20Bank\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"ICS20_VERSION\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"ibcAddress\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"onAcknowledgementPacket\",\"inputs\":[{\"name\":\"packet\",\"type\":\"tuple\",\"internalType\":\"structPacket.Data\",\"components\":[{\"name\":\"sequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"source_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"source_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"timeout_height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"timeout_timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"acknowledgement\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"onChanCloseConfirm\",\"inputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structIIBCModule.MsgOnChanCloseConfirm\",\"components\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"onChanCloseInit\",\"inputs\":[{\"name\":\"msg_\",\"type\":\"tuple\",\"internalType\":\"structIIBCModule.MsgOnChanCloseInit\",\"components\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"onChanOpenAck\",\"inputs\":[{\"name\":\"msg_\",\"type\":\"tuple\",\"internalType\":\"structIIBCModule.MsgOnChanOpenAck\",\"components\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"counterpartyVersion\",\"type\":\"string\",\"internalType\":\"string\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"onChanOpenConfirm\",\"inputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structIIBCModule.MsgOnChanOpenConfirm\",\"components\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"onChanOpenInit\",\"inputs\":[{\"name\":\"msg_\",\"type\":\"tuple\",\"internalType\":\"structIIBCModule.MsgOnChanOpenInit\",\"components\":[{\"name\":\"order\",\"type\":\"uint8\",\"internalType\":\"enumChannel.Order\"},{\"name\":\"connectionHops\",\"type\":\"string[]\",\"internalType\":\"string[]\"},{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"counterparty\",\"type\":\"tuple\",\"internalType\":\"structChannelCounterparty.Data\",\"components\":[{\"name\":\"port_id\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channel_id\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"name\":\"version\",\"type\":\"string\",\"internalType\":\"string\"}]}],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"onChanOpenTry\",\"inputs\":[{\"name\":\"msg_\",\"type\":\"tuple\",\"internalType\":\"structIIBCModule.MsgOnChanOpenTry\",\"components\":[{\"name\":\"order\",\"type\":\"uint8\",\"internalType\":\"enumChannel.Order\"},{\"name\":\"connectionHops\",\"type\":\"string[]\",\"internalType\":\"string[]\"},{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"counterparty\",\"type\":\"tuple\",\"internalType\":\"structChannelCounterparty.Data\",\"components\":[{\"name\":\"port_id\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channel_id\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"name\":\"counterpartyVersion\",\"type\":\"string\",\"internalType\":\"string\"}]}],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"onRecvPacket\",\"inputs\":[{\"name\":\"packet\",\"type\":\"tuple\",\"internalType\":\"structPacket.Data\",\"components\":[{\"name\":\"sequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"source_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"source_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"timeout_height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"timeout_timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"acknowledgement\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"onTimeoutPacket\",\"inputs\":[{\"name\":\"packet\",\"type\":\"tuple\",\"internalType\":\"structPacket.Data\",\"components\":[{\"name\":\"sequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"source_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"source_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_port\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"destination_channel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"timeout_height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"timeout_timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"sendTransfer\",\"inputs\":[{\"name\":\"denom\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"receiver\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"sourcePort\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"sourceChannel\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"timeoutHeight\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"error\",\"name\":\"IBCModuleChannelCloseNotAllowed\",\"inputs\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"type\":\"error\",\"name\":\"IBCModuleChannelOrderNotAllowed\",\"inputs\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"order\",\"type\":\"uint8\",\"internalType\":\"enumChannel.Order\"}]},{\"type\":\"error\",\"name\":\"IBCModuleInvalidSender\",\"inputs\":[{\"name\":\"sender\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"ICS20BankNotAdminRole\",\"inputs\":[{\"name\":\"sender\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"ICS20BankNotBurnRole\",\"inputs\":[{\"name\":\"sender\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"ICS20BankNotMintRole\",\"inputs\":[{\"name\":\"sender\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"ICS20BytesSliceOutOfBounds\",\"inputs\":[{\"name\":\"length\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"start\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"end\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"ICS20BytesSliceOverflow\",\"inputs\":[{\"name\":\"length\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"ICS20EscrowAddressNotFound\",\"inputs\":[{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"type\":\"error\",\"name\":\"ICS20FailedERC20Transfer\",\"inputs\":[{\"name\":\"tokenContract\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"from\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"to\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"ICS20FailedERC20TransferFrom\",\"inputs\":[{\"name\":\"tokenContract\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"sender\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"from\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"to\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"ICS20InsufficientBalance\",\"inputs\":[{\"name\":\"sender\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"balance\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"needed\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"ICS20InvalidReceiver\",\"inputs\":[{\"name\":\"receiver\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"ICS20InvalidReceiverAddress\",\"inputs\":[{\"name\":\"receiver\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"type\":\"error\",\"name\":\"ICS20InvalidSender\",\"inputs\":[{\"name\":\"sender\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"ICS20InvalidSenderAddress\",\"inputs\":[{\"name\":\"sender\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"type\":\"error\",\"name\":\"ICS20InvalidTokenContract\",\"inputs\":[{\"name\":\"tokenContract\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"ICS20JSONClosingBraceNotFound\",\"inputs\":[{\"name\":\"position\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"actual\",\"type\":\"bytes1\",\"internalType\":\"bytes1\"}]},{\"type\":\"error\",\"name\":\"ICS20JSONInvalidEscape\",\"inputs\":[{\"name\":\"position\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"actual\",\"type\":\"bytes1\",\"internalType\":\"bytes1\"}]},{\"type\":\"error\",\"name\":\"ICS20JSONStringClosingDoubleQuoteNotFound\",\"inputs\":[{\"name\":\"position\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"actual\",\"type\":\"bytes1\",\"internalType\":\"bytes1\"}]},{\"type\":\"error\",\"name\":\"ICS20JSONStringUnclosed\",\"inputs\":[{\"name\":\"bz\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"position\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"ICS20JSONUnexpectedBytes\",\"inputs\":[{\"name\":\"position\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"expected\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"actual\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"type\":\"error\",\"name\":\"ICS20UnexpectedVersion\",\"inputs\":[{\"name\":\"version\",\"type\":\"string\",\"internalType\":\"string\"}]}]", } // Ics20transferbankABI is the input ABI used to generate the binding from. @@ -355,23 +355,23 @@ func (_Ics20transferbank *Ics20transferbankTransactorSession) OnChanCloseConfirm // OnChanCloseInit is a paid mutator transaction binding the contract method 0x3c7df3fb. // -// Solidity: function onChanCloseInit((string,string) ) returns() -func (_Ics20transferbank *Ics20transferbankTransactor) OnChanCloseInit(opts *bind.TransactOpts, arg0 IIBCModuleMsgOnChanCloseInit) (*types.Transaction, error) { - return _Ics20transferbank.contract.Transact(opts, "onChanCloseInit", arg0) +// Solidity: function onChanCloseInit((string,string) msg_) returns() +func (_Ics20transferbank *Ics20transferbankTransactor) OnChanCloseInit(opts *bind.TransactOpts, msg_ IIBCModuleMsgOnChanCloseInit) (*types.Transaction, error) { + return _Ics20transferbank.contract.Transact(opts, "onChanCloseInit", msg_) } // OnChanCloseInit is a paid mutator transaction binding the contract method 0x3c7df3fb. // -// Solidity: function onChanCloseInit((string,string) ) returns() -func (_Ics20transferbank *Ics20transferbankSession) OnChanCloseInit(arg0 IIBCModuleMsgOnChanCloseInit) (*types.Transaction, error) { - return _Ics20transferbank.Contract.OnChanCloseInit(&_Ics20transferbank.TransactOpts, arg0) +// Solidity: function onChanCloseInit((string,string) msg_) returns() +func (_Ics20transferbank *Ics20transferbankSession) OnChanCloseInit(msg_ IIBCModuleMsgOnChanCloseInit) (*types.Transaction, error) { + return _Ics20transferbank.Contract.OnChanCloseInit(&_Ics20transferbank.TransactOpts, msg_) } // OnChanCloseInit is a paid mutator transaction binding the contract method 0x3c7df3fb. // -// Solidity: function onChanCloseInit((string,string) ) returns() -func (_Ics20transferbank *Ics20transferbankTransactorSession) OnChanCloseInit(arg0 IIBCModuleMsgOnChanCloseInit) (*types.Transaction, error) { - return _Ics20transferbank.Contract.OnChanCloseInit(&_Ics20transferbank.TransactOpts, arg0) +// Solidity: function onChanCloseInit((string,string) msg_) returns() +func (_Ics20transferbank *Ics20transferbankTransactorSession) OnChanCloseInit(msg_ IIBCModuleMsgOnChanCloseInit) (*types.Transaction, error) { + return _Ics20transferbank.Contract.OnChanCloseInit(&_Ics20transferbank.TransactOpts, msg_) } // OnChanOpenAck is a paid mutator transaction binding the contract method 0x12f6ff6f. diff --git a/pkg/contract/mockclient/mockclient.go b/pkg/contract/mockclient/mockclient.go new file mode 100644 index 00000000..1dc4b465 --- /dev/null +++ b/pkg/contract/mockclient/mockclient.go @@ -0,0 +1,733 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package mockclient + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// HeightData is an auto generated low-level Go binding around an user-defined struct. +type HeightData struct { + RevisionNumber uint64 + RevisionHeight uint64 +} + +// IbcLightclientsMockV1HeaderData is an auto generated low-level Go binding around an user-defined struct. +type IbcLightclientsMockV1HeaderData struct { + Height HeightData + Timestamp uint64 +} + +// MockclientMetaData contains all meta data concerning the Mockclient contract. +var MockclientMetaData = &bind.MetaData{ + ABI: "[{\"type\":\"constructor\",\"inputs\":[{\"name\":\"ibcHandler_\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"getClientState\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"}],\"outputs\":[{\"name\":\"clientStateBytes\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getConsensusState\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"outputs\":[{\"name\":\"consensusStateBytes\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getLatestHeight\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"}],\"outputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getStatus\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint8\",\"internalType\":\"enumILightClient.ClientStatus\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getTimestampAtHeight\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"outputs\":[{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"initializeClient\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"protoClientState\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"protoConsensusState\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"owner\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"renounceOwnership\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"routeUpdateClient\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"protoClientMessage\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bytes4\",\"internalType\":\"bytes4\"},{\"name\":\"\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"setStatus\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"status\",\"type\":\"uint8\",\"internalType\":\"enumILightClient.ClientStatus\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"transferOwnership\",\"inputs\":[{\"name\":\"newOwner\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"updateClient\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"header\",\"type\":\"tuple\",\"internalType\":\"structIbcLightclientsMockV1Header.Data\",\"components\":[{\"name\":\"height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"outputs\":[{\"name\":\"heights\",\"type\":\"tuple[]\",\"internalType\":\"structHeight.Data[]\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"verifyMembership\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"proof\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"prefix\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"path\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"verifyNonMembership\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"proof\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"prefix\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"path\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"event\",\"name\":\"OwnershipTransferred\",\"inputs\":[{\"name\":\"previousOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"ClientStateNotFound\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"type\":\"error\",\"name\":\"ConsensusStateNotFound\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}]},{\"type\":\"error\",\"name\":\"InvalidCaller\",\"inputs\":[{\"name\":\"caller\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"InvalidClientState\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidConsensusState\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidHeader\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidPrefix\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidProof\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"NotActiveClient\",\"inputs\":[{\"name\":\"clientId\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"type\":\"error\",\"name\":\"OwnableInvalidOwner\",\"inputs\":[{\"name\":\"owner\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"OwnableUnauthorizedAccount\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"UnexpectedProtoAnyTypeURL\",\"inputs\":[{\"name\":\"url\",\"type\":\"string\",\"internalType\":\"string\"}]}]", +} + +// MockclientABI is the input ABI used to generate the binding from. +// Deprecated: Use MockclientMetaData.ABI instead. +var MockclientABI = MockclientMetaData.ABI + +// Mockclient is an auto generated Go binding around an Ethereum contract. +type Mockclient struct { + MockclientCaller // Read-only binding to the contract + MockclientTransactor // Write-only binding to the contract + MockclientFilterer // Log filterer for contract events +} + +// MockclientCaller is an auto generated read-only Go binding around an Ethereum contract. +type MockclientCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// MockclientTransactor is an auto generated write-only Go binding around an Ethereum contract. +type MockclientTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// MockclientFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type MockclientFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// MockclientSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type MockclientSession struct { + Contract *Mockclient // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// MockclientCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type MockclientCallerSession struct { + Contract *MockclientCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// MockclientTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type MockclientTransactorSession struct { + Contract *MockclientTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// MockclientRaw is an auto generated low-level Go binding around an Ethereum contract. +type MockclientRaw struct { + Contract *Mockclient // Generic contract binding to access the raw methods on +} + +// MockclientCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type MockclientCallerRaw struct { + Contract *MockclientCaller // Generic read-only contract binding to access the raw methods on +} + +// MockclientTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type MockclientTransactorRaw struct { + Contract *MockclientTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewMockclient creates a new instance of Mockclient, bound to a specific deployed contract. +func NewMockclient(address common.Address, backend bind.ContractBackend) (*Mockclient, error) { + contract, err := bindMockclient(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &Mockclient{MockclientCaller: MockclientCaller{contract: contract}, MockclientTransactor: MockclientTransactor{contract: contract}, MockclientFilterer: MockclientFilterer{contract: contract}}, nil +} + +// NewMockclientCaller creates a new read-only instance of Mockclient, bound to a specific deployed contract. +func NewMockclientCaller(address common.Address, caller bind.ContractCaller) (*MockclientCaller, error) { + contract, err := bindMockclient(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &MockclientCaller{contract: contract}, nil +} + +// NewMockclientTransactor creates a new write-only instance of Mockclient, bound to a specific deployed contract. +func NewMockclientTransactor(address common.Address, transactor bind.ContractTransactor) (*MockclientTransactor, error) { + contract, err := bindMockclient(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &MockclientTransactor{contract: contract}, nil +} + +// NewMockclientFilterer creates a new log filterer instance of Mockclient, bound to a specific deployed contract. +func NewMockclientFilterer(address common.Address, filterer bind.ContractFilterer) (*MockclientFilterer, error) { + contract, err := bindMockclient(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &MockclientFilterer{contract: contract}, nil +} + +// bindMockclient binds a generic wrapper to an already deployed contract. +func bindMockclient(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := MockclientMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Mockclient *MockclientRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Mockclient.Contract.MockclientCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Mockclient *MockclientRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Mockclient.Contract.MockclientTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Mockclient *MockclientRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Mockclient.Contract.MockclientTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Mockclient *MockclientCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Mockclient.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Mockclient *MockclientTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Mockclient.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Mockclient *MockclientTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Mockclient.Contract.contract.Transact(opts, method, params...) +} + +// GetClientState is a free data retrieval call binding the contract method 0x76c81c42. +// +// Solidity: function getClientState(string clientId) view returns(bytes clientStateBytes, bool) +func (_Mockclient *MockclientCaller) GetClientState(opts *bind.CallOpts, clientId string) ([]byte, bool, error) { + var out []interface{} + err := _Mockclient.contract.Call(opts, &out, "getClientState", clientId) + + if err != nil { + return *new([]byte), *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new([]byte)).(*[]byte) + out1 := *abi.ConvertType(out[1], new(bool)).(*bool) + + return out0, out1, err + +} + +// GetClientState is a free data retrieval call binding the contract method 0x76c81c42. +// +// Solidity: function getClientState(string clientId) view returns(bytes clientStateBytes, bool) +func (_Mockclient *MockclientSession) GetClientState(clientId string) ([]byte, bool, error) { + return _Mockclient.Contract.GetClientState(&_Mockclient.CallOpts, clientId) +} + +// GetClientState is a free data retrieval call binding the contract method 0x76c81c42. +// +// Solidity: function getClientState(string clientId) view returns(bytes clientStateBytes, bool) +func (_Mockclient *MockclientCallerSession) GetClientState(clientId string) ([]byte, bool, error) { + return _Mockclient.Contract.GetClientState(&_Mockclient.CallOpts, clientId) +} + +// GetConsensusState is a free data retrieval call binding the contract method 0x6cf44bf4. +// +// Solidity: function getConsensusState(string clientId, (uint64,uint64) height) view returns(bytes consensusStateBytes, bool) +func (_Mockclient *MockclientCaller) GetConsensusState(opts *bind.CallOpts, clientId string, height HeightData) ([]byte, bool, error) { + var out []interface{} + err := _Mockclient.contract.Call(opts, &out, "getConsensusState", clientId, height) + + if err != nil { + return *new([]byte), *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new([]byte)).(*[]byte) + out1 := *abi.ConvertType(out[1], new(bool)).(*bool) + + return out0, out1, err + +} + +// GetConsensusState is a free data retrieval call binding the contract method 0x6cf44bf4. +// +// Solidity: function getConsensusState(string clientId, (uint64,uint64) height) view returns(bytes consensusStateBytes, bool) +func (_Mockclient *MockclientSession) GetConsensusState(clientId string, height HeightData) ([]byte, bool, error) { + return _Mockclient.Contract.GetConsensusState(&_Mockclient.CallOpts, clientId, height) +} + +// GetConsensusState is a free data retrieval call binding the contract method 0x6cf44bf4. +// +// Solidity: function getConsensusState(string clientId, (uint64,uint64) height) view returns(bytes consensusStateBytes, bool) +func (_Mockclient *MockclientCallerSession) GetConsensusState(clientId string, height HeightData) ([]byte, bool, error) { + return _Mockclient.Contract.GetConsensusState(&_Mockclient.CallOpts, clientId, height) +} + +// GetLatestHeight is a free data retrieval call binding the contract method 0x329681d0. +// +// Solidity: function getLatestHeight(string clientId) view returns((uint64,uint64)) +func (_Mockclient *MockclientCaller) GetLatestHeight(opts *bind.CallOpts, clientId string) (HeightData, error) { + var out []interface{} + err := _Mockclient.contract.Call(opts, &out, "getLatestHeight", clientId) + + if err != nil { + return *new(HeightData), err + } + + out0 := *abi.ConvertType(out[0], new(HeightData)).(*HeightData) + + return out0, err + +} + +// GetLatestHeight is a free data retrieval call binding the contract method 0x329681d0. +// +// Solidity: function getLatestHeight(string clientId) view returns((uint64,uint64)) +func (_Mockclient *MockclientSession) GetLatestHeight(clientId string) (HeightData, error) { + return _Mockclient.Contract.GetLatestHeight(&_Mockclient.CallOpts, clientId) +} + +// GetLatestHeight is a free data retrieval call binding the contract method 0x329681d0. +// +// Solidity: function getLatestHeight(string clientId) view returns((uint64,uint64)) +func (_Mockclient *MockclientCallerSession) GetLatestHeight(clientId string) (HeightData, error) { + return _Mockclient.Contract.GetLatestHeight(&_Mockclient.CallOpts, clientId) +} + +// GetStatus is a free data retrieval call binding the contract method 0x22b05ed2. +// +// Solidity: function getStatus(string clientId) view returns(uint8) +func (_Mockclient *MockclientCaller) GetStatus(opts *bind.CallOpts, clientId string) (uint8, error) { + var out []interface{} + err := _Mockclient.contract.Call(opts, &out, "getStatus", clientId) + + if err != nil { + return *new(uint8), err + } + + out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) + + return out0, err + +} + +// GetStatus is a free data retrieval call binding the contract method 0x22b05ed2. +// +// Solidity: function getStatus(string clientId) view returns(uint8) +func (_Mockclient *MockclientSession) GetStatus(clientId string) (uint8, error) { + return _Mockclient.Contract.GetStatus(&_Mockclient.CallOpts, clientId) +} + +// GetStatus is a free data retrieval call binding the contract method 0x22b05ed2. +// +// Solidity: function getStatus(string clientId) view returns(uint8) +func (_Mockclient *MockclientCallerSession) GetStatus(clientId string) (uint8, error) { + return _Mockclient.Contract.GetStatus(&_Mockclient.CallOpts, clientId) +} + +// GetTimestampAtHeight is a free data retrieval call binding the contract method 0x4b0bbdc4. +// +// Solidity: function getTimestampAtHeight(string clientId, (uint64,uint64) height) view returns(uint64) +func (_Mockclient *MockclientCaller) GetTimestampAtHeight(opts *bind.CallOpts, clientId string, height HeightData) (uint64, error) { + var out []interface{} + err := _Mockclient.contract.Call(opts, &out, "getTimestampAtHeight", clientId, height) + + if err != nil { + return *new(uint64), err + } + + out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64) + + return out0, err + +} + +// GetTimestampAtHeight is a free data retrieval call binding the contract method 0x4b0bbdc4. +// +// Solidity: function getTimestampAtHeight(string clientId, (uint64,uint64) height) view returns(uint64) +func (_Mockclient *MockclientSession) GetTimestampAtHeight(clientId string, height HeightData) (uint64, error) { + return _Mockclient.Contract.GetTimestampAtHeight(&_Mockclient.CallOpts, clientId, height) +} + +// GetTimestampAtHeight is a free data retrieval call binding the contract method 0x4b0bbdc4. +// +// Solidity: function getTimestampAtHeight(string clientId, (uint64,uint64) height) view returns(uint64) +func (_Mockclient *MockclientCallerSession) GetTimestampAtHeight(clientId string, height HeightData) (uint64, error) { + return _Mockclient.Contract.GetTimestampAtHeight(&_Mockclient.CallOpts, clientId, height) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_Mockclient *MockclientCaller) Owner(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _Mockclient.contract.Call(opts, &out, "owner") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_Mockclient *MockclientSession) Owner() (common.Address, error) { + return _Mockclient.Contract.Owner(&_Mockclient.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_Mockclient *MockclientCallerSession) Owner() (common.Address, error) { + return _Mockclient.Contract.Owner(&_Mockclient.CallOpts) +} + +// RouteUpdateClient is a free data retrieval call binding the contract method 0xf13a62f9. +// +// Solidity: function routeUpdateClient(string clientId, bytes protoClientMessage) pure returns(bytes4, bytes) +func (_Mockclient *MockclientCaller) RouteUpdateClient(opts *bind.CallOpts, clientId string, protoClientMessage []byte) ([4]byte, []byte, error) { + var out []interface{} + err := _Mockclient.contract.Call(opts, &out, "routeUpdateClient", clientId, protoClientMessage) + + if err != nil { + return *new([4]byte), *new([]byte), err + } + + out0 := *abi.ConvertType(out[0], new([4]byte)).(*[4]byte) + out1 := *abi.ConvertType(out[1], new([]byte)).(*[]byte) + + return out0, out1, err + +} + +// RouteUpdateClient is a free data retrieval call binding the contract method 0xf13a62f9. +// +// Solidity: function routeUpdateClient(string clientId, bytes protoClientMessage) pure returns(bytes4, bytes) +func (_Mockclient *MockclientSession) RouteUpdateClient(clientId string, protoClientMessage []byte) ([4]byte, []byte, error) { + return _Mockclient.Contract.RouteUpdateClient(&_Mockclient.CallOpts, clientId, protoClientMessage) +} + +// RouteUpdateClient is a free data retrieval call binding the contract method 0xf13a62f9. +// +// Solidity: function routeUpdateClient(string clientId, bytes protoClientMessage) pure returns(bytes4, bytes) +func (_Mockclient *MockclientCallerSession) RouteUpdateClient(clientId string, protoClientMessage []byte) ([4]byte, []byte, error) { + return _Mockclient.Contract.RouteUpdateClient(&_Mockclient.CallOpts, clientId, protoClientMessage) +} + +// VerifyMembership is a free data retrieval call binding the contract method 0xf9bb5a51. +// +// Solidity: function verifyMembership(string clientId, (uint64,uint64) height, uint64 , uint64 , bytes proof, bytes prefix, bytes path, bytes value) view returns(bool) +func (_Mockclient *MockclientCaller) VerifyMembership(opts *bind.CallOpts, clientId string, height HeightData, arg2 uint64, arg3 uint64, proof []byte, prefix []byte, path []byte, value []byte) (bool, error) { + var out []interface{} + err := _Mockclient.contract.Call(opts, &out, "verifyMembership", clientId, height, arg2, arg3, proof, prefix, path, value) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// VerifyMembership is a free data retrieval call binding the contract method 0xf9bb5a51. +// +// Solidity: function verifyMembership(string clientId, (uint64,uint64) height, uint64 , uint64 , bytes proof, bytes prefix, bytes path, bytes value) view returns(bool) +func (_Mockclient *MockclientSession) VerifyMembership(clientId string, height HeightData, arg2 uint64, arg3 uint64, proof []byte, prefix []byte, path []byte, value []byte) (bool, error) { + return _Mockclient.Contract.VerifyMembership(&_Mockclient.CallOpts, clientId, height, arg2, arg3, proof, prefix, path, value) +} + +// VerifyMembership is a free data retrieval call binding the contract method 0xf9bb5a51. +// +// Solidity: function verifyMembership(string clientId, (uint64,uint64) height, uint64 , uint64 , bytes proof, bytes prefix, bytes path, bytes value) view returns(bool) +func (_Mockclient *MockclientCallerSession) VerifyMembership(clientId string, height HeightData, arg2 uint64, arg3 uint64, proof []byte, prefix []byte, path []byte, value []byte) (bool, error) { + return _Mockclient.Contract.VerifyMembership(&_Mockclient.CallOpts, clientId, height, arg2, arg3, proof, prefix, path, value) +} + +// VerifyNonMembership is a free data retrieval call binding the contract method 0x999fbbb3. +// +// Solidity: function verifyNonMembership(string clientId, (uint64,uint64) height, uint64 , uint64 , bytes proof, bytes prefix, bytes path) view returns(bool) +func (_Mockclient *MockclientCaller) VerifyNonMembership(opts *bind.CallOpts, clientId string, height HeightData, arg2 uint64, arg3 uint64, proof []byte, prefix []byte, path []byte) (bool, error) { + var out []interface{} + err := _Mockclient.contract.Call(opts, &out, "verifyNonMembership", clientId, height, arg2, arg3, proof, prefix, path) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// VerifyNonMembership is a free data retrieval call binding the contract method 0x999fbbb3. +// +// Solidity: function verifyNonMembership(string clientId, (uint64,uint64) height, uint64 , uint64 , bytes proof, bytes prefix, bytes path) view returns(bool) +func (_Mockclient *MockclientSession) VerifyNonMembership(clientId string, height HeightData, arg2 uint64, arg3 uint64, proof []byte, prefix []byte, path []byte) (bool, error) { + return _Mockclient.Contract.VerifyNonMembership(&_Mockclient.CallOpts, clientId, height, arg2, arg3, proof, prefix, path) +} + +// VerifyNonMembership is a free data retrieval call binding the contract method 0x999fbbb3. +// +// Solidity: function verifyNonMembership(string clientId, (uint64,uint64) height, uint64 , uint64 , bytes proof, bytes prefix, bytes path) view returns(bool) +func (_Mockclient *MockclientCallerSession) VerifyNonMembership(clientId string, height HeightData, arg2 uint64, arg3 uint64, proof []byte, prefix []byte, path []byte) (bool, error) { + return _Mockclient.Contract.VerifyNonMembership(&_Mockclient.CallOpts, clientId, height, arg2, arg3, proof, prefix, path) +} + +// InitializeClient is a paid mutator transaction binding the contract method 0xfe66819f. +// +// Solidity: function initializeClient(string clientId, bytes protoClientState, bytes protoConsensusState) returns((uint64,uint64) height) +func (_Mockclient *MockclientTransactor) InitializeClient(opts *bind.TransactOpts, clientId string, protoClientState []byte, protoConsensusState []byte) (*types.Transaction, error) { + return _Mockclient.contract.Transact(opts, "initializeClient", clientId, protoClientState, protoConsensusState) +} + +// InitializeClient is a paid mutator transaction binding the contract method 0xfe66819f. +// +// Solidity: function initializeClient(string clientId, bytes protoClientState, bytes protoConsensusState) returns((uint64,uint64) height) +func (_Mockclient *MockclientSession) InitializeClient(clientId string, protoClientState []byte, protoConsensusState []byte) (*types.Transaction, error) { + return _Mockclient.Contract.InitializeClient(&_Mockclient.TransactOpts, clientId, protoClientState, protoConsensusState) +} + +// InitializeClient is a paid mutator transaction binding the contract method 0xfe66819f. +// +// Solidity: function initializeClient(string clientId, bytes protoClientState, bytes protoConsensusState) returns((uint64,uint64) height) +func (_Mockclient *MockclientTransactorSession) InitializeClient(clientId string, protoClientState []byte, protoConsensusState []byte) (*types.Transaction, error) { + return _Mockclient.Contract.InitializeClient(&_Mockclient.TransactOpts, clientId, protoClientState, protoConsensusState) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_Mockclient *MockclientTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Mockclient.contract.Transact(opts, "renounceOwnership") +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_Mockclient *MockclientSession) RenounceOwnership() (*types.Transaction, error) { + return _Mockclient.Contract.RenounceOwnership(&_Mockclient.TransactOpts) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_Mockclient *MockclientTransactorSession) RenounceOwnership() (*types.Transaction, error) { + return _Mockclient.Contract.RenounceOwnership(&_Mockclient.TransactOpts) +} + +// SetStatus is a paid mutator transaction binding the contract method 0xdeaab7a9. +// +// Solidity: function setStatus(string clientId, uint8 status) returns() +func (_Mockclient *MockclientTransactor) SetStatus(opts *bind.TransactOpts, clientId string, status uint8) (*types.Transaction, error) { + return _Mockclient.contract.Transact(opts, "setStatus", clientId, status) +} + +// SetStatus is a paid mutator transaction binding the contract method 0xdeaab7a9. +// +// Solidity: function setStatus(string clientId, uint8 status) returns() +func (_Mockclient *MockclientSession) SetStatus(clientId string, status uint8) (*types.Transaction, error) { + return _Mockclient.Contract.SetStatus(&_Mockclient.TransactOpts, clientId, status) +} + +// SetStatus is a paid mutator transaction binding the contract method 0xdeaab7a9. +// +// Solidity: function setStatus(string clientId, uint8 status) returns() +func (_Mockclient *MockclientTransactorSession) SetStatus(clientId string, status uint8) (*types.Transaction, error) { + return _Mockclient.Contract.SetStatus(&_Mockclient.TransactOpts, clientId, status) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_Mockclient *MockclientTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { + return _Mockclient.contract.Transact(opts, "transferOwnership", newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_Mockclient *MockclientSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _Mockclient.Contract.TransferOwnership(&_Mockclient.TransactOpts, newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_Mockclient *MockclientTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _Mockclient.Contract.TransferOwnership(&_Mockclient.TransactOpts, newOwner) +} + +// UpdateClient is a paid mutator transaction binding the contract method 0x883a9998. +// +// Solidity: function updateClient(string clientId, ((uint64,uint64),uint64) header) returns((uint64,uint64)[] heights) +func (_Mockclient *MockclientTransactor) UpdateClient(opts *bind.TransactOpts, clientId string, header IbcLightclientsMockV1HeaderData) (*types.Transaction, error) { + return _Mockclient.contract.Transact(opts, "updateClient", clientId, header) +} + +// UpdateClient is a paid mutator transaction binding the contract method 0x883a9998. +// +// Solidity: function updateClient(string clientId, ((uint64,uint64),uint64) header) returns((uint64,uint64)[] heights) +func (_Mockclient *MockclientSession) UpdateClient(clientId string, header IbcLightclientsMockV1HeaderData) (*types.Transaction, error) { + return _Mockclient.Contract.UpdateClient(&_Mockclient.TransactOpts, clientId, header) +} + +// UpdateClient is a paid mutator transaction binding the contract method 0x883a9998. +// +// Solidity: function updateClient(string clientId, ((uint64,uint64),uint64) header) returns((uint64,uint64)[] heights) +func (_Mockclient *MockclientTransactorSession) UpdateClient(clientId string, header IbcLightclientsMockV1HeaderData) (*types.Transaction, error) { + return _Mockclient.Contract.UpdateClient(&_Mockclient.TransactOpts, clientId, header) +} + +// MockclientOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the Mockclient contract. +type MockclientOwnershipTransferredIterator struct { + Event *MockclientOwnershipTransferred // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *MockclientOwnershipTransferredIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(MockclientOwnershipTransferred) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(MockclientOwnershipTransferred) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *MockclientOwnershipTransferredIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *MockclientOwnershipTransferredIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// MockclientOwnershipTransferred represents a OwnershipTransferred event raised by the Mockclient contract. +type MockclientOwnershipTransferred struct { + PreviousOwner common.Address + NewOwner common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_Mockclient *MockclientFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*MockclientOwnershipTransferredIterator, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _Mockclient.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return &MockclientOwnershipTransferredIterator{contract: _Mockclient.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil +} + +// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_Mockclient *MockclientFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *MockclientOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _Mockclient.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(MockclientOwnershipTransferred) + if err := _Mockclient.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_Mockclient *MockclientFilterer) ParseOwnershipTransferred(log types.Log) (*MockclientOwnershipTransferred, error) { + event := new(MockclientOwnershipTransferred) + if err := _Mockclient.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/pkg/testing/chains.go b/pkg/testing/chains.go index d25606ae..79d1e0a1 100644 --- a/pkg/testing/chains.go +++ b/pkg/testing/chains.go @@ -31,8 +31,10 @@ import ( ibccommitment "github.com/hyperledger-labs/yui-ibc-solidity/pkg/contract/ibccommitmenttesthelper" "github.com/hyperledger-labs/yui-ibc-solidity/pkg/contract/ibchandler" "github.com/hyperledger-labs/yui-ibc-solidity/pkg/contract/ibcmockapp" + "github.com/hyperledger-labs/yui-ibc-solidity/pkg/contract/ibft2client" "github.com/hyperledger-labs/yui-ibc-solidity/pkg/contract/ics20bank" "github.com/hyperledger-labs/yui-ibc-solidity/pkg/contract/ics20transferbank" + "github.com/hyperledger-labs/yui-ibc-solidity/pkg/contract/mockclient" ibft2clienttypes "github.com/hyperledger-labs/yui-ibc-solidity/pkg/ibc/clients/ibft2" mockclienttypes "github.com/hyperledger-labs/yui-ibc-solidity/pkg/ibc/clients/mock" channeltypes "github.com/hyperledger-labs/yui-ibc-solidity/pkg/ibc/core/channel" @@ -66,6 +68,9 @@ var ( abiGeneratedChannelIdentifier abi.Event ) +// IBCErrorsRepository is a repository of custom errors defined in the ibc-solidity contracts. +var IBCErrorsRepository client.ErrorsRepository + func init() { var err error abiIBCHandler, err = abi.JSON(strings.NewReader(ibchandler.IbchandlerABI)) @@ -77,6 +82,26 @@ func init() { abiGeneratedClientIdentifier = abiIBCHandler.Events["GeneratedClientIdentifier"] abiGeneratedConnectionIdentifier = abiIBCHandler.Events["GeneratedConnectionIdentifier"] abiGeneratedChannelIdentifier = abiIBCHandler.Events["GeneratedChannelIdentifier"] + + abiICS20Bank, err := abi.JSON(strings.NewReader(ics20bank.Ics20bankABI)) + if err != nil { + panic(err) + } + abiICS20TransferBank, err := abi.JSON(strings.NewReader(ics20transferbank.Ics20transferbankABI)) + if err != nil { + panic(err) + } + abiMockClient, err := abi.JSON(strings.NewReader(mockclient.MockclientABI)) + abiIBFT2Client, err := abi.JSON(strings.NewReader(ibft2client.Ibft2clientABI)) + if err != nil { + panic(err) + } + IBCErrorsRepository = client.NewErrorsRepository() + addErrorsToRepository(abiIBCHandler.Errors, IBCErrorsRepository) + addErrorsToRepository(abiICS20Bank.Errors, IBCErrorsRepository) + addErrorsToRepository(abiICS20TransferBank.Errors, IBCErrorsRepository) + addErrorsToRepository(abiIBFT2Client.Errors, IBCErrorsRepository) + addErrorsToRepository(abiMockClient.Errors, IBCErrorsRepository) } type Chain struct { @@ -1452,3 +1477,11 @@ func makeGenTxOpts(chainID *big.Int, prv *ecdsa.PrivateKey) func(ctx context.Con } } } + +func addErrorsToRepository(errors map[string]abi.Error, repository client.ErrorsRepository) { + for _, e := range errors { + if err := repository.Add(e); err != nil { + panic(err) + } + } +} diff --git a/scripts/abigen.sh b/scripts/abigen.sh index 1bc78f74..337326fe 100755 --- a/scripts/abigen.sh +++ b/scripts/abigen.sh @@ -21,10 +21,12 @@ function gen_code() { function main() { local srcs=( - "IIBCHandler ibchandler" + "IBCHandler" "ERC20" "ICS20TransferBank" "ICS20Bank" + "IBFT2Client" + "MockClient" "IBCMockApp" "IBCCommitmentTestHelper" ) diff --git a/tests/e2e/chains_test.go b/tests/e2e/chains_test.go index 239fb954..e49e2799 100644 --- a/tests/e2e/chains_test.go +++ b/tests/e2e/chains_test.go @@ -39,9 +39,9 @@ func (suite *ChainTestSuite) SetupTest() {} func (suite *ChainTestSuite) TestICS20() { ctx := context.Background() - ethClA, err := client.NewETHClient("http://127.0.0.1:8645") + ethClA, err := client.NewETHClient("http://127.0.0.1:8645", ibctesting.IBCErrorsRepository) suite.Require().NoError(err) - ethClB, err := client.NewETHClient("http://127.0.0.1:8745") + ethClB, err := client.NewETHClient("http://127.0.0.1:8745", ibctesting.IBCErrorsRepository) suite.Require().NoError(err) chainA := ibctesting.NewChain(suite.T(), ethClA, ibctesting.NewLightClient(ethClA, clienttypes.BesuIBFT2Client), true) @@ -182,9 +182,9 @@ func (suite *ChainTestSuite) TestICS20() { func (suite *ChainTestSuite) TestTimeoutAndClose() { ctx := context.Background() - ethClA, err := client.NewETHClient("http://127.0.0.1:8645") + ethClA, err := client.NewETHClient("http://127.0.0.1:8645", ibctesting.IBCErrorsRepository) suite.Require().NoError(err) - ethClB, err := client.NewETHClient("http://127.0.0.1:8745") + ethClB, err := client.NewETHClient("http://127.0.0.1:8745", ibctesting.IBCErrorsRepository) suite.Require().NoError(err) chainA := ibctesting.NewChain(suite.T(), ethClA, ibctesting.NewLightClient(ethClA, clienttypes.BesuIBFT2Client), true) @@ -302,9 +302,9 @@ func (suite *ChainTestSuite) TestTimeoutAndClose() { func (suite *ChainTestSuite) TestPacketRelayWithDelay() { ctx := context.Background() - ethClA, err := client.NewETHClient("http://127.0.0.1:8645") + ethClA, err := client.NewETHClient("http://127.0.0.1:8645", ibctesting.IBCErrorsRepository) suite.Require().NoError(err) - ethClB, err := client.NewETHClient("http://127.0.0.1:8745") + ethClB, err := client.NewETHClient("http://127.0.0.1:8745", ibctesting.IBCErrorsRepository) suite.Require().NoError(err) chainA := ibctesting.NewChain(suite.T(), ethClA, ibctesting.NewLightClient(ethClA, clienttypes.BesuIBFT2Client), true) diff --git a/tests/foundry/src/ICS02.t.sol b/tests/foundry/src/ICS02.t.sol index 36b6dfbc..eb361f81 100644 --- a/tests/foundry/src/ICS02.t.sol +++ b/tests/foundry/src/ICS02.t.sol @@ -3,6 +3,7 @@ pragma solidity ^0.8.20; import "forge-std/Test.sol"; import "../../../contracts/core/02-client/IBCClient.sol"; +import "../../../contracts/core/02-client/IIBCClientErrors.sol"; import "../../../contracts/core/03-connection/IBCConnectionSelfStateNoValidation.sol"; import "../../../contracts/core/04-channel/IBCChannelHandshake.sol"; import "../../../contracts/core/04-channel/IBCChannelPacketSendRecv.sol"; @@ -16,6 +17,7 @@ import "../../../contracts/clients/MockClient.sol"; import "./helpers/TestableIBCHandler.t.sol"; import "./helpers/IBCTestHelper.t.sol"; import "./helpers/MockClientTestHelper.t.sol"; +import {IIBCHostErrors} from "../../../contracts/core/24-host/IIBCHostErrors.sol"; contract TestICS02 is Test, MockClientTestHelper { function testRegisterClient() public { @@ -29,23 +31,25 @@ contract TestICS02 is Test, MockClientTestHelper { TestableIBCHandler handler = defaultIBCHandler(); MockClient mockClient = new MockClient(address(handler)); handler.registerClient(MOCK_CLIENT_TYPE, mockClient); - vm.expectRevert("clientType already exists"); + vm.expectRevert( + abi.encodeWithSelector(IIBCHostErrors.IBCHostClientTypeAlreadyExists.selector, MOCK_CLIENT_TYPE) + ); handler.registerClient(MOCK_CLIENT_TYPE, mockClient); } function testRegisterClientInvalidClientType() public { TestableIBCHandler handler = defaultIBCHandler(); - vm.expectRevert("invalid client address"); + vm.expectRevert(abi.encodeWithSelector(IIBCHostErrors.IBCHostInvalidLightClientAddress.selector, address(0))); handler.registerClient(MOCK_CLIENT_TYPE, ILightClient(address(0))); MockClient mockClient = new MockClient(address(handler)); - vm.expectRevert("invalid clientType"); + vm.expectRevert(abi.encodeWithSelector(IIBCHostErrors.IBCHostInvalidClientType.selector, "")); handler.registerClient("", mockClient); - vm.expectRevert("invalid clientType"); + vm.expectRevert(abi.encodeWithSelector(IIBCHostErrors.IBCHostInvalidClientType.selector, "-mock")); handler.registerClient("-mock", mockClient); - vm.expectRevert("invalid clientType"); + vm.expectRevert(abi.encodeWithSelector(IIBCHostErrors.IBCHostInvalidClientType.selector, "mock-")); handler.registerClient("mock-", mockClient); } @@ -76,13 +80,15 @@ contract TestICS02 is Test, MockClientTestHelper { { IIBCClient.MsgCreateClient memory msg_ = msgCreateMockClient(1); msg_.clientType = ""; - vm.expectRevert("unregistered client type"); + vm.expectRevert(abi.encodeWithSelector(IIBCClientErrors.IBCClientUnregisteredClientType.selector, "")); handler.createClient(msg_); } { IIBCClient.MsgCreateClient memory msg_ = msgCreateMockClient(1); msg_.clientType = "06-solomachine"; - vm.expectRevert("unregistered client type"); + vm.expectRevert( + abi.encodeWithSelector(IIBCClientErrors.IBCClientUnregisteredClientType.selector, "06-solomachine") + ); handler.createClient(msg_); } { diff --git a/tests/foundry/src/ICS04Packet.t.sol b/tests/foundry/src/ICS04Packet.t.sol index a7f3399d..8fbdaca2 100644 --- a/tests/foundry/src/ICS04Packet.t.sol +++ b/tests/foundry/src/ICS04Packet.t.sol @@ -428,7 +428,13 @@ contract TestICS04Packet is IIBCChannelPacketSendRecv.MsgPacketRecv memory msg_ = msgPacketRecv(p0, H(block.number)); vm.roll(block.number + 1); - vm.expectRevert("block height >= packet timeout height"); + vm.expectRevert( + abi.encodeWithSelector( + IIBCChannelErrors.IBCChannelTimeoutPacketHeight.selector, + block.number, + p0.timeout_height.revision_height + ) + ); counterpartyHandler.recvPacket(msg_); client.updateClient(clientId, mockClientHeader(uint64(block.number))); // timeout on source chain @@ -473,7 +479,13 @@ contract TestICS04Packet is IIBCChannelPacketSendRecv.MsgPacketRecv memory msg_ = msgPacketRecv(p0, H(block.number)); vm.warp(block.timestamp + 1); vm.roll(block.number + 1); - vm.expectRevert("block timestamp >= packet timeout timestamp"); + vm.expectRevert( + abi.encodeWithSelector( + IIBCChannelErrors.IBCChannelTimeoutPacketTimestamp.selector, + block.timestamp * 1e9, + p0.timeout_timestamp + ) + ); counterpartyHandler.recvPacket(msg_); client.updateClient(clientId, mockClientHeader(uint64(block.number))); // timeout on source chain diff --git a/tests/integration/contract_test.go b/tests/integration/contract_test.go index 189a32e9..8d80c688 100644 --- a/tests/integration/contract_test.go +++ b/tests/integration/contract_test.go @@ -40,7 +40,7 @@ type ContractTestSuite struct { } func (suite *ContractTestSuite) SetupTest() { - ethClient, err := client.NewETHClient("http://127.0.0.1:8545") + ethClient, err := client.NewETHClient("http://127.0.0.1:8545", ibctesting.IBCErrorsRepository) suite.Require().NoError(err) suite.chainA = ibctesting.NewChain(suite.T(), ethClient, ibctesting.NewLightClient(ethClient, clienttypes.MockClient), false)