diff --git a/contract/bridge_fee_oracle.sol.go b/contract/bridge_fee_oracle.sol.go index 8bdf50b7..f049f6ec 100644 --- a/contract/bridge_fee_oracle.sol.go +++ b/contract/bridge_fee_oracle.sol.go @@ -32,7 +32,7 @@ var ( // BridgeFeeOracleMetaData contains all meta data concerning the BridgeFeeOracle contract. var BridgeFeeOracleMetaData = &bind.MetaData{ ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"OWNER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"QUOTE_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"UPGRADE_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_oracle\",\"type\":\"address\"}],\"name\":\"blackOracle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"crosschainContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"defaultOracle\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getOracleList\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_crosschain\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_chainName\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"_oracle\",\"type\":\"address\"}],\"name\":\"isOnline\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"oracleStatus\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"isBlacklisted\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"isActive\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"proxiableUUID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_defaultOracle\",\"type\":\"address\"}],\"name\":\"setDefaultOracle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", - Bin: "0x60a06040523060805234801561001457600080fd5b50608051611c7f61004c6000396000818161054601528181610586015281816106260152818161066601526107070152611c7f6000f3fe60806040526004361061012a5760003560e01c806380dce169116100ab578063c4d66de81161006f578063c4d66de814610363578063d10c106114610383578063d547741f146103a3578063e58378bb146103c3578063e863f6a7146103e5578063ec331b2b1461043657600080fd5b806380dce169146102a157806391d14854146102da578063a217fddf146102fa578063b908afa81461030f578063c44014d21461034357600080fd5b80634f1ef286116100f25780634f1ef28614610204578063510c27ad1461021757806352d1902d146102395780635bca74db1461024e5780637c90c9a91461028157600080fd5b806301ffc9a71461012f578063248a9ca3146101645780632f2ff15d146101a257806336568abe146101c45780633659cfe6146101e4575b600080fd5b34801561013b57600080fd5b5061014f61014a3660046116bd565b610457565b60405190151581526020015b60405180910390f35b34801561017057600080fd5b5061019461017f3660046116e7565b600090815260c9602052604090206001015490565b60405190815260200161015b565b3480156101ae57600080fd5b506101c26101bd36600461171c565b61048e565b005b3480156101d057600080fd5b506101c26101df36600461171c565b6104b8565b3480156101f057600080fd5b506101c26101ff366004611748565b61053b565b6101c26102123660046117ef565b61061b565b34801561022357600080fd5b5061022c6106e8565b60405161015b9190611851565b34801561024557600080fd5b506101946106fa565b34801561025a57600080fd5b506101947e0caaa0e08f624de190c2474175cd13784c8c75bbdd1b63ae5fab5540967b3c81565b34801561028d57600080fd5b506101c261029c366004611748565b6107ad565b3480156102ad57600080fd5b5061012e546102c2906001600160a01b031681565b6040516001600160a01b03909116815260200161015b565b3480156102e657600080fd5b5061014f6102f536600461171c565b61087a565b34801561030657600080fd5b50610194600081565b34801561031b57600080fd5b506101947f88aa719609f728b0c5e7fb8dd3608d5c25d497efbb3b9dd64e9251ebba10150881565b34801561034f57600080fd5b506101c261035e366004611748565b6108a5565b34801561036f57600080fd5b506101c261037e366004611748565b610951565b34801561038f57600080fd5b5061014f61039e36600461189e565b610adb565b3480156103af57600080fd5b506101c26103be36600461171c565b610ce0565b3480156103cf57600080fd5b50610194600080516020611be383398151915281565b3480156103f157600080fd5b5061041f610400366004611748565b6101316020526000908152604090205460ff8082169161010090041682565b60408051921515835290151560208301520161015b565b34801561044257600080fd5b5061012d546102c2906001600160a01b031681565b60006001600160e01b03198216637965db0b60e01b148061048857506301ffc9a760e01b6001600160e01b03198316145b92915050565b600082815260c960205260409020600101546104a981610d05565b6104b38383610d0f565b505050565b6001600160a01b038116331461052d5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6105378282610d95565b5050565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156105845760405162461bcd60e51b8152600401610524906118f7565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166105cd600080516020611c03833981519152546001600160a01b031690565b6001600160a01b0316146105f35760405162461bcd60e51b815260040161052490611943565b6105fc81610dfc565b6040805160008082526020820190925261061891839190610e26565b50565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156106645760405162461bcd60e51b8152600401610524906118f7565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166106ad600080516020611c03833981519152546001600160a01b031690565b6001600160a01b0316146106d35760405162461bcd60e51b815260040161052490611943565b6106dc82610dfc565b61053782826001610e26565b60606106f561012f610f91565b905090565b6000306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461079a5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610524565b50600080516020611c0383398151915290565b600080516020611be38339815191526107c581610d05565b6107cd610fa5565b6001600160a01b0382166000908152610131602052604090205460ff16156107f457610870565b6001600160a01b03821660009081526101316020526040902054610100900460ff161561084b576001600160a01b038216600090815261013160205260409020805461ff001916905561084961012f83610fff565b505b6001600160a01b038216600090815261013160205260409020805460ff191660011790555b610537600160fb55565b600091825260c9602090815260408084206001600160a01b0393909316845291905290205460ff1690565b600080516020611be38339815191526108bd81610d05565b6108c961012f8361101b565b61092d576040805180820182526000808252600160208084019182526001600160a01b0387168352610131905292902090518154925161ffff1990931690151561ff001916176101009215159290920291909117905561092b61012f8361103d565b505b5061012e80546001600160a01b0319166001600160a01b0392909216919091179055565b600054610100900460ff16158080156109715750600054600160ff909116105b8061098b5750303b15801561098b575060005460ff166001145b6109ee5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610524565b6000805460ff191660011790558015610a11576000805461ff0019166101001790555b61012d80546001600160a01b0319166001600160a01b038416179055610a35611052565b610a3d611052565b610a4561107b565b610a50600033610d0f565b610a7a7f88aa719609f728b0c5e7fb8dd3608d5c25d497efbb3b9dd64e9251ebba10150833610d0f565b610a92600080516020611be383398151915233610d0f565b8015610537576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b60007e0caaa0e08f624de190c2474175cd13784c8c75bbdd1b63ae5fab5540967b3c610b0681610d05565b610b0e610fa5565b6001600160a01b03831660009081526101316020526040902054610100900460ff1615610b3e5760019150610ccf565b6001600160a01b0383166000908152610131602052604090205460ff1615610b695760009150610ccf565b61012d546040516333e7eceb60e11b81526001600160a01b03909116906367cfd9d690610b9c90879087906004016119e7565b602060405180830381865afa158015610bb9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bdd9190611a11565b610bea5760009150610ccf565b61012d54604051630b63ae7d60e11b81526001600160a01b03909116906316c75cfa90610c1d90879087906004016119e7565b602060405180830381865afa158015610c3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c5e9190611a11565b610c6b5760009150610ccf565b6040805180820182526000808252600160208084019182526001600160a01b0388168352610131905292902090518154925161ffff1990931690151561ff0019161761010092151592909202919091179055610cc961012f8461103d565b50600191505b610cd9600160fb55565b5092915050565b600082815260c96020526040902060010154610cfb81610d05565b6104b38383610d95565b61061881336110aa565b610d19828261087a565b61053757600082815260c9602090815260408083206001600160a01b03851684529091529020805460ff19166001179055610d513390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b610d9f828261087a565b1561053757600082815260c9602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b7f88aa719609f728b0c5e7fb8dd3608d5c25d497efbb3b9dd64e9251ebba10150861053781610d05565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615610e59576104b383611103565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015610eb3575060408051601f3d908101601f19168201909252610eb091810190611a33565b60015b610f165760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610524565b600080516020611c038339815191528114610f855760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610524565b506104b383838361119f565b60606000610f9e836111ca565b9392505050565b600260fb541415610ff85760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610524565b600260fb55565b6000610f9e836001600160a01b038416611226565b600160fb55565b6001600160a01b03811660009081526001830160205260408120541515610f9e565b6000610f9e836001600160a01b038416611319565b600054610100900460ff166110795760405162461bcd60e51b815260040161052490611a4c565b565b600054610100900460ff166110a25760405162461bcd60e51b815260040161052490611a4c565b611079611368565b6110b4828261087a565b610537576110c18161138f565b6110cc8360206113a1565b6040516020016110dd929190611a97565b60408051601f198184030181529082905262461bcd60e51b825261052491600401611b0c565b6001600160a01b0381163b6111705760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610524565b600080516020611c0383398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6111a88361153d565b6000825111806111b55750805b156104b3576111c4838361157d565b50505050565b60608160000180548060200260200160405190810160405280929190818152602001828054801561121a57602002820191906000526020600020905b815481526020019060010190808311611206575b50505050509050919050565b6000818152600183016020526040812054801561130f57600061124a600183611b35565b855490915060009061125e90600190611b35565b90508181146112c357600086600001828154811061127e5761127e611b4c565b90600052602060002001549050808760000184815481106112a1576112a1611b4c565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806112d4576112d4611b62565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610488565b6000915050610488565b600081815260018301602052604081205461136057508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610488565b506000610488565b600054610100900460ff166110145760405162461bcd60e51b815260040161052490611a4c565b60606104886001600160a01b03831660145b606060006113b0836002611b78565b6113bb906002611b97565b67ffffffffffffffff8111156113d3576113d3611763565b6040519080825280601f01601f1916602001820160405280156113fd576020820181803683370190505b509050600360fc1b8160008151811061141857611418611b4c565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061144757611447611b4c565b60200101906001600160f81b031916908160001a905350600061146b846002611b78565b611476906001611b97565b90505b60018111156114ee576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106114aa576114aa611b4c565b1a60f81b8282815181106114c0576114c0611b4c565b60200101906001600160f81b031916908160001a90535060049490941c936114e781611baf565b9050611479565b508315610f9e5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610524565b61154681611103565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060610f9e8383604051806060016040528060278152602001611c23602791396060600080856001600160a01b0316856040516115ba9190611bc6565b600060405180830381855af49150503d80600081146115f5576040519150601f19603f3d011682016040523d82523d6000602084013e6115fa565b606091505b509150915061160b86838387611615565b9695505050505050565b6060831561168157825161167a576001600160a01b0385163b61167a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610524565b508161168b565b61168b8383611693565b949350505050565b8151156116a35781518083602001fd5b8060405162461bcd60e51b81526004016105249190611b0c565b6000602082840312156116cf57600080fd5b81356001600160e01b031981168114610f9e57600080fd5b6000602082840312156116f957600080fd5b5035919050565b80356001600160a01b038116811461171757600080fd5b919050565b6000806040838503121561172f57600080fd5b8235915061173f60208401611700565b90509250929050565b60006020828403121561175a57600080fd5b610f9e82611700565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff8084111561179457611794611763565b604051601f8501601f19908116603f011681019082821181831017156117bc576117bc611763565b816040528093508581528686860111156117d557600080fd5b858560208301376000602087830101525050509392505050565b6000806040838503121561180257600080fd5b61180b83611700565b9150602083013567ffffffffffffffff81111561182757600080fd5b8301601f8101851361183857600080fd5b61184785823560208401611779565b9150509250929050565b6020808252825182820181905260009190848201906040850190845b818110156118925783516001600160a01b03168352928401929184019160010161186d565b50909695505050505050565b600080604083850312156118b157600080fd5b823567ffffffffffffffff8111156118c857600080fd5b8301601f810185136118d957600080fd5b6118e885823560208401611779565b92505061173f60208401611700565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b60005b838110156119aa578181015183820152602001611992565b838111156111c45750506000910152565b600081518084526119d381602086016020860161198f565b601f01601f19169290920160200192915050565b6040815260006119fa60408301856119bb565b905060018060a01b03831660208301529392505050565b600060208284031215611a2357600080fd5b81518015158114610f9e57600080fd5b600060208284031215611a4557600080fd5b5051919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611acf81601785016020880161198f565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351611b0081602884016020880161198f565b01602801949350505050565b602081526000610f9e60208301846119bb565b634e487b7160e01b600052601160045260246000fd5b600082821015611b4757611b47611b1f565b500390565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b6000816000190483118215151615611b9257611b92611b1f565b500290565b60008219821115611baa57611baa611b1f565b500190565b600081611bbe57611bbe611b1f565b506000190190565b60008251611bd881846020870161198f565b919091019291505056feb19546dff01e856fb3f010c267a7b1c60363cf8a4664e21cc89c26224620214e360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122018c0d1d90402a72b5b7878acf38fd5b80864638916316e4caf30dc368a20fb4864736f6c634300080a0033", + Bin: "0x60a06040523060805234801561001457600080fd5b50608051611c7f61004c6000396000818161054601528181610586015281816106260152818161066601526107070152611c7f6000f3fe60806040526004361061012a5760003560e01c806380dce169116100ab578063c4d66de81161006f578063c4d66de814610363578063d10c106114610383578063d547741f146103a3578063e58378bb146103c3578063e863f6a7146103e5578063ec331b2b1461043657600080fd5b806380dce169146102a157806391d14854146102da578063a217fddf146102fa578063b908afa81461030f578063c44014d21461034357600080fd5b80634f1ef286116100f25780634f1ef28614610204578063510c27ad1461021757806352d1902d146102395780635bca74db1461024e5780637c90c9a91461028157600080fd5b806301ffc9a71461012f578063248a9ca3146101645780632f2ff15d146101a257806336568abe146101c45780633659cfe6146101e4575b600080fd5b34801561013b57600080fd5b5061014f61014a3660046116bd565b610457565b60405190151581526020015b60405180910390f35b34801561017057600080fd5b5061019461017f3660046116e7565b600090815260c9602052604090206001015490565b60405190815260200161015b565b3480156101ae57600080fd5b506101c26101bd36600461171c565b61048e565b005b3480156101d057600080fd5b506101c26101df36600461171c565b6104b8565b3480156101f057600080fd5b506101c26101ff366004611748565b61053b565b6101c26102123660046117ef565b61061b565b34801561022357600080fd5b5061022c6106e8565b60405161015b9190611851565b34801561024557600080fd5b506101946106fa565b34801561025a57600080fd5b506101947e0caaa0e08f624de190c2474175cd13784c8c75bbdd1b63ae5fab5540967b3c81565b34801561028d57600080fd5b506101c261029c366004611748565b6107ad565b3480156102ad57600080fd5b5061012e546102c2906001600160a01b031681565b6040516001600160a01b03909116815260200161015b565b3480156102e657600080fd5b5061014f6102f536600461171c565b61087a565b34801561030657600080fd5b50610194600081565b34801561031b57600080fd5b506101947f88aa719609f728b0c5e7fb8dd3608d5c25d497efbb3b9dd64e9251ebba10150881565b34801561034f57600080fd5b506101c261035e366004611748565b6108a5565b34801561036f57600080fd5b506101c261037e366004611748565b610951565b34801561038f57600080fd5b5061014f61039e36600461189e565b610adb565b3480156103af57600080fd5b506101c26103be36600461171c565b610ce0565b3480156103cf57600080fd5b50610194600080516020611be383398151915281565b3480156103f157600080fd5b5061041f610400366004611748565b6101316020526000908152604090205460ff8082169161010090041682565b60408051921515835290151560208301520161015b565b34801561044257600080fd5b5061012d546102c2906001600160a01b031681565b60006001600160e01b03198216637965db0b60e01b148061048857506301ffc9a760e01b6001600160e01b03198316145b92915050565b600082815260c960205260409020600101546104a981610d05565b6104b38383610d0f565b505050565b6001600160a01b038116331461052d5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6105378282610d95565b5050565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156105845760405162461bcd60e51b8152600401610524906118f7565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166105cd600080516020611c03833981519152546001600160a01b031690565b6001600160a01b0316146105f35760405162461bcd60e51b815260040161052490611943565b6105fc81610dfc565b6040805160008082526020820190925261061891839190610e26565b50565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156106645760405162461bcd60e51b8152600401610524906118f7565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166106ad600080516020611c03833981519152546001600160a01b031690565b6001600160a01b0316146106d35760405162461bcd60e51b815260040161052490611943565b6106dc82610dfc565b61053782826001610e26565b60606106f561012f610f91565b905090565b6000306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461079a5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610524565b50600080516020611c0383398151915290565b600080516020611be38339815191526107c581610d05565b6107cd610fa5565b6001600160a01b0382166000908152610131602052604090205460ff16156107f457610870565b6001600160a01b03821660009081526101316020526040902054610100900460ff161561084b576001600160a01b038216600090815261013160205260409020805461ff001916905561084961012f83610fff565b505b6001600160a01b038216600090815261013160205260409020805460ff191660011790555b610537600160fb55565b600091825260c9602090815260408084206001600160a01b0393909316845291905290205460ff1690565b600080516020611be38339815191526108bd81610d05565b6108c961012f8361101b565b61092d576040805180820182526000808252600160208084019182526001600160a01b0387168352610131905292902090518154925161ffff1990931690151561ff001916176101009215159290920291909117905561092b61012f8361103d565b505b5061012e80546001600160a01b0319166001600160a01b0392909216919091179055565b600054610100900460ff16158080156109715750600054600160ff909116105b8061098b5750303b15801561098b575060005460ff166001145b6109ee5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610524565b6000805460ff191660011790558015610a11576000805461ff0019166101001790555b61012d80546001600160a01b0319166001600160a01b038416179055610a35611052565b610a3d611052565b610a4561107b565b610a50600033610d0f565b610a7a7f88aa719609f728b0c5e7fb8dd3608d5c25d497efbb3b9dd64e9251ebba10150833610d0f565b610a92600080516020611be383398151915233610d0f565b8015610537576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b60007e0caaa0e08f624de190c2474175cd13784c8c75bbdd1b63ae5fab5540967b3c610b0681610d05565b610b0e610fa5565b6001600160a01b03831660009081526101316020526040902054610100900460ff1615610b3e5760019150610ccf565b6001600160a01b0383166000908152610131602052604090205460ff1615610b695760009150610ccf565b61012d546040516333e7eceb60e11b81526001600160a01b03909116906367cfd9d690610b9c90879087906004016119e7565b602060405180830381865afa158015610bb9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bdd9190611a11565b610bea5760009150610ccf565b61012d54604051630b63ae7d60e11b81526001600160a01b03909116906316c75cfa90610c1d90879087906004016119e7565b602060405180830381865afa158015610c3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c5e9190611a11565b610c6b5760009150610ccf565b6040805180820182526000808252600160208084019182526001600160a01b0388168352610131905292902090518154925161ffff1990931690151561ff0019161761010092151592909202919091179055610cc961012f8461103d565b50600191505b610cd9600160fb55565b5092915050565b600082815260c96020526040902060010154610cfb81610d05565b6104b38383610d95565b61061881336110aa565b610d19828261087a565b61053757600082815260c9602090815260408083206001600160a01b03851684529091529020805460ff19166001179055610d513390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b610d9f828261087a565b1561053757600082815260c9602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b7f88aa719609f728b0c5e7fb8dd3608d5c25d497efbb3b9dd64e9251ebba10150861053781610d05565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615610e59576104b383611103565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015610eb3575060408051601f3d908101601f19168201909252610eb091810190611a33565b60015b610f165760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610524565b600080516020611c038339815191528114610f855760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610524565b506104b383838361119f565b60606000610f9e836111ca565b9392505050565b600260fb541415610ff85760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610524565b600260fb55565b6000610f9e836001600160a01b038416611226565b600160fb55565b6001600160a01b03811660009081526001830160205260408120541515610f9e565b6000610f9e836001600160a01b038416611319565b600054610100900460ff166110795760405162461bcd60e51b815260040161052490611a4c565b565b600054610100900460ff166110a25760405162461bcd60e51b815260040161052490611a4c565b611079611368565b6110b4828261087a565b610537576110c18161138f565b6110cc8360206113a1565b6040516020016110dd929190611a97565b60408051601f198184030181529082905262461bcd60e51b825261052491600401611b0c565b6001600160a01b0381163b6111705760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610524565b600080516020611c0383398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6111a88361153d565b6000825111806111b55750805b156104b3576111c4838361157d565b50505050565b60608160000180548060200260200160405190810160405280929190818152602001828054801561121a57602002820191906000526020600020905b815481526020019060010190808311611206575b50505050509050919050565b6000818152600183016020526040812054801561130f57600061124a600183611b35565b855490915060009061125e90600190611b35565b90508181146112c357600086600001828154811061127e5761127e611b4c565b90600052602060002001549050808760000184815481106112a1576112a1611b4c565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806112d4576112d4611b62565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610488565b6000915050610488565b600081815260018301602052604081205461136057508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610488565b506000610488565b600054610100900460ff166110145760405162461bcd60e51b815260040161052490611a4c565b60606104886001600160a01b03831660145b606060006113b0836002611b78565b6113bb906002611b97565b67ffffffffffffffff8111156113d3576113d3611763565b6040519080825280601f01601f1916602001820160405280156113fd576020820181803683370190505b509050600360fc1b8160008151811061141857611418611b4c565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061144757611447611b4c565b60200101906001600160f81b031916908160001a905350600061146b846002611b78565b611476906001611b97565b90505b60018111156114ee576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106114aa576114aa611b4c565b1a60f81b8282815181106114c0576114c0611b4c565b60200101906001600160f81b031916908160001a90535060049490941c936114e781611baf565b9050611479565b508315610f9e5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610524565b61154681611103565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060610f9e8383604051806060016040528060278152602001611c23602791396060600080856001600160a01b0316856040516115ba9190611bc6565b600060405180830381855af49150503d80600081146115f5576040519150601f19603f3d011682016040523d82523d6000602084013e6115fa565b606091505b509150915061160b86838387611615565b9695505050505050565b6060831561168157825161167a576001600160a01b0385163b61167a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610524565b508161168b565b61168b8383611693565b949350505050565b8151156116a35781518083602001fd5b8060405162461bcd60e51b81526004016105249190611b0c565b6000602082840312156116cf57600080fd5b81356001600160e01b031981168114610f9e57600080fd5b6000602082840312156116f957600080fd5b5035919050565b80356001600160a01b038116811461171757600080fd5b919050565b6000806040838503121561172f57600080fd5b8235915061173f60208401611700565b90509250929050565b60006020828403121561175a57600080fd5b610f9e82611700565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff8084111561179457611794611763565b604051601f8501601f19908116603f011681019082821181831017156117bc576117bc611763565b816040528093508581528686860111156117d557600080fd5b858560208301376000602087830101525050509392505050565b6000806040838503121561180257600080fd5b61180b83611700565b9150602083013567ffffffffffffffff81111561182757600080fd5b8301601f8101851361183857600080fd5b61184785823560208401611779565b9150509250929050565b6020808252825182820181905260009190848201906040850190845b818110156118925783516001600160a01b03168352928401929184019160010161186d565b50909695505050505050565b600080604083850312156118b157600080fd5b823567ffffffffffffffff8111156118c857600080fd5b8301601f810185136118d957600080fd5b6118e885823560208401611779565b92505061173f60208401611700565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b60005b838110156119aa578181015183820152602001611992565b838111156111c45750506000910152565b600081518084526119d381602086016020860161198f565b601f01601f19169290920160200192915050565b6040815260006119fa60408301856119bb565b905060018060a01b03831660208301529392505050565b600060208284031215611a2357600080fd5b81518015158114610f9e57600080fd5b600060208284031215611a4557600080fd5b5051919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611acf81601785016020880161198f565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351611b0081602884016020880161198f565b01602801949350505050565b602081526000610f9e60208301846119bb565b634e487b7160e01b600052601160045260246000fd5b600082821015611b4757611b47611b1f565b500390565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b6000816000190483118215151615611b9257611b92611b1f565b500290565b60008219821115611baa57611baa611b1f565b500190565b600081611bbe57611bbe611b1f565b506000190190565b60008251611bd881846020870161198f565b919091019291505056feb19546dff01e856fb3f010c267a7b1c60363cf8a4664e21cc89c26224620214e360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220d13c7294882759e3dd174728107e8ea9d03fb2c90d0dab9aa8f97675a9dac6a164736f6c634300080a0033", } // BridgeFeeOracleABI is the input ABI used to generate the binding from. diff --git a/contract/icrosschain.sol.go b/contract/icrosschain.sol.go index 5bd0c558..cba23df6 100644 --- a/contract/icrosschain.sol.go +++ b/contract/icrosschain.sol.go @@ -31,7 +31,7 @@ var ( // ICrosschainMetaData contains all meta data concerning the ICrosschain contract. var ICrosschainMetaData = &bind.MetaData{ - ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_txOrigin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_eventNonce\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_dstChain\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"_tokens\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"_amounts\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_quoteId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_memo\",\"type\":\"bytes\"}],\"name\":\"BridgeCallEvent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"denom\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"receipt\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"target\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"name\":\"CrossChain\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_eventNonce\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_chain\",\"type\":\"string\"}],\"name\":\"ExecuteClaimEvent\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_dstChain\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"_refund\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"_tokens\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"_quoteId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_memo\",\"type\":\"bytes\"}],\"name\":\"bridgeCall\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_eventNonce\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_target\",\"type\":\"bytes32\"}],\"name\":\"bridgeCoinAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"_receipt\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_fee\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"_target\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"_memo\",\"type\":\"string\"}],\"name\":\"crossChain\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_chain\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"_eventNonce\",\"type\":\"uint256\"}],\"name\":\"executeClaim\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_chain\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"_externalAddress\",\"type\":\"address\"}],\"name\":\"hasOracle\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_chain\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"_externalAddress\",\"type\":\"address\"}],\"name\":\"isOracleOnline\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", + ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_txOrigin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_eventNonce\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_dstChain\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"_tokens\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"_amounts\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_quoteId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_memo\",\"type\":\"bytes\"}],\"name\":\"BridgeCallEvent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"denom\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"receipt\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"target\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"name\":\"CrossChain\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_eventNonce\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_chain\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_errReason\",\"type\":\"string\"}],\"name\":\"ExecuteClaimEvent\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_dstChain\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"_refund\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"_tokens\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"_quoteId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_memo\",\"type\":\"bytes\"}],\"name\":\"bridgeCall\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_eventNonce\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_target\",\"type\":\"bytes32\"}],\"name\":\"bridgeCoinAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"_receipt\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_fee\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"_target\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"_memo\",\"type\":\"string\"}],\"name\":\"crossChain\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_chain\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"_eventNonce\",\"type\":\"uint256\"}],\"name\":\"executeClaim\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_chain\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"_externalAddress\",\"type\":\"address\"}],\"name\":\"hasOracle\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_chain\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"_externalAddress\",\"type\":\"address\"}],\"name\":\"isOracleOnline\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", } // ICrosschainABI is the input ABI used to generate the binding from. @@ -737,12 +737,13 @@ type ICrosschainExecuteClaimEvent struct { Sender common.Address EventNonce *big.Int Chain string + ErrReason string Raw types.Log // Blockchain specific contextual infos } -// FilterExecuteClaimEvent is a free log retrieval operation binding the contract event 0xa45a8d344c26216c8d81958a3688ec20b5f2e5af820e03433537687e94667a78. +// FilterExecuteClaimEvent is a free log retrieval operation binding the contract event 0x67ddf3796d30bb96cc50ccd9d322ab53317f5c6cac5860f3137894ee70ed0053. // -// Solidity: event ExecuteClaimEvent(address indexed _sender, uint256 _eventNonce, string _chain) +// Solidity: event ExecuteClaimEvent(address indexed _sender, uint256 _eventNonce, string _chain, string _errReason) func (_ICrosschain *ICrosschainFilterer) FilterExecuteClaimEvent(opts *bind.FilterOpts, _sender []common.Address) (*ICrosschainExecuteClaimEventIterator, error) { var _senderRule []interface{} @@ -757,9 +758,9 @@ func (_ICrosschain *ICrosschainFilterer) FilterExecuteClaimEvent(opts *bind.Filt return &ICrosschainExecuteClaimEventIterator{contract: _ICrosschain.contract, event: "ExecuteClaimEvent", logs: logs, sub: sub}, nil } -// WatchExecuteClaimEvent is a free log subscription operation binding the contract event 0xa45a8d344c26216c8d81958a3688ec20b5f2e5af820e03433537687e94667a78. +// WatchExecuteClaimEvent is a free log subscription operation binding the contract event 0x67ddf3796d30bb96cc50ccd9d322ab53317f5c6cac5860f3137894ee70ed0053. // -// Solidity: event ExecuteClaimEvent(address indexed _sender, uint256 _eventNonce, string _chain) +// Solidity: event ExecuteClaimEvent(address indexed _sender, uint256 _eventNonce, string _chain, string _errReason) func (_ICrosschain *ICrosschainFilterer) WatchExecuteClaimEvent(opts *bind.WatchOpts, sink chan<- *ICrosschainExecuteClaimEvent, _sender []common.Address) (event.Subscription, error) { var _senderRule []interface{} @@ -799,9 +800,9 @@ func (_ICrosschain *ICrosschainFilterer) WatchExecuteClaimEvent(opts *bind.Watch }), nil } -// ParseExecuteClaimEvent is a log parse operation binding the contract event 0xa45a8d344c26216c8d81958a3688ec20b5f2e5af820e03433537687e94667a78. +// ParseExecuteClaimEvent is a log parse operation binding the contract event 0x67ddf3796d30bb96cc50ccd9d322ab53317f5c6cac5860f3137894ee70ed0053. // -// Solidity: event ExecuteClaimEvent(address indexed _sender, uint256 _eventNonce, string _chain) +// Solidity: event ExecuteClaimEvent(address indexed _sender, uint256 _eventNonce, string _chain, string _errReason) func (_ICrosschain *ICrosschainFilterer) ParseExecuteClaimEvent(log types.Log) (*ICrosschainExecuteClaimEvent, error) { event := new(ICrosschainExecuteClaimEvent) if err := _ICrosschain.contract.UnpackLog(event, "ExecuteClaimEvent", log); err != nil { diff --git a/precompiles/crosschain/execute_claim.go b/precompiles/crosschain/execute_claim.go index 0d3e8cdf..40764f7c 100644 --- a/precompiles/crosschain/execute_claim.go +++ b/precompiles/crosschain/execute_claim.go @@ -55,10 +55,11 @@ func (m *ExecuteClaimMethod) Run(evm *vm.EVM, contract *vm.Contract) ([]byte, er } stateDB := evm.StateDB.(evmtypes.ExtStateDB) if err = stateDB.ExecuteNativeAction(contract.Address(), nil, func(ctx sdk.Context) error { - if err = crosschainKeeper.ExecuteClaim(ctx, args.EventNonce.Uint64()); err != nil { - return err + preExecuteErr, executeErr := crosschainKeeper.ExecuteClaim(ctx, args.EventNonce.Uint64()) + if preExecuteErr != nil { + return preExecuteErr } - data, topic, err := m.NewExecuteClaimEvent(contract.Caller(), args.EventNonce, args.Chain) + data, topic, err := m.NewExecuteClaimEvent(contract.Caller(), args.EventNonce, args.Chain, executeErr) if err != nil { return err } @@ -83,8 +84,12 @@ func NewExecuteClaimABI() ExecuteClaimABI { } } -func (m ExecuteClaimABI) NewExecuteClaimEvent(sender common.Address, eventNonce *big.Int, dstChain string) (data []byte, topic []common.Hash, err error) { - return evmtypes.PackTopicData(m.Event, []common.Hash{sender.Hash()}, eventNonce, dstChain) +func (m ExecuteClaimABI) NewExecuteClaimEvent(sender common.Address, eventNonce *big.Int, dstChain string, executeErr error) (data []byte, topic []common.Hash, err error) { + errReason := "" + if executeErr != nil { + errReason = executeErr.Error() + } + return evmtypes.PackTopicData(m.Event, []common.Hash{sender.Hash()}, eventNonce, dstChain, errReason) } func (m ExecuteClaimABI) PackInput(args fxcontract.ExecuteClaimArgs) ([]byte, error) { diff --git a/precompiles/crosschain/execute_claim_test.go b/precompiles/crosschain/execute_claim_test.go index b0c0a2ba..0e21c20c 100644 --- a/precompiles/crosschain/execute_claim_test.go +++ b/precompiles/crosschain/execute_claim_test.go @@ -19,7 +19,7 @@ func TestExecuteClaimMethod_ABI(t *testing.T) { methodStr := `function executeClaim(string _chain, uint256 _eventNonce) returns(bool _result)` assert.Equal(t, methodStr, executeClaimABI.Method.String()) - eventStr := `event ExecuteClaimEvent(address indexed _sender, uint256 _eventNonce, string _chain)` + eventStr := `event ExecuteClaimEvent(address indexed _sender, uint256 _eventNonce, string _chain, string _errReason)` assert.Equal(t, eventStr, executeClaimABI.Event.String()) } diff --git a/precompiles/types/expected_keepers.go b/precompiles/types/expected_keepers.go index ee92092a..cc39d04f 100644 --- a/precompiles/types/expected_keepers.go +++ b/precompiles/types/expected_keepers.go @@ -27,7 +27,7 @@ type BankKeeper interface { } type CrosschainKeeper interface { - ExecuteClaim(ctx sdk.Context, eventNonce uint64) error + ExecuteClaim(ctx sdk.Context, eventNonce uint64) (error, error) BridgeCoinSupply(ctx context.Context, token, target string) (sdk.Coin, error) CrosschainBaseCoin(ctx sdk.Context, from sdk.AccAddress, receipt string, amount, fee sdk.Coin, fxTarget *crosschaintypes.FxTarget, memo string, originToken bool) error BridgeCallBaseCoin(ctx sdk.Context, from, refund, to common.Address, coins sdk.Coins, data, memo []byte, quoteId *big.Int, fxTarget *crosschaintypes.FxTarget, originTokenAmount sdkmath.Int) (uint64, error) diff --git a/solidity/contracts/bridge/ICrosschain.sol b/solidity/contracts/bridge/ICrosschain.sol index 95bcac72..e7adf1bb 100644 --- a/solidity/contracts/bridge/ICrosschain.sol +++ b/solidity/contracts/bridge/ICrosschain.sol @@ -66,6 +66,7 @@ interface ICrosschain is IBridgeCall { event ExecuteClaimEvent( address indexed _sender, uint256 _eventNonce, - string _chain + string _chain, + string _errReason ); } diff --git a/tests/contract/crosschain_test.sol.go b/tests/contract/crosschain_test.sol.go index d050c72d..c6473723 100644 --- a/tests/contract/crosschain_test.sol.go +++ b/tests/contract/crosschain_test.sol.go @@ -32,7 +32,7 @@ var ( // CrosschainTestMetaData contains all meta data concerning the CrosschainTest contract. var CrosschainTestMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[],\"name\":\"CROSS_CHAIN_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_target\",\"type\":\"bytes32\"}],\"name\":\"bridgeCoinAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"_receipt\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_fee\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"_target\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"_memo\",\"type\":\"string\"}],\"name\":\"crossChain\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_chain\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"_eventNonce\",\"type\":\"uint256\"}],\"name\":\"executeClaim\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_chain\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"_externalAddress\",\"type\":\"address\"}],\"name\":\"hasOracle\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_chain\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"_externalAddress\",\"type\":\"address\"}],\"name\":\"isOracleOnline\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", - Bin: "0x608060405234801561001057600080fd5b50610918806100206000396000f3fe6080604052600436106100555760003560e01c8063160d7c731461005a57806316c75cfa146100825780634ac3bdc3146100a257806367cfd9d6146100c25780638fefb765146100e2578063f735647514610110575b600080fd5b61006d610068366004610646565b61013e565b60405190151581526020015b60405180910390f35b34801561008e57600080fd5b5061006d61009d3660046106d6565b61042e565b3480156100ae57600080fd5b5061006d6100bd366004610724565b6104a0565b3480156100ce57600080fd5b5061006d6100dd3660046106d6565b6104e9565b3480156100ee57600080fd5b506101026100fd366004610769565b610513565b604051908152602001610079565b34801561011c57600080fd5b5061012661100481565b6040516001600160a01b039091168152602001610079565b60006001600160a01b03871615610270576001600160a01b0387166323b872dd333061016a888a610793565b6040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015260448201526064016020604051808303816000875af11580156101be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101e291906107b9565b506001600160a01b03871663095ea7b36110046101ff8789610793565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af115801561024a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061026e91906107b9565b505b6001600160a01b0387161561035757604051636eb1769f60e11b815230600482015261100460248201526000906001600160a01b0389169063dd62ed3e90604401602060405180830381865afa1580156102ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102f291906107db565b90506102fe8587610793565b81146103515760405162461bcd60e51b815260206004820181905260248201527f616c6c6f77616e6365206e6f7420657175616c20616d6f756e74202b2066656560448201526064015b60405180910390fd5b506103af565b6103618486610793565b34146103af5760405162461bcd60e51b815260206004820181905260248201527f6d73672e76616c7565206e6f7420657175616c20616d6f756e74202b206665656044820152606401610348565b60405163160d7c7360e01b81526110049063160d7c739034906103e0908b908b908b908b908b908b90600401610841565b60206040518083038185885af11580156103fe573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061042391906107b9565b979650505050505050565b604051630b63ae7d60e11b8152600090611004906316c75cfa906104589086908690600401610896565b602060405180830381865afa158015610475573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061049991906107b9565b9392505050565b604051634ac3bdc360e01b815260009061100490634ac3bdc3906104ca90869086906004016108c0565b6020604051808303816000875af1158015610475573d6000803e3d6000fd5b6040516333e7eceb60e11b8152600090611004906367cfd9d6906104589086908690600401610896565b604051638fefb76560e01b81526001600160a01b03831660048201526024810182905260009061100490638fefb76590604401602060405180830381865afa158015610563573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061049991906107db565b80356001600160a01b038116811461059e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126105ca57600080fd5b813567ffffffffffffffff808211156105e5576105e56105a3565b604051601f8301601f19908116603f0116810190828211818310171561060d5761060d6105a3565b8160405283815286602085880101111561062657600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060008060008060c0878903121561065f57600080fd5b61066887610587565b9550602087013567ffffffffffffffff8082111561068557600080fd5b6106918a838b016105b9565b965060408901359550606089013594506080890135935060a08901359150808211156106bc57600080fd5b506106c989828a016105b9565b9150509295509295509295565b600080604083850312156106e957600080fd5b823567ffffffffffffffff81111561070057600080fd5b61070c858286016105b9565b92505061071b60208401610587565b90509250929050565b6000806040838503121561073757600080fd5b823567ffffffffffffffff81111561074e57600080fd5b61075a858286016105b9565b95602094909401359450505050565b6000806040838503121561077c57600080fd5b61078583610587565b946020939093013593505050565b600082198211156107b457634e487b7160e01b600052601160045260246000fd5b500190565b6000602082840312156107cb57600080fd5b8151801515811461049957600080fd5b6000602082840312156107ed57600080fd5b5051919050565b6000815180845260005b8181101561081a576020818501810151868301820152016107fe565b8181111561082c576000602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b038716815260c060208201819052600090610865908301886107f4565b86604084015285606084015284608084015282810360a084015261088981856107f4565b9998505050505050505050565b6040815260006108a960408301856107f4565b905060018060a01b03831660208301529392505050565b6040815260006108d360408301856107f4565b9050826020830152939250505056fea26469706673582212202546ce31c67b5802ac49527ec09a385855f7a8251299318181352bc254259b6164736f6c634300080a0033", + Bin: "0x608060405234801561001057600080fd5b50610918806100206000396000f3fe6080604052600436106100555760003560e01c8063160d7c731461005a57806316c75cfa146100825780634ac3bdc3146100a257806367cfd9d6146100c25780638fefb765146100e2578063f735647514610110575b600080fd5b61006d610068366004610646565b61013e565b60405190151581526020015b60405180910390f35b34801561008e57600080fd5b5061006d61009d3660046106d6565b61042e565b3480156100ae57600080fd5b5061006d6100bd366004610724565b6104a0565b3480156100ce57600080fd5b5061006d6100dd3660046106d6565b6104e9565b3480156100ee57600080fd5b506101026100fd366004610769565b610513565b604051908152602001610079565b34801561011c57600080fd5b5061012661100481565b6040516001600160a01b039091168152602001610079565b60006001600160a01b03871615610270576001600160a01b0387166323b872dd333061016a888a610793565b6040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015260448201526064016020604051808303816000875af11580156101be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101e291906107b9565b506001600160a01b03871663095ea7b36110046101ff8789610793565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af115801561024a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061026e91906107b9565b505b6001600160a01b0387161561035757604051636eb1769f60e11b815230600482015261100460248201526000906001600160a01b0389169063dd62ed3e90604401602060405180830381865afa1580156102ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102f291906107db565b90506102fe8587610793565b81146103515760405162461bcd60e51b815260206004820181905260248201527f616c6c6f77616e6365206e6f7420657175616c20616d6f756e74202b2066656560448201526064015b60405180910390fd5b506103af565b6103618486610793565b34146103af5760405162461bcd60e51b815260206004820181905260248201527f6d73672e76616c7565206e6f7420657175616c20616d6f756e74202b206665656044820152606401610348565b60405163160d7c7360e01b81526110049063160d7c739034906103e0908b908b908b908b908b908b90600401610841565b60206040518083038185885af11580156103fe573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061042391906107b9565b979650505050505050565b604051630b63ae7d60e11b8152600090611004906316c75cfa906104589086908690600401610896565b602060405180830381865afa158015610475573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061049991906107b9565b9392505050565b604051634ac3bdc360e01b815260009061100490634ac3bdc3906104ca90869086906004016108c0565b6020604051808303816000875af1158015610475573d6000803e3d6000fd5b6040516333e7eceb60e11b8152600090611004906367cfd9d6906104589086908690600401610896565b604051638fefb76560e01b81526001600160a01b03831660048201526024810182905260009061100490638fefb76590604401602060405180830381865afa158015610563573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061049991906107db565b80356001600160a01b038116811461059e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126105ca57600080fd5b813567ffffffffffffffff808211156105e5576105e56105a3565b604051601f8301601f19908116603f0116810190828211818310171561060d5761060d6105a3565b8160405283815286602085880101111561062657600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060008060008060c0878903121561065f57600080fd5b61066887610587565b9550602087013567ffffffffffffffff8082111561068557600080fd5b6106918a838b016105b9565b965060408901359550606089013594506080890135935060a08901359150808211156106bc57600080fd5b506106c989828a016105b9565b9150509295509295509295565b600080604083850312156106e957600080fd5b823567ffffffffffffffff81111561070057600080fd5b61070c858286016105b9565b92505061071b60208401610587565b90509250929050565b6000806040838503121561073757600080fd5b823567ffffffffffffffff81111561074e57600080fd5b61075a858286016105b9565b95602094909401359450505050565b6000806040838503121561077c57600080fd5b61078583610587565b946020939093013593505050565b600082198211156107b457634e487b7160e01b600052601160045260246000fd5b500190565b6000602082840312156107cb57600080fd5b8151801515811461049957600080fd5b6000602082840312156107ed57600080fd5b5051919050565b6000815180845260005b8181101561081a576020818501810151868301820152016107fe565b8181111561082c576000602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b038716815260c060208201819052600090610865908301886107f4565b86604084015285606084015284608084015282810360a084015261088981856107f4565b9998505050505050505050565b6040815260006108a960408301856107f4565b905060018060a01b03831660208301529392505050565b6040815260006108d360408301856107f4565b9050826020830152939250505056fea26469706673582212202a315dbf295c32030bc27a6a6f65d5c0c82d01791eafa4fac92c4c53305e205d64736f6c634300080a0033", } // CrosschainTestABI is the input ABI used to generate the binding from. diff --git a/x/crosschain/keeper/attestation_handler.go b/x/crosschain/keeper/attestation_handler.go index 4f7f28d4..53d41667 100644 --- a/x/crosschain/keeper/attestation_handler.go +++ b/x/crosschain/keeper/attestation_handler.go @@ -27,20 +27,26 @@ func (k Keeper) AttestationHandler(ctx sdk.Context, externalClaim types.External } } -func (k Keeper) ExecuteClaim(ctx sdk.Context, eventNonce uint64) error { - externalClaim, err := k.GetPendingExecuteClaim(ctx, eventNonce) - if err != nil { - return err +func (k Keeper) ExecuteClaim(ctx sdk.Context, eventNonce uint64) (preExecuteErr, executeErr error) { + externalClaim, preExecuteErr := k.GetPendingExecuteClaim(ctx, eventNonce) + if preExecuteErr != nil { + return preExecuteErr, nil } k.DeletePendingExecuteClaim(ctx, eventNonce) + + cacheCtx, commit := ctx.CacheContext() switch claim := externalClaim.(type) { case *types.MsgSendToFxClaim: - return k.SendToFxExecuted(ctx, claim) + executeErr = k.SendToFxExecuted(cacheCtx, claim) case *types.MsgBridgeCallClaim: - return k.BridgeCallHandler(ctx, claim) + executeErr = k.BridgeCallHandler(cacheCtx, claim) case *types.MsgBridgeCallResultClaim: - return k.BridgeCallResultHandler(ctx, claim) + executeErr = k.BridgeCallResultHandler(cacheCtx, claim) default: - return sdkerrors.ErrInvalidRequest.Wrapf("invalid claim type: %s", claim.GetType()) + executeErr = sdkerrors.ErrInvalidRequest.Wrapf("invalid claim type: %s", claim.GetType()) + } + if executeErr == nil { + commit() } + return nil, executeErr } diff --git a/x/crosschain/keeper/keeper_v1_test.go b/x/crosschain/keeper/keeper_v1_test.go index 900bd405..17fd1e79 100644 --- a/x/crosschain/keeper/keeper_v1_test.go +++ b/x/crosschain/keeper/keeper_v1_test.go @@ -112,8 +112,9 @@ func (suite *KeeperTestSuite) SendClaim(externalClaim types.ExternalClaim) { err := suite.SendClaimReturnErr(externalClaim) suite.Require().NoError(err) - err = suite.Keeper().ExecuteClaim(suite.Ctx, externalClaim.GetEventNonce()) - suite.Require().NoError(err) + preErr, executeErr := suite.Keeper().ExecuteClaim(suite.Ctx, externalClaim.GetEventNonce()) + suite.Require().NoError(preErr) + suite.Require().NoError(executeErr) } func (suite *KeeperTestSuite) SendClaimReturnErr(externalClaim types.ExternalClaim) error {