chore: update abi and bytecode (#2137)

This commit is contained in:
Roshan 2024-01-08 11:15:14 +08:00 committed by GitHub
parent e5822640c6
commit 64a57a3e2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 426 additions and 99 deletions

@ -1391,13 +1391,26 @@ const validatorSetABIBeforeLuban = `
]
`
// TODO: update ABI
// TODO: update ABI to the latest version
const validatorSetABI = `
[
{
"type": "receive",
"stateMutability": "payable"
},
{
"type": "function",
"name": "BC_FUSION_CHANNELID",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint8",
"internalType": "uint8"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "BIND_CHANNELID",
@ -1411,6 +1424,19 @@ const validatorSetABI = `
],
"stateMutability": "view"
},
{
"type": "function",
"name": "BLOCK_FEES_RATIO_SCALE",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "BURN_ADDRESS",
@ -1424,19 +1450,6 @@ const validatorSetABI = `
],
"stateMutability": "view"
},
{
"type": "function",
"name": "BURN_RATIO_SCALE",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "CODE_OK",
@ -1619,6 +1632,19 @@ const validatorSetABI = `
],
"stateMutability": "view"
},
{
"type": "function",
"name": "GOV_TOKEN_ADDR",
"inputs": [],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "INCENTIVIZE_ADDR",
@ -1814,6 +1840,19 @@ const validatorSetABI = `
],
"stateMutability": "view"
},
{
"type": "function",
"name": "STAKE_CREDIT_ADDR",
"inputs": [],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "STAKE_HUB_ADDR",
@ -1868,13 +1907,13 @@ const validatorSetABI = `
},
{
"type": "function",
"name": "SYSTEM_REWARD_RATIO_SCALE",
"name": "TIMELOCK_ADDR",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
"type": "address",
"internalType": "address"
}
],
"stateMutability": "view"
@ -2431,19 +2470,6 @@ const validatorSetABI = `
],
"stateMutability": "view"
},
{
"type": "function",
"name": "jailValidator",
"inputs": [
{
"name": "consensusAddress",
"type": "address",
"internalType": "address"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "maintainSlashScale",
@ -2593,6 +2619,19 @@ const validatorSetABI = `
],
"stateMutability": "view"
},
{
"type": "function",
"name": "removeTmpMigratedValidator",
"inputs": [
{
"name": "validator",
"type": "address",
"internalType": "address"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "systemRewardRatio",
@ -3919,7 +3958,7 @@ const slashABI = `
]
`
// TODO: update ABI
// TODO: update ABI to the latest version
const stakeABI = `
[
{
@ -3928,7 +3967,20 @@ const stakeABI = `
},
{
"type": "function",
"name": "BREATH_BLOCK_INTERVAL",
"name": "BC_FUSION_CHANNELID",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint8",
"internalType": "uint8"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "BREATHE_BLOCK_INTERVAL",
"inputs": [],
"outputs": [
{
@ -3954,7 +4006,7 @@ const stakeABI = `
},
{
"type": "function",
"name": "INIT_LOCK_AMOUNT",
"name": "LOCK_AMOUNT",
"inputs": [],
"outputs": [
{
@ -3978,6 +4030,19 @@ const stakeABI = `
],
"stateMutability": "view"
},
{
"type": "function",
"name": "STAKING_CHANNELID",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint8",
"internalType": "uint8"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "addToBlackList",
@ -4059,6 +4124,44 @@ const stakeABI = `
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "consensusExpiration",
"inputs": [
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "consensusToOperator",
"inputs": [
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "createValidator",
@ -4319,44 +4422,6 @@ const stakeABI = `
],
"stateMutability": "view"
},
{
"type": "function",
"name": "getOperatorAddressByConsensusAddress",
"inputs": [
{
"name": "consensusAddress",
"type": "address",
"internalType": "address"
}
],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "getOperatorAddressByVoteAddress",
"inputs": [
{
"name": "voteAddress",
"type": "bytes",
"internalType": "bytes"
}
],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "getValidatorBasicInfo",
@ -4565,6 +4630,100 @@ const stakeABI = `
],
"stateMutability": "view"
},
{
"type": "function",
"name": "getValidators",
"inputs": [
{
"name": "offset",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "limit",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [
{
"name": "operatorAddrs",
"type": "address[]",
"internalType": "address[]"
},
{
"name": "creditAddrs",
"type": "address[]",
"internalType": "address[]"
},
{
"name": "totalLength",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "handleAckPackage",
"inputs": [
{
"name": "channelId",
"type": "uint8",
"internalType": "uint8"
},
{
"name": "msgBytes",
"type": "bytes",
"internalType": "bytes"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "handleFailAckPackage",
"inputs": [
{
"name": "channelId",
"type": "uint8",
"internalType": "uint8"
},
{
"name": "msgBytes",
"type": "bytes",
"internalType": "bytes"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "handleSynPackage",
"inputs": [
{
"name": "",
"type": "uint8",
"internalType": "uint8"
},
{
"name": "msgBytes",
"type": "bytes",
"internalType": "bytes"
}
],
"outputs": [
{
"name": "",
"type": "bytes",
"internalType": "bytes"
}
],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "initialize",
@ -4590,7 +4749,7 @@ const stakeABI = `
"name": "maliciousVoteSlash",
"inputs": [
{
"name": "_voteAddr",
"name": "voteAddress",
"type": "bytes",
"internalType": "bytes"
}
@ -4611,6 +4770,19 @@ const stakeABI = `
],
"stateMutability": "view"
},
{
"type": "function",
"name": "maxFelonyBetweenBreatheBlock",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "minDelegationBNBChange",
@ -4811,6 +4983,44 @@ const stakeABI = `
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "voteExpiration",
"inputs": [
{
"name": "",
"type": "bytes",
"internalType": "bytes"
}
],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "voteToOperator",
"inputs": [
{
"name": "",
"type": "bytes",
"internalType": "bytes"
}
],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"stateMutability": "view"
},
{
"type": "event",
"name": "Claimed",
@ -4847,7 +5057,7 @@ const stakeABI = `
"internalType": "address"
},
{
"name": "commissionRate",
"name": "newCommissionRate",
"type": "uint64",
"indexed": false,
"internalType": "uint64"
@ -4931,6 +5141,68 @@ const stakeABI = `
],
"anonymous": false
},
{
"type": "event",
"name": "MigrateFailed",
"inputs": [
{
"name": "operatorAddress",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "delegator",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "bnbAmount",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
},
{
"name": "status",
"type": "uint8",
"indexed": false,
"internalType": "enum StakeHub.StakeMigrationStatus"
}
],
"anonymous": false
},
{
"type": "event",
"name": "MigrateSuccess",
"inputs": [
{
"name": "operatorAddress",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "delegator",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "shares",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
},
{
"name": "bnbAmount",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
}
],
"anonymous": false
},
{
"type": "event",
"name": "ParamChange",
@ -5194,11 +5466,35 @@ const stakeABI = `
],
"anonymous": false
},
{
"type": "event",
"name": "unexpectedPackage",
"inputs": [
{
"name": "channelId",
"type": "uint8",
"indexed": false,
"internalType": "uint8"
},
{
"name": "msgBytes",
"type": "bytes",
"indexed": false,
"internalType": "bytes"
}
],
"anonymous": false
},
{
"type": "error",
"name": "AlreadySlashed",
"inputs": []
},
{
"type": "error",
"name": "ConsensusAddressExpired",
"inputs": []
},
{
"type": "error",
"name": "DelegationAmountTooSmall",
@ -5209,6 +5505,11 @@ const stakeABI = `
"name": "DuplicateConsensusAddress",
"inputs": []
},
{
"type": "error",
"name": "DuplicateMoniker",
"inputs": []
},
{
"type": "error",
"name": "DuplicateVoteAddress",
@ -5239,6 +5540,11 @@ const stakeABI = `
"name": "InvalidRequest",
"inputs": []
},
{
"type": "error",
"name": "InvalidSynPackage",
"inputs": []
},
{
"type": "error",
"name": "InvalidValue",
@ -5267,7 +5573,7 @@ const stakeABI = `
},
{
"type": "error",
"name": "NoMoreFelonyToday",
"name": "NoMoreFelonyAllowed",
"inputs": []
},
{
@ -5357,6 +5663,11 @@ const stakeABI = `
"name": "ValidatorNotJailed",
"inputs": []
},
{
"type": "error",
"name": "VoteAddressExpired",
"inputs": []
},
{
"type": "error",
"name": "ZeroShares",

@ -18,11 +18,12 @@ import (
"github.com/ethereum/go-ethereum/rpc"
)
// TODO: revert to normal value
// TODO: SecondsPerDay represents the seconds in a day, it should be 86400
// We set it to 60 for testing purpose and we will change it back to 86400 when launching
// const SecondsPerDay uint64 = 86400
const SecondsPerDay uint64 = 60
// the parmas should be blocks' time which are timestamp
// the params should be two blocks' time(timestamp)
func sameDayInUTC(first, second uint64) bool {
return first/SecondsPerDay == second/SecondsPerDay
}

File diff suppressed because one or more lines are too long