diff --git a/BLSkeystore.json b/BLSkeystore.json new file mode 100644 index 00000000..908cffe2 --- /dev/null +++ b/BLSkeystore.json @@ -0,0 +1,45 @@ +{ + "public_key": [ + "8f2bc5decb56ad5f88d4c704f6ad616d5038cf1bc068419f4d7f3457a853d74048b1ba3531185d6d36d6bd6881034505", + "83126cd32592a6be5e9658805c5da32db2f5d39f2f294a230cf1689b52f8b8be2135802f6b6ca6b11765331de2bb8def", + "b9cafd2354b57acadd88992fd9dc38986ec29d8efd793acb693f0d0f6b8397cb2a9f8d66e01253579c7d38242d3760f6", + "b373f6a4dfc54e625c2796da0789cbb243e6a285329c3c075ab1a9268db45951a2d6c2a2aafd558efc8c5857bd71dbc0", + "ac0646a7851a75f2d0d8239e717ed1874ed83906eff3845cc7a29abd6064adb8a48c221c3d12624f136292b19c0d92de", + "992354e0ff65e8cb4088a72a241992bf68a192ea685f810bda7a193dc056af3be4bf1f65073cf5e906676d32f2eabe60", + "95d8bb8660a34a374a05a3b9c59609f4a6f5598bba8240b59ef61e94ed6161e00108bac0b817bcb4cf13001924d19539", + "b4c030c9c012ab39aea3117fc96203b18ffb5e979ae44f17de64e212a1a97975d419e2060294940a285778e2100ff023", + "ac1e598ae0ccbeeaafa31bc6faefa85c2ae3138699cac79169cd718f1a38445201454ec092a86f200e08a15266bdc6e9", + "af3ca3f530c61bf7e6b82db58dc6bd4c75192044128004510290289330ae1d33269ec873e0a8e890c2619cf3868c8880", + "987c6c786c2d293f4b5337344c8d29ab0264f80851d5698e597e201f7743af3f848a1ffb7c4802a73e06696d99f95e45", + "97d9423cb780f6a09e759a7327fc5e2542ddc54f9d2cd1b836abf30948f45059709510e8421df03ceccf2ef2ecc9c594", + "b71f0d38cc1d05995126fa0ba311541f0ed3c5c7df64e33c8037afa5d72a5a38a83103433b204f1512502748656cf06f", + "b800c8a040b76946ca14470e7a67c9ca76bf9868730336be57235505e1786f3417a969587be2ac7e6aad1ab21db9cff9", + "a625e9aa0681a842091d9cbc26daa9497a9d305acc36d04f2cb42e9aed90a561514f607625fbf84b23f98ce4baadadb5", + "98a7250b7492047cdb0b388e094db5dc073bba5a4bfc9ed2fc0ec68cba5cec1aad06d72a91ed03211f583f52e5e5d221", + "a8fa139e60271c25de8d5c83a4d0d15107152c193897d2307d334425c40d31104b6ee507e5eb3402419bca0625b58835", + "905024253dae51eb1836a3da59e5883f48d768bb73b4c8be76fd3a124af6ed252941653619ab1e429253fc2586c65383", + "a52c02e1279cbadb974a02404d7cece18d70a2835d004a4e7a25c9e120d794f62e76b9728a13ee84bc6567716238c59f", + "aacd7b81831bc19de3a26f013d2bba8cf5a76cf3c6acee742bace02e2a809a96f72245fb6cb54874b72d300a42b14fe3", + "8f16d65d4898459265d237328b419fad130b2cf2ee381e0a0fc3d5898e81b577a0157d0b99b92eda8891b46ff62c9ea9", + "90ddfd09c9af4d0b693a4013b7e42595ea7bb60ee7fb942a8460d63cd5f0e4c3138467b7c2a50518fa26fe9a2450dbc0", + "a2ec2a7e46bb5d99e7307c39b9ba96e0ef245e2588658b5ccb9a8c2f682a111de5775fec6e7508d19e06be40a260cc7d", + "86d0488587c7dd682988d13c7db0bf9994dd21fa886244a1ddd24aea753de38d32d0c762bd6fbeb137b1ae3118c65885", + "b3e34b6aff02bf146faf47e27d813e3c1bcf2a9a424c2ec95da39ea9dd974aeb239e47bd183ac75e8502ca6e610caf7c", + "b45752f376347597826c52202dd5a4695b7f73b4a111d9a39f8bd43220984ecd428280779befa314f4b24ce537b7448b", + "83c96f5cab6a2d0fb3c4c96c7a1bf992c776f10aa6e321157df8b07359bbfdc111587f529d3ed867b1c69a98f57fea6b", + "9107b995298a0a2becc7a1feecc6d8a0cae95d66384ef08adb9dc74023357fb5c1dac1ce9de936eb4015d276150a4933", + "aa7049b3ce18e503b8546b08ef48056780cfeb4a48e50f30d0da8a2b6261e77ed19c40bc8050df874e992072db591575", + "b28f8221b85d07f04d6037a56d96e621d4c25bf3aaff3e745231bcf102dfa34508ca92814854019487b6dcecdaa0bab0", + "a75e47260f047889767fc8cc7121440afa2b4fc372ebc1ef39f72912247ad2efa1e0dc4022d4c44ecab95032fa30df49", + "a76daaa9e8741e7d9a5970f10bc585ce42a3e5ce4e53faadf3327a3b7759223e35aeb30214c0ecf2bca46a2ea1c45855", + "a031dcf5b47643630aba6e0625c21da9e0f76388ea6bcdd33ede31f51a1d080ba322ba0c9aaa5137b18fd3c47453aec9", + "a9be92a80b0909c491cd9475001cc34ee1a766b95109cdc32c8cdfcf7135c8d0e862b8612d0ea79e74d02a09d5403993", + "b490893e8eb5f101b5178e6ff8279fe14eb78b764290095e6e595dfcc11371925dc0af4b9d4bce8e69ac83ce57984e3a", + "89ca38e186e1378b0778cb8d4f0f6d4eef4a15db97a4596a44621548090dfb893f833689b580b0f60a934fd31c271bb3", + "8b20e24ad933b9af0a55a6d34a08e10b832a10f389154dc0dec79b63a38b79ea2f0d9f4fa664b3c06b1b2437cb58236f", + "a1484f2b97137fb957daad064ca6cbe5b99549249ceb51f42e928ec091f94fed642ddffe3a9916769538decd0a9937bf", + "89abcc45efe76bec679ca35c27adbd66fb9712a278e3c8530ab25cfaf997765aee574f5c5745dbb873dbf7e961684347", + "8addebd6ef7609df215e006987040d0a643858f3a4d791beaa77177d67529160e645fac54f0d8acdcd5a088393cb6681", + "85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588" + ] +} \ No newline at end of file diff --git a/abi/bscvalidatorset.abi b/abi/bscvalidatorset.abi index c3194b70..207effaf 100644 --- a/abi/bscvalidatorset.abi +++ b/abi/bscvalidatorset.abi @@ -1,1016 +1,1451 @@ [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "batchTransfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "string", - "name": "reason", - "type": "string" - } - ], - "name": "batchTransferFailed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "reason", - "type": "bytes" - } - ], - "name": "batchTransferLowerFailed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "validator", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "deprecatedDeposit", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address payable", - "name": "validator", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "directTransfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address payable", - "name": "validator", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "directTransferFail", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "message", - "type": "string" - } - ], - "name": "failReasonWithStr", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "value", - "type": "bytes" - } - ], - "name": "paramChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "systemTransfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "channelId", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "msgBytes", - "type": "bytes" - } - ], - "name": "unexpectedPackage", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "validator", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "validatorDeposit", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "validator", - "type": "address" - } - ], - "name": "validatorEmptyJailed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "validator", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "validatorFelony", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "validator", - "type": "address" - } - ], - "name": "validatorJailed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "validator", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "validatorMisdemeanor", - "type": "event" - }, - { - "anonymous": false, - "inputs": [], - "name": "validatorSetUpdated", - "type": "event" - }, - { - "constant": true, - "inputs": [], - "name": "BIND_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CODE_OK", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CROSS_CHAIN_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "DUSTY_INCOMING", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "ERROR_FAIL_CHECK_VALIDATORS", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "ERROR_FAIL_DECODE", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "ERROR_LEN_OF_VAL_MISMATCH", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "ERROR_RELAYFEE_TOO_LARGE", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "ERROR_UNKNOWN_PACKAGE_TYPE", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "EXPIRE_TIME_SECOND_GAP", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "GOV_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "GOV_HUB_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "INCENTIVIZE_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "INIT_VALIDATORSET_BYTES", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "JAIL_MESSAGE_TYPE", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "LIGHT_CLIENT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "MAX_NUM_OF_VALIDATORS", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "PRECISION", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "RELAYERHUB_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "SLASH_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "SLASH_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "STAKING_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "SYSTEM_REWARD_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "TOKEN_HUB_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "TOKEN_MANAGER_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "TRANSFER_IN_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "TRANSFER_OUT_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "VALIDATORS_UPDATE_MESSAGE_TYPE", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "VALIDATOR_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "alreadyInit", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "bscChainID", - "outputs": [ - { - "internalType": "uint16", - "name": "", - "type": "uint16" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "currentValidatorSet", - "outputs": [ - { - "internalType": "address", - "name": "consensusAddress", - "type": "address" - }, - { - "internalType": "address payable", - "name": "feeAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "BBCFeeAddress", - "type": "address" - }, - { - "internalType": "uint64", - "name": "votingPower", - "type": "uint64" - }, - { - "internalType": "bool", - "name": "jailed", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "incoming", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "currentValidatorSetMap", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "expireTimeSecondGap", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "numOfJailed", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalInComing", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "init", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - }, - { - "internalType": "bytes", - "name": "msgBytes", - "type": "bytes" - } - ], - "name": "handleSynPackage", - "outputs": [ - { - "internalType": "bytes", - "name": "responsePayload", - "type": "bytes" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint8", - "name": "channelId", - "type": "uint8" - }, - { - "internalType": "bytes", - "name": "msgBytes", - "type": "bytes" - } - ], - "name": "handleAckPackage", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint8", - "name": "channelId", - "type": "uint8" - }, - { - "internalType": "bytes", - "name": "msgBytes", - "type": "bytes" - } - ], - "name": "handleFailAckPackage", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "valAddr", - "type": "address" - } - ], - "name": "deposit", - "outputs": [], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getValidators", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "validator", - "type": "address" - } - ], - "name": "getIncoming", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "validator", - "type": "address" - } - ], - "name": "misdemeanor", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "validator", - "type": "address" - } - ], - "name": "felony", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bytes", - "name": "value", - "type": "bytes" - } - ], - "name": "updateParam", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "batchTransfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "string", + "name": "reason", + "type": "string" + } + ], + "name": "batchTransferFailed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "reason", + "type": "bytes" + } + ], + "name": "batchTransferLowerFailed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "validator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "deprecatedDeposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "validator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "deprecatedFinalityRewardDeposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address payable", + "name": "validator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "directTransfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address payable", + "name": "validator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "directTransferFail", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "message", + "type": "string" + } + ], + "name": "failReasonWithStr", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "feeBurned", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "validator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "finalityRewardDeposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "value", + "type": "bytes" + } + ], + "name": "paramChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "systemTransfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "channelId", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "msgBytes", + "type": "bytes" + } + ], + "name": "unexpectedPackage", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "validator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "validatorDeposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "validator", + "type": "address" + } + ], + "name": "validatorEmptyJailed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "validator", + "type": "address" + } + ], + "name": "validatorEnterMaintenance", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "validator", + "type": "address" + } + ], + "name": "validatorExitMaintenance", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "validator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "validatorFelony", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "validator", + "type": "address" + } + ], + "name": "validatorJailed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "validator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "validatorMisdemeanor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "validatorSetUpdated", + "type": "event" + }, + { + "inputs": [], + "name": "BIND_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "BURN_ADDRESS", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "BURN_RATIO_SCALE", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CODE_OK", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CROSS_CHAIN_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CROSS_STAKE_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DUSTY_INCOMING", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "EPOCH", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ERROR_FAIL_CHECK_VALIDATORS", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ERROR_FAIL_DECODE", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ERROR_LEN_OF_VAL_MISMATCH", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ERROR_RELAYFEE_TOO_LARGE", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ERROR_UNKNOWN_PACKAGE_TYPE", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "EXPIRE_TIME_SECOND_GAP", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "GOV_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "GOV_HUB_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "INCENTIVIZE_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "INIT_BURN_RATIO", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "INIT_FINALITY_REWARD_RATIO", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "INIT_MAINTAIN_SLASH_SCALE", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "INIT_MAX_NUM_OF_MAINTAINING", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "INIT_NUM_OF_CABINETS", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "INIT_VALIDATORSET_BYTES", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "JAIL_MESSAGE_TYPE", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "LIGHT_CLIENT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_NUM_OF_VALIDATORS", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PRECISION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "RELAYERHUB_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SLASH_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SLASH_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STAKING_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STAKING_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SYSTEM_REWARD_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TOKEN_HUB_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TOKEN_MANAGER_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TRANSFER_IN_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TRANSFER_OUT_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "VALIDATORS_UPDATE_MESSAGE_TYPE", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "VALIDATOR_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "alreadyInit", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "bscChainID", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "burnRatio", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "burnRatioInitialized", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "canEnterMaintenance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "currentValidatorSet", + "outputs": [ + { + "internalType": "address", + "name": "consensusAddress", + "type": "address" + }, + { + "internalType": "address payable", + "name": "feeAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "BBCFeeAddress", + "type": "address" + }, + { + "internalType": "uint64", + "name": "votingPower", + "type": "uint64" + }, + { + "internalType": "bool", + "name": "jailed", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "incoming", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "currentValidatorSetMap", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "valAddr", + "type": "address" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "valAddrs", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "weights", + "type": "uint256[]" + } + ], + "name": "distributeFinalityReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "enterMaintenance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "exitMaintenance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "expireTimeSecondGap", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validator", + "type": "address" + } + ], + "name": "felony", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "finalityRewardRatio", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_validator", + "type": "address" + } + ], + "name": "getCurrentValidatorIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validator", + "type": "address" + } + ], + "name": "getIncoming", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getLivingValidators", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + }, + { + "internalType": "bytes[]", + "name": "", + "type": "bytes[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMiningValidators", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + }, + { + "internalType": "bytes[]", + "name": "", + "type": "bytes[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidators", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getWorkingValidatorCount", + "outputs": [ + { + "internalType": "uint256", + "name": "workingValidatorCount", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "channelId", + "type": "uint8" + }, + { + "internalType": "bytes", + "name": "msgBytes", + "type": "bytes" + } + ], + "name": "handleAckPackage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "channelId", + "type": "uint8" + }, + { + "internalType": "bytes", + "name": "msgBytes", + "type": "bytes" + } + ], + "name": "handleFailAckPackage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + }, + { + "internalType": "bytes", + "name": "msgBytes", + "type": "bytes" + } + ], + "name": "handleSynPackage", + "outputs": [ + { + "internalType": "bytes", + "name": "responsePayload", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "init", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validator", + "type": "address" + } + ], + "name": "isCurrentValidator", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "isWorkingValidator", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maintainSlashScale", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxNumOfCandidates", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxNumOfMaintaining", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxNumOfWorkingCandidates", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validator", + "type": "address" + } + ], + "name": "misdemeanor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "numOfCabinets", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "numOfJailed", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "numOfMaintaining", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "previousHeight", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalInComing", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "internalType": "bytes", + "name": "value", + "type": "bytes" + } + ], + "name": "updateParam", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "validatorExtraSet", + "outputs": [ + { + "internalType": "uint256", + "name": "enterMaintenanceHeight", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isMaintaining", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "voteAddress", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } ] \ No newline at end of file diff --git a/abi/crosschain.abi b/abi/crosschain.abi index e84fcd2d..d8f6c78a 100644 --- a/abi/crosschain.abi +++ b/abi/crosschain.abi @@ -1,810 +1,1166 @@ [ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint8", - "name": "channelId", - "type": "uint8" - }, - { - "indexed": true, - "internalType": "address", - "name": "contractAddr", - "type": "address" - } - ], - "name": "addChannel", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint16", - "name": "chainId", - "type": "uint16" - }, - { - "indexed": true, - "internalType": "uint64", - "name": "oracleSequence", - "type": "uint64" - }, - { - "indexed": true, - "internalType": "uint64", - "name": "packageSequence", - "type": "uint64" - }, - { - "indexed": true, - "internalType": "uint8", - "name": "channelId", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "payload", - "type": "bytes" - } - ], - "name": "crossChainPackage", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint8", - "name": "channelId", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "bool", - "name": "isEnable", - "type": "bool" - } - ], - "name": "enableOrDisableChannel", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "value", - "type": "bytes" - } - ], - "name": "paramChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "packageType", - "type": "uint8" - }, - { - "indexed": true, - "internalType": "uint64", - "name": "packageSequence", - "type": "uint64" - }, - { - "indexed": true, - "internalType": "uint8", - "name": "channelId", - "type": "uint8" - } - ], - "name": "receivedPackage", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "contractAddr", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "lowLevelData", - "type": "bytes" - } - ], - "name": "unexpectedFailureAssertionInPackageHandler", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "contractAddr", - "type": "address" - }, - { - "indexed": false, - "internalType": "string", - "name": "reason", - "type": "string" - } - ], - "name": "unexpectedRevertInPackageHandler", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint64", - "name": "packageSequence", - "type": "uint64" - }, - { - "indexed": true, - "internalType": "uint8", - "name": "channelId", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "payload", - "type": "bytes" - } - ], - "name": "unsupportedPackage", - "type": "event" - }, - { - "inputs": [], - "name": "ACK_PACKAGE", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "BIND_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "CODE_OK", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "CROSS_CHAIN_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "CROSS_CHAIN_KEY_PREFIX", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "CROSS_STAKE_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "ERROR_FAIL_DECODE", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "FAIL_ACK_PACKAGE", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "GOV_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "GOV_HUB_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "INCENTIVIZE_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "INIT_BATCH_SIZE", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "LIGHT_CLIENT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "RELAYERHUB_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "SLASH_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "SLASH_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "STAKING_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "STAKING_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "STORE_NAME", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "SYN_PACKAGE", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "SYSTEM_REWARD_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "TOKEN_HUB_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "TOKEN_MANAGER_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "TRANSFER_IN_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "TRANSFER_OUT_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "VALIDATOR_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "alreadyInit", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "batchSizeForOracle", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "bscChainID", - "outputs": [ - { - "internalType": "uint16", - "name": "", - "type": "uint16" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "name": "channelHandlerContractMap", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "name": "channelReceiveSequenceMap", - "outputs": [ - { - "internalType": "uint64", - "name": "", - "type": "uint64" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "name": "channelSendSequenceMap", - "outputs": [ - { - "internalType": "uint64", - "name": "", - "type": "uint64" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "name": "isRelayRewardFromSystemReward", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "oracleSequence", - "outputs": [ - { - "internalType": "int64", - "name": "", - "type": "int64" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "previousTxHeight", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "name": "registeredContractChannelMap", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "txCounter", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "init", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "packageType", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "relayFee", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "msgBytes", - "type": "bytes" - } - ], - "name": "encodePayload", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "payload", - "type": "bytes" - }, - { - "internalType": "bytes", - "name": "proof", - "type": "bytes" - }, - { - "internalType": "uint64", - "name": "height", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "packageSequence", - "type": "uint64" - }, - { - "internalType": "uint8", - "name": "channelId", - "type": "uint8" - } - ], - "name": "handlePackage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "channelId", - "type": "uint8" - }, - { - "internalType": "bytes", - "name": "msgBytes", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "relayFee", - "type": "uint256" - } - ], - "name": "sendSynPackage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bytes", - "name": "value", - "type": "bytes" - } - ], - "name": "updateParam", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "proposalTypeHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "proposer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "quorum", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "expiredAt", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "contentHash", + "type": "bytes32" + } + ], + "name": "ProposalSubmitted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "executor", + "type": "address" + } + ], + "name": "Reopened", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "challenger", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "packageSequence", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "channelId", + "type": "uint8" + } + ], + "name": "SuccessChallenge", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "executor", + "type": "address" + } + ], + "name": "Suspended", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint8", + "name": "channelId", + "type": "uint8" + }, + { + "indexed": true, + "internalType": "address", + "name": "contractAddr", + "type": "address" + } + ], + "name": "addChannel", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "chainId", + "type": "uint16" + }, + { + "indexed": true, + "internalType": "uint64", + "name": "oracleSequence", + "type": "uint64" + }, + { + "indexed": true, + "internalType": "uint64", + "name": "packageSequence", + "type": "uint64" + }, + { + "indexed": true, + "internalType": "uint8", + "name": "channelId", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "payload", + "type": "bytes" + } + ], + "name": "crossChainPackage", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint8", + "name": "channelId", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isEnable", + "type": "bool" + } + ], + "name": "enableOrDisableChannel", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "value", + "type": "bytes" + } + ], + "name": "paramChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "packageType", + "type": "uint8" + }, + { + "indexed": true, + "internalType": "uint64", + "name": "packageSequence", + "type": "uint64" + }, + { + "indexed": true, + "internalType": "uint8", + "name": "channelId", + "type": "uint8" + } + ], + "name": "receivedPackage", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "contractAddr", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "lowLevelData", + "type": "bytes" + } + ], + "name": "unexpectedFailureAssertionInPackageHandler", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "contractAddr", + "type": "address" + }, + { + "indexed": false, + "internalType": "string", + "name": "reason", + "type": "string" + } + ], + "name": "unexpectedRevertInPackageHandler", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint64", + "name": "packageSequence", + "type": "uint64" + }, + { + "indexed": true, + "internalType": "uint8", + "name": "channelId", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "payload", + "type": "bytes" + } + ], + "name": "unsupportedPackage", + "type": "event" + }, + { + "inputs": [], + "name": "ACK_PACKAGE", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "BIND_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CANCEL_TRANSFER_PROPOSAL", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CODE_OK", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CROSS_CHAIN_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CROSS_CHAIN_KEY_PREFIX", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CROSS_STAKE_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "EMERGENCY_PROPOSAL_EXPIRE_PERIOD", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "EMPTY_CONTENT_HASH", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ERROR_FAIL_DECODE", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "FAIL_ACK_PACKAGE", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "GOV_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "GOV_HUB_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "INCENTIVIZE_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "INIT_BATCH_SIZE", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "INIT_CANCEL_TRANSFER_QUORUM", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "INIT_REOPEN_QUORUM", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "INIT_SUSPEND_QUORUM", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "LIGHT_CLIENT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "RELAYERHUB_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "REOPEN_PROPOSAL", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SLASH_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SLASH_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STAKING_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STAKING_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STORE_NAME", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SUSPEND_PROPOSAL", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SYN_PACKAGE", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SYSTEM_REWARD_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TOKEN_HUB_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TOKEN_MANAGER_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TRANSFER_IN_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TRANSFER_OUT_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "VALIDATOR_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "alreadyInit", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "batchSizeForOracle", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "bscChainID", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenAddr", + "type": "address" + }, + { + "internalType": "address", + "name": "attacker", + "type": "address" + } + ], + "name": "cancelTransfer", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint64[4]", + "name": "params", + "type": "uint64[4]" + }, + { + "internalType": "bytes", + "name": "payload0", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "payload1", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "proof0", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "proof1", + "type": "bytes" + } + ], + "name": "challenge", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "challenged", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "name": "channelHandlerContractMap", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "name": "channelReceiveSequenceMap", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "name": "channelSendSequenceMap", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "name": "channelSyncedHeaderMap", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "emergencyProposals", + "outputs": [ + { + "internalType": "uint16", + "name": "quorum", + "type": "uint16" + }, + { + "internalType": "uint128", + "name": "expiredAt", + "type": "uint128" + }, + { + "internalType": "bytes32", + "name": "contentHash", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "packageType", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "relayFee", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "msgBytes", + "type": "bytes" + } + ], + "name": "encodePayload", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "payload", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "height", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "packageSequence", + "type": "uint64" + }, + { + "internalType": "uint8", + "name": "channelId", + "type": "uint8" + } + ], + "name": "handlePackage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "init", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "name": "isRelayRewardFromSystemReward", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "isSuspended", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "oracleSequence", + "outputs": [ + { + "internalType": "int64", + "name": "", + "type": "int64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "previousTxHeight", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "quorumMap", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "name": "registeredContractChannelMap", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "reopen", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "channelId", + "type": "uint8" + }, + { + "internalType": "bytes", + "name": "msgBytes", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "relayFee", + "type": "uint256" + } + ], + "name": "sendSynPackage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "suspend", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "txCounter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "internalType": "bytes", + "name": "value", + "type": "bytes" + } + ], + "name": "updateParam", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } ] \ No newline at end of file diff --git a/abi/govhub.abi b/abi/govhub.abi index 981fd424..cbd6ff0a 100644 --- a/abi/govhub.abi +++ b/abi/govhub.abi @@ -1,458 +1,432 @@ [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes", - "name": "message", - "type": "bytes" - } - ], - "name": "failReasonWithBytes", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "message", - "type": "string" - } - ], - "name": "failReasonWithStr", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "value", - "type": "bytes" - } - ], - "name": "paramChange", - "type": "event" - }, - { - "constant": true, - "inputs": [], - "name": "BIND_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CODE_OK", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CROSS_CHAIN_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "ERROR_FAIL_DECODE", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "ERROR_TARGET_CONTRACT_FAIL", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "ERROR_TARGET_NOT_CONTRACT", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "GOV_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "GOV_HUB_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "INCENTIVIZE_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "LIGHT_CLIENT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "PARAM_UPDATE_MESSAGE_TYPE", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "RELAYERHUB_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "SLASH_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "SLASH_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "STAKING_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "SYSTEM_REWARD_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "TOKEN_HUB_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "TOKEN_MANAGER_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "TRANSFER_IN_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "TRANSFER_OUT_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "VALIDATOR_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "alreadyInit", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "bscChainID", - "outputs": [ - { - "internalType": "uint16", - "name": "", - "type": "uint16" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - }, - { - "internalType": "bytes", - "name": "msgBytes", - "type": "bytes" - } - ], - "name": "handleSynPackage", - "outputs": [ - { - "internalType": "bytes", - "name": "responsePayload", - "type": "bytes" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - }, - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "name": "handleAckPackage", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - }, - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "name": "handleFailAckPackage", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes", + "name": "message", + "type": "bytes" + } + ], + "name": "failReasonWithBytes", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "message", + "type": "string" + } + ], + "name": "failReasonWithStr", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "value", + "type": "bytes" + } + ], + "name": "paramChange", + "type": "event" + }, + { + "inputs": [], + "name": "BIND_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CODE_OK", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CROSS_CHAIN_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CROSS_STAKE_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ERROR_FAIL_DECODE", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ERROR_TARGET_CONTRACT_FAIL", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ERROR_TARGET_NOT_CONTRACT", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "GOV_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "GOV_HUB_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "INCENTIVIZE_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "LIGHT_CLIENT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PARAM_UPDATE_MESSAGE_TYPE", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "RELAYERHUB_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SLASH_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SLASH_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STAKING_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STAKING_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SYSTEM_REWARD_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TOKEN_HUB_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TOKEN_MANAGER_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TRANSFER_IN_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TRANSFER_OUT_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "VALIDATOR_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "alreadyInit", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "bscChainID", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "handleAckPackage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "handleFailAckPackage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + }, + { + "internalType": "bytes", + "name": "msgBytes", + "type": "bytes" + } + ], + "name": "handleSynPackage", + "outputs": [ + { + "internalType": "bytes", + "name": "responsePayload", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } ] \ No newline at end of file diff --git a/abi/relayerhub.abi b/abi/relayerhub.abi index 719c4cc6..b712a5c7 100644 --- a/abi/relayerhub.abi +++ b/abi/relayerhub.abi @@ -1,475 +1,443 @@ [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "value", - "type": "bytes" - } - ], - "name": "paramChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_relayer", - "type": "address" - } - ], - "name": "relayerRegister", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_relayer", - "type": "address" - } - ], - "name": "relayerUnRegister", - "type": "event" - }, - { - "constant": true, - "inputs": [], - "name": "BIND_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CODE_OK", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CROSS_CHAIN_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "ERROR_FAIL_DECODE", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "GOV_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "GOV_HUB_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "INCENTIVIZE_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "INIT_DUES", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "INIT_REQUIRED_DEPOSIT", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "LIGHT_CLIENT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "RELAYERHUB_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "SLASH_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "SLASH_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "STAKING_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "SYSTEM_REWARD_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "TOKEN_HUB_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "TOKEN_MANAGER_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "TRANSFER_IN_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "TRANSFER_OUT_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "VALIDATOR_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "alreadyInit", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "bscChainID", - "outputs": [ - { - "internalType": "uint16", - "name": "", - "type": "uint16" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "dues", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "requiredDeposit", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "init", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "register", - "outputs": [], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "unregister", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bytes", - "name": "value", - "type": "bytes" - } - ], - "name": "updateParam", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "isRelayer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "value", + "type": "bytes" + } + ], + "name": "paramChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_relayer", + "type": "address" + } + ], + "name": "relayerRegister", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_relayer", + "type": "address" + } + ], + "name": "relayerUnRegister", + "type": "event" + }, + { + "inputs": [], + "name": "BIND_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CODE_OK", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CROSS_CHAIN_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CROSS_STAKE_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ERROR_FAIL_DECODE", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "GOV_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "GOV_HUB_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "INCENTIVIZE_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "INIT_DUES", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "INIT_REQUIRED_DEPOSIT", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "LIGHT_CLIENT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "RELAYERHUB_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SLASH_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SLASH_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STAKING_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STAKING_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SYSTEM_REWARD_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TOKEN_HUB_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TOKEN_MANAGER_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TRANSFER_IN_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TRANSFER_OUT_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "VALIDATOR_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "alreadyInit", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "bscChainID", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "dues", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "init", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "isRelayer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "register", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "requiredDeposit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "unregister", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "internalType": "bytes", + "name": "value", + "type": "bytes" + } + ], + "name": "updateParam", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } ] \ No newline at end of file diff --git a/abi/relayerincentivize.abi b/abi/relayerincentivize.abi index b389ff6b..4cc97425 100644 --- a/abi/relayerincentivize.abi +++ b/abi/relayerincentivize.abi @@ -1,807 +1,755 @@ [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "sequence", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "roundRewardForHeaderRelayer", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "roundRewardForTransferRelayer", - "type": "uint256" - } - ], - "name": "distributeCollectedReward", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "value", - "type": "bytes" - } - ], - "name": "paramChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "relayer", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "rewardToRelayer", - "type": "event" - }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, - { - "constant": true, - "inputs": [], - "name": "BIND_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CALLER_COMPENSATION_DENOMINATOR", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CALLER_COMPENSATION_MOLECULE", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CODE_OK", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CROSS_CHAIN_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "ERROR_FAIL_DECODE", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "GOV_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "GOV_HUB_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "HEADER_RELAYER_REWARD_RATE_DENOMINATOR", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "HEADER_RELAYER_REWARD_RATE_MOLECULE", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "INCENTIVIZE_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "LIGHT_CLIENT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "MAXIMUM_WEIGHT", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "RELAYERHUB_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "ROUND_SIZE", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "SLASH_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "SLASH_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "STAKING_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "SYSTEM_REWARD_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "TOKEN_HUB_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "TOKEN_MANAGER_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "TRANSFER_IN_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "TRANSFER_OUT_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "VALIDATOR_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "alreadyInit", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "bscChainID", - "outputs": [ - { - "internalType": "uint16", - "name": "", - "type": "uint16" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "callerCompensationDenominator", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "callerCompensationMolecule", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "collectedRewardForHeaderRelayer", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "collectedRewardForTransferRelayer", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "countInRound", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "headerRelayerAddressRecord", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "headerRelayerRewardRateDenominator", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "headerRelayerRewardRateMolecule", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "headerRelayersSubmitCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "packageRelayerAddressRecord", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "packageRelayersSubmitCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "relayerRewardVault", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "roundSequence", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "init", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address payable", - "name": "headerRelayerAddr", - "type": "address" - }, - { - "internalType": "address payable", - "name": "packageRelayer", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "fromSystemReward", - "type": "bool" - } - ], - "name": "addReward", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "relayerAddr", - "type": "address" - } - ], - "name": "claimRelayerReward", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "uint256", - "name": "count", - "type": "uint256" - } - ], - "name": "calculateTransferRelayerWeight", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "pure", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "uint256", - "name": "count", - "type": "uint256" - } - ], - "name": "calculateHeaderRelayerWeight", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "pure", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bytes", - "name": "value", - "type": "bytes" - } - ], - "name": "updateParam", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "sequence", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "roundRewardForHeaderRelayer", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "roundRewardForTransferRelayer", + "type": "uint256" + } + ], + "name": "distributeCollectedReward", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "value", + "type": "bytes" + } + ], + "name": "paramChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "relayer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "rewardToRelayer", + "type": "event" + }, + { + "inputs": [], + "name": "BIND_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CALLER_COMPENSATION_DENOMINATOR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CALLER_COMPENSATION_MOLECULE", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CODE_OK", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CROSS_CHAIN_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CROSS_STAKE_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ERROR_FAIL_DECODE", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "GOV_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "GOV_HUB_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "HEADER_RELAYER_REWARD_RATE_DENOMINATOR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "HEADER_RELAYER_REWARD_RATE_MOLECULE", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "INCENTIVIZE_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "LIGHT_CLIENT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAXIMUM_WEIGHT", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "RELAYERHUB_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ROUND_SIZE", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SLASH_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SLASH_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STAKING_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STAKING_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SYSTEM_REWARD_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TOKEN_HUB_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TOKEN_MANAGER_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TRANSFER_IN_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TRANSFER_OUT_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "VALIDATOR_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address payable", + "name": "headerRelayerAddr", + "type": "address" + }, + { + "internalType": "address payable", + "name": "packageRelayer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "fromSystemReward", + "type": "bool" + } + ], + "name": "addReward", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "alreadyInit", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "bscChainID", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "count", + "type": "uint256" + } + ], + "name": "calculateHeaderRelayerWeight", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "count", + "type": "uint256" + } + ], + "name": "calculateTransferRelayerWeight", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "callerCompensationDenominator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "callerCompensationMolecule", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "relayerAddr", + "type": "address" + } + ], + "name": "claimRelayerReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "collectedRewardForHeaderRelayer", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "collectedRewardForTransferRelayer", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "countInRound", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "dynamicExtraIncentiveAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "headerRelayerAddressRecord", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "headerRelayerRewardRateDenominator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "headerRelayerRewardRateMolecule", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "headerRelayersSubmitCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "init", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "packageRelayerAddressRecord", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "packageRelayersSubmitCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "relayerRewardVault", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "roundSequence", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "internalType": "bytes", + "name": "value", + "type": "bytes" + } + ], + "name": "updateParam", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } ] \ No newline at end of file diff --git a/abi/slashindicator.abi b/abi/slashindicator.abi index 60eb3d90..83152d12 100644 --- a/abi/slashindicator.abi +++ b/abi/slashindicator.abi @@ -1,674 +1,792 @@ [ - { - "anonymous": false, - "inputs": [], - "name": "crashResponse", - "type": "event" - }, - { - "anonymous": false, - "inputs": [], - "name": "indicatorCleaned", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint32", - "name": "code", - "type": "uint32" - } - ], - "name": "knownResponse", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "value", - "type": "bytes" - } - ], - "name": "paramChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint32", - "name": "code", - "type": "uint32" - } - ], - "name": "unKnownResponse", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "validator", - "type": "address" - } - ], - "name": "validatorSlashed", - "type": "event" - }, - { - "constant": true, - "inputs": [], - "name": "BIND_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "BSC_RELAYER_REWARD", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CODE_OK", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CROSS_CHAIN_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "DECREASE_RATE", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "ERROR_FAIL_DECODE", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "FELONY_THRESHOLD", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "GOV_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "GOV_HUB_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "INCENTIVIZE_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "LIGHT_CLIENT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "MISDEMEANOR_THRESHOLD", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "RELAYERHUB_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "SLASH_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "SLASH_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "STAKING_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "SYSTEM_REWARD_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "TOKEN_HUB_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "TOKEN_MANAGER_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "TRANSFER_IN_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "TRANSFER_OUT_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "VALIDATOR_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "alreadyInit", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "bscChainID", - "outputs": [ - { - "internalType": "uint16", - "name": "", - "type": "uint16" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "felonyThreshold", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "indicators", - "outputs": [ - { - "internalType": "uint256", - "name": "height", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "count", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "exist", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "misdemeanorThreshold", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "previousHeight", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "validators", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "init", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - }, - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "name": "handleSynPackage", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - }, - { - "internalType": "bytes", - "name": "msgBytes", - "type": "bytes" - } - ], - "name": "handleAckPackage", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - }, - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "name": "handleFailAckPackage", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "validator", - "type": "address" - } - ], - "name": "slash", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "clean", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bytes", - "name": "value", - "type": "bytes" - } - ], - "name": "updateParam", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "validator", - "type": "address" - } - ], - "name": "getSlashIndicator", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + { + "anonymous": false, + "inputs": [], + "name": "crashResponse", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "validator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "slashCount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "failReason", + "type": "bytes" + } + ], + "name": "failedFelony", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "indicatorCleaned", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint32", + "name": "code", + "type": "uint32" + } + ], + "name": "knownResponse", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "value", + "type": "bytes" + } + ], + "name": "paramChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint32", + "name": "code", + "type": "uint32" + } + ], + "name": "unKnownResponse", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "validator", + "type": "address" + } + ], + "name": "validatorSlashed", + "type": "event" + }, + { + "inputs": [], + "name": "BIND_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "BSC_RELAYER_REWARD", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CODE_OK", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CROSS_CHAIN_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CROSS_STAKE_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DECREASE_RATE", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ERROR_FAIL_DECODE", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "FELONY_THRESHOLD", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "GOV_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "GOV_HUB_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "INCENTIVIZE_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "INIT_FINALITY_SLASH_REWARD_RATIO", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "LIGHT_CLIENT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MISDEMEANOR_THRESHOLD", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "RELAYERHUB_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SLASH_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SLASH_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STAKING_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STAKING_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SYSTEM_REWARD_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TOKEN_HUB_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TOKEN_MANAGER_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TRANSFER_IN_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TRANSFER_OUT_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "VALIDATOR_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "alreadyInit", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "bscChainID", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "clean", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "felonyThreshold", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "finalitySlashRewardRatio", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validator", + "type": "address" + } + ], + "name": "getSlashIndicator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getSlashThresholds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + }, + { + "internalType": "bytes", + "name": "msgBytes", + "type": "bytes" + } + ], + "name": "handleAckPackage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "handleFailAckPackage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "handleSynPackage", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "indicators", + "outputs": [ + { + "internalType": "uint256", + "name": "height", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "count", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "exist", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "init", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "misdemeanorThreshold", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "previousHeight", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validator", + "type": "address" + } + ], + "name": "sendFelonyPackage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validator", + "type": "address" + } + ], + "name": "slash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "uint256", + "name": "srcNum", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "srcHash", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "tarNum", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "tarHash", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "internalType": "struct SlashIndicator.VoteData", + "name": "voteA", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "srcNum", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "srcHash", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "tarNum", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "tarHash", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "internalType": "struct SlashIndicator.VoteData", + "name": "voteB", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "voteAddr", + "type": "bytes" + } + ], + "internalType": "struct SlashIndicator.FinalityEvidence", + "name": "_evidence", + "type": "tuple" + } + ], + "name": "submitFinalityViolationEvidence", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "internalType": "bytes", + "name": "value", + "type": "bytes" + } + ], + "name": "updateParam", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "validators", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } ] \ No newline at end of file diff --git a/abi/staking.abi b/abi/staking.abi index 551f0511..495bd05b 100644 --- a/abi/staking.abi +++ b/abi/staking.abi @@ -658,6 +658,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "INIT_TRANSFER_GAS", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "LIGHT_CLIENT_ADDR", @@ -881,177 +894,168 @@ }, { "inputs": [], - "name": "minDelegation", + "name": "claimReward", "outputs": [ { "internalType": "uint256", - "name": "", + "name": "amount", "type": "uint256" } ], - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], - "name": "relayerFee", + "name": "claimUndelegated", "outputs": [ { "internalType": "uint256", - "name": "", + "name": "amount", "type": "uint256" } ], - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, - { - "stateMutability": "payable", - "type": "receive" - }, { "inputs": [ { - "internalType": "uint8", - "name": "", - "type": "uint8" + "internalType": "address", + "name": "validator", + "type": "address" }, { - "internalType": "bytes", - "name": "msgBytes", - "type": "bytes" - } - ], - "name": "handleSynPackage", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" + "internalType": "uint256", + "name": "amount", + "type": "uint256" } ], - "stateMutability": "nonpayable", + "name": "delegate", + "outputs": [], + "stateMutability": "payable", "type": "function" }, { "inputs": [ { - "internalType": "uint8", - "name": "", - "type": "uint8" + "internalType": "address", + "name": "delegator", + "type": "address" }, { - "internalType": "bytes", - "name": "msgBytes", - "type": "bytes" + "internalType": "address", + "name": "validator", + "type": "address" } ], - "name": "handleAckPackage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ + "name": "getDelegated", + "outputs": [ { - "internalType": "uint8", + "internalType": "uint256", "name": "", - "type": "uint8" - }, - { - "internalType": "bytes", - "name": "msgBytes", - "type": "bytes" + "type": "uint256" } ], - "name": "handleFailAckPackage", - "outputs": [], - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", - "name": "validator", + "name": "delegator", "type": "address" - }, + } + ], + "name": "getDistributedReward", + "outputs": [ { "internalType": "uint256", - "name": "amount", + "name": "", "type": "uint256" } ], - "name": "delegate", - "outputs": [], - "stateMutability": "payable", + "stateMutability": "view", "type": "function" }, { - "inputs": [ - { - "internalType": "address", - "name": "validator", - "type": "address" - }, + "inputs": [], + "name": "getMinDelegation", + "outputs": [ { "internalType": "uint256", - "name": "amount", + "name": "", "type": "uint256" } ], - "name": "undelegate", - "outputs": [], - "stateMutability": "payable", + "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", - "name": "validatorSrc", + "name": "delegator", "type": "address" }, { "internalType": "address", - "name": "validatorDst", + "name": "valSrc", "type": "address" }, + { + "internalType": "address", + "name": "valDst", + "type": "address" + } + ], + "name": "getPendingRedelegateTime", + "outputs": [ { "internalType": "uint256", - "name": "amount", + "name": "", "type": "uint256" } ], - "name": "redelegate", - "outputs": [], - "stateMutability": "payable", + "stateMutability": "view", "type": "function" }, { - "inputs": [], - "name": "claimReward", + "inputs": [ + { + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "internalType": "address", + "name": "validator", + "type": "address" + } + ], + "name": "getPendingUndelegateTime", "outputs": [ { "internalType": "uint256", - "name": "amount", + "name": "", "type": "uint256" } ], - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { "inputs": [], - "name": "claimUndelegated", + "name": "getRelayerFee", "outputs": [ { "internalType": "uint256", - "name": "amount", + "name": "", "type": "uint256" } ], - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { @@ -1060,19 +1064,14 @@ "internalType": "address", "name": "delegator", "type": "address" - }, - { - "internalType": "address", - "name": "validator", - "type": "address" } ], - "name": "getDelegated", + "name": "getRequestInFly", "outputs": [ { - "internalType": "uint256", + "internalType": "uint256[3]", "name": "", - "type": "uint256" + "type": "uint256[3]" } ], "stateMutability": "view", @@ -1105,7 +1104,7 @@ "type": "address" } ], - "name": "getDistributedReward", + "name": "getUndelegated", "outputs": [ { "internalType": "uint256", @@ -1119,41 +1118,66 @@ { "inputs": [ { - "internalType": "address", - "name": "delegator", - "type": "address" - }, - { - "internalType": "address", - "name": "valSrc", - "type": "address" + "internalType": "uint8", + "name": "", + "type": "uint8" }, { - "internalType": "address", - "name": "valDst", - "type": "address" + "internalType": "bytes", + "name": "msgBytes", + "type": "bytes" } ], - "name": "getPendingRedelegateTime", - "outputs": [ + "name": "handleAckPackage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ { - "internalType": "uint256", + "internalType": "uint8", "name": "", - "type": "uint256" + "type": "uint8" + }, + { + "internalType": "bytes", + "name": "msgBytes", + "type": "bytes" } ], - "stateMutability": "view", + "name": "handleFailAckPackage", + "outputs": [], + "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { - "internalType": "address", - "name": "delegator", - "type": "address" + "internalType": "uint8", + "name": "", + "type": "uint8" + }, + { + "internalType": "bytes", + "name": "msgBytes", + "type": "bytes" } ], - "name": "getUndelegated", + "name": "handleSynPackage", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "minDelegation", "outputs": [ { "internalType": "uint256", @@ -1168,29 +1192,28 @@ "inputs": [ { "internalType": "address", - "name": "delegator", + "name": "validatorSrc", "type": "address" }, { "internalType": "address", - "name": "validator", + "name": "validatorDst", "type": "address" - } - ], - "name": "getPendingUndelegateTime", - "outputs": [ + }, { "internalType": "uint256", - "name": "", + "name": "amount", "type": "uint256" } ], - "stateMutability": "view", + "name": "redelegate", + "outputs": [], + "stateMutability": "payable", "type": "function" }, { "inputs": [], - "name": "getRelayerFee", + "name": "relayerFee", "outputs": [ { "internalType": "uint256", @@ -1203,7 +1226,7 @@ }, { "inputs": [], - "name": "getMinDelegation", + "name": "transferGas", "outputs": [ { "internalType": "uint256", @@ -1218,19 +1241,18 @@ "inputs": [ { "internalType": "address", - "name": "delegator", + "name": "validator", "type": "address" - } - ], - "name": "getRequestInFly", - "outputs": [ + }, { - "internalType": "uint256[3]", - "name": "", - "type": "uint256[3]" + "internalType": "uint256", + "name": "amount", + "type": "uint256" } ], - "stateMutability": "view", + "name": "undelegate", + "outputs": [], + "stateMutability": "payable", "type": "function" }, { @@ -1250,5 +1272,9 @@ "outputs": [], "stateMutability": "nonpayable", "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" } ] \ No newline at end of file diff --git a/abi/systemreward.abi b/abi/systemreward.abi index aca3233f..352cd95f 100644 --- a/abi/systemreward.abi +++ b/abi/systemreward.abi @@ -1,428 +1,468 @@ [ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "receiveDeposit", - "type": "event" - }, - { - "anonymous": false, - "inputs": [], - "name": "rewardEmpty", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "rewardTo", - "type": "event" - }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, - { - "constant": true, - "inputs": [], - "name": "BIND_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CODE_OK", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CROSS_CHAIN_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "ERROR_FAIL_DECODE", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "GOV_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "GOV_HUB_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "INCENTIVIZE_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "LIGHT_CLIENT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "MAX_REWARDS", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "RELAYERHUB_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "SLASH_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "SLASH_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "STAKING_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "SYSTEM_REWARD_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "TOKEN_HUB_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "TOKEN_MANAGER_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "TRANSFER_IN_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "TRANSFER_OUT_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "VALIDATOR_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "alreadyInit", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "bscChainID", - "outputs": [ - { - "internalType": "uint16", - "name": "", - "type": "uint16" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "numOperator", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address payable", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "claimRewards", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "addr", - "type": "address" - } - ], - "name": "isOperator", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "addOperator", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "deleteOperator", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "value", + "type": "bytes" + } + ], + "name": "paramChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "receiveDeposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "rewardEmpty", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "rewardTo", + "type": "event" + }, + { + "inputs": [], + "name": "BIND_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CODE_OK", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CROSS_CHAIN_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CROSS_STAKE_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ERROR_FAIL_DECODE", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "GOV_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "GOV_HUB_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "INCENTIVIZE_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "LIGHT_CLIENT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_REWARDS", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "RELAYERHUB_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SLASH_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SLASH_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STAKING_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STAKING_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SYSTEM_REWARD_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TOKEN_HUB_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TOKEN_MANAGER_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TRANSFER_IN_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TRANSFER_OUT_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "VALIDATOR_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "alreadyInit", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "bscChainID", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address payable", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "claimRewards", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "isOperator", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "numOperator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "internalType": "bytes", + "name": "value", + "type": "bytes" + } + ], + "name": "updateParam", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } ] \ No newline at end of file diff --git a/abi/tendermintlightclient.abi b/abi/tendermintlightclient.abi index 8ed2dc61..93dc47fc 100644 --- a/abi/tendermintlightclient.abi +++ b/abi/tendermintlightclient.abi @@ -1,657 +1,586 @@ [ - { - "inputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint64", - "name": "initHeight", - "type": "uint64" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "appHash", - "type": "bytes32" - } - ], - "name": "initConsensusState", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "value", - "type": "bytes" - } - ], - "name": "paramChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint64", - "name": "height", - "type": "uint64" - }, - { - "indexed": false, - "internalType": "uint64", - "name": "preValidatorSetChangeHeight", - "type": "uint64" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "appHash", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "bool", - "name": "validatorChanged", - "type": "bool" - } - ], - "name": "syncConsensusState", - "type": "event" - }, - { - "constant": true, - "inputs": [], - "name": "BIND_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CODE_OK", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CROSS_CHAIN_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "ERROR_FAIL_DECODE", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "GOV_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "GOV_HUB_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "INCENTIVIZE_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "INIT_CONSENSUS_STATE_BYTES", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "INIT_REWARD_FOR_VALIDATOR_SER_CHANGE", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "LIGHT_CLIENT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "RELAYERHUB_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "SLASH_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "SLASH_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "STAKING_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "SYSTEM_REWARD_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "TOKEN_HUB_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "TOKEN_MANAGER_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "TRANSFER_IN_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "TRANSFER_OUT_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "VALIDATOR_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "alreadyInit", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "bscChainID", - "outputs": [ - { - "internalType": "uint16", - "name": "", - "type": "uint16" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "chainID", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "initialHeight", - "outputs": [ - { - "internalType": "uint64", - "name": "", - "type": "uint64" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "latestHeight", - "outputs": [ - { - "internalType": "uint64", - "name": "", - "type": "uint64" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "uint64", - "name": "", - "type": "uint64" - } - ], - "name": "lightClientConsensusStates", - "outputs": [ - { - "internalType": "uint64", - "name": "preValidatorSetChangeHeight", - "type": "uint64" - }, - { - "internalType": "bytes32", - "name": "appHash", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "curValidatorSetHash", - "type": "bytes32" - }, - { - "internalType": "bytes", - "name": "nextValidatorSet", - "type": "bytes" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "rewardForValidatorSetChange", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "uint64", - "name": "", - "type": "uint64" - } - ], - "name": "submitters", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "init", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "bytes", - "name": "header", - "type": "bytes" - }, - { - "internalType": "uint64", - "name": "height", - "type": "uint64" - } - ], - "name": "syncTendermintHeader", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "uint64", - "name": "height", - "type": "uint64" - } - ], - "name": "isHeaderSynced", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "uint64", - "name": "height", - "type": "uint64" - } - ], - "name": "getAppHash", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "uint64", - "name": "height", - "type": "uint64" - } - ], - "name": "getSubmitter", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getChainID", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bytes", - "name": "value", - "type": "bytes" - } - ], - "name": "updateParam", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "initHeight", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "appHash", + "type": "bytes32" + } + ], + "name": "initConsensusState", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "value", + "type": "bytes" + } + ], + "name": "paramChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "height", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "preValidatorSetChangeHeight", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "appHash", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bool", + "name": "validatorChanged", + "type": "bool" + } + ], + "name": "syncConsensusState", + "type": "event" + }, + { + "inputs": [], + "name": "BIND_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CODE_OK", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CROSS_CHAIN_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ERROR_FAIL_DECODE", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "GOV_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "GOV_HUB_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "INCENTIVIZE_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "INIT_CONSENSUS_STATE_BYTES", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "INIT_REWARD_FOR_VALIDATOR_SER_CHANGE", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "LIGHT_CLIENT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "RELAYERHUB_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SLASH_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SLASH_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STAKING_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SYSTEM_REWARD_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TOKEN_HUB_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TOKEN_MANAGER_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TRANSFER_IN_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TRANSFER_OUT_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "VALIDATOR_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "alreadyInit", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "bscChainID", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "chainID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "initialHeight", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "latestHeight", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "name": "lightClientConsensusStates", + "outputs": [ + { + "internalType": "uint64", + "name": "preValidatorSetChangeHeight", + "type": "uint64" + }, + { + "internalType": "bytes32", + "name": "appHash", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "curValidatorSetHash", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "nextValidatorSet", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardForValidatorSetChange", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "name": "submitters", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "init", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "header", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "height", + "type": "uint64" + } + ], + "name": "syncTendermintHeader", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint64", + "name": "height", + "type": "uint64" + } + ], + "name": "isHeaderSynced", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint64", + "name": "height", + "type": "uint64" + } + ], + "name": "getAppHash", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint64", + "name": "height", + "type": "uint64" + } + ], + "name": "getSubmitter", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getChainID", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "internalType": "bytes", + "name": "value", + "type": "bytes" + } + ], + "name": "updateParam", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } ] \ No newline at end of file diff --git a/abi/tokenhub.abi b/abi/tokenhub.abi index 1faeb599..f8ede968 100644 --- a/abi/tokenhub.abi +++ b/abi/tokenhub.abi @@ -1,1057 +1,1299 @@ [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "value", - "type": "bytes" - } - ], - "name": "paramChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "receiveDeposit", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "bep20Addr", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "refundAddr", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint32", - "name": "status", - "type": "uint32" - } - ], - "name": "refundFailure", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "bep20Addr", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "refundAddr", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint32", - "name": "status", - "type": "uint32" - } - ], - "name": "refundSuccess", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "rewardTo", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "bep20Addr", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "refundAddr", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transferInSuccess", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "bep20Addr", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "senderAddr", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "relayFee", - "type": "uint256" - } - ], - "name": "transferOutSuccess", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "channelId", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "msgBytes", - "type": "bytes" - } - ], - "name": "unexpectedPackage", - "type": "event" - }, - { - "inputs": [], - "name": "BEP2_TOKEN_DECIMALS", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "BEP2_TOKEN_SYMBOL_FOR_BNB", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "BIND_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "CODE_OK", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "CROSS_CHAIN_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "CROSS_STAKE_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "ERROR_FAIL_DECODE", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "GOV_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "GOV_HUB_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "INCENTIVIZE_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "INIT_MINIMUM_RELAY_FEE", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "LIGHT_CLIENT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAXIMUM_BEP20_SYMBOL_LEN", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_BEP2_TOTAL_SUPPLY", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_GAS_FOR_CALLING_BEP20", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_GAS_FOR_TRANSFER_BNB", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MINIMUM_BEP20_SYMBOL_LEN", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "RELAYERHUB_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "REWARD_UPPER_LIMIT", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "SLASH_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "SLASH_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "STAKING_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "STAKING_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "SYSTEM_REWARD_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "TEN_DECIMALS", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "TOKEN_HUB_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "TOKEN_MANAGER_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "TRANSFER_IN_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "TRANSFER_IN_FAILURE_INSUFFICIENT_BALANCE", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "TRANSFER_IN_FAILURE_NON_PAYABLE_RECIPIENT", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "TRANSFER_IN_FAILURE_TIMEOUT", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "TRANSFER_IN_FAILURE_UNBOUND_TOKEN", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "TRANSFER_IN_FAILURE_UNKNOWN", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "TRANSFER_IN_SUCCESS", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "TRANSFER_OUT_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "VALIDATOR_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "alreadyInit", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "bep20ContractDecimals", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "bscChainID", - "outputs": [ - { - "internalType": "uint16", - "name": "", - "type": "uint16" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "relayFee", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "stateMutability": "payable", - "type": "receive" - }, - { - "inputs": [], - "name": "init", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address payable", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "claimRewards", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "getMiniRelayFee", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "channelId", - "type": "uint8" - }, - { - "internalType": "bytes", - "name": "msgBytes", - "type": "bytes" - } - ], - "name": "handleSynPackage", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "channelId", - "type": "uint8" - }, - { - "internalType": "bytes", - "name": "msgBytes", - "type": "bytes" - } - ], - "name": "handleAckPackage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "channelId", - "type": "uint8" - }, - { - "internalType": "bytes", - "name": "msgBytes", - "type": "bytes" - } - ], - "name": "handleFailAckPackage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "contractAddr", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint64", - "name": "expireTime", - "type": "uint64" - } - ], - "name": "transferOut", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "recipientAddrs", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "amounts", - "type": "uint256[]" - }, - { - "internalType": "address[]", - "name": "refundAddrs", - "type": "address[]" - }, - { - "internalType": "uint64", - "name": "expireTime", - "type": "uint64" - } - ], - "name": "batchTransferOutBNB", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bytes", - "name": "value", - "type": "bytes" - } - ], - "name": "updateParam", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "bep2Symbol", - "type": "bytes32" - } - ], - "name": "getContractAddrByBEP2Symbol", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "contractAddr", - "type": "address" - } - ], - "name": "getBep2SymbolByContractAddr", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "bep2Symbol", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "contractAddr", - "type": "address" - }, - { - "internalType": "uint256", - "name": "decimals", - "type": "uint256" - } - ], - "name": "bindToken", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "bep2Symbol", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "contractAddr", - "type": "address" - } - ], - "name": "unbindToken", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "bep2Symbol", - "type": "string" - } - ], - "name": "getBoundContract", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "contractAddr", - "type": "address" - } - ], - "name": "getBoundBep2Symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "withdrawStakingBNB", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "tokenAddr", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "attacker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "CancelTransfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "tokenAddr", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "largeTransferLimit", + "type": "uint256" + } + ], + "name": "LargeTransferLimitSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "tokenAddr", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "unlockAt", + "type": "uint256" + } + ], + "name": "LargeTransferLocked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "tokenAddr", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "WithdrawUnlockedToken", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "value", + "type": "bytes" + } + ], + "name": "paramChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "receiveDeposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "bep20Addr", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "refundAddr", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "status", + "type": "uint32" + } + ], + "name": "refundFailure", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "bep20Addr", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "refundAddr", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "status", + "type": "uint32" + } + ], + "name": "refundSuccess", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "rewardTo", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "bep20Addr", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "refundAddr", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferInSuccess", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "bep20Addr", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "senderAddr", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "relayFee", + "type": "uint256" + } + ], + "name": "transferOutSuccess", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "channelId", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "msgBytes", + "type": "bytes" + } + ], + "name": "unexpectedPackage", + "type": "event" + }, + { + "inputs": [], + "name": "BEP2_TOKEN_DECIMALS", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "BEP2_TOKEN_SYMBOL_FOR_BNB", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "BIND_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CODE_OK", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CROSS_CHAIN_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CROSS_STAKE_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ERROR_FAIL_DECODE", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "GOV_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "GOV_HUB_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "INCENTIVIZE_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "INIT_BNB_LARGE_TRANSFER_LIMIT", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "INIT_LOCK_PERIOD", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "INIT_MINIMUM_RELAY_FEE", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "LIGHT_CLIENT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAXIMUM_BEP20_SYMBOL_LEN", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_BEP2_TOTAL_SUPPLY", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_GAS_FOR_CALLING_BEP20", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_GAS_FOR_TRANSFER_BNB", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MINIMUM_BEP20_SYMBOL_LEN", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "RELAYERHUB_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "REWARD_UPPER_LIMIT", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SLASH_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SLASH_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STAKING_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STAKING_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SYSTEM_REWARD_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TEN_DECIMALS", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TOKEN_HUB_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TOKEN_MANAGER_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TRANSFER_IN_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TRANSFER_IN_FAILURE_INSUFFICIENT_BALANCE", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TRANSFER_IN_FAILURE_NON_PAYABLE_RECIPIENT", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TRANSFER_IN_FAILURE_TIMEOUT", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TRANSFER_IN_FAILURE_UNBOUND_TOKEN", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TRANSFER_IN_FAILURE_UNKNOWN", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TRANSFER_IN_SUCCESS", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TRANSFER_OUT_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "VALIDATOR_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "alreadyInit", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "recipientAddrs", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + }, + { + "internalType": "address[]", + "name": "refundAddrs", + "type": "address[]" + }, + { + "internalType": "uint64", + "name": "expireTime", + "type": "uint64" + } + ], + "name": "batchTransferOutBNB", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "bep20ContractDecimals", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "bep2Symbol", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "contractAddr", + "type": "address" + }, + { + "internalType": "uint256", + "name": "decimals", + "type": "uint256" + } + ], + "name": "bindToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "bscChainID", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "attacker", + "type": "address" + } + ], + "name": "cancelTransferIn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address payable", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "claimRewards", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "contractAddr", + "type": "address" + } + ], + "name": "getBep2SymbolByContractAddr", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "contractAddr", + "type": "address" + } + ], + "name": "getBoundBep2Symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "bep2Symbol", + "type": "string" + } + ], + "name": "getBoundContract", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "bep2Symbol", + "type": "bytes32" + } + ], + "name": "getContractAddrByBEP2Symbol", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMiniRelayFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "channelId", + "type": "uint8" + }, + { + "internalType": "bytes", + "name": "msgBytes", + "type": "bytes" + } + ], + "name": "handleAckPackage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "channelId", + "type": "uint8" + }, + { + "internalType": "bytes", + "name": "msgBytes", + "type": "bytes" + } + ], + "name": "handleFailAckPackage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "channelId", + "type": "uint8" + }, + { + "internalType": "bytes", + "name": "msgBytes", + "type": "bytes" + } + ], + "name": "handleSynPackage", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "init", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "largeTransferLimitMap", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "lockInfoMap", + "outputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "unlockAt", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lockPeriod", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "relayFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "bep20Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "largeTransferLimit", + "type": "uint256" + } + ], + "name": "setLargeTransferLimit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "contractAddr", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint64", + "name": "expireTime", + "type": "uint64" + } + ], + "name": "transferOut", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "bep2Symbol", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "contractAddr", + "type": "address" + } + ], + "name": "unbindToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "internalType": "bytes", + "name": "value", + "type": "bytes" + } + ], + "name": "updateParam", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdrawStakingBNB", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + } + ], + "name": "withdrawUnlockedToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } ] \ No newline at end of file diff --git a/abi/tokenmanager.abi b/abi/tokenmanager.abi index 1d03235b..11d7ea2a 100644 --- a/abi/tokenmanager.abi +++ b/abi/tokenmanager.abi @@ -1,1202 +1,1081 @@ [ - { - "inputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "contractAddr", - "type": "address" - }, - { - "indexed": false, - "internalType": "string", - "name": "bep2Symbol", - "type": "string" - }, - { - "indexed": false, - "internalType": "uint32", - "name": "failedReason", - "type": "uint32" - } - ], - "name": "bindFailure", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "contractAddr", - "type": "address" - }, - { - "indexed": false, - "internalType": "string", - "name": "bep2Symbol", - "type": "string" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "peggyAmount", - "type": "uint256" - } - ], - "name": "bindSuccess", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "bep20Addr", - "type": "address" - }, - { - "indexed": false, - "internalType": "string", - "name": "reason", - "type": "string" - } - ], - "name": "mirrorFailure", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "bep20Addr", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "bep2Symbol", - "type": "bytes32" - } - ], - "name": "mirrorSuccess", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "value", - "type": "bytes" - } - ], - "name": "paramChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "bep20Addr", - "type": "address" - }, - { - "indexed": false, - "internalType": "string", - "name": "reason", - "type": "string" - } - ], - "name": "syncFailure", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "bep20Addr", - "type": "address" - } - ], - "name": "syncSuccess", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "channelId", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "msgBytes", - "type": "bytes" - } - ], - "name": "unexpectedPackage", - "type": "event" - }, - { - "constant": true, - "inputs": [], - "name": "BEP2_TOKEN_DECIMALS", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "BIND_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "BIND_PACKAGE", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "BIND_STATUS_ALREADY_BOUND_TOKEN", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "BIND_STATUS_DECIMALS_MISMATCH", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "BIND_STATUS_REJECTED", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "BIND_STATUS_SUCCESS", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "BIND_STATUS_SYMBOL_MISMATCH", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "BIND_STATUS_TIMEOUT", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "BIND_STATUS_TOO_MUCH_TOKENHUB_BALANCE", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "BIND_STATUS_TOTAL_SUPPLY_MISMATCH", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CODE_OK", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CROSS_CHAIN_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "ERROR_FAIL_DECODE", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "GOV_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "GOV_HUB_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "INCENTIVIZE_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "LIGHT_CLIENT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "MAXIMUM_BEP20_SYMBOL_LEN", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "MAX_BEP2_TOTAL_SUPPLY", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "MAX_GAS_FOR_TRANSFER_BNB", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "MINIMUM_BEP20_SYMBOL_LEN", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "MIRROR_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "MIRROR_STATUS_ALREADY_BOUND", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "MIRROR_STATUS_DUPLICATED_BEP2_SYMBOL", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "MIRROR_STATUS_SUCCESS", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "MIRROR_STATUS_TIMEOUT", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "RELAYERHUB_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "SLASH_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "SLASH_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "STAKING_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "SYNC_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "SYNC_STATUS_NOT_BOUND_MIRROR", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "SYNC_STATUS_SUCCESS", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "SYNC_STATUS_TIMEOUT", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "SYSTEM_REWARD_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "TEN_DECIMALS", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "TOKEN_HUB_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "TOKEN_MANAGER_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "TRANSFER_IN_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "TRANSFER_OUT_CHANNELID", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "UNBIND_PACKAGE", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "VALIDATOR_CONTRACT_ADDR", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "alreadyInit", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "contractAddr", - "type": "address" - }, - { - "internalType": "string", - "name": "bep2Symbol", - "type": "string" - } - ], - "name": "approveBind", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "bindPackageRecord", - "outputs": [ - { - "internalType": "uint8", - "name": "packageType", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "bep2TokenSymbol", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "contractAddr", - "type": "address" - }, - { - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "peggyAmount", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "bep20Decimals", - "type": "uint8" - }, - { - "internalType": "uint64", - "name": "expireTime", - "type": "uint64" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "boundByMirror", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "bscChainID", - "outputs": [ - { - "internalType": "uint16", - "name": "", - "type": "uint16" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "string", - "name": "bep2Symbol", - "type": "string" - } - ], - "name": "expireBind", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint8", - "name": "channelId", - "type": "uint8" - }, - { - "internalType": "bytes", - "name": "msgBytes", - "type": "bytes" - } - ], - "name": "handleAckPackage", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint8", - "name": "channelId", - "type": "uint8" - }, - { - "internalType": "bytes", - "name": "msgBytes", - "type": "bytes" - } - ], - "name": "handleFailAckPackage", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint8", - "name": "channelId", - "type": "uint8" - }, - { - "internalType": "bytes", - "name": "msgBytes", - "type": "bytes" - } - ], - "name": "handleSynPackage", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "bep20Addr", - "type": "address" - }, - { - "internalType": "uint64", - "name": "expireTime", - "type": "uint64" - } - ], - "name": "mirror", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "mirrorFee", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "mirrorPendingRecord", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "string", - "name": "symbol", - "type": "string" - } - ], - "name": "queryRequiredLockAmountForBind", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "contractAddr", - "type": "address" - }, - { - "internalType": "string", - "name": "bep2Symbol", - "type": "string" - } - ], - "name": "rejectBind", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "bep20Addr", - "type": "address" - }, - { - "internalType": "uint64", - "name": "expireTime", - "type": "uint64" - } - ], - "name": "sync", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "syncFee", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bytes", - "name": "value", - "type": "bytes" - } - ], - "name": "updateParam", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "contractAddr", + "type": "address" + }, + { + "indexed": false, + "internalType": "string", + "name": "bep2Symbol", + "type": "string" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "failedReason", + "type": "uint32" + } + ], + "name": "bindFailure", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "contractAddr", + "type": "address" + }, + { + "indexed": false, + "internalType": "string", + "name": "bep2Symbol", + "type": "string" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "peggyAmount", + "type": "uint256" + } + ], + "name": "bindSuccess", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "bep20Addr", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "errCode", + "type": "uint8" + } + ], + "name": "mirrorFailure", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "bep20Addr", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "bep2Symbol", + "type": "bytes32" + } + ], + "name": "mirrorSuccess", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "value", + "type": "bytes" + } + ], + "name": "paramChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "bep20Addr", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "errCode", + "type": "uint8" + } + ], + "name": "syncFailure", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "bep20Addr", + "type": "address" + } + ], + "name": "syncSuccess", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "channelId", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "msgBytes", + "type": "bytes" + } + ], + "name": "unexpectedPackage", + "type": "event" + }, + { + "inputs": [], + "name": "BEP2_TOKEN_DECIMALS", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "BIND_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "BIND_PACKAGE", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "BIND_STATUS_ALREADY_BOUND_TOKEN", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "BIND_STATUS_DECIMALS_MISMATCH", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "BIND_STATUS_REJECTED", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "BIND_STATUS_SYMBOL_MISMATCH", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "BIND_STATUS_TIMEOUT", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "BIND_STATUS_TOO_MUCH_TOKENHUB_BALANCE", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "BIND_STATUS_TOTAL_SUPPLY_MISMATCH", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CODE_OK", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CROSS_CHAIN_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CROSS_STAKE_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ERROR_FAIL_DECODE", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "GOV_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "GOV_HUB_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "INCENTIVIZE_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "LIGHT_CLIENT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "LOG_MAX_UINT256", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAXIMUM_BEP20_SYMBOL_LEN", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_BEP2_TOTAL_SUPPLY", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_GAS_FOR_TRANSFER_BNB", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MINIMUM_BEP20_SYMBOL_LEN", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MIRROR_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MIRROR_STATUS_ALREADY_BOUND", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MIRROR_STATUS_DUPLICATED_BEP2_SYMBOL", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MIRROR_STATUS_TIMEOUT", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "RELAYERHUB_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SLASH_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SLASH_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STAKING_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STAKING_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SYNC_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SYNC_STATUS_NOT_BOUND_MIRROR", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SYNC_STATUS_TIMEOUT", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SYSTEM_REWARD_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TEN_DECIMALS", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TOKEN_HUB_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TOKEN_MANAGER_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TRANSFER_IN_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TRANSFER_OUT_CHANNELID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "UNBIND_PACKAGE", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "VALIDATOR_CONTRACT_ADDR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "alreadyInit", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "contractAddr", + "type": "address" + }, + { + "internalType": "string", + "name": "bep2Symbol", + "type": "string" + } + ], + "name": "approveBind", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "bindPackageRecord", + "outputs": [ + { + "internalType": "uint8", + "name": "packageType", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "bep2TokenSymbol", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "contractAddr", + "type": "address" + }, + { + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "peggyAmount", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "bep20Decimals", + "type": "uint8" + }, + { + "internalType": "uint64", + "name": "expireTime", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "boundByMirror", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "bscChainID", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "bep2Symbol", + "type": "string" + } + ], + "name": "expireBind", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "channelId", + "type": "uint8" + }, + { + "internalType": "bytes", + "name": "msgBytes", + "type": "bytes" + } + ], + "name": "handleAckPackage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "channelId", + "type": "uint8" + }, + { + "internalType": "bytes", + "name": "msgBytes", + "type": "bytes" + } + ], + "name": "handleFailAckPackage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "channelId", + "type": "uint8" + }, + { + "internalType": "bytes", + "name": "msgBytes", + "type": "bytes" + } + ], + "name": "handleSynPackage", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "bep20Addr", + "type": "address" + }, + { + "internalType": "uint64", + "name": "expireTime", + "type": "uint64" + } + ], + "name": "mirror", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "mirrorFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "mirrorPendingRecord", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "symbol", + "type": "string" + } + ], + "name": "queryRequiredLockAmountForBind", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "contractAddr", + "type": "address" + }, + { + "internalType": "string", + "name": "bep2Symbol", + "type": "string" + } + ], + "name": "rejectBind", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "bep20Addr", + "type": "address" + }, + { + "internalType": "uint64", + "name": "expireTime", + "type": "uint64" + } + ], + "name": "sync", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "syncFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "internalType": "bytes", + "name": "value", + "type": "bytes" + } + ], + "name": "updateParam", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } ] \ No newline at end of file diff --git a/contracts/BSCValidatorSet.sol b/contracts/BSCValidatorSet.sol index f2f7fbb4..c0ef234a 100644 --- a/contracts/BSCValidatorSet.sol +++ b/contracts/BSCValidatorSet.sol @@ -1,4 +1,5 @@ pragma solidity 0.6.4; +pragma experimental ABIEncoderV2; import "./System.sol"; import "./lib/BytesToTypes.sol"; @@ -54,7 +55,7 @@ contract BSCValidatorSet is IBSCValidatorSet, System, IParamSubscriber, IApplica uint256 public constant BURN_RATIO_SCALE = 10000; address public constant BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD; - uint256 public constant INIT_BURN_RATIO = 0; + uint256 public constant INIT_BURN_RATIO = 1000; uint256 public burnRatio; bool public burnRatioInitialized; @@ -74,7 +75,15 @@ contract BSCValidatorSet is IBSCValidatorSet, System, IParamSubscriber, IApplica uint256 public maxNumOfCandidates; uint256 public maxNumOfWorkingCandidates; - struct Validator{ + // BEP-126 Fast Finality + uint256 public constant INIT_FINALITY_REWARD_RATIO = 50; + uint256 public constant MAX_SYSTEM_REWARD_BALANCE = 100 ether; + + uint256 public finalityRewardRatio; + uint256 public previousHeight; + uint256 public previousBalanceOfSystemReward; + + struct Validator { address consensusAddress; address payable feeAddress; address BBCFeeAddress; @@ -90,14 +99,18 @@ contract BSCValidatorSet is IBSCValidatorSet, System, IParamSubscriber, IApplica uint256 enterMaintenanceHeight; // the height from where the validator enters Maintenance bool isMaintaining; + // BEP-126 Fast Finality + bytes voteAddress; + // reserve for future use - uint256[20] slots; + uint256[19] slots; } /*********************** cross chain package **************************/ struct IbcValidatorSetPackage { uint8 packageType; Validator[] validatorSet; + bytes[] voteAddrs; } /*********************** modifiers **************************/ @@ -111,7 +124,7 @@ contract BSCValidatorSet is IBSCValidatorSet, System, IParamSubscriber, IApplica ValidatorExtra memory validatorExtra; // init validatorExtraSet uint256 validatorsNum = currentValidatorSet.length; - for (uint i; i < validatorsNum; ++i) { + for (uint i; i previousHeight, "can not do this twice in one block"); + _; + previousHeight = block.number; + } + /*********************** events **************************/ event validatorSetUpdated(); event validatorJailed(address indexed validator); @@ -139,12 +158,14 @@ contract BSCValidatorSet is IBSCValidatorSet, System, IParamSubscriber, IApplica event feeBurned(uint256 amount); event validatorEnterMaintenance(address indexed validator); event validatorExitMaintenance(address indexed validator); + event finalityRewardDeposit(address indexed validator, uint256 amount); + event deprecatedFinalityRewardDeposit(address indexed validator, uint256 amount); /*********************** init **************************/ function init() external onlyNotInit{ (IbcValidatorSetPackage memory validatorSetPkg, bool valid)= decodeValidatorSetSynPackage(INIT_VALIDATORSET_BYTES); require(valid, "failed to parse init validatorSet"); - for (uint i;i MAX_NUM_OF_VALIDATORS) { + emit failReasonWithStr("the number of validators exceed the limit"); return ERROR_FAIL_CHECK_VALIDATORS; } + for (uint i; i= DUSTY_INCOMING) { - ++crossSize; - } else if (currentValidatorSet[i].incoming > 0) { - ++directSize; - } - } - - //cross transfer - address[] memory crossAddrs = new address[](crossSize); - uint256[] memory crossAmounts = new uint256[](crossSize); - uint256[] memory crossIndexes = new uint256[](crossSize); - address[] memory crossRefundAddrs = new address[](crossSize); - uint256 crossTotal; - // direct transfer - address payable[] memory directAddrs = new address payable[](directSize); - uint256[] memory directAmounts = new uint256[](directSize); - crossSize = 0; - directSize = 0; - uint256 relayFee = ITokenHub(TOKEN_HUB_ADDR).getMiniRelayFee(); - if (relayFee > DUSTY_INCOMING) { - emit failReasonWithStr("fee is larger than DUSTY_INCOMING"); - return ERROR_RELAYFEE_TOO_LARGE; - } - for (uint i; i < validatorsNum; ++i) { - if (currentValidatorSet[i].incoming >= DUSTY_INCOMING) { - crossAddrs[crossSize] = currentValidatorSet[i].BBCFeeAddress; - uint256 value = currentValidatorSet[i].incoming - currentValidatorSet[i].incoming % PRECISION; - crossAmounts[crossSize] = value.sub(relayFee); - crossRefundAddrs[crossSize] = currentValidatorSet[i].BBCFeeAddress; - crossIndexes[crossSize] = i; - crossTotal = crossTotal.add(value); - ++crossSize; - } else if (currentValidatorSet[i].incoming > 0) { - directAddrs[directSize] = currentValidatorSet[i].feeAddress; - directAmounts[directSize] = currentValidatorSet[i].incoming; - ++directSize; - } - } - - //step 2: do cross chain transfer - bool failCross = false; - if (crossTotal > 0) { - try ITokenHub(TOKEN_HUB_ADDR).batchTransferOutBNB{value:crossTotal}(crossAddrs, crossAmounts, crossRefundAddrs, uint64(block.timestamp + expireTimeSecondGap)) returns (bool success) { - if (success) { - emit batchTransfer(crossTotal); - } else { - emit batchTransferFailed(crossTotal, "batch transfer return false"); + (Validator[] memory validatorSetTemp, bytes[] memory voteAddrsTemp) = _forceMaintainingValidatorsExit(validatorSet, voteAddrs); + + { + //step 1: do calculate distribution, do not make it as an internal function for saving gas. + uint crossSize; + uint directSize; + uint validatorsNum = currentValidatorSet.length; + for (uint i; i= DUSTY_INCOMING) { + ++crossSize; + } else if (currentValidatorSet[i].incoming > 0) { + ++directSize; } - }catch Error(string memory reason) { - failCross = true; - emit batchTransferFailed(crossTotal, reason); - }catch (bytes memory lowLevelData) { - failCross = true; - emit batchTransferLowerFailed(crossTotal, lowLevelData); } - } - if (failCross) { - for (uint i; i< crossIndexes.length;++i) { - uint idx = crossIndexes[i]; - bool success = currentValidatorSet[idx].feeAddress.send(currentValidatorSet[idx].incoming); - if (success) { - emit directTransfer(currentValidatorSet[idx].feeAddress, currentValidatorSet[idx].incoming); - } else { - emit directTransferFail(currentValidatorSet[idx].feeAddress, currentValidatorSet[idx].incoming); + //cross transfer + address[] memory crossAddrs = new address[](crossSize); + uint256[] memory crossAmounts = new uint256[](crossSize); + uint256[] memory crossIndexes = new uint256[](crossSize); + address[] memory crossRefundAddrs = new address[](crossSize); + uint256 crossTotal; + // direct transfer + address payable[] memory directAddrs = new address payable[](directSize); + uint256[] memory directAmounts = new uint256[](directSize); + crossSize = 0; + directSize = 0; + uint256 relayFee = ITokenHub(TOKEN_HUB_ADDR).getMiniRelayFee(); + if (relayFee > DUSTY_INCOMING) { + emit failReasonWithStr("fee is larger than DUSTY_INCOMING"); + return ERROR_RELAYFEE_TOO_LARGE; + } + for (uint i; i= DUSTY_INCOMING) { + crossAddrs[crossSize] = currentValidatorSet[i].BBCFeeAddress; + uint256 value = currentValidatorSet[i].incoming - currentValidatorSet[i].incoming % PRECISION; + crossAmounts[crossSize] = value.sub(relayFee); + crossRefundAddrs[crossSize] = currentValidatorSet[i].BBCFeeAddress; + crossIndexes[crossSize] = i; + crossTotal = crossTotal.add(value); + ++crossSize; + } else if (currentValidatorSet[i].incoming > 0) { + directAddrs[directSize] = currentValidatorSet[i].feeAddress; + directAmounts[directSize] = currentValidatorSet[i].incoming; + ++directSize; } } - } - // step 3: direct transfer - if (directAddrs.length>0) { - for (uint i;i 0) { + try ITokenHub(TOKEN_HUB_ADDR).batchTransferOutBNB{value : crossTotal}(crossAddrs, crossAmounts, crossRefundAddrs, uint64(block.timestamp + expireTimeSecondGap)) returns (bool success) { + if (success) { + emit batchTransfer(crossTotal); + } else { + emit batchTransferFailed(crossTotal, "batch transfer return false"); + } + }catch Error(string memory reason) { + failCross = true; + emit batchTransferFailed(crossTotal, reason); + }catch (bytes memory lowLevelData) { + failCross = true; + emit batchTransferLowerFailed(crossTotal, lowLevelData); + } + } + + if (failCross) { + for (uint i; i0) { + for (uint i; i0) { - doUpdateState(validatorSetTemp); + doUpdateState(validatorSetTemp, voteAddrsTemp); } // step 6: clean slash contract @@ -372,13 +404,16 @@ contract BSCValidatorSet is IBSCValidatorSet, System, IParamSubscriber, IApplica * @dev With each epoch, there will be a partial rotation between cabinets and candidates. Rotation is determined by this function * */ - function shuffle(address[] memory validators, uint256 epochNumber, uint startIdx, uint offset, uint limit, uint modNumber) internal pure { + function shuffle(address[] memory validators, bytes[] memory voteAddrs, uint256 epochNumber, uint startIdx, uint offset, uint limit, uint modNumber) internal pure { for (uint i; i 0) { uint256 epochNumber = block.number / EPOCH; - shuffle(validators, epochNumber, _numOfCabinets-_maxNumOfWorkingCandidates, 0, _maxNumOfWorkingCandidates, _numOfCabinets); - shuffle(validators, epochNumber, _numOfCabinets-_maxNumOfWorkingCandidates, _numOfCabinets-_maxNumOfWorkingCandidates, - _maxNumOfWorkingCandidates, validators.length-_numOfCabinets+_maxNumOfWorkingCandidates); + shuffle(validators, voteAddrs, epochNumber, _numOfCabinets-_maxNumOfWorkingCandidates, 0, _maxNumOfWorkingCandidates, _numOfCabinets); + shuffle(validators, voteAddrs, epochNumber, _numOfCabinets-_maxNumOfWorkingCandidates, _numOfCabinets-_maxNumOfWorkingCandidates, + _maxNumOfWorkingCandidates, validators.length - _numOfCabinets+_maxNumOfWorkingCandidates); } address[] memory miningValidators = new address[](_numOfCabinets); + bytes[] memory miningVoteAddrs = new bytes[](_numOfCabinets); for (uint i; i<_numOfCabinets; ++i) { miningValidators[i] = validators[i]; + miningVoteAddrs[i] = voteAddrs[i]; } - return miningValidators; + return (miningValidators, miningVoteAddrs); } /** @@ -470,6 +538,63 @@ contract BSCValidatorSet is IBSCValidatorSet, System, IParamSubscriber, IApplica return isWorkingValidator(index); } + function distributeFinalityReward(address[] calldata valAddrs, uint256[] calldata weights) external onlyCoinbase oncePerBlock onlyInit { + // first time to call this function + if (finalityRewardRatio == 0) { + finalityRewardRatio = INIT_FINALITY_REWARD_RATIO; + previousBalanceOfSystemReward = address(SYSTEM_REWARD_ADDR).balance; + return; + } + + uint256 totalValue; + uint256 balanceOfSystemReward = address(SYSTEM_REWARD_ADDR).balance; + if (balanceOfSystemReward.sub(MAX_SYSTEM_REWARD_BALANCE) > 0) { + totalValue = balanceOfSystemReward.div(100); + } else if (balanceOfSystemReward.sub(previousBalanceOfSystemReward) > 0) { + totalValue = (balanceOfSystemReward.sub(previousBalanceOfSystemReward).mul(finalityRewardRatio).div(100)); + } else { + return; + } + + totalValue = ISystemReward(SYSTEM_REWARD_ADDR).claimRewards(payable(address(this)), totalValue); + previousBalanceOfSystemReward = address(SYSTEM_REWARD_ADDR).balance; + if (totalValue == 0) { + return; + } + + uint256 totalWeight; + for (uint256 i; i 0) { + Validator storage validator = currentValidatorSet[index - 1]; + if (validator.jailed) { + emit deprecatedFinalityRewardDeposit(valAddr, value); + } else { + totalInComing = totalInComing.add(value); + validator.incoming = validator.incoming.add(value); + emit finalityRewardDeposit(valAddr, value); + } + } else { + // get incoming from deprecated validator; + emit deprecatedFinalityRewardDeposit(valAddr, value); + } + } + + } + function getWorkingValidatorCount() public view returns(uint256 workingValidatorCount) { workingValidatorCount = getValidators().length; uint256 _numOfCabinets = numOfCabinets > 0 ? numOfCabinets : INIT_NUM_OF_CABINETS; @@ -584,7 +709,7 @@ contract BSCValidatorSet is IBSCValidatorSet, System, IParamSubscriber, IApplica if (_numOfCabinets == 0) { _numOfCabinets = INIT_NUM_OF_CABINETS; } - require(newMaxNumOfMaintaining < _numOfCabinets, "the maxNumOfMaintaining must be less than numOfCaninates"); + require(newMaxNumOfMaintaining < _numOfCabinets, "the maxNumOfMaintaining must be less than numOfCabinets"); maxNumOfMaintaining = newMaxNumOfMaintaining; } else if (Memory.compareStrings(key, "maintainSlashScale")) { require(value.length == 32, "length of maintainSlashScale mismatch"); @@ -609,6 +734,11 @@ contract BSCValidatorSet is IBSCValidatorSet, System, IParamSubscriber, IApplica require(newNumOfCabinets > 0, "the numOfCabinets must be greater than 0"); require(newNumOfCabinets <= MAX_NUM_OF_VALIDATORS, "the numOfCabinets must be less than MAX_NUM_OF_VALIDATORS"); numOfCabinets = newNumOfCabinets; + } else if (Memory.compareStrings(key, "finalityRewardRatio")) { + require(value.length == 32, "length of finalityRewardRatio mismatch"); + uint256 newFinalityRewardRatio = BytesToTypes.bytesToUint256(32, value); + require(newFinalityRewardRatio >= 1 && newFinalityRewardRatio <= 100, "the finalityRewardRatio is out of range"); + finalityRewardRatio = newFinalityRewardRatio; } else { require(false, "unknown param"); } @@ -616,29 +746,14 @@ contract BSCValidatorSet is IBSCValidatorSet, System, IParamSubscriber, IApplica } /*********************** Internal Functions **************************/ - - function checkValidatorSet(Validator[] memory validatorSet) private pure returns(bool, string memory) { - if (validatorSet.length > MAX_NUM_OF_VALIDATORS){ - return (false, "the number of validators exceed the limit"); - } - for (uint i; i < validatorSet.length; ++i) { - for (uint j = 0; jm) { - for (uint i = m; i < n; ++i) { + for (uint i=m; in) { ValidatorExtra memory validatorExtra; - for (uint i = n; i < m; ++i) { + for (uint i=n; i < m; ++i) { + validatorExtra.voteAddress = voteAddrs[i]; currentValidatorSet.push(validatorSet[i]); validatorExtraSet.push(validatorExtra); currentValidatorSetMap[validatorSet[i].consensusAddress] = i+1; @@ -677,7 +796,7 @@ contract BSCValidatorSet is IBSCValidatorSet, System, IParamSubscriber, IApplica // should not happen, still protect numOfMaintaining = 0; n = currentValidatorSet.length; - for (uint i; i < n; ++i) { + for (uint i; i previousHeight, "can not do this twice in one block"); + _; + previousHeight = block.number; + } + /*********************** events **************************/ event validatorSetUpdated(); event validatorJailed(address indexed validator); @@ -139,12 +158,14 @@ contract BSCValidatorSet is IBSCValidatorSet, System, IParamSubscriber, IApplica event feeBurned(uint256 amount); event validatorEnterMaintenance(address indexed validator); event validatorExitMaintenance(address indexed validator); + event finalityRewardDeposit(address indexed validator, uint256 amount); + event deprecatedFinalityRewardDeposit(address indexed validator, uint256 amount); /*********************** init **************************/ function init() external onlyNotInit{ (IbcValidatorSetPackage memory validatorSetPkg, bool valid)= decodeValidatorSetSynPackage(INIT_VALIDATORSET_BYTES); require(valid, "failed to parse init validatorSet"); - for (uint i;i MAX_NUM_OF_VALIDATORS) { + emit failReasonWithStr("the number of validators exceed the limit"); return ERROR_FAIL_CHECK_VALIDATORS; } + for (uint i; i= DUSTY_INCOMING) { - ++crossSize; - } else if (currentValidatorSet[i].incoming > 0) { - ++directSize; - } - } - - //cross transfer - address[] memory crossAddrs = new address[](crossSize); - uint256[] memory crossAmounts = new uint256[](crossSize); - uint256[] memory crossIndexes = new uint256[](crossSize); - address[] memory crossRefundAddrs = new address[](crossSize); - uint256 crossTotal; - // direct transfer - address payable[] memory directAddrs = new address payable[](directSize); - uint256[] memory directAmounts = new uint256[](directSize); - crossSize = 0; - directSize = 0; - uint256 relayFee = ITokenHub(TOKEN_HUB_ADDR).getMiniRelayFee(); - if (relayFee > DUSTY_INCOMING) { - emit failReasonWithStr("fee is larger than DUSTY_INCOMING"); - return ERROR_RELAYFEE_TOO_LARGE; - } - for (uint i; i < validatorsNum; ++i) { - if (currentValidatorSet[i].incoming >= DUSTY_INCOMING) { - crossAddrs[crossSize] = currentValidatorSet[i].BBCFeeAddress; - uint256 value = currentValidatorSet[i].incoming - currentValidatorSet[i].incoming % PRECISION; - crossAmounts[crossSize] = value.sub(relayFee); - crossRefundAddrs[crossSize] = currentValidatorSet[i].BBCFeeAddress; - crossIndexes[crossSize] = i; - crossTotal = crossTotal.add(value); - ++crossSize; - } else if (currentValidatorSet[i].incoming > 0) { - directAddrs[directSize] = currentValidatorSet[i].feeAddress; - directAmounts[directSize] = currentValidatorSet[i].incoming; - ++directSize; - } - } - - //step 2: do cross chain transfer - bool failCross = false; - if (crossTotal > 0) { - try ITokenHub(TOKEN_HUB_ADDR).batchTransferOutBNB{value:crossTotal}(crossAddrs, crossAmounts, crossRefundAddrs, uint64(block.timestamp + expireTimeSecondGap)) returns (bool success) { - if (success) { - emit batchTransfer(crossTotal); - } else { - emit batchTransferFailed(crossTotal, "batch transfer return false"); + (Validator[] memory validatorSetTemp, bytes[] memory voteAddrsTemp) = _forceMaintainingValidatorsExit(validatorSet, voteAddrs); + + { + //step 1: do calculate distribution, do not make it as an internal function for saving gas. + uint crossSize; + uint directSize; + uint validatorsNum = currentValidatorSet.length; + for (uint i; i= DUSTY_INCOMING) { + ++crossSize; + } else if (currentValidatorSet[i].incoming > 0) { + ++directSize; } - }catch Error(string memory reason) { - failCross = true; - emit batchTransferFailed(crossTotal, reason); - }catch (bytes memory lowLevelData) { - failCross = true; - emit batchTransferLowerFailed(crossTotal, lowLevelData); } - } - if (failCross) { - for (uint i; i< crossIndexes.length;++i) { - uint idx = crossIndexes[i]; - bool success = currentValidatorSet[idx].feeAddress.send(currentValidatorSet[idx].incoming); - if (success) { - emit directTransfer(currentValidatorSet[idx].feeAddress, currentValidatorSet[idx].incoming); - } else { - emit directTransferFail(currentValidatorSet[idx].feeAddress, currentValidatorSet[idx].incoming); + //cross transfer + address[] memory crossAddrs = new address[](crossSize); + uint256[] memory crossAmounts = new uint256[](crossSize); + uint256[] memory crossIndexes = new uint256[](crossSize); + address[] memory crossRefundAddrs = new address[](crossSize); + uint256 crossTotal; + // direct transfer + address payable[] memory directAddrs = new address payable[](directSize); + uint256[] memory directAmounts = new uint256[](directSize); + crossSize = 0; + directSize = 0; + uint256 relayFee = ITokenHub(TOKEN_HUB_ADDR).getMiniRelayFee(); + if (relayFee > DUSTY_INCOMING) { + emit failReasonWithStr("fee is larger than DUSTY_INCOMING"); + return ERROR_RELAYFEE_TOO_LARGE; + } + for (uint i; i= DUSTY_INCOMING) { + crossAddrs[crossSize] = currentValidatorSet[i].BBCFeeAddress; + uint256 value = currentValidatorSet[i].incoming - currentValidatorSet[i].incoming % PRECISION; + crossAmounts[crossSize] = value.sub(relayFee); + crossRefundAddrs[crossSize] = currentValidatorSet[i].BBCFeeAddress; + crossIndexes[crossSize] = i; + crossTotal = crossTotal.add(value); + ++crossSize; + } else if (currentValidatorSet[i].incoming > 0) { + directAddrs[directSize] = currentValidatorSet[i].feeAddress; + directAmounts[directSize] = currentValidatorSet[i].incoming; + ++directSize; } } - } - // step 3: direct transfer - if (directAddrs.length>0) { - for (uint i;i 0) { + try ITokenHub(TOKEN_HUB_ADDR).batchTransferOutBNB{value : crossTotal}(crossAddrs, crossAmounts, crossRefundAddrs, uint64(block.timestamp + expireTimeSecondGap)) returns (bool success) { + if (success) { + emit batchTransfer(crossTotal); + } else { + emit batchTransferFailed(crossTotal, "batch transfer return false"); + } + }catch Error(string memory reason) { + failCross = true; + emit batchTransferFailed(crossTotal, reason); + }catch (bytes memory lowLevelData) { + failCross = true; + emit batchTransferLowerFailed(crossTotal, lowLevelData); + } + } + + if (failCross) { + for (uint i; i0) { + for (uint i; i0) { - doUpdateState(validatorSetTemp); + doUpdateState(validatorSetTemp, voteAddrsTemp); } // step 6: clean slash contract @@ -372,13 +404,16 @@ contract BSCValidatorSet is IBSCValidatorSet, System, IParamSubscriber, IApplica * @dev With each epoch, there will be a partial rotation between cabinets and candidates. Rotation is determined by this function * */ - function shuffle(address[] memory validators, uint256 epochNumber, uint startIdx, uint offset, uint limit, uint modNumber) internal pure { + function shuffle(address[] memory validators, bytes[] memory voteAddrs, uint256 epochNumber, uint startIdx, uint offset, uint limit, uint modNumber) internal pure { for (uint i; i 0) { uint256 epochNumber = block.number / EPOCH; - shuffle(validators, epochNumber, _numOfCabinets-_maxNumOfWorkingCandidates, 0, _maxNumOfWorkingCandidates, _numOfCabinets); - shuffle(validators, epochNumber, _numOfCabinets-_maxNumOfWorkingCandidates, _numOfCabinets-_maxNumOfWorkingCandidates, - _maxNumOfWorkingCandidates, validators.length-_numOfCabinets+_maxNumOfWorkingCandidates); + shuffle(validators, voteAddrs, epochNumber, _numOfCabinets-_maxNumOfWorkingCandidates, 0, _maxNumOfWorkingCandidates, _numOfCabinets); + shuffle(validators, voteAddrs, epochNumber, _numOfCabinets-_maxNumOfWorkingCandidates, _numOfCabinets-_maxNumOfWorkingCandidates, + _maxNumOfWorkingCandidates, validators.length - _numOfCabinets+_maxNumOfWorkingCandidates); } address[] memory miningValidators = new address[](_numOfCabinets); + bytes[] memory miningVoteAddrs = new bytes[](_numOfCabinets); for (uint i; i<_numOfCabinets; ++i) { miningValidators[i] = validators[i]; + miningVoteAddrs[i] = voteAddrs[i]; } - return miningValidators; + return (miningValidators, miningVoteAddrs); } /** @@ -470,6 +538,55 @@ contract BSCValidatorSet is IBSCValidatorSet, System, IParamSubscriber, IApplica return isWorkingValidator(index); } + function distributeFinalityReward(address[] calldata valAddrs, uint256[] calldata weights) external onlyCoinbase oncePerBlock onlyInit { + // first time to call this function + if (finalityRewardRatio == 0) { + finalityRewardRatio = INIT_FINALITY_REWARD_RATIO; + previousBalanceOfSystemReward = address(SYSTEM_REWARD_ADDR).balance; + return; + } + + uint256 totalValue; + uint256 balanceOfSystemReward = address(SYSTEM_REWARD_ADDR).balance; + if (balanceOfSystemReward.sub(MAX_SYSTEM_REWARD_BALANCE) > 0) { + totalValue = balanceOfSystemReward.div(100); + } else if (balanceOfSystemReward.sub(previousBalanceOfSystemReward) > 0) { + totalValue = (balanceOfSystemReward.sub(previousBalanceOfSystemReward).mul(finalityRewardRatio).div(100)); + } else { + return; + } + + totalValue = ISystemReward(SYSTEM_REWARD_ADDR).claimRewards(payable(address(this)), totalValue); + previousBalanceOfSystemReward = address(SYSTEM_REWARD_ADDR).balance; + if (totalValue == 0) { + return; + } + + uint256 value; + address valAddr; + uint256 index; + + for (uint256 i; i 0) { + Validator storage validator = currentValidatorSet[index - 1]; + if (validator.jailed) { + emit deprecatedFinalityRewardDeposit(valAddr, value); + } else { + totalInComing = totalInComing.add(value); + validator.incoming = validator.incoming.add(value); + emit finalityRewardDeposit(valAddr, value); + } + } else { + // get incoming from deprecated validator; + emit deprecatedFinalityRewardDeposit(valAddr, value); + } + } + + } + function getWorkingValidatorCount() public view returns(uint256 workingValidatorCount) { workingValidatorCount = getValidators().length; uint256 _numOfCabinets = numOfCabinets > 0 ? numOfCabinets : INIT_NUM_OF_CABINETS; @@ -584,7 +701,7 @@ contract BSCValidatorSet is IBSCValidatorSet, System, IParamSubscriber, IApplica if (_numOfCabinets == 0) { _numOfCabinets = INIT_NUM_OF_CABINETS; } - require(newMaxNumOfMaintaining < _numOfCabinets, "the maxNumOfMaintaining must be less than numOfCaninates"); + require(newMaxNumOfMaintaining < _numOfCabinets, "the maxNumOfMaintaining must be less than numOfCabinets"); maxNumOfMaintaining = newMaxNumOfMaintaining; } else if (Memory.compareStrings(key, "maintainSlashScale")) { require(value.length == 32, "length of maintainSlashScale mismatch"); @@ -609,6 +726,11 @@ contract BSCValidatorSet is IBSCValidatorSet, System, IParamSubscriber, IApplica require(newNumOfCabinets > 0, "the numOfCabinets must be greater than 0"); require(newNumOfCabinets <= MAX_NUM_OF_VALIDATORS, "the numOfCabinets must be less than MAX_NUM_OF_VALIDATORS"); numOfCabinets = newNumOfCabinets; + } else if (Memory.compareStrings(key, "finalityRewardRatio")) { + require(value.length == 32, "length of finalityRewardRatio mismatch"); + uint256 newFinalityRewardRatio = BytesToTypes.bytesToUint256(32, value); + require(newFinalityRewardRatio >= 1 && newFinalityRewardRatio <= 100, "the finalityRewardRatio is out of range"); + finalityRewardRatio = newFinalityRewardRatio; } else { require(false, "unknown param"); } @@ -616,29 +738,14 @@ contract BSCValidatorSet is IBSCValidatorSet, System, IParamSubscriber, IApplica } /*********************** Internal Functions **************************/ - - function checkValidatorSet(Validator[] memory validatorSet) private pure returns(bool, string memory) { - if (validatorSet.length > MAX_NUM_OF_VALIDATORS){ - return (false, "the number of validators exceed the limit"); - } - for (uint i; i < validatorSet.length; ++i) { - for (uint j = 0; jm) { - for (uint i = m; i < n; ++i) { + for (uint i=m; in) { - ValidatorExtra memory validatorExtra; - for (uint i = n; i < m; ++i) { + ValidatorExtra memory _validatorExtra; + for (uint i = n; i < m; i++) { + _validatorExtra.voteAddress = voteAddrs[i]; currentValidatorSet.push(validatorSet[i]); - validatorExtraSet.push(validatorExtra); + validatorExtraSet.push(_validatorExtra); currentValidatorSetMap[validatorSet[i].consensusAddress] = i+1; } } @@ -677,7 +788,7 @@ contract BSCValidatorSet is IBSCValidatorSet, System, IParamSubscriber, IApplica // should not happen, still protect numOfMaintaining = 0; n = currentValidatorSet.length; - for (uint i; i < n; ++i) { + for (uint i; i previousHeight, "can not slash twice in one block"); _; @@ -115,19 +140,18 @@ contract SlashIndicator is ISlashIndicator,System,IParamSubscriber, IApplication emit validatorSlashed(validator); } - // To prevent validator misbehaving and leaving, do not clean slash record to zero, but decrease by felonyThreshold/DECREASE_RATE . // Clean is an effective implement to reorganize "validators" and "indicators". function clean() external override(ISlashIndicator) onlyValidatorContract onlyInit{ - if(validators.length == 0){ + if (validators.length == 0) { return; } - uint i = 0; + uint i; uint j = validators.length-1; - for (;i <= j;) { + for ( ; i<=j; ) { bool findLeft = false; bool findRight = false; - for(;i felonyThreshold/DECREASE_RATE){ leftIndicator.count = leftIndicator.count - felonyThreshold/DECREASE_RATE; @@ -137,7 +161,7 @@ contract SlashIndicator is ISlashIndicator,System,IParamSubscriber, IApplication break; } } - for(;i<=j;--j){ + for( ; i<=j; --j){ Indicator memory rightIndicator = indicators[validators[j]]; if(rightIndicator.count > felonyThreshold/DECREASE_RATE){ rightIndicator.count = rightIndicator.count - felonyThreshold/DECREASE_RATE; @@ -170,6 +194,46 @@ contract SlashIndicator is ISlashIndicator,System,IParamSubscriber, IApplication emit indicatorCleaned(); } + function submitFinalityViolationEvidence(FinalityEvidence memory _evidence) public onlyInit onlyRelayer { + if (finalitySlashRewardRatio == 0) { + finalitySlashRewardRatio = INIT_FINALITY_SLASH_REWARD_RATIO; + } + + // Basic check + require(_evidence.voteA.srcNum+256 > block.number && + _evidence.voteB.srcNum+256 > block.number, "too old block involved"); + require(!(_evidence.voteA.srcHash == _evidence.voteB.srcHash && + _evidence.voteA.tarHash == _evidence.voteB.tarHash), "two identical votes"); + require(_evidence.voteA.srcNum < _evidence.voteA.tarNum && + _evidence.voteB.srcNum < _evidence.voteB.tarNum, "srcNum bigger than tarNum"); + + // Vote rules check + require((_evidence.voteA.srcNum<_evidence.voteB.srcNum && _evidence.voteB.tarNum<_evidence.voteA.tarNum) || + (_evidence.voteB.srcNum<_evidence.voteA.srcNum && _evidence.voteA.tarNum<_evidence.voteB.tarNum) || + _evidence.voteA.tarNum == _evidence.voteB.tarNum, "no violation of vote rules"); + + // BLS verification + (address[] memory vals, bytes[] memory voteAddrs) = IBSCValidatorSet(VALIDATOR_CONTRACT_ADDR).getLivingValidators(); + address valAddr; + bytes memory voteAddr = _evidence.voteAddr; + for (uint i; i < voteAddrs.length; ++i) { + if (BytesLib.equal(voteAddrs[i], voteAddr)) { + valAddr = vals[i]; + break; + } + } + require(valAddr != address(0), "validator not exist"); + + require(verifyBLSSignature(_evidence.voteA, _evidence.voteAddr) && + verifyBLSSignature(_evidence.voteB, _evidence.voteAddr), "verify signature failed"); + + uint256 amount = (address(SYSTEM_REWARD_ADDR).balance * finalitySlashRewardRatio) / 100; + ISystemReward(SYSTEM_REWARD_ADDR).claimRewards(msg.sender, amount); + IBSCValidatorSet(VALIDATOR_CONTRACT_ADDR).felony(valAddr); + ICrossChain(CROSS_CHAIN_CONTRACT_ADDR).sendSynPackage(SLASH_CHANNELID, encodeSlashPackage(valAddr), 0); + emit validatorSlashed(valAddr); + } + /** * @dev Send a felony cross-chain package to jail a validator * @@ -179,6 +243,45 @@ contract SlashIndicator is ISlashIndicator,System,IParamSubscriber, IApplication ICrossChain(CROSS_CHAIN_CONTRACT_ADDR).sendSynPackage(SLASH_CHANNELID, encodeSlashPackage(validator), 0); } + function verifyBLSSignature(VoteData memory vote, bytes memory voteAddr) internal view returns(bool) { + bytes[] memory elements = new bytes[](4); + bytes memory _bytes = new bytes(32); + elements[0] = vote.srcNum.encodeUint(); + TypesToBytes.bytes32ToBytes(32, vote.srcHash, _bytes); + elements[1] = _bytes.encodeBytes(); + elements[2] = vote.tarNum.encodeUint(); + TypesToBytes.bytes32ToBytes(32, vote.tarHash, _bytes); + elements[3] = _bytes.encodeBytes(); + + TypesToBytes.bytes32ToBytes(32, keccak256(elements.encodeList()), _bytes); + + // assemble input data + bytes memory input = new bytes(176); + bytesConcat(input, _bytes, 0, 32); + bytesConcat(input, vote.sig, 32, 96); + bytesConcat(input, voteAddr, 128, 48); + + // call the precompiled contract to verify the BLS signature + // the precompiled contract's address is 0x66 + bytes memory output = new bytes(1); + assembly { + let len := mload(input) + if iszero(staticcall(not(0), 0x66, add(input, 0x20), len, add(output, 0x20), 0x01)) { + revert(0, 0) + } + } + if (BytesLib.toUint8(output, 0) != uint8(1)) { + return false; + } + return true; + } + + function bytesConcat(bytes memory data, bytes memory _bytes, uint256 index, uint256 len) internal pure { + for (uint i; i misdemeanorThreshold, "the felonyThreshold out of range"); felonyThreshold = newFelonyThreshold; + } else if (Memory.compareStrings(key, "finalitySlashRewardRatio")) { + require(value.length == 32, "length of finalitySlashRewardRatio mismatch"); + uint256 newFinalitySlashRewardRatio = BytesToTypes.bytesToUint256(32, value); + require(newFinalitySlashRewardRatio >= 10 && newFinalitySlashRewardRatio < 100, "the finality slash reward ratio out of range"); + finalitySlashRewardRatio = newFinalitySlashRewardRatio; } else { require(false, "unknown param"); } diff --git a/contracts/SlashIndicator.template b/contracts/SlashIndicator.template index 647e937c..a3ecf96f 100644 --- a/contracts/SlashIndicator.template +++ b/contracts/SlashIndicator.template @@ -1,12 +1,17 @@ pragma solidity 0.6.4; +pragma experimental ABIEncoderV2; + import "./System.sol"; import "./lib/BytesToTypes.sol"; +import "./lib/TypesToBytes.sol"; +import "./lib/BytesLib.sol"; import "./lib/Memory.sol"; import "./interface/ISlashIndicator.sol"; import "./interface/IApplication.sol"; import "./interface/IBSCValidatorSet.sol"; import "./interface/IParamSubscriber.sol"; import "./interface/ICrossChain.sol"; +import "./interface/ISystemReward.sol"; import "./lib/CmnPkg.sol"; import "./lib/RLPEncode.sol"; @@ -28,6 +33,11 @@ contract SlashIndicator is ISlashIndicator,System,IParamSubscriber, IApplication uint256 public misdemeanorThreshold; uint256 public felonyThreshold; + // BEP-126 Fast Finality + uint256 public constant INIT_FINALITY_SLASH_REWARD_RATIO = 20; + + uint256 public finalitySlashRewardRatio; + event validatorSlashed(address indexed validator); event indicatorCleaned(); event paramChange(string key, bytes value); @@ -44,6 +54,21 @@ contract SlashIndicator is ISlashIndicator,System,IParamSubscriber, IApplication bool exist; } + // Proof that a validator misbehaved in fast finality + struct VoteData { + uint256 srcNum; + bytes32 srcHash; + uint256 tarNum; + bytes32 tarHash; + bytes sig; + } + + struct FinalityEvidence { + VoteData voteA; + VoteData voteB; + bytes voteAddr; + } + modifier oncePerBlock() { require(block.number > previousHeight, "can not slash twice in one block"); _; @@ -120,19 +145,18 @@ contract SlashIndicator is ISlashIndicator,System,IParamSubscriber, IApplication emit validatorSlashed(validator); } - // To prevent validator misbehaving and leaving, do not clean slash record to zero, but decrease by felonyThreshold/DECREASE_RATE . // Clean is an effective implement to reorganize "validators" and "indicators". function clean() external override(ISlashIndicator) onlyValidatorContract onlyInit{ - if(validators.length == 0){ + if (validators.length == 0) { return; } - uint i = 0; + uint i; uint j = validators.length-1; - for (;i <= j;) { + for ( ; i<=j; ) { bool findLeft = false; bool findRight = false; - for(;i felonyThreshold/DECREASE_RATE){ leftIndicator.count = leftIndicator.count - felonyThreshold/DECREASE_RATE; @@ -142,7 +166,7 @@ contract SlashIndicator is ISlashIndicator,System,IParamSubscriber, IApplication break; } } - for(;i<=j;--j){ + for( ; i<=j; --j){ Indicator memory rightIndicator = indicators[validators[j]]; if(rightIndicator.count > felonyThreshold/DECREASE_RATE){ rightIndicator.count = rightIndicator.count - felonyThreshold/DECREASE_RATE; @@ -175,6 +199,46 @@ contract SlashIndicator is ISlashIndicator,System,IParamSubscriber, IApplication emit indicatorCleaned(); } + function submitFinalityViolationEvidence(FinalityEvidence memory _evidence) public onlyInit onlyRelayer { + if (finalitySlashRewardRatio == 0) { + finalitySlashRewardRatio = INIT_FINALITY_SLASH_REWARD_RATIO; + } + + // Basic check + require(_evidence.voteA.srcNum+256 > block.number && + _evidence.voteB.srcNum+256 > block.number, "too old block involved"); + require(!(_evidence.voteA.srcHash == _evidence.voteB.srcHash && + _evidence.voteA.tarHash == _evidence.voteB.tarHash), "two identical votes"); + require(_evidence.voteA.srcNum < _evidence.voteA.tarNum && + _evidence.voteB.srcNum < _evidence.voteB.tarNum, "srcNum bigger than tarNum"); + + // Vote rules check + require((_evidence.voteA.srcNum<_evidence.voteB.srcNum && _evidence.voteB.tarNum<_evidence.voteA.tarNum) || + (_evidence.voteB.srcNum<_evidence.voteA.srcNum && _evidence.voteA.tarNum<_evidence.voteB.tarNum) || + _evidence.voteA.tarNum == _evidence.voteB.tarNum, "no violation of vote rules"); + + // BLS verification + (address[] memory vals, bytes[] memory voteAddrs) = IBSCValidatorSet(VALIDATOR_CONTRACT_ADDR).getLivingValidators(); + address valAddr; + bytes memory voteAddr = _evidence.voteAddr; + for (uint i; i < voteAddrs.length; ++i) { + if (BytesLib.equal(voteAddrs[i], voteAddr)) { + valAddr = vals[i]; + break; + } + } + require(valAddr != address(0), "validator not exist"); + + require(verifyBLSSignature(_evidence.voteA, _evidence.voteAddr) && + verifyBLSSignature(_evidence.voteB, _evidence.voteAddr), "verify signature failed"); + + uint256 amount = (address(SYSTEM_REWARD_ADDR).balance * finalitySlashRewardRatio) / 100; + ISystemReward(SYSTEM_REWARD_ADDR).claimRewards(msg.sender, amount); + IBSCValidatorSet(VALIDATOR_CONTRACT_ADDR).felony(valAddr); + ICrossChain(CROSS_CHAIN_CONTRACT_ADDR).sendSynPackage(SLASH_CHANNELID, encodeSlashPackage(valAddr), 0); + emit validatorSlashed(valAddr); + } + /** * @dev Send a felony cross-chain package to jail a validator * @@ -184,6 +248,45 @@ contract SlashIndicator is ISlashIndicator,System,IParamSubscriber, IApplication ICrossChain(CROSS_CHAIN_CONTRACT_ADDR).sendSynPackage(SLASH_CHANNELID, encodeSlashPackage(validator), 0); } + function verifyBLSSignature(VoteData memory vote, bytes memory voteAddr) internal view returns(bool) { + bytes[] memory elements = new bytes[](4); + bytes memory _bytes = new bytes(32); + elements[0] = vote.srcNum.encodeUint(); + TypesToBytes.bytes32ToBytes(32, vote.srcHash, _bytes); + elements[1] = _bytes.encodeBytes(); + elements[2] = vote.tarNum.encodeUint(); + TypesToBytes.bytes32ToBytes(32, vote.tarHash, _bytes); + elements[3] = _bytes.encodeBytes(); + + TypesToBytes.bytes32ToBytes(32, keccak256(elements.encodeList()), _bytes); + + // assemble input data + bytes memory input = new bytes(176); + bytesConcat(input, _bytes, 0, 32); + bytesConcat(input, vote.sig, 32, 96); + bytesConcat(input, voteAddr, 128, 48); + + // call the precompiled contract to verify the BLS signature + // the precompiled contract's address is 0x66 + bytes memory output = new bytes(1); + assembly { + let len := mload(input) + if iszero(staticcall(not(0), 0x66, add(input, 0x20), len, add(output, 0x20), 0x01)) { + revert(0, 0) + } + } + if (BytesLib.toUint8(output, 0) != uint8(1)) { + return false; + } + return true; + } + + function bytesConcat(bytes memory data, bytes memory _bytes, uint256 index, uint256 len) internal pure { + for (uint i; i misdemeanorThreshold, "the felonyThreshold out of range"); felonyThreshold = newFelonyThreshold; + } else if (Memory.compareStrings(key, "finalitySlashRewardRatio")) { + require(value.length == 32, "length of finalitySlashRewardRatio mismatch"); + uint256 newFinalitySlashRewardRatio = BytesToTypes.bytesToUint256(32, value); + require(newFinalitySlashRewardRatio >= 10 && newFinalitySlashRewardRatio < 100, "the finality slash reward ratio out of range"); + finalitySlashRewardRatio = newFinalitySlashRewardRatio; } else { require(false, "unknown param"); } diff --git a/contracts/SystemReward.sol b/contracts/SystemReward.sol index ffaa2a60..7669d23f 100644 --- a/contracts/SystemReward.sol +++ b/contracts/SystemReward.sol @@ -1,14 +1,16 @@ pragma solidity 0.6.4; + import "./System.sol"; +import "./lib/Memory.sol"; +import "./interface/IParamSubscriber.sol"; import "./interface/ISystemReward.sol"; -contract SystemReward is System, ISystemReward{ +contract SystemReward is System, IParamSubscriber, ISystemReward { uint256 public constant MAX_REWARDS = 1e18; uint public numOperator; mapping(address => bool) operators; - modifier doInit() { if (!alreadyInit) { operators[LIGHT_CLIENT_ADDR] = true; @@ -19,16 +21,17 @@ contract SystemReward is System, ISystemReward{ _; } - modifier onlyOperator() { require(operators[msg.sender],"only operator is allowed to call the method"); _; } - + event rewardTo(address indexed to, uint256 amount); event rewardEmpty(); event receiveDeposit(address indexed from, uint256 amount); - + event addOperator(address indexed operator); + event deleteOperator(address indexed operator); + event paramChange(string key, bytes value); receive() external payable{ if (msg.value>0) { @@ -36,13 +39,12 @@ contract SystemReward is System, ISystemReward{ } } - - function claimRewards(address payable to, uint256 amount) external override(ISystemReward) doInit onlyOperator returns(uint256) { + function claimRewards(address payable to, uint256 amount) external override(ISystemReward) doInit onlyOperator returns (uint256) { uint256 actualAmount = amount < address(this).balance ? amount : address(this).balance; if (actualAmount > MAX_REWARDS) { actualAmount = MAX_REWARDS; } - if (actualAmount>0) { + if (actualAmount != 0) { to.transfer(actualAmount); emit rewardTo(to, actualAmount); } else { @@ -54,4 +56,29 @@ contract SystemReward is System, ISystemReward{ function isOperator(address addr) external view returns (bool) { return operators[addr]; } -} \ No newline at end of file + + function updateParam(string calldata key, bytes calldata value) onlyGov external override { + if (Memory.compareStrings(key, "addOperator")) { + bytes memory valueLocal = value; + require(valueLocal.length == 20, "length of value for addOperator should be 20"); + address operatorAddr; + assembly { + operatorAddr := mload(add(valueLocal, 20)) + } + operators[operatorAddr] = true; + emit addOperator(operatorAddr); + } else if (Memory.compareStrings(key, "deleteOperator")) { + bytes memory valueLocal = value; + require(valueLocal.length == 20, "length of value for deleteOperator should be 20"); + address operatorAddr; + assembly { + operatorAddr := mload(add(valueLocal, 20)) + } + delete operators[operatorAddr]; + emit deleteOperator(operatorAddr); + } else { + require(false, "unknown param"); + } + emit paramChange(key, value); + } +} diff --git a/contracts/SystemReward.template b/contracts/SystemReward.template index b5dec8a1..7669d23f 100644 --- a/contracts/SystemReward.template +++ b/contracts/SystemReward.template @@ -1,14 +1,16 @@ pragma solidity 0.6.4; + import "./System.sol"; +import "./lib/Memory.sol"; +import "./interface/IParamSubscriber.sol"; import "./interface/ISystemReward.sol"; -contract SystemReward is System, ISystemReward{ +contract SystemReward is System, IParamSubscriber, ISystemReward { uint256 public constant MAX_REWARDS = 1e18; uint public numOperator; mapping(address => bool) operators; - modifier doInit() { if (!alreadyInit) { operators[LIGHT_CLIENT_ADDR] = true; @@ -19,19 +21,17 @@ contract SystemReward is System, ISystemReward{ _; } - modifier onlyOperator() { require(operators[msg.sender],"only operator is allowed to call the method"); _; } - {% if mock %} - event newOperator(address indexed operator); - event deleteOperator(address indexed operator); - {% endif %} + event rewardTo(address indexed to, uint256 amount); event rewardEmpty(); event receiveDeposit(address indexed from, uint256 amount); - + event addOperator(address indexed operator); + event deleteOperator(address indexed operator); + event paramChange(string key, bytes value); receive() external payable{ if (msg.value>0) { @@ -39,35 +39,12 @@ contract SystemReward is System, ISystemReward{ } } - {% if mock %} - modifier onlyOperatorExist(address _operator) { - require(operators[_operator], "the operator do not exist"); - _; - } - - modifier onlyOperatorNotExist(address _operator) { - require(!operators[_operator],"the operator already exist"); - _; - } - - function addOperator(address operator) external doInit onlyOperatorNotExist(operator) { - operators[operator] = true; - ++numOperator; - emit newOperator(operator); - } - - function removeOperator(address operator) external doInit onlyOperatorExist(operator) { - delete operators[operator]; - --numOperator; - emit deleteOperator(operator); - } - {% endif %} - function claimRewards(address payable to, uint256 amount) external override(ISystemReward) doInit onlyOperator returns(uint256) { + function claimRewards(address payable to, uint256 amount) external override(ISystemReward) doInit onlyOperator returns (uint256) { uint256 actualAmount = amount < address(this).balance ? amount : address(this).balance; if (actualAmount > MAX_REWARDS) { actualAmount = MAX_REWARDS; } - if (actualAmount>0) { + if (actualAmount != 0) { to.transfer(actualAmount); emit rewardTo(to, actualAmount); } else { @@ -79,4 +56,29 @@ contract SystemReward is System, ISystemReward{ function isOperator(address addr) external view returns (bool) { return operators[addr]; } -} \ No newline at end of file + + function updateParam(string calldata key, bytes calldata value) onlyGov external override { + if (Memory.compareStrings(key, "addOperator")) { + bytes memory valueLocal = value; + require(valueLocal.length == 20, "length of value for addOperator should be 20"); + address operatorAddr; + assembly { + operatorAddr := mload(add(valueLocal, 20)) + } + operators[operatorAddr] = true; + emit addOperator(operatorAddr); + } else if (Memory.compareStrings(key, "deleteOperator")) { + bytes memory valueLocal = value; + require(valueLocal.length == 20, "length of value for deleteOperator should be 20"); + address operatorAddr; + assembly { + operatorAddr := mload(add(valueLocal, 20)) + } + delete operators[operatorAddr]; + emit deleteOperator(operatorAddr); + } else { + require(false, "unknown param"); + } + emit paramChange(key, value); + } +} diff --git a/contracts/interface/IBSCValidatorSet.sol b/contracts/interface/IBSCValidatorSet.sol index 513c9289..3a6f2407 100644 --- a/contracts/interface/IBSCValidatorSet.sol +++ b/contracts/interface/IBSCValidatorSet.sol @@ -1,7 +1,10 @@ pragma solidity 0.6.4; +pragma experimental ABIEncoderV2; interface IBSCValidatorSet { function misdemeanor(address validator) external; function felony(address validator)external; function isCurrentValidator(address validator) external view returns (bool); + function getLivingValidators() external view returns(address[] memory, bytes[] memory); + function getMiningValidators() external view returns(address[] memory, bytes[] memory); } diff --git a/generate-validator.js b/generate-validator.js index b23556fb..7246b684 100644 --- a/generate-validator.js +++ b/generate-validator.js @@ -1,10 +1,11 @@ const fs = require("fs"); const readline = require('readline'); const nunjucks = require("nunjucks"); - +const BLSKeys = require("./BLSkeystore.json"); async function processValidatorConf() { - const fileStream = fs.createReadStream(__dirname + '/validators.conf'); + const fileStream = fs.createReadStream(__dirname + "/validators.conf"); + const publicKey = BLSKeys.public_key; const rl = readline.createInterface({ input: fileStream, @@ -19,14 +20,16 @@ async function processValidatorConf() { feeAddr: vs[1], bscFeeAddr: vs[2], votingPower: vs[3], - }) + bLSPublicKey: "0x" + publicKey.pop() + }); } return validators } -processValidatorConf().then(function (validators) { +processValidatorConf().then(function (validators, bLSPublicKeys) { const data = { - validators: validators + validators: validators, + bLSPublicKeys: bLSPublicKeys, }; const templateString = fs.readFileSync(__dirname + '/validators.template').toString(); const resultString = nunjucks.renderString(templateString, data); diff --git a/genesis-template.json b/genesis-template.json index a421cd51..8636d298 100644 --- a/genesis-template.json +++ b/genesis-template.json @@ -18,6 +18,8 @@ "eulerBlock": 2, "gibbsBlock": 3, "moranBlock": 4, + "bonehBlock": 5, + "lynnBlock": 6, "parlia": { "period": 3, "epoch": 200 diff --git a/genesis.json b/genesis.json index 8785c315..8520d550 100644 --- a/genesis.json +++ b/genesis.json @@ -18,6 +18,8 @@ "eulerBlock": 2, "gibbsBlock": 3, "moranBlock": 4, + "bonehBlock": 5, + "lynnBlock": 6, "parlia": { "period": 3, "epoch": 200 @@ -25,7 +27,7 @@ }, "nonce": "0x0", "timestamp": "0x5e9da7ce", - "extraData": "0x00000000000000000000000000000000000000000000000000000000000000009fb29aac15b9a4b7f17c3385939b007540f4d7910000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "extraData": "0x00000000000000000000000000000000000000000000000000000000000000009fb29aac15b9a4b7f17c3385939b007540f4d79185e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb55880000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "gasLimit": "0x2625a00", "difficulty": "0x1", "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", diff --git a/lib/Deployer.sol b/lib/Deployer.sol index 67d23cb4..b9af68d3 100644 --- a/lib/Deployer.sol +++ b/lib/Deployer.sol @@ -121,4 +121,41 @@ contract Deployer is Test { govHub.handleSynPackage(GOV_CHANNELID, elements.encodeList()); vm.stopPrank(); } + + function encodeOldValidatorSetUpdatePack(uint8 code, address[] memory valSet) internal pure returns (bytes memory) { + bytes[] memory elements = new bytes[](2); + elements[0] = code.encodeUint(); + + bytes[] memory vals = new bytes[](valSet.length); + for (uint256 i; i < valSet.length; ++i) { + bytes[] memory tmp = new bytes[](4); + tmp[0] = valSet[i].encodeAddress(); + tmp[1] = valSet[i].encodeAddress(); + tmp[2] = valSet[i].encodeAddress(); + tmp[3] = uint8(0x64).encodeUint(); + vals[i] = tmp.encodeList(); + } + + elements[1] = vals.encodeList(); + return elements.encodeList(); + } + + function encodeNewValidatorSetUpdatePack(uint8 code, address[] memory valSet, bytes[] memory voteAddrs) internal pure returns (bytes memory) { + bytes[] memory elements = new bytes[](2); + elements[0] = code.encodeUint(); + + bytes[] memory vals = new bytes[](valSet.length); + for (uint256 i; i < valSet.length; ++i) { + bytes[] memory tmp = new bytes[](5); + tmp[0] = valSet[i].encodeAddress(); + tmp[1] = valSet[i].encodeAddress(); + tmp[2] = valSet[i].encodeAddress(); + tmp[3] = uint8(0x64).encodeUint(); + tmp[4] = voteAddrs[i].encodeBytes(); + vals[i] = tmp.encodeList(); + } + + elements[1] = vals.encodeList(); + return elements.encodeList(); + } } diff --git a/lib/RLPDecode.sol b/lib/RLPDecode.sol index 69bcad8c..9ee71ffa 100644 --- a/lib/RLPDecode.sol +++ b/lib/RLPDecode.sol @@ -109,7 +109,11 @@ library RLPDecode { result := byte(0, mload(memPtr)) } - return result == 0 ? false : true; + if (result == 0 || result == STRING_SHORT_START) { + return false; + } else { + return true; + } } function toAddress(RLPItem memory item) internal pure returns (address) { @@ -272,4 +276,4 @@ library RLPDecode { mstore(dest, or(destpart, srcpart)) } } -} \ No newline at end of file +} diff --git a/lib/RLPEncode.sol b/lib/RLPEncode.sol index cc286dbc..423ef0b8 100644 --- a/lib/RLPEncode.sol +++ b/lib/RLPEncode.sol @@ -58,9 +58,7 @@ library RLPEncode { */ function encodeBool(bool self) internal pure returns (bytes memory) { bytes memory rs = new bytes(1); - if (self) { - rs[0] = bytes1(uint8(1)); - } + rs[0] = (self ? bytes1(0x01) : bytes1(0x80)); return rs; } @@ -213,4 +211,4 @@ library RLPEncode { } return rs; } -} \ No newline at end of file +} diff --git a/lib/interface/IBSCValidatorSet.sol b/lib/interface/IBSCValidatorSet.sol index d5364b94..350dba8a 100644 --- a/lib/interface/IBSCValidatorSet.sol +++ b/lib/interface/IBSCValidatorSet.sol @@ -5,10 +5,12 @@ interface BSCValidatorSet { event batchTransferFailed(uint256 indexed amount, string reason); event batchTransferLowerFailed(uint256 indexed amount, bytes reason); event deprecatedDeposit(address indexed validator, uint256 amount); + event deprecatedFinalityRewardDeposit(address indexed validator, uint256 amount); event directTransfer(address indexed validator, uint256 amount); event directTransferFail(address indexed validator, uint256 amount); event failReasonWithStr(string message); event feeBurned(uint256 amount); + event finalityRewardDeposit(address indexed validator, uint256 amount); event paramChange(string key, bytes value); event systemTransfer(uint256 amount); event unexpectedPackage(uint8 channelId, bytes msgBytes); @@ -39,6 +41,7 @@ interface BSCValidatorSet { function GOV_HUB_ADDR() external view returns (address); function INCENTIVIZE_ADDR() external view returns (address); function INIT_BURN_RATIO() external view returns (uint256); + function INIT_FINALITY_REWARD_RATIO() external view returns (uint256); function INIT_MAINTAIN_SLASH_SCALE() external view returns (uint256); function INIT_MAX_NUM_OF_MAINTAINING() external view returns (uint256); function INIT_NUM_OF_CABINETS() external view returns (uint256); @@ -77,13 +80,16 @@ interface BSCValidatorSet { ); function currentValidatorSetMap(address) external view returns (uint256); function deposit(address valAddr) external payable; + function distributeFinalityReward(address[] memory valAddrs, uint256[] memory weights) external; function enterMaintenance() external; function exitMaintenance() external; function expireTimeSecondGap() external view returns (uint256); function felony(address validator) external; + function finalityRewardRatio() external view returns (uint256); function getCurrentValidatorIndex(address _validator) external view returns (uint256); function getIncoming(address validator) external view returns (uint256); - function getMiningValidators() external view returns (address[] memory); + function getLivingValidators() external view returns (address[] memory, bytes[] memory); + function getMiningValidators() external view returns (address[] memory, bytes[] memory); function getValidators() external view returns (address[] memory); function getWorkingValidatorCount() external view returns (uint256 workingValidatorCount); function handleAckPackage(uint8 channelId, bytes memory msgBytes) external; @@ -100,7 +106,11 @@ interface BSCValidatorSet { function numOfCabinets() external view returns (uint256); function numOfJailed() external view returns (uint256); function numOfMaintaining() external view returns (uint256); + function previousHeight() external view returns (uint256); function totalInComing() external view returns (uint256); function updateParam(string memory key, bytes memory value) external; - function validatorExtraSet(uint256) external view returns (uint256 enterMaintenanceHeight, bool isMaintaining); + function validatorExtraSet(uint256) + external + view + returns (uint256 enterMaintenanceHeight, bool isMaintaining, bytes memory voteAddress); } diff --git a/lib/interface/ISlashIndicator.sol b/lib/interface/ISlashIndicator.sol index e9d53129..1c0edb1f 100644 --- a/lib/interface/ISlashIndicator.sol +++ b/lib/interface/ISlashIndicator.sol @@ -8,6 +8,20 @@ interface SlashIndicator { event unKnownResponse(uint32 code); event validatorSlashed(address indexed validator); + struct FinalityEvidence { + VoteData voteA; + VoteData voteB; + bytes voteAddr; + } + + struct VoteData { + uint256 srcNum; + bytes32 srcHash; + uint256 tarNum; + bytes32 tarHash; + bytes sig; + } + function BIND_CHANNELID() external view returns (uint8); function BSC_RELAYER_REWARD() external view returns (uint256); function CODE_OK() external view returns (uint32); @@ -19,6 +33,7 @@ interface SlashIndicator { function GOV_CHANNELID() external view returns (uint8); function GOV_HUB_ADDR() external view returns (address); function INCENTIVIZE_ADDR() external view returns (address); + function INIT_FINALITY_SLASH_REWARD_RATIO() external view returns (uint256); function LIGHT_CLIENT_ADDR() external view returns (address); function MISDEMEANOR_THRESHOLD() external view returns (uint256); function RELAYERHUB_CONTRACT_ADDR() external view returns (address); @@ -36,6 +51,7 @@ interface SlashIndicator { function bscChainID() external view returns (uint16); function clean() external; function felonyThreshold() external view returns (uint256); + function finalitySlashRewardRatio() external view returns (uint256); function getSlashIndicator(address validator) external view returns (uint256, uint256); function getSlashThresholds() external view returns (uint256, uint256); function handleAckPackage(uint8, bytes memory msgBytes) external; @@ -47,6 +63,7 @@ interface SlashIndicator { function previousHeight() external view returns (uint256); function sendFelonyPackage(address validator) external; function slash(address validator) external; + function submitFinalityViolationEvidence(FinalityEvidence memory _evidence) external; function updateParam(string memory key, bytes memory value) external; function validators(uint256) external view returns (address); } diff --git a/lib/interface/ISystemReward.sol b/lib/interface/ISystemReward.sol index deabd0ed..48f98080 100644 --- a/lib/interface/ISystemReward.sol +++ b/lib/interface/ISystemReward.sol @@ -1,9 +1,12 @@ pragma solidity ^0.8.10; interface SystemReward { + event paramChange(string key, bytes value); event receiveDeposit(address indexed from, uint256 amount); event rewardEmpty(); event rewardTo(address indexed to, uint256 amount); + event addOperator(address indexed operator); + event deleteOperator(address indexed operator); function BIND_CHANNELID() external view returns (uint8); function CODE_OK() external view returns (uint32); @@ -31,4 +34,5 @@ interface SystemReward { function claimRewards(address to, uint256 amount) external returns (uint256); function isOperator(address addr) external view returns (bool); function numOperator() external view returns (uint256); + function updateParam(string memory key, bytes memory value) external; } diff --git a/test/SlashIndicator.t.sol b/test/SlashIndicator.t.sol index 85ef92e0..56ba9e92 100644 --- a/test/SlashIndicator.t.sol +++ b/test/SlashIndicator.t.sol @@ -3,5 +3,304 @@ pragma solidity ^0.8.10; import "../lib/Deployer.sol"; contract SlashIndicatorTest is Deployer { - function setUp() public {} + event validatorSlashed(address indexed validator); + event indicatorCleaned(); + event paramChange(string key, bytes value); + + address public coinbase; + address[] public validators; + + function setUp() public { + bytes memory slashCode = vm.getDeployedCode("SlashIndicator.sol"); + vm.etch(address(slash), slashCode); + + validators = validator.getValidators(); + + coinbase = block.coinbase; + vm.deal(coinbase, 100 ether); + } + + function testGov() public { + bytes memory key = "misdemeanorThreshold"; + bytes memory value = bytes(hex"0000000000000000000000000000000000000000000000000000000000000064"); // 100 + updateParamByGovHub(key, value, address(slash)); + assertEq(slash.misdemeanorThreshold(), 100); + + key = "felonyThreshold"; + value = bytes(hex"00000000000000000000000000000000000000000000000000000000000000c8"); // 200 + updateParamByGovHub(key, value, address(slash)); + assertEq(slash.felonyThreshold(), 200); + + key = "finalitySlashRewardRatio"; + value = bytes(hex"0000000000000000000000000000000000000000000000000000000000000032"); // 50 + updateParamByGovHub(key, value, address(slash)); + assertEq(slash.finalitySlashRewardRatio(), 50); + } + + function testSlash() public { + address validator = validators[0]; + + vm.expectRevert(bytes("the message sender must be the block producer")); + slash.slash(validator); + + vm.startPrank(coinbase); + (, uint256 origin) = slash.getSlashIndicator(validator); + for (uint256 i = 1; i < 10; ++i) { + vm.expectEmit(true, false, false, true, address(slash)); + emit validatorSlashed(validator); + slash.slash(validator); + vm.roll(block.number + 1); + (, uint256 count) = slash.getSlashIndicator(validator); + assertEq(origin + i, count); + } + vm.stopPrank(); + } + + function testMaintenance() public { + vm.prank(validators[0]); + validator.enterMaintenance(); + + (, uint256 countBefore) = slash.getSlashIndicator(validators[0]); + vm.prank(coinbase); + slash.slash(validators[0]); + (, uint256 countAfter) = slash.getSlashIndicator(validators[0]); + assertEq(countAfter, countBefore); + + vm.prank(validators[0]); + vm.expectRevert(bytes("can not enter Temporary Maintenance")); + validator.enterMaintenance(); + + // exit maintenance + vm.prank(validators[0]); + validator.exitMaintenance(); + vm.roll(block.number + 1); + vm.prank(coinbase); + slash.slash(validators[0]); + (, countAfter) = slash.getSlashIndicator(validators[0]); + assertEq(countAfter, countBefore + 1); + + vm.prank(validators[0]); + vm.expectRevert(bytes("can not enter Temporary Maintenance")); + validator.enterMaintenance(); + } + + function testMisdemeanor() public { + address[] memory vals = new address[](21); + for (uint256 i; i < vals.length; ++i) { + vals[i] = addrSet[addrIdx++]; + } + vm.prank(address(crossChain)); + validator.handleSynPackage(STAKING_CHANNELID, encodeOldValidatorSetUpdatePack(0x00, vals)); + + vm.startPrank(coinbase); + validator.deposit{value: 1 ether}(vals[0]); + assertEq(9e17, validator.getIncoming(vals[0])); + + for (uint256 i; i < 50; ++i) { + vm.roll(block.number + 1); + slash.slash(vals[0]); + } + (, uint256 count) = slash.getSlashIndicator(vals[0]); + assertEq(50, count); + assertEq(0, validator.getIncoming(vals[0])); + + // enter maintenance, cannot be slashed + vm.roll(block.number + 1); + slash.slash(vals[0]); + (, count) = slash.getSlashIndicator(vals[0]); + assertEq(50, count); + vm.stopPrank(); + + address[] memory newVals = new address[](3); + for (uint256 i; i < newVals.length; ++i) { + newVals[i] = vals[i]; + } + vm.prank(address(crossChain)); + validator.handleSynPackage(STAKING_CHANNELID, encodeOldValidatorSetUpdatePack(0x00, newVals)); + + vm.startPrank(coinbase); + validator.deposit{value: 2 ether}(newVals[0]); + assertEq(18e17, validator.getIncoming(newVals[0])); + + for (uint256 i; i < 37; ++i) { + vm.roll(block.number + 1); + slash.slash(newVals[0]); + } + (, count) = slash.getSlashIndicator(newVals[0]); + assertEq(50, count); + assertEq(0, validator.getIncoming(newVals[0])); + assertEq(9e17, validator.getIncoming(newVals[1])); + assertEq(9e17, validator.getIncoming(newVals[2])); + + validator.deposit{value: 1 ether}(newVals[1]); + assertEq(18e17, validator.getIncoming(newVals[1])); + for (uint256 i; i < 50; ++i) { + vm.roll(block.number + 1); + slash.slash(newVals[1]); + } + assertEq(9e17, validator.getIncoming(newVals[0])); + assertEq(0, validator.getIncoming(newVals[1])); + assertEq(18e17, validator.getIncoming(newVals[2])); + + assertEq(18e17, validator.getIncoming(newVals[2])); + for (uint256 i; i < 50; ++i) { + vm.roll(block.number + 1); + slash.slash(newVals[2]); + } + assertEq(18e17, validator.getIncoming(newVals[0])); + assertEq(9e17, validator.getIncoming(newVals[1])); + assertEq(0, validator.getIncoming(newVals[2])); + vm.stopPrank(); + } + + function testFelony() public { + address[] memory vals = new address[](3); + for (uint256 i; i < vals.length; ++i) { + vals[i] = addrSet[addrIdx++]; + } + vm.prank(address(crossChain)); + validator.handleSynPackage(STAKING_CHANNELID, encodeOldValidatorSetUpdatePack(0x00, vals)); + + vm.startPrank(coinbase); + validator.deposit{value: 1 ether}(vals[0]); + assertEq(9e17, validator.getIncoming(vals[0])); + + for (uint256 i; i < 50; ++i) { + vm.roll(block.number + 1); + slash.slash(vals[0]); + } + (, uint256 count) = slash.getSlashIndicator(vals[0]); + assertEq(50, count); + assertEq(0, validator.getIncoming(vals[0])); + vm.stopPrank(); + + vm.prank(vals[0]); + validator.exitMaintenance(); + + vm.startPrank(coinbase); + validator.deposit{value: 1 ether}(vals[0]); + for (uint256 i; i < 100; ++i) { + vm.roll(block.number + 1); + slash.slash(vals[0]); + } + (, count) = slash.getSlashIndicator(vals[0]); + assertEq(0, count); + assertEq(0, validator.getIncoming(vals[0])); + assertEq(9e17, validator.getIncoming(vals[1])); + assertEq(9e17, validator.getIncoming(vals[2])); + + vals = validator.getValidators(); + assertEq(2, vals.length); + vm.stopPrank(); + } + + function testClean() public { + // case 1: all clean. + address[] memory vals = new address[](20); + for (uint256 i; i < vals.length; ++i) { + vals[i] = addrSet[addrIdx++]; + } + vm.prank(address(crossChain)); + validator.handleSynPackage(STAKING_CHANNELID, encodeOldValidatorSetUpdatePack(0x00, vals)); + + vm.startPrank(coinbase); + for (uint256 i; i < vals.length; ++i) { + vm.roll(block.number + 1); + slash.slash(vals[i]); + } + vm.stopPrank(); + + // do clean + vm.prank(address(crossChain)); + validator.handleSynPackage(STAKING_CHANNELID, encodeOldValidatorSetUpdatePack(0x00, vals)); + + uint256 count; + for (uint256 i; i < vals.length; ++i) { + (, count) = slash.getSlashIndicator(vals[i]); + assertEq(0, count); + } + + // case 2: all stay. + // felonyThreshold/DECREASE_RATE = 37 + vm.startPrank(coinbase); + for (uint256 i; i < vals.length; ++i) { + for (uint256 j; j < 38; ++j) { + vm.roll(block.number + 1); + slash.slash(vals[i]); + } + } + vm.stopPrank(); + + // do clean + vm.prank(address(crossChain)); + validator.handleSynPackage(STAKING_CHANNELID, encodeOldValidatorSetUpdatePack(0x00, vals)); + + for (uint256 i; i < vals.length; ++i) { + (, count) = slash.getSlashIndicator(vals[i]); + assertEq(1, count); + } + + // case 3: partial stay. + vm.startPrank(coinbase); + for (uint256 i; i < 10; ++i) { + for (uint256 j; j < 38; ++j) { + vm.roll(block.number + 1); + slash.slash(vals[2 * i]); + } + vm.roll(block.number + 1); + slash.slash(vals[2 * i + 1]); + } + vm.stopPrank(); + + // do clean + vm.prank(address(crossChain)); + validator.handleSynPackage(STAKING_CHANNELID, encodeOldValidatorSetUpdatePack(0x00, vals)); + + for (uint256 i; i < 10; ++i) { + (, count) = slash.getSlashIndicator(vals[i]); + if (i % 2 == 0) { + assertEq(2, count); + } else { + assertEq(0, count); + } + } + } + + // function testFinality() public { + // address[] memory vals = new address[](20); + // bytes[] memory voteAddrs = new bytes[](20); + // for (uint256 i; i < vals.length; ++i) { + // vals[i] = addrSet[addrIdx++]; + // voteAddrs[i] = abi.encodePacked(vals[i]); + // } + // vm.prank(address(crossChain)); + // validator.handleSynPackage(STAKING_CHANNELID, encodeNewValidatorSetUpdatePack(0x00, vals, voteAddrs)); + // + // // case1: valid finality evidence: same target block + // uint256 srcNumA = block.number - 20; + // uint256 tarNumA = block.number - 10; + // uint256 srcNumB = block.number - 15; + // uint256 tarNumB = tarNumA; + // SlashIndicator.VoteData memory voteA; + // voteA.srcNum = srcNumA; + // voteA.srcHash = blockhash(srcNumA); + // voteA.tarNum = tarNumA; + // voteA.tarHash = blockhash(tarNumA); + // voteA.sig = abi.encode("sigA"); + // + // SlashIndicator.VoteData memory voteB; + // voteB.srcNum = srcNumB; + // voteB.srcHash = blockhash(srcNumB); + // voteB.tarNum = tarNumB; + // voteB.tarHash = blockhash(tarNumB); + // voteB.sig = abi.encode("sigB"); + // + // SlashIndicator.FinalityEvidence memory evidence; + // evidence.voteA = voteA; + // evidence.voteB = voteB; + // evidence.voteAddr = voteAddrs[0]; + // + // vm.prank(relayer); + // slash.submitFinalityViolationEvidence(evidence); + // } } diff --git a/test/Staking.t.sol b/test/Staking.t.sol index b270cc02..3a2d1b9e 100644 --- a/test/Staking.t.sol +++ b/test/Staking.t.sol @@ -7,9 +7,7 @@ contract StakingTest is Deployer { event delegateSubmitted(address indexed delegator, address indexed validator, uint256 amount, uint256 oracleRelayerFee); event undelegateSubmitted(address indexed delegator, address indexed validator, uint256 amount, uint256 oracleRelayerFee); - event redelegateSubmitted( - address indexed delegator, address indexed validatorSrc, address indexed validatorDst, uint256 amount, uint256 oracleRelayerFee - ); + event redelegateSubmitted(address indexed delegator, address indexed validatorSrc, address indexed validatorDst, uint256 amount, uint256 oracleRelayerFee); event rewardReceived(address indexed delegator, uint256 amount); event rewardClaimed(address indexed delegator, uint256 amount); event undelegatedReceived(address indexed delegator, address indexed validator, uint256 amount); diff --git a/test/SystemReward.t.sol b/test/SystemReward.t.sol index 3ef0c708..0d97ccf3 100644 --- a/test/SystemReward.t.sol +++ b/test/SystemReward.t.sol @@ -3,10 +3,14 @@ pragma solidity ^0.8.10; import "../lib/Deployer.sol"; contract SystemRewardTest is Deployer { + event paramChange(string key, bytes value); event rewardTo(address indexed to, uint256 amount); event rewardEmpty(); - function setUp() public {} + function setUp() public { + bytes memory rewardCode = vm.getDeployedCode("SystemReward.sol"); + vm.etch(address(systemReward), rewardCode); + } function testReceive(uint256 amount) public { vm.assume(amount < 1e20); @@ -25,7 +29,6 @@ contract SystemRewardTest is Deployer { } function testClaimReward() public { - // vm.assume(amount < 1e20); address newAccount = addrSet[addrIdx++]; payable(address(systemReward)).transfer(1 ether); @@ -43,4 +46,19 @@ contract SystemRewardTest is Deployer { vm.prank(LIGHT_CLIENT_ADDR); systemReward.claimRewards(newAccount, 1 ether); } + + function testGov() public { + bytes memory key = "addOperator"; + bytes memory valueBytes = abi.encodePacked(address(validator)); + vm.expectEmit(false, false, false, true, address(systemReward)); + emit paramChange(string(key), valueBytes); + updateParamByGovHub(key, valueBytes, address(systemReward)); + assertTrue(systemReward.isOperator(address(validator))); + + key = "deleteOperator"; + vm.expectEmit(false, false, false, true, address(systemReward)); + emit paramChange(string(key), valueBytes); + updateParamByGovHub(key, valueBytes, address(systemReward)); + assertFalse(systemReward.isOperator(address(validator))); + } } diff --git a/test/TokenHub.t.sol b/test/TokenHub.t.sol index 2e4de5c4..36708e4f 100644 --- a/test/TokenHub.t.sol +++ b/test/TokenHub.t.sol @@ -74,8 +74,7 @@ contract TokenHubTest is Deployer { vm.prank(address(crossChain)); tokenManager.handleSynPackage(BIND_CHANNELID, pack); - (, bytes32 symbol, address addr, uint256 totalSupply, uint256 peggyAmount, uint8 decimal,) = - tokenManager.bindPackageRecord(bytes32("ABC-9C7")); + (, bytes32 symbol, address addr, uint256 totalSupply, uint256 peggyAmount, uint8 decimal,) = tokenManager.bindPackageRecord(bytes32("ABC-9C7")); assertEq(symbol, bytes32("ABC-9C7"), "wrong symbol"); assertEq(addr, address(abcToken), "wrong token address"); assertEq(totalSupply, 1e8 * 1e18, "wrong total supply"); @@ -776,9 +775,7 @@ contract TokenHubTest is Deployer { tokenManager.mirror{value: miniRelayerFee + mirrorFee}(address(xyzToken), expireTime); // Mirror fail ack - pack = buildMirrorFailAckPackage( - address(this), address(xyzToken), bytes32("XYZ Token"), uint8(18), bytes32("XYZ"), 1e8 * 1e18, mirrorFee / 1e10, expireTime - ); + pack = buildMirrorFailAckPackage(address(this), address(xyzToken), bytes32("XYZ Token"), uint8(18), bytes32("XYZ"), 1e8 * 1e18, mirrorFee / 1e10, expireTime); vm.prank(address(crossChain)); tokenManager.handleFailAckPackage(MIRROR_CHANNELID, pack); assertEq(address(tokenManager).balance, 0, "wrong balance in tokenManager"); @@ -888,11 +885,7 @@ contract TokenHubTest is Deployer { tokenManager.sync{value: miniRelayerFee + mirrorFee}(address(xyzToken), expireTime); } - function buildBindPackage(uint8 bindType, bytes32 symbol, address addr, uint256 totalSupply, uint256 peggyAmount, uint8 decimal) - internal - view - returns (bytes memory) - { + function buildBindPackage(uint8 bindType, bytes32 symbol, address addr, uint256 totalSupply, uint256 peggyAmount, uint8 decimal) internal view returns (bytes memory) { uint256 timestamp = block.timestamp; uint256 expireTime = timestamp + 3; bytes[] memory elements = new bytes[](7); @@ -906,11 +899,7 @@ contract TokenHubTest is Deployer { return elements.encodeList(); } - function buildTransferInPackage(bytes32 symbol, address tokenAddr, uint256 amount, address recipient, address refundAddr) - internal - view - returns (bytes memory) - { + function buildTransferInPackage(bytes32 symbol, address tokenAddr, uint256 amount, address recipient, address refundAddr) internal view returns (bytes memory) { uint256 timestamp = block.timestamp; uint256 expireTime = timestamp + 3; bytes[] memory elements = new bytes[](6); @@ -923,13 +912,7 @@ contract TokenHubTest is Deployer { return elements.encodeList(); } - function buildBatchTransferOutFailAckPackage( - bytes32 symbol, - address tokenAddr, - uint256[] memory amounts, - address[] memory recipients, - address[] memory refundAddrs - ) internal view returns (bytes memory) { + function buildBatchTransferOutFailAckPackage(bytes32 symbol, address tokenAddr, uint256[] memory amounts, address[] memory recipients, address[] memory refundAddrs) internal view returns (bytes memory) { uint256 length = amounts.length; bytes[] memory amtBytes = new bytes[](length); bytes[] memory recipientBytes = new bytes[](length); @@ -952,11 +935,7 @@ contract TokenHubTest is Deployer { return elements.encodeList(); } - function buildRefundPackage(address tokenAddr, uint256[] memory amounts, address[] memory recipients, uint32 status) - internal - pure - returns (bytes memory) - { + function buildRefundPackage(address tokenAddr, uint256[] memory amounts, address[] memory recipients, uint32 status) internal pure returns (bytes memory) { uint256 length = amounts.length; bytes[] memory amtBytes = new bytes[](length); bytes[] memory recipientBytes = new bytes[](length); @@ -973,11 +952,7 @@ contract TokenHubTest is Deployer { return elements.encodeList(); } - function buildMirrorAckPackage(address sender, address tokenAddr, uint8 decimal, bytes32 symbol, uint256 mirrorFee, uint8 errCode) - internal - pure - returns (bytes memory) - { + function buildMirrorAckPackage(address sender, address tokenAddr, uint8 decimal, bytes32 symbol, uint256 mirrorFee, uint8 errCode) internal pure returns (bytes memory) { bytes[] memory elements = new bytes[](6); elements[0] = sender.encodeAddress(); elements[1] = tokenAddr.encodeAddress(); @@ -988,16 +963,7 @@ contract TokenHubTest is Deployer { return elements.encodeList(); } - function buildMirrorFailAckPackage( - address sender, - address tokenAddr, - bytes32 name, - uint8 decimal, - bytes32 symbol, - uint256 supply, - uint256 mirrorFee, - uint256 expireTime - ) internal pure returns (bytes memory) { + function buildMirrorFailAckPackage(address sender, address tokenAddr, bytes32 name, uint8 decimal, bytes32 symbol, uint256 supply, uint256 mirrorFee, uint256 expireTime) internal pure returns (bytes memory) { bytes[] memory elements = new bytes[](8); elements[0] = sender.encodeAddress(); elements[1] = tokenAddr.encodeAddress(); @@ -1019,11 +985,7 @@ contract TokenHubTest is Deployer { return elements.encodeList(); } - function buildSyncFailAckPackage(address sender, address tokenAddr, bytes32 symbol, uint256 supply, uint256 syncFee, uint256 expireTime) - internal - pure - returns (bytes memory) - { + function buildSyncFailAckPackage(address sender, address tokenAddr, bytes32 symbol, uint256 supply, uint256 syncFee, uint256 expireTime) internal pure returns (bytes memory) { bytes[] memory elements = new bytes[](6); elements[0] = sender.encodeAddress(); elements[1] = tokenAddr.encodeAddress(); diff --git a/test/ValidatorSet.t.sol b/test/ValidatorSet.t.sol index 50b7f275..5f840b76 100644 --- a/test/ValidatorSet.t.sol +++ b/test/ValidatorSet.t.sol @@ -24,6 +24,8 @@ contract ValidatorSetTest is Deployer { event feeBurned(uint256 amount); event validatorEnterMaintenance(address indexed validator); event validatorExitMaintenance(address indexed validator); + event finalityRewardDeposit(address indexed validator, uint256 amount); + event deprecatedFinalityRewardDeposit(address indexed validator, uint256 amount); uint256 public totalInComing; uint256 public burnRatio; @@ -36,6 +38,21 @@ contract ValidatorSetTest is Deployer { mapping(address => bool) cabinets; function setUp() public { + bytes memory rewardCode = vm.getDeployedCode("SystemReward.sol"); + vm.etch(address(systemReward), rewardCode); + bytes memory slashCode = vm.getDeployedCode("SlashIndicator.sol"); + vm.etch(address(slash), slashCode); + bytes memory validatorCode = vm.getDeployedCode("BSCValidatorSet.sol"); + vm.etch(address(validator), validatorCode); + + // add operator + bytes memory key = "addOperator"; + bytes memory valueBytes = abi.encodePacked(address(validator)); + vm.expectEmit(false, false, false, true, address(systemReward)); + emit paramChange(string(key), valueBytes); + updateParamByGovHub(key, valueBytes, address(systemReward)); + assertTrue(systemReward.isOperator(address(validator))); + burnRatio = validator.INIT_BURN_RATIO(); burnRatioScale = validator.BURN_RATIO_SCALE(); validators = validator.getValidators(); @@ -120,27 +137,33 @@ contract ValidatorSetTest is Deployer { newValidators[i] = addrSet[addrIdx++]; } vm.startPrank(address(crossChain)); - validator.handleSynPackage(STAKING_CHANNELID, _encodeValidatorSetUpdatePack(0x00, newValidators)); + validator.handleSynPackage(STAKING_CHANNELID, encodeOldValidatorSetUpdatePack(0x00, newValidators)); vm.stopPrank(); address[] memory vals = validator.getValidators(); - address[] memory miningVals = validator.getMiningValidators(); + (address[] memory miningVals,) = validator.getMiningValidators(); + uint256 count; uint256 _numOfCabinets; + uint256 _maxNumOfWorkingCandidates = maxNumOfWorkingCandidates; if (numOfCabinets == 0) { _numOfCabinets = validator.INIT_NUM_OF_CABINETS(); } else { _numOfCabinets = numOfCabinets; } + if ((vals.length - _numOfCabinets) < _maxNumOfWorkingCandidates) { + _maxNumOfWorkingCandidates = vals.length - _numOfCabinets; + } + for (uint256 i; i < _numOfCabinets; ++i) { cabinets[vals[i]] = true; } - for (uint256 i; i < miningVals.length; ++i) { + for (uint256 i; i < _numOfCabinets; ++i) { if (!cabinets[miningVals[i]]) { ++count; } } - assertGe(maxNumOfWorkingCandidates, count); + assertGe(_maxNumOfWorkingCandidates, count); assertGe(count, 0); } @@ -150,7 +173,7 @@ contract ValidatorSetTest is Deployer { // To reset the incoming vm.startPrank(address(crossChain)); - validator.handleSynPackage(STAKING_CHANNELID, _encodeValidatorSetUpdatePack(0x00, newValidator)); + validator.handleSynPackage(STAKING_CHANNELID, encodeOldValidatorSetUpdatePack(0x00, newValidator)); vm.stopPrank(); address val = newValidator[0]; @@ -180,7 +203,7 @@ contract ValidatorSetTest is Deployer { vm.expectEmit(false, false, false, false, address(validator)); emit validatorSetUpdated(); vm.startPrank(address(crossChain)); - validator.handleSynPackage(STAKING_CHANNELID, _encodeValidatorSetUpdatePack(0x00, newValidator)); + validator.handleSynPackage(STAKING_CHANNELID, encodeOldValidatorSetUpdatePack(0x00, newValidator)); vm.stopPrank(); } @@ -192,7 +215,7 @@ contract ValidatorSetTest is Deployer { // To reset the incoming vm.startPrank(address(crossChain)); - validator.handleSynPackage(STAKING_CHANNELID, _encodeValidatorSetUpdatePack(0x00, newValidators)); + validator.handleSynPackage(STAKING_CHANNELID, encodeOldValidatorSetUpdatePack(0x00, newValidators)); vm.stopPrank(); vm.startPrank(coinbase); @@ -205,7 +228,7 @@ contract ValidatorSetTest is Deployer { newValidators[i] = addrSet[addrIdx++]; } vm.startPrank(address(crossChain)); - validator.handleSynPackage(STAKING_CHANNELID, _encodeValidatorSetUpdatePack(0x00, newValidators)); + validator.handleSynPackage(STAKING_CHANNELID, encodeOldValidatorSetUpdatePack(0x00, newValidators)); vm.stopPrank(); } @@ -219,7 +242,7 @@ contract ValidatorSetTest is Deployer { vm.startPrank(address(crossChain)); vm.expectEmit(false, false, false, true, address(validator)); emit failReasonWithStr("the number of validators exceed the limit"); - validator.handleSynPackage(STAKING_CHANNELID, _encodeValidatorSetUpdatePack(0x00, newValidators)); + validator.handleSynPackage(STAKING_CHANNELID, encodeOldValidatorSetUpdatePack(0x00, newValidators)); vm.stopPrank(); } @@ -230,7 +253,7 @@ contract ValidatorSetTest is Deployer { for (uint256 i; i < 5; ++i) { newValidators[i] = addrSet[addrIdx++]; } - bytes memory pack = _encodeValidatorSetUpdatePack(0x00, newValidators); + bytes memory pack = encodeOldValidatorSetUpdatePack(0x00, newValidators); vm.startPrank(address(crossChain)); validator.handleSynPackage(STAKING_CHANNELID, pack); vm.stopPrank(); @@ -282,7 +305,7 @@ contract ValidatorSetTest is Deployer { vm.startPrank(address(crossChain)); for (uint256 k; k < 5; ++k) { - validator.handleSynPackage(STAKING_CHANNELID, _encodeValidatorSetUpdatePack(0x00, newValSet[k])); + validator.handleSynPackage(STAKING_CHANNELID, encodeOldValidatorSetUpdatePack(0x00, newValSet[k])); address[] memory valSet = validator.getValidators(); for (uint256 l; l < 5 + k; ++l) { assertEq(valSet[l], newValSet[k][l], "consensusAddr not equal"); @@ -309,13 +332,13 @@ contract ValidatorSetTest is Deployer { newValSet[2][3] = addrSet[addrIdx++]; vm.startPrank(address(crossChain)); - validator.handleSynPackage(STAKING_CHANNELID, _encodeValidatorSetUpdatePack(0x00, newValSet[2])); + validator.handleSynPackage(STAKING_CHANNELID, encodeOldValidatorSetUpdatePack(0x00, newValSet[2])); for (uint256 i; i < 2; ++i) { vm.expectEmit(false, false, false, true, address(validator)); emit failReasonWithStr("duplicate consensus address of validatorSet"); - validator.handleSynPackage(STAKING_CHANNELID, _encodeValidatorSetUpdatePack(0x00, newValSet[i])); + validator.handleSynPackage(STAKING_CHANNELID, encodeOldValidatorSetUpdatePack(0x00, newValSet[i])); } - validator.handleSynPackage(STAKING_CHANNELID, _encodeValidatorSetUpdatePack(0x00, newValSet[3])); + validator.handleSynPackage(STAKING_CHANNELID, encodeOldValidatorSetUpdatePack(0x00, newValSet[3])); vm.stopPrank(); uint256 height = block.number; @@ -336,11 +359,11 @@ contract ValidatorSetTest is Deployer { address[] memory newValidators = new address[](5); address deprecated = addrSet[addrIdx++]; uint256 balance = deprecated.balance; - newValidators[0] = address(validator); + newValidators[0] = address(slash); for (uint256 i = 1; i < 5; ++i) { newValidators[i] = addrSet[addrIdx++]; } - bytes memory pack = _encodeValidatorSetUpdatePack(0x00, newValidators); + bytes memory pack = encodeOldValidatorSetUpdatePack(0x00, newValidators); vm.startPrank(address(crossChain)); validator.handleSynPackage(STAKING_CHANNELID, pack); vm.stopPrank(); @@ -385,7 +408,7 @@ contract ValidatorSetTest is Deployer { address[] memory newValidators = new address[](5); address deprecated = addrSet[addrIdx++]; uint256 balance = deprecated.balance; - newValidators[0] = address(validator); + newValidators[0] = address(slash); for (uint256 i = 1; i < 5; ++i) { newValidators[i] = addrSet[addrIdx++]; } @@ -396,7 +419,7 @@ contract ValidatorSetTest is Deployer { (bool success,) = address(tokenHub).call(abi.encodeWithSignature("setPanicBatchTransferOut(bool)", true)); require(success); - bytes memory pack = _encodeValidatorSetUpdatePack(0x00, newValidators); + bytes memory pack = encodeOldValidatorSetUpdatePack(0x00, newValidators); vm.startPrank(address(crossChain)); validator.handleSynPackage(STAKING_CHANNELID, pack); vm.stopPrank(); @@ -450,7 +473,7 @@ contract ValidatorSetTest is Deployer { } vm.startPrank(address(crossChain)); - validator.handleSynPackage(STAKING_CHANNELID, _encodeValidatorSetUpdatePack(0x00, newValidators)); + validator.handleSynPackage(STAKING_CHANNELID, encodeOldValidatorSetUpdatePack(0x00, newValidators)); address[] memory remainVals = validator.getValidators(); assertEq(remainVals.length, 3); @@ -460,11 +483,11 @@ contract ValidatorSetTest is Deployer { vm.expectEmit(false, false, false, true, address(validator)); emit failReasonWithStr("length of jail validators must be one"); - validator.handleSynPackage(STAKING_CHANNELID, _encodeValidatorSetUpdatePack(0x01, newValidators)); + validator.handleSynPackage(STAKING_CHANNELID, encodeOldValidatorSetUpdatePack(0x01, newValidators)); address[] memory jailVal = new address[](1); jailVal[0] = newValidators[0]; - validator.handleSynPackage(STAKING_CHANNELID, _encodeValidatorSetUpdatePack(0x01, jailVal)); + validator.handleSynPackage(STAKING_CHANNELID, encodeOldValidatorSetUpdatePack(0x01, jailVal)); remainVals = validator.getValidators(); assertEq(remainVals.length, 2); @@ -473,34 +496,69 @@ contract ValidatorSetTest is Deployer { } jailVal[0] = newValidators[1]; - validator.handleSynPackage(STAKING_CHANNELID, _encodeValidatorSetUpdatePack(0x01, jailVal)); + validator.handleSynPackage(STAKING_CHANNELID, encodeOldValidatorSetUpdatePack(0x01, jailVal)); remainVals = validator.getValidators(); assertEq(remainVals.length, 1); assertEq(remainVals[0], newValidators[2]); jailVal[0] = newValidators[2]; - validator.handleSynPackage(STAKING_CHANNELID, _encodeValidatorSetUpdatePack(0x01, jailVal)); + validator.handleSynPackage(STAKING_CHANNELID, encodeOldValidatorSetUpdatePack(0x01, jailVal)); remainVals = validator.getValidators(); assertEq(remainVals.length, 1); assertEq(remainVals[0], newValidators[2]); vm.stopPrank(); } - function _encodeValidatorSetUpdatePack(uint8 code, address[] memory valSet) internal pure returns (bytes memory) { - bytes[] memory elements = new bytes[](2); - elements[0] = code.encodeUint(); - - bytes[] memory vals = new bytes[](valSet.length); - for (uint256 i; i < valSet.length; ++i) { - bytes[] memory tmp = new bytes[](4); - tmp[0] = valSet[i].encodeAddress(); - tmp[1] = valSet[i].encodeAddress(); - tmp[2] = valSet[i].encodeAddress(); - tmp[3] = uint8(0x64).encodeUint(); - vals[i] = tmp.encodeList(); + function testDecodeNewCrossChainPack() public { + address[] memory newValidators = new address[](41); + bytes[] memory newVoteAddrs = new bytes[](41); + for (uint256 i; i < newValidators.length; ++i) { + newValidators[i] = addrSet[addrIdx++]; + newVoteAddrs[i] = abi.encodePacked(newValidators[i]); + } + vm.startPrank(address(crossChain)); + validator.handleSynPackage(STAKING_CHANNELID, encodeNewValidatorSetUpdatePack(0x00, newValidators, newVoteAddrs)); + vm.stopPrank(); + + (address[] memory vals, bytes[] memory voteAddrs) = validator.getLivingValidators(); + for (uint256 i; i < newValidators.length; ++i) { + assertEq(voteAddrs[i], abi.encodePacked(vals[i])); + } + } + + function testDistributeFinalityReward() public { + address[] memory addrs = new address[](20); + uint256[] memory weights = new uint256[](20); + address[] memory vals = validator.getValidators(); + for (uint256 i; i < 10; ++i) { + addrs[i] = vals[i]; + weights[i] = 1; + } + + for (uint256 i = 10; i < 20; ++i) { + vals[i] = addrSet[addrIdx++]; + weights[i] = 1; } - elements[1] = vals.encodeList(); - return elements.encodeList(); + vm.deal(address(systemReward), 99 ether); + vm.expectRevert(bytes("the message sender must be the block producer")); + validator.distributeFinalityReward(addrs, weights); + + // first time distribution will init the config and return + vm.startPrank(address(coinbase)); + validator.distributeFinalityReward(addrs, weights); + vm.deal(address(systemReward), 100 ether); + vm.roll(block.number + 1); + + vm.expectEmit(true, false, false, true, address(validator)); + emit finalityRewardDeposit(addrs[0], 25e15); + vm.expectEmit(true, false, false, true, address(validator)); + emit finalityRewardDeposit(addrs[9], 25e15); + vm.expectEmit(true, false, false, true, address(validator)); + emit deprecatedFinalityRewardDeposit(addrs[10], 25e15); + vm.expectEmit(true, false, false, true, address(validator)); + emit deprecatedFinalityRewardDeposit(addrs[19], 25e15); + validator.distributeFinalityReward(addrs, weights); + vm.stopPrank(); } } diff --git a/validators.js b/validators.js index 355e0a99..cfe30890 100644 --- a/validators.js +++ b/validators.js @@ -10,26 +10,31 @@ const validators = [ votingPower: 0x0000000000000064 } ]; +const bLSPublicKeys = [ + "0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588", +]; // =============== Do not edit below ==== -function generateExtradata(validators) { +function generateExtradata(validators, bLSPublicKeys) { let extraVanity =Buffer.alloc(32); - let validatorsBytes = extraDataSerialize(validators); + let validatorsBytes = extraDataSerialize(validators, bLSPublicKeys); let extraSeal =Buffer.alloc(65); return Buffer.concat([extraVanity,validatorsBytes,extraSeal]); } -function extraDataSerialize(validators) { +function extraDataSerialize(validators, bLSPublicKeys) { let n = validators.length; let arr = []; for(let i = 0;i